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

Finalise UC6

parent 71504bef
......@@ -122,17 +122,30 @@ module ItsRSUsSimulator_Functions {
} // 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
group usecase6 {
function f_initialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component,
in integer p_vehicleIndex,
out template (omit) CAM p_cam
) runs on ItsRSUsSimulator {
p_cam :=
m_camMsg_vehicle(
f_getTsStationId(),
f_getTsStationId() + p_vehicleIndex,
f_getCurrentTime() mod 65536, // Shall be updated in function f_prepare_vehicle_cam
m_rsuPosition(
0, // Shall be computed
......@@ -640,13 +653,16 @@ module ItsRSUsSimulator_Functions {
// Apply 90° rotation
fx_computePositionFromRotation(
p_camVehicle.cam.camParameters.basicContainer.referencePosition.latitude,
p_camVehicle.cam.camParameters.basicContainer.referencePosition.longitude,
p_location.latitude,
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.longitude,
-90.0,
v_newPosition.latitude,
v_newPosition.longitude);
log("Rotation: (", p_location.latitude, ", ", p_location.longitude, ") --> (", v_newPosition.latitude, ", ", v_newPosition.longitude, ")");
/*v_newPosition.latitude := ;
v_newPosition.longitude := ;*/
// Update CAM
......
......@@ -460,9 +460,10 @@ module ItsRSUsSimulator_Pics {
/**
* @desc Coordinates of the collision point
*/
modulepar TwoDLocation PICS_UC6_COLLISION_POINT := {
latitude := 435521940,
longitude := 103001700
modulepar ThreeDLocation PICS_UC6_COLLISION_POINT := {
latitude := 435522970,
longitude := 103000170,
elevation := '0000'O
} // End of PICS_UC6_COLLISION_POINT
/**
......@@ -470,12 +471,12 @@ module ItsRSUsSimulator_Pics {
*/
modulepar RectangularRegion PICS_UC6_CAM_DETECTION_AREA := {
northwest := {
latitude := 435528900,
longitude := 103010950
latitude := 435529170,
longitude := 102998330
},
southeast := {
latitude := 435520810,
longitude := 103002620
latitude := 435522420,
longitude := 103011400
}
} // End of PICS_UC6_CAM_DETECTION_AREA
......
......@@ -34,7 +34,7 @@ module ItsRSUsSimulator_Pixits {
* UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 !! PX_RSU_ID 5
* @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
......@@ -44,15 +44,15 @@ module ItsRSUsSimulator_Pixits {
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_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;
......
......@@ -169,15 +169,21 @@ module ItsRSUsSimulator_TestCases {
*/
testcase TC_RSUSIMU_BV_02() runs on ItsRSUsSimulator system ItsRSUsSimulatorSystem {
// Local variables
const RectangularRegions c_detectionArea := { PICS_UC6_CAM_DETECTION_AREA };
var VehiclesSimulator v_vehicles := {};
var integer v_vehiclesIdx := 0;
var charstring v_stationIDs := "";
var charstring v_stationID;
var integer v_stationID;
var boolean v_isInDetectionZone;
var boolean v_notProcessed;
var integer v_idx;
var ThreeDLocation v_location;
var GeoNetworkingInd v_gnInd;
var CfEvent v_cfEvent;
// Test control
if (f_isLocationInsideRectangularRegion(c_detectionArea, PICS_UC6_COLLISION_POINT) == false) {
stop;
}
// Test component configuration
ItsRSUsSimulator_Functions.f_cf01Up();
......@@ -185,6 +191,11 @@ module ItsRSUsSimulator_TestCases {
// Test adapter configuration
// 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);
// Test Body
......@@ -199,31 +210,59 @@ module ItsRSUsSimulator_TestCases {
-,
e_btpB
)))) -> value v_gnInd { // Receive a CAM message
tc_ac.stop;
v_location := {
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_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)
};
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 entered into the rectangular area
if (f_isLocationInsideRectangularRegion({ PICS_UC6_CAM_DETECTION_AREA }, v_location) == true) {
// Check if it already processed
if (regexp(v_stationIDs, charstring:"(" & v_stationID & ",)", 0) == "") { // Vehicle not processed yet
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " is entering in area ***");
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));
v_notProcessed := false;
for (v_idx := 0; v_idx < 10 and v_vehicles[v_idx].stationId != 0; v_idx := v_idx + 1) { // FIXME Use a PIXIT
if (v_vehicles[v_idx].stationId == v_stationID) {
v_notProcessed := not(v_vehicles[v_idx].detected);
break;
}
} // End of 'for' statement
if (v_vehicles[v_idx].stationId == 0) { // FIXME Use a PIXIT
v_vehicles[v_vehiclesIdx].stationId := v_stationID;
v_vehiclesIdx := v_vehiclesIdx + 1;
v_stationIDs := v_stationIDs & v_stationID & ",";
log("*** " & testcasename() & ": DEBUG: New v_stationIDs: " & v_stationIDs & " ***");
} 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 {
// 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 {
// 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;
repeat;
......@@ -243,8 +282,8 @@ module ItsRSUsSimulator_TestCases {
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// Postamble
for (var integer v_idx := 0; v_idx < lengthof(v_vehicles); v_idx := v_idx + 1) {
v_vehicles[v_idx].done;
for (v_idx := 0; v_idx < lengthof(v_vehicles); v_idx := v_idx + 1) {
v_vehicles[v_vehiclesIdx].component_.kill;
} // End of 'for' statement
ItsRSUsSimulator_Functions.f_cf01Down();
......@@ -254,16 +293,18 @@ module ItsRSUsSimulator_TestCases {
function f_startVehicleSimulator(
in ItsRSUsSimulator p_component,
in CAM p_camVehicle,
in ThreeDLocation p_location
in integer p_vehicleIndex,
in CAM p_camVehicle
) runs on ItsRSUsSimulator {
// Local variables
const RectangularRegions c_detectionArea := { PICS_UC6_CAM_DETECTION_AREA };
var GeoNetworkingInd v_gnInd;
var template (value) CAM v_camSimu;
var ThreeDLocation v_location;
log("*** " & testcasename() & ": DEBUG: >>> f_startVehicleSimulator: " & int2str(p_camVehicle.header.stationID) & " ***");
f_initialiseVehicleSimulatorComponent(p_component, v_camSimu);
//log("*** " & testcasename() & ": DEBUG: >>> f_startVehicleSimulator: " & int2str(p_camVehicle.header.stationID) & " ***");
f_initialiseVehicleSimulatorComponent(p_component, p_vehicleIndex, v_camSimu);
tc_cam.start;
alt {
......@@ -278,10 +319,23 @@ module ItsRSUsSimulator_TestCases {
-,
p_camVehicle.header.stationID
))))) -> value v_gnInd { // Receive a CAM message from the processed vehicle
log("*** " & testcasename() & ": DEBUG: Processing CAM #" & int2str(p_camVehicle.header.stationID) & " ***");
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 := {
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 {
tc_cam.stop;
......
......@@ -104,7 +104,12 @@ module ItsRSUsSimulator_TestSystem {
port ConfigRsuSimulatorPort cfPort;
}
type record of ItsRSUsSimulator VehiclesSimulator;
type record of record {
boolean detected,
ItsRSUsSimulator component_,
integer stationId,
integer detectionCounter
} VehiclesSimulator;
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