Commit 7828f8be authored by garciay's avatar garciay
Browse files

Finalise UC6

parent 71504bef
...@@ -122,17 +122,30 @@ module ItsRSUsSimulator_Functions { ...@@ -122,17 +122,30 @@ module ItsRSUsSimulator_Functions {
} // End of function f_cf01Down } // End of function f_cf01Down
/**
* @desc Default handling cf01 de-initialisation.
*/
altstep a_cf01Down() runs on ItsGeoNetworking {
[] a_shutdown() {
f_poDefault();
f_cf01Down();
log("*** a_cf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
} // End of altstep a_cf01Down
} // End of group rsuConfigurationFunctions } // End of group rsuConfigurationFunctions
group usecase6 { group usecase6 {
function f_initialiseVehicleSimulatorComponent( function f_initialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component, in ItsRSUsSimulator p_component,
in integer p_vehicleIndex,
out template (omit) CAM p_cam out template (omit) CAM p_cam
) runs on ItsRSUsSimulator { ) runs on ItsRSUsSimulator {
p_cam := p_cam :=
m_camMsg_vehicle( m_camMsg_vehicle(
f_getTsStationId(), f_getTsStationId() + p_vehicleIndex,
f_getCurrentTime() mod 65536, // Shall be updated in function f_prepare_vehicle_cam f_getCurrentTime() mod 65536, // Shall be updated in function f_prepare_vehicle_cam
m_rsuPosition( m_rsuPosition(
0, // Shall be computed 0, // Shall be computed
...@@ -640,13 +653,16 @@ module ItsRSUsSimulator_Functions { ...@@ -640,13 +653,16 @@ module ItsRSUsSimulator_Functions {
// Apply 90° rotation // Apply 90° rotation
fx_computePositionFromRotation( fx_computePositionFromRotation(
p_camVehicle.cam.camParameters.basicContainer.referencePosition.latitude, p_location.latitude,
p_camVehicle.cam.camParameters.basicContainer.referencePosition.longitude, p_location.longitude,
// p_camVehicle.cam.camParameters.basicContainer.referencePosition.latitude,
// p_camVehicle.cam.camParameters.basicContainer.referencePosition.longitude,
PICS_UC6_COLLISION_POINT.latitude, PICS_UC6_COLLISION_POINT.latitude,
PICS_UC6_COLLISION_POINT.longitude, PICS_UC6_COLLISION_POINT.longitude,
-90.0, -90.0,
v_newPosition.latitude, v_newPosition.latitude,
v_newPosition.longitude); v_newPosition.longitude);
log("Rotation: (", p_location.latitude, ", ", p_location.longitude, ") --> (", v_newPosition.latitude, ", ", v_newPosition.longitude, ")");
/*v_newPosition.latitude := ; /*v_newPosition.latitude := ;
v_newPosition.longitude := ;*/ v_newPosition.longitude := ;*/
// Update CAM // Update CAM
......
...@@ -460,9 +460,10 @@ module ItsRSUsSimulator_Pics { ...@@ -460,9 +460,10 @@ module ItsRSUsSimulator_Pics {
/** /**
* @desc Coordinates of the collision point * @desc Coordinates of the collision point
*/ */
modulepar TwoDLocation PICS_UC6_COLLISION_POINT := { modulepar ThreeDLocation PICS_UC6_COLLISION_POINT := {
latitude := 435521940, latitude := 435522970,
longitude := 103001700 longitude := 103000170,
elevation := '0000'O
} // End of PICS_UC6_COLLISION_POINT } // End of PICS_UC6_COLLISION_POINT
/** /**
...@@ -470,12 +471,12 @@ module ItsRSUsSimulator_Pics { ...@@ -470,12 +471,12 @@ module ItsRSUsSimulator_Pics {
*/ */
modulepar RectangularRegion PICS_UC6_CAM_DETECTION_AREA := { modulepar RectangularRegion PICS_UC6_CAM_DETECTION_AREA := {
northwest := { northwest := {
latitude := 435528900, latitude := 435529170,
longitude := 103010950 longitude := 102998330
}, },
southeast := { southeast := {
latitude := 435520810, latitude := 435522420,
longitude := 103002620 longitude := 103011400
} }
} // End of PICS_UC6_CAM_DETECTION_AREA } // End of PICS_UC6_CAM_DETECTION_AREA
......
...@@ -34,7 +34,7 @@ module ItsRSUsSimulator_Pixits { ...@@ -34,7 +34,7 @@ module ItsRSUsSimulator_Pixits {
* UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 !! PX_RSU_ID 5 * UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 !! PX_RSU_ID 5
* @remark LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB * @remark LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
*/ */
modulepar integer PX_ETSI_USE_CASE_ID := 3; modulepar integer PX_ETSI_USE_CASE_ID := 6;
/** /**
* @desc Indicate which zone to simulate * @desc Indicate which zone to simulate
...@@ -44,15 +44,15 @@ module ItsRSUsSimulator_Pixits { ...@@ -44,15 +44,15 @@ module ItsRSUsSimulator_Pixits {
modulepar boolean PICS_GENERATE_BEACON := false; modulepar boolean PICS_GENERATE_BEACON := false;
modulepar boolean PICS_GENERATE_CAM := false; modulepar boolean PICS_GENERATE_CAM := true;
modulepar boolean PICS_GENERATE_DENM := false; modulepar boolean PICS_GENERATE_DENM := false;
modulepar boolean PICS_GENERATE_IVIM := false; modulepar boolean PICS_GENERATE_IVIM := false;
modulepar boolean PICS_GENERATE_MAPEM := true; modulepar boolean PICS_GENERATE_MAPEM := false;
modulepar boolean PICS_GENERATE_SPATEM := true; modulepar boolean PICS_GENERATE_SPATEM := false;
modulepar boolean PICS_GENERATE_SSEM := true; modulepar boolean PICS_GENERATE_SSEM := true;
......
...@@ -169,15 +169,21 @@ module ItsRSUsSimulator_TestCases { ...@@ -169,15 +169,21 @@ module ItsRSUsSimulator_TestCases {
*/ */
testcase TC_RSUSIMU_BV_02() runs on ItsRSUsSimulator system ItsRSUsSimulatorSystem { testcase TC_RSUSIMU_BV_02() runs on ItsRSUsSimulator system ItsRSUsSimulatorSystem {
// Local variables // Local variables
const RectangularRegions c_detectionArea := { PICS_UC6_CAM_DETECTION_AREA };
var VehiclesSimulator v_vehicles := {}; var VehiclesSimulator v_vehicles := {};
var integer v_vehiclesIdx := 0; var integer v_vehiclesIdx := 0;
var charstring v_stationIDs := ""; var integer v_stationID;
var charstring v_stationID; var boolean v_isInDetectionZone;
var boolean v_notProcessed;
var integer v_idx;
var ThreeDLocation v_location; var ThreeDLocation v_location;
var GeoNetworkingInd v_gnInd; var GeoNetworkingInd v_gnInd;
var CfEvent v_cfEvent; var CfEvent v_cfEvent;
// Test control // Test control
if (f_isLocationInsideRectangularRegion(c_detectionArea, PICS_UC6_COLLISION_POINT) == false) {
stop;
}
// Test component configuration // Test component configuration
ItsRSUsSimulator_Functions.f_cf01Up(); ItsRSUsSimulator_Functions.f_cf01Up();
...@@ -185,6 +191,11 @@ module ItsRSUsSimulator_TestCases { ...@@ -185,6 +191,11 @@ module ItsRSUsSimulator_TestCases {
// Test adapter configuration // Test adapter configuration
// Preamble // Preamble
for (v_idx := 0; v_idx < 10; v_idx := v_idx + 1) { // FIXME Use a PIXIT
v_vehicles[v_idx].detected := false;
v_vehicles[v_idx].detectionCounter := 0;
v_vehicles[v_idx].stationId := 0;
} // End of 'for' statement
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body // Test Body
...@@ -199,31 +210,59 @@ module ItsRSUsSimulator_TestCases { ...@@ -199,31 +210,59 @@ module ItsRSUsSimulator_TestCases {
-, -,
e_btpB e_btpB
)))) -> value v_gnInd { // Receive a CAM message )))) -> value v_gnInd { // Receive a CAM message
tc_ac.stop;
v_location := { v_location := {
v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.latitude, v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.latitude,
v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.longitude, v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.longitude,
int2oct(v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.altitude.altitudeValue, 2) int2oct(0, 2)
// v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.latitude,
// v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.longitude,
// int2oct(v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.altitude.altitudeValue, 2)
}; };
v_stationID := int2str(v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.header.stationID); v_stationID := v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.header.stationID;
tc_ac.stop; // Check if it already processed
// Check if it entered into the rectangular area v_notProcessed := false;
if (f_isLocationInsideRectangularRegion({ PICS_UC6_CAM_DETECTION_AREA }, v_location) == true) { for (v_idx := 0; v_idx < 10 and v_vehicles[v_idx].stationId != 0; v_idx := v_idx + 1) { // FIXME Use a PIXIT
// Check if it already processed if (v_vehicles[v_idx].stationId == v_stationID) {
if (regexp(v_stationIDs, charstring:"(" & v_stationID & ",)", 0) == "") { // Vehicle not processed yet v_notProcessed := not(v_vehicles[v_idx].detected);
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " is entering in area ***"); break;
v_vehicles[v_vehiclesIdx] := ItsRSUsSimulator.create("Node" & int2char(v_vehiclesIdx + 65)) alive; }
v_vehicles[v_vehiclesIdx].start(f_startVehicleSimulator(v_vehicles[v_vehiclesIdx], v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket, v_location)); } // End of 'for' statement
v_vehiclesIdx := v_vehiclesIdx + 1; if (v_vehicles[v_idx].stationId == 0) { // FIXME Use a PIXIT
v_stationIDs := v_stationIDs & v_stationID & ","; v_vehicles[v_vehiclesIdx].stationId := v_stationID;
log("*** " & testcasename() & ": DEBUG: New v_stationIDs: " & v_stationIDs & " ***"); v_vehiclesIdx := v_vehiclesIdx + 1;
} else if (v_idx == 10) {
log("*** " & testcasename() & ": ERROR: Increase the size of the file ***");
stop;
}
v_isInDetectionZone := f_isLocationInsideRectangularRegion(c_detectionArea, v_location);
if (v_notProcessed == true) { // Vehicle not processed yet
if (v_isInDetectionZone == true) { // Check if it entered into the rectangular area
if (v_vehicles[v_idx].detectionCounter == 0) { // First detection, wait one CAM to confrm detection
// Prepare component
v_vehicles[v_idx].detectionCounter := 1;
v_vehicles[v_idx].component_ := ItsRSUsSimulator.create("Node" & int2char(v_vehiclesIdx + 65)) alive;
// Wait next message in detection area
} else {
v_vehicles[v_idx].detectionCounter := 0;
v_vehicles[v_idx].detected := true;
v_vehicles[v_idx].component_.start(f_startVehicleSimulator(v_vehicles[v_idx].component_, v_idx, v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket));
}
} else { } else {
// Nothing to do // Nothing to do
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " already processed ***"); log("*** " & testcasename() & ": DEBUG: StationID: " & int2str(v_stationID) & " is outside of area ***");
} }
} else if (v_isInDetectionZone == false) {
if (v_vehicles[v_idx].detected == true) { // Remove station if from v_stationIDs
log("*** " & testcasename() & ": DEBUG: Suspend stationID: " & int2str(v_stationID) & " ***");
v_vehicles[v_idx].detectionCounter := 0;
v_vehicles[v_idx].detected := false;
v_vehicles[v_idx].component_.kill;
} // else Nothing to do
} else { } else {
// Nothing to do // Nothing to do
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " is outside of area ***"); log("*** " & testcasename() & ": DEBUG: StationID: " & int2str(v_stationID) & " already processed ***");
} }
tc_ac.start; tc_ac.start;
repeat; repeat;
...@@ -243,8 +282,8 @@ module ItsRSUsSimulator_TestCases { ...@@ -243,8 +282,8 @@ module ItsRSUsSimulator_TestCases {
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// Postamble // Postamble
for (var integer v_idx := 0; v_idx < lengthof(v_vehicles); v_idx := v_idx + 1) { for (v_idx := 0; v_idx < lengthof(v_vehicles); v_idx := v_idx + 1) {
v_vehicles[v_idx].done; v_vehicles[v_vehiclesIdx].component_.kill;
} // End of 'for' statement } // End of 'for' statement
ItsRSUsSimulator_Functions.f_cf01Down(); ItsRSUsSimulator_Functions.f_cf01Down();
...@@ -254,16 +293,18 @@ module ItsRSUsSimulator_TestCases { ...@@ -254,16 +293,18 @@ module ItsRSUsSimulator_TestCases {
function f_startVehicleSimulator( function f_startVehicleSimulator(
in ItsRSUsSimulator p_component, in ItsRSUsSimulator p_component,
in CAM p_camVehicle, in integer p_vehicleIndex,
in ThreeDLocation p_location in CAM p_camVehicle
) runs on ItsRSUsSimulator { ) runs on ItsRSUsSimulator {
// Local variables // Local variables
const RectangularRegions c_detectionArea := { PICS_UC6_CAM_DETECTION_AREA };
var GeoNetworkingInd v_gnInd; var GeoNetworkingInd v_gnInd;
var template (value) CAM v_camSimu; var template (value) CAM v_camSimu;
var ThreeDLocation v_location;
log("*** " & testcasename() & ": DEBUG: >>> f_startVehicleSimulator: " & int2str(p_camVehicle.header.stationID) & " ***"); //log("*** " & testcasename() & ": DEBUG: >>> f_startVehicleSimulator: " & int2str(p_camVehicle.header.stationID) & " ***");
f_initialiseVehicleSimulatorComponent(p_component, v_camSimu); f_initialiseVehicleSimulatorComponent(p_component, p_vehicleIndex, v_camSimu);
tc_cam.start; tc_cam.start;
alt { alt {
...@@ -278,10 +319,23 @@ module ItsRSUsSimulator_TestCases { ...@@ -278,10 +319,23 @@ module ItsRSUsSimulator_TestCases {
-, -,
p_camVehicle.header.stationID p_camVehicle.header.stationID
))))) -> value v_gnInd { // Receive a CAM message from the processed vehicle ))))) -> value v_gnInd { // Receive a CAM message from the processed vehicle
log("*** " & testcasename() & ": DEBUG: Processing CAM #" & int2str(p_camVehicle.header.stationID) & " ***");
tc_cam.stop; tc_cam.stop;
f_mirror_and_send_vehicle_cam(v_camSimu, v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket, p_location); v_location := {
tc_cam.start; v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.latitude,
v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.longitude,
int2oct(0, 2)
// v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.latitude,
// v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.longitude,
// int2oct(v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.cam.camParameters.basicContainer.referencePosition.altitude.altitudeValue, 2)
};
f_mirror_and_send_vehicle_cam(v_camSimu, v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket, v_location/*To ne removed*/);
// Check if the behicule leave the area
if (f_isLocationInsideRectangularRegion(c_detectionArea, v_location) == true) {
tc_cam.start;
repeat;
} else {
f_setVerdict(e_success);
}
} }
[] cfPort.receive { [] cfPort.receive {
tc_cam.stop; tc_cam.stop;
......
...@@ -104,7 +104,12 @@ module ItsRSUsSimulator_TestSystem { ...@@ -104,7 +104,12 @@ module ItsRSUsSimulator_TestSystem {
port ConfigRsuSimulatorPort cfPort; port ConfigRsuSimulatorPort cfPort;
} }
type record of ItsRSUsSimulator VehiclesSimulator; type record of record {
boolean detected,
ItsRSUsSimulator component_,
integer stationId,
integer detectionCounter
} VehiclesSimulator;
group configRsuSimulatorTypes { group configRsuSimulatorTypes {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment