Commit d69fc9a6 authored by garciay's avatar garciay
Browse files

Update UC6/UC7

parent 81aa65cb
......@@ -47,6 +47,10 @@ module ItsRSUsSimulator_Functions {
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Pixits all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Functions all;
// AtsRSUsSimulator
import from ItsRSUsSimulator_TypesAndValues all;
import from ItsRSUsSimulator_TestSystem all;
......@@ -54,6 +58,20 @@ module ItsRSUsSimulator_Functions {
import from ItsRSUsSimulator_Pics all;
import from ItsRSUsSimulator_Pixits all;
group externalFunctions {
external function fx_computePositionFromRotation(
in Int32 p_refLatitude,
in Int32 p_refLongitude,
in Int32 p_cenLatitude,
in Int32 p_cenLongitude,
in float p_rotation,
out Int32 p_latitude,
out Int32 p_longitude
);
} // End of group externalFunctions
group rsuConfigurationFunctions {
/**
......@@ -106,28 +124,32 @@ module ItsRSUsSimulator_Functions {
} // End of group rsuConfigurationFunctions
function f_initialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component,
out template (omit) CAM p_cam
) runs on ItsRSUsSimulator {
p_cam :=
m_camMsg_vehicle(
f_getTsStationId(),
f_getCurrentTime() mod 65536, // Shall be updated in function f_prepare_vehicle_cam
m_rsuPosition(
PICS_USECASE6_VEHICLE_POSITIONS[0].latitude, // Shall be updated in function f_prepare_vehicle_cam
PICS_USECASE6_VEHICLE_POSITIONS[0].longitude // Shall be updated in function f_prepare_vehicle_cam
)
);
map(p_component:geoNetworkingPort, system:geoNetworkingPort);
} // End of function f_initialiseVehicleSimulatorComponent
function f_uninitialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component
) runs on ItsRSUsSimulator {
p_component.done;
unmap(p_component:geoNetworkingPort, system:geoNetworkingPort);
} // End of function f_uninitialiseVehicleSimulatorComponent
group usecase6 {
function f_initialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component,
out template (omit) CAM p_cam
) runs on ItsRSUsSimulator {
p_cam :=
m_camMsg_vehicle(
f_getTsStationId(),
f_getCurrentTime() mod 65536, // Shall be updated in function f_prepare_vehicle_cam
m_rsuPosition(
0, // Shall be computed
0 // Shall be computed
)
);
map(p_component:geoNetworkingPort, system:geoNetworkingPort);
} // End of function f_initialiseVehicleSimulatorComponent
function f_uninitialiseVehicleSimulatorComponent(
in ItsRSUsSimulator p_component
) runs on ItsRSUsSimulator {
p_component.done;
unmap(p_component:geoNetworkingPort, system:geoNetworkingPort);
} // End of function f_uninitialiseVehicleSimulatorComponent
} // End of group usecase6
function f_setup_rsu(
in integer p_rsu_id
......@@ -255,7 +277,23 @@ module ItsRSUsSimulator_Functions {
// CAM
if (vc_cam == true) {
// Build the list of the CAM events
if (PX_ETSI_USE_CASE_ID == 9) {
if (PX_ETSI_USE_CASE_ID == 7) {
vc_longPosVectorRsu := PICS_UC7_LPV.longPosVector;
v_cam :=
m_camParm(
PICS_UC7_LPV.stationID,
m_rsuPosition(
PICS_UC7_LPV.longPosVector.latitude,
PICS_UC7_LPV.longPosVector.longitude
),
PICS_UC7_LPV.pathHistory,
{
rsuContainerHighFrequency := {
protectedCommunicationZonesRSU := omit
}
}
);
} else if (PX_ETSI_USE_CASE_ID == 9) {
v_cam :=
m_camParm(
PICS_RSU_PARAMS[p_rsu_id].stationID,
......@@ -572,55 +610,50 @@ module ItsRSUsSimulator_Functions {
return v_payload;
} // End of function f_adaptPayload
function f_send_vehicle_cam(
in template (value) CAM p_camSimu,
in CAM p_camVehicle
function f_mirror_and_send_vehicle_cam(
in template (value) CAM p_camSimu,
in CAM p_camVehicle,
in ThreeDLocation p_location
) runs on ItsRSUsSimulator {
// Local variables
var LongPosVector v_vehiclePosition := PICS_UC6_VEHICLE_POSITION;
var float v_distanceToCollision;
var SpeedValue v_vehicleSpeed := p_camVehicle.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue;
var ReferencePosition v_newPosition := p_camVehicle.cam.camParameters.basicContainer.referencePosition;
var template (value) Payload v_payload;
// Compute distance to collision point
v_vehiclePosition.latitude := p_camVehicle.cam.camParameters.basicContainer.referencePosition.latitude;
v_vehiclePosition.longitude := p_camVehicle.cam.camParameters.basicContainer.referencePosition.longitude;
v_distanceToCollision := LibItsGeoNetworking_Functions.f_distance(
v_vehiclePosition,
PICS_UC6_COLLISION_POINT
// Apply 90° rotation
fx_computePositionFromRotation(
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);
/*v_newPosition.latitude := ;
v_newPosition.longitude := ;*/
// Update CAM
p_camSimu.cam.generationDeltaTime := f_getCurrentTime() mod 65536; // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
p_camSimu.cam.camParameters.basicContainer.referencePosition := v_newPosition;
p_camSimu.cam.camParameters.highFrequencyContainer := p_camVehicle.cam.camParameters.highFrequencyContainer;
v_payload := valueof(
f_adaptPayload(
bit2oct(
encvalue(
valueof(
p_camSimu
))),
PICS_CAM_BTP_DESTINATION_PORT,
PICS_CAM_BTP_SOURCE_PORT
)
);
// Compute time to collision point
if (v_vehicleSpeed != 0) {
var float v_timeToCollision := v_distanceToCollision / int2float(v_vehicleSpeed);
// Updade simulated CAM to setup the same distance to the collision point
// FIXME p_camSimu.cam.camParameters.basicContainer.referencePosition := PICS_USECASE6_VEHICLE_POSITIONS[p_idx];
// Update generationDeltaTime
p_camSimu.cam.generationDeltaTime := f_getCurrentTime() mod 65536; // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
v_payload := valueof(
f_adaptPayload(
bit2oct(
encvalue(
valueof(
p_camSimu
))),
PICS_CAM_BTP_DESTINATION_PORT,
PICS_CAM_BTP_SOURCE_PORT
)
);
// Update GN
vc_longPosVectorRsu := PICS_UC6_VEHICLE_POSITION;
vc_longPosVectorRsu.latitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.latitude);
vc_longPosVectorRsu.longitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.longitude);
vc_geoArea := PICS_UC6_VEHICLE_GEOAREA;
vc_geoArea.area.geoAreaPosLatitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.latitude);
vc_geoArea.area.geoAreaPosLongitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.longitude);
// And send it
f_send(v_payload, PICS_CAM_ITS_AID);
} else {
}
// Update GN
vc_longPosVectorRsu := PICS_UC6_VEHICLE_TEMPLATE_POSITION;
vc_longPosVectorRsu.latitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.latitude);
vc_longPosVectorRsu.longitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.longitude);
vc_geoArea := PICS_UC6_VEHICLE_TEMPLATE_GEOAREA;
vc_geoArea.area.geoAreaPosLatitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.latitude);
vc_geoArea.area.geoAreaPosLongitude := valueof(p_camSimu.cam.camParameters.basicContainer.referencePosition.longitude);
// And send it
f_send(v_payload, PICS_CAM_ITS_AID);
} // End of function f_send_vehicle_cam
function f_send(
......@@ -629,6 +662,8 @@ module ItsRSUsSimulator_Functions {
) runs on ItsRSUsSimulator {
var GeoNetworkingPdu v_geoNetworkingPdu;
vc_longPosVectorRsu.timestamp_ := f_getCurrentTime();
if (p_its_aid == 36) { // CAM
v_geoNetworkingPdu := valueof(m_geoNwPdu( // FIXME Use PIXIT parameter to get a fully configurable template
m_geoNwShbPacket_payload(
......
......@@ -23,6 +23,9 @@ module ItsRSUsSimulator_Pics {
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
// ItsRSUsSimulator
import from ItsRSUsSimulator_TypesAndValues all;
......@@ -582,38 +585,9 @@ module ItsRSUsSimulator_Pics {
group camUseCase6 {
group camUseCase6SyncLocation {
group camUseCase6VehicleTemplateDescription {
modulepar LongPosVector PICS_UC6_COLLISION_POINT := {
gnAddr := {
typeOfAddress := e_manual,
stationType := e_unknown,
stationCountryCode := 0,
mid := '000000000000'O
},
timestamp_ := 0,
latitude := 433310000,
longitude := 101803000,
pai := '0'B,
speed := 0,
heading := 0
} // End of PICS_UC6_DETECTION_POINT
/**
* @desc Maximum synchronisation area to start sending CAM
*/
modulepar float PICS_UC6_DETECTION_DISTANCE := 11.0;
/**
* @desc Maximum synchronisation area to start sending CAM
*/
modulepar float PICS_UC6_DETECTION_EPSILLON := 0.01;
} // End of group camUseCase6SyncLocation
group camUseCase6VehicleDescription {
modulepar LongPosVector PICS_UC6_VEHICLE_POSITION := {
modulepar LongPosVector PICS_UC6_VEHICLE_TEMPLATE_POSITION := {
gnAddr := {
typeOfAddress := e_manual,
stationType := e_passengerCar,
......@@ -628,7 +602,7 @@ module ItsRSUsSimulator_Pics {
heading := 0
} // End of PICS_UC6_VEHICLE_POSITION
modulepar GeoArea PICS_UC6_VEHICLE_GEOAREA := {
modulepar GeoArea PICS_UC6_VEHICLE_TEMPLATE_GEOAREA := {
shape := e_geoElip,
area := {
geoAreaPosLatitude := 0,
......@@ -641,7 +615,33 @@ module ItsRSUsSimulator_Pics {
} // End of group camUseCase6VehicleDescription
modulepar Usecase6VehiclePositions PICS_USECASE6_VEHICLE_POSITIONS := {
group camUseCase6SyncLocation {
/**
* @desc Coordinates of the collision point
*/
modulepar TwoDLocation PICS_UC6_COLLISION_POINT := {
latitude := 433310000,
longitude := 101803000
} // End of PICS_UC6_COLLISION_POINT
/**
* @desc Vehicle detection area
*/
modulepar RectangularRegion PICS_UC6_CAM_DETECTION_AREA := {
northwest := {
latitude := 435523210,
longitude := 103000210
},
southeast := {
latitude := 435528290,
longitude := 103010320
}
} // End of PICS_UC6_CAM_DETECTION_AREA
} // End of group camUseCase6SyncLocation
/*modulepar Usecase6VehiclePositions PICS_USECASE6_VEHICLE_POSITIONS := {
{ // UC-Z1-P0
latitude := 43551930,
longitude := 10300440,
......@@ -1201,10 +1201,57 @@ module ItsRSUsSimulator_Pics {
altitudeConfidence := unavailable
}
}
} // End of PICS_USECASE6_VEHICLE_POSITIONS
}*/ // End of PICS_USECASE6_VEHICLE_POSITIONS
} // End of group camUseCase6
group camUseCase7 {
/**
* @desc RSU GN address
*/
modulepar GN_Address PICS_UC7_GN_ADDRESS := {
typeOfAddress := e_manual,
stationType := e_bus,
stationCountryCode := 39,
mid := 'AABBCCDDEEEE'O
} // End of PICS_UC7_GN_ADDRESS
modulepar RsuParm PICS_UC7_LPV := {
gnAddress := PICS_UC7_GN_ADDRESS,
longPosVector := {
gnAddr := PICS_RSU_GN_ADDRESS_RSU4,
timestamp_ := 0,
latitude := 435582150,
longitude := 103065170,
pai := '0'B,
speed := 0,
heading := 10
},
stationID := 12345,
geoShape := e_geoCircle,
geoParms := {
radius := 300
},
pathHistory := {}
} // End of PICS_UC7_LPV
modulepar ReferencePosition PICS_UC7_COLLISION_POINT := {
latitude := 435582150,
longitude := 103065170,
positionConfidenceEllipse := {
semiMajorConfidence := SemiAxisLength_oneCentimeter_,
semiMinorConfidence := SemiAxisLength_oneCentimeter_,
semiMajorOrientation := HeadingValue_wgs84North_
},
altitude := {
altitudeValue := AltitudeValue_referenceEllipsoidSurface_,
altitudeConfidence := unavailable
}
}
} // End of group camUseCase7
group camUseCase9 {
modulepar ProtectedCommunicationZone PICS_USECASE9_PCZ_1 := {
......@@ -1220,7 +1267,7 @@ module ItsRSUsSimulator_Pics {
PICS_USECASE9_PCZ_1
} // End of PICS_USECASE9_PCZ
} // End of group camUseCase9
} // End of group camUseCase7
} // End of group camParams
......@@ -1981,8 +2028,8 @@ module ItsRSUsSimulator_Pics {
},
{ // Z3_D1_H2
eventPosition := {
deltaLatitude := -3699,
deltaLongitude := -5788,
deltaLatitude := 2969,
deltaLongitude := 3874,
deltaAltitude := 0
},
eventDeltaTime := omit,
......@@ -1997,40 +2044,40 @@ module ItsRSUsSimulator_Pics {
{
{ // Z3-D1-T1
pathPosition := {
deltaLatitude := 4659,
deltaLongitude := 7205,
deltaLatitude := -4657,
deltaLongitude := -9320,
deltaAltitude := 0
},
pathDeltaTime := omit
},
{ // Z3-D1-T2
pathPosition := {
deltaLatitude := 510,
deltaLongitude := 720,
deltaLatitude := -34,
deltaLongitude := -1018,
deltaAltitude := 0
},
pathDeltaTime := omit
},
{ // Z3-D1-T3
pathPosition := {
deltaLatitude := -247,
deltaLongitude := -797,
deltaLatitude := -109,
deltaLongitude := -897,
deltaAltitude := 0
},
pathDeltaTime := omit
},
{ // Z3-D1-T4
pathPosition := {
deltaLatitude := -258,
deltaLongitude := -675,
deltaLatitude := -247,
deltaLongitude := -797,
deltaAltitude := 0
},
pathDeltaTime := omit
},
{ // Z3-D1-T5
pathPosition := {
deltaLatitude := -4657,
deltaLongitude := -9320,
deltaLatitude := -258,
deltaLongitude := -675,
deltaAltitude := 0
},
pathDeltaTime := omit
......
......@@ -26,11 +26,12 @@ module ItsRSUsSimulator_Pixits {
/**
* @desc Indicate which Use Case to simulate
* @remark UC1 (DENM): PX_ETSI_USE_CASE_ID := 1
* UC3 (TLM): PX_ETSI_USE_CASE_ID := 3
* UC5 (IVIM): PX_ETSI_USE_CASE_ID := 5
* UC6 (CAM): PX_ETSI_USE_CASE_ID := 6
* UC9 (CAM): PX_ETSI_USE_CASE_ID := 9 !! PX_RSU_ID 5
* @remark UC1 (DENM only): PX_ETSI_USE_CASE_ID := 1 !! PX_RSU_ID 2
* UC3 (TLM MAPEM/SPATEM): PX_ETSI_USE_CASE_ID := 3 !! PX_RSU_ID 2
* UC5 (IVIM only): PX_ETSI_USE_CASE_ID := 5 !! PX_RSU_ID 2
* UC6 (CAM only): PX_ETSI_USE_CASE_ID := 6 !! PX_RSU_ID 2
* UC7 (CAM only): PX_ETSI_USE_CASE_ID := 7 !! PX_RSU_ID 2
* UC9 (CAM only): PX_ETSI_USE_CASE_ID := 9 !! PX_RSU_ID 5
*/
modulepar integer PX_ETSI_USE_CASE_ID := 6;
......
......@@ -250,6 +250,7 @@ module ItsRSUsSimulator_Templates {
timestamp_ := ?,
latitude := ?,
longitude := ?,
pai := ?,
//FIXME May the delta factor should be based on the actual speed value -> low speed=lower delta, high speed=higher delta
speed := ?,
heading := ?
......
......@@ -19,6 +19,10 @@ module ItsRSUsSimulator_TestCases {
// LibItsDenm
import from LibItsDenm_Templates all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Functions all;
// AtsRSUsSimulator
import from ItsRSUsSimulator_TypesAndValues all;
import from ItsRSUsSimulator_Templates all;
......@@ -169,6 +173,7 @@ module ItsRSUsSimulator_TestCases {
var integer v_vehiclesIdx := 0;
var charstring v_stationIDs := "";
var charstring v_stationID;
var ThreeDLocation v_location;
var GeoNetworkingInd v_gnInd;
var CfEvent v_cfEvent;
......@@ -194,18 +199,31 @@ module ItsRSUsSimulator_TestCases {
-,
e_btpB
)))) -> value v_gnInd { // Receive a CAM message
tc_ac.stop;
// Check if it already processed
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_stationID := int2str(v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket.header.stationID);
if (regexp(v_stationIDs, charstring:"(" & v_stationID & ",)", 0) == "") { // Vehicle not processed yet
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_vehiclesIdx := v_vehiclesIdx + 1;
v_stationIDs := v_stationIDs & v_stationID & ",";
log("*** " & testcasename() & ": DEBUG: New v_stationIDs: " & v_stationIDs & " ***");
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_vehiclesIdx := v_vehiclesIdx + 1;
v_stationIDs := v_stationIDs & v_stationID & ",";
log("*** " & testcasename() & ": DEBUG: New v_stationIDs: " & v_stationIDs & " ***");
} else {
// Nothing to do
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " already processed ***");
}
} else {
// Nothing to do
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " already processed ***");
log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " is outside of area ***");
}
tc_ac.start;
repeat;
......@@ -236,7 +254,8 @@ module ItsRSUsSimulator_TestCases {
function f_startVehicleSimulator(
in ItsRSUsSimulator p_component,
in CAM p_camVehicle
in CAM p_camVehicle,
in ThreeDLocation p_location
) runs on ItsRSUsSimulator {
// Local variables
......@@ -261,12 +280,13 @@ module ItsRSUsSimulator_TestCases {
))))) -> 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_send_vehicle_cam(v_camSimu, v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket);
f_mirror_and_send_vehicle_cam(v_camSimu, v_gnInd.msgIn.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.camPacket, p_location);
tc_cam.start;
}
/*[] cfPort.receive {
[] cfPort.receive {
tc_cam.stop;
repeat;
}*/
}
[] tc_cam.timeout {
log("*** " & testcasename() & ": DEBUG: No CAM message received ***");
}
......
......@@ -6,10 +6,10 @@ module ItsRSUsSimulator_TestControl {
control {
if (PX_ETSI_USE_CASE_ID != 6) {
execute(TC_RSUSIMU_BV_01());
} else {
if (PX_ETSI_USE_CASE_ID == 6) {
execute(TC_RSUSIMU_BV_02());
} else {
execute(TC_RSUSIMU_BV_01());
}
}
......
......@@ -111,7 +111,7 @@ module ItsRSUsSimulator_TypesAndValues {
/**
* @desc List of simulated vehicle positions for UC6
*/
type record of ReferencePosition Usecase6VehiclePositions;
//type record of ReferencePosition Usecase6VehiclePositions;
} // End of group camDataStructures
......
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