Commit 28b03d5f authored by garciay's avatar garciay

Add MAPEM support

parent 39200759
......@@ -16,6 +16,7 @@ module ItsRSUsSimulator_Functions {
import from IVIM_PDU_Descriptions language "ASN.1:1997" all;
import from SREM_PDU_Descriptions language "ASN.1:1997" all;
import from SSEM_PDU_Descriptions language "ASN.1:1997" all;
import from DSRC language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_Functions all;
......@@ -27,6 +28,9 @@ module ItsRSUsSimulator_Functions {
// LibItsDenm
import from LibItsDenm_Templates all;
// LibItsMapemSpatemm
import from LibItsMapemSpatem_Templates all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_Functions all;
......@@ -80,43 +84,66 @@ module ItsRSUsSimulator_Functions {
// Initialisations
vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector;
// TODO MAPEM
// TODO IVIM
// MAPEM
if (PICS_GENERATE_MAPEM) {
// Build the list of the MAPEM events
v_mapem :=
m_mapemParm(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
m_mapem(
f_getMsgIssueRevision(),
PICS_MAPEM_PARMS_RSUs[PX_RSU_ID - 1].intersections,
PICS_MAPEM_PARMS_RSUs[PX_RSU_ID - 1].roadSegments
));
// Update revision fields
v_mapem.map_.intersections[0].revision := f_incMsgIssueRevision();
// TODO Add more?
}
// SPATEM
if (PICS_GENERATE_SPATEM) {
// TODO
}
// IVIM
if (PICS_GENERATE_IVIM) {
// TODO
}
// DENM
if (PICS_GENERATE_DENM) {
// Build the list of the DENM events
for (v_counter := 0; v_counter < lengthof(PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1]); v_counter := v_counter + 1) {
// Build DENM with dynamic values
v_denmParmContainers := m_denmParmContainers(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
f_getDenmSequenceNumber(),
f_incDenmSequenceNumber(),
PICS_DENM_REPETITION_INTERVAL,
PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].eventPosition,
PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].causeCodeType,
PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].eventHistory
);
v_denms[v_counter] := valueof(
m_denmPdu(
m_denm(
v_denmParmContainers.managementContainer,
v_denmParmContainers.situationContainer,
v_denmParmContainers.locationContainer
)));
m_denmPdu(
m_denm(
v_denmParmContainers.managementContainer,
v_denmParmContainers.situationContainer,
v_denmParmContainers.locationContainer
)));
if (ispresent(PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].roadWorksContainerExtended)) {
v_denms[v_counter].denm.alacarte := m_alacarte(PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].roadWorksContainerExtended);
}
} // End of 'for' loop
}
// CAM
if (PICS_GENERATE_CAM) {
// Build the list of the CAM events
v_cam := valueof(
m_camParm(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
m_rsuPosition(
vc_longPosVectorRsu.latitude,
vc_longPosVectorRsu.longitude
),
PICS_RSU_PARAMS[PX_RSU_ID - 1].pathHistory
)
m_camParm(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
m_rsuPosition(
vc_longPosVectorRsu.latitude,
vc_longPosVectorRsu.longitude
),
PICS_RSU_PARAMS[PX_RSU_ID - 1].pathHistory
)
);
}
// Build the messages value list for this RSU
......@@ -197,8 +224,17 @@ module ItsRSUsSimulator_Functions {
out template (value) Payload p_payload
) runs on ItsRSUsSimulator {
p_payload := {}; // FIXME To be developped
p_payload := valueof(
f_adaptPayload(
bit2oct(
encvalue(
valueof(
vc_rsuMessagesValueList[PX_RSU_ID - 1].mapem
))),
PICS_MAPEM_BTP_DESTINATION_PORT,
PICS_MAPEM_BTP_SOURCE_PORT
)
);
}
function f_prepare_spatem(
......@@ -304,8 +340,22 @@ module ItsRSUsSimulator_Functions {
return vc_localSeqNumber;
}
function f_incMsgIssueRevision() runs on ItsRSUsSimulator return MsgCount {
vc_msgIssueRevision := (vc_msgIssueRevision + 1) mod 128; // See MsgCount declaration
return vc_msgIssueRevision;
}
function f_getMsgIssueRevision() runs on ItsRSUsSimulator return MsgCount {
return vc_msgIssueRevision;
}
function f_incDenmSequenceNumber() runs on ItsRSUsSimulator return SequenceNumber {
vc_sequenceNumber := (vc_sequenceNumber + 1) mod 65536; // See SequenceNumber declaration
return vc_sequenceNumber;
}
function f_getDenmSequenceNumber() runs on ItsRSUsSimulator return SequenceNumber {
return 12345; // FIXME To be refined
return vc_sequenceNumber;
}
} // End of module ItsRSUsSimulator_Functions
\ No newline at end of file
......@@ -162,6 +162,18 @@ module ItsRSUsSimulator_Templates {
group mapemTemplates {
template (value) MAPEM m_mapemParm(
in template (value) StationID p_stationID,
in template (value) MapData p_map
) := {
header := {
protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
messageID := ItsPduHeader_messageID_mapem_,
stationID := p_stationID
},
map_ := p_map
}
} // End of group mapemTemplates
group ivimTemplates {
......
......@@ -20,6 +20,7 @@ module ItsRSUsSimulator_TestCases {
import from ItsRSUsSimulator_Templates all;
import from ItsRSUsSimulator_TestSystem all;
import from ItsRSUsSimulator_Functions all;
import from ItsRSUsSimulator_Pics all;
import from ItsRSUsSimulator_Pixits all;
testcase TC_RSUSIMU_BV_01() runs on ItsRSUsSimulator system ItsGeoNetworkingSystem {
......@@ -69,38 +70,41 @@ module ItsRSUsSimulator_TestCases {
// Nothing to do, just for logging purposes
repeat;
}
[] tc_cam.timeout {
[PICS_GENERATE_CAM] tc_cam.timeout {
log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
f_prepare_cam(v_payload);
f_send(v_payload);
tc_cam.start;
repeat;
}
[] tc_denm.timeout {
[PICS_GENERATE_DENM] tc_denm.timeout {
log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
f_prepare_denm(v_payload);
f_send(v_payload);
tc_denm.start;
repeat;
}
// [] tc_spatem.timeout {
// f_prepare_spatem(v_payload);
// f_send(v_payload);
// tc_spatem.start;
// repeat;
// }
// [] tc_mapem.timeout {
// f_prepare_spatem(v_payload);
// f_send(v_payload);
// tc_mapem.start;
// repeat;
// }
// [] tc_ivim.timeout {
// f_prepare_ivim(v_payload);
// f_send(v_payload);
// tc_ivim.start;
// repeat;
// }
[PICS_GENERATE_MAPEM] tc_mapem.timeout {
log("*** " & testcasename() & ": DEBUG: Processing MAPEM ***");
f_prepare_mapem(v_payload);
f_send(v_payload);
tc_mapem.start;
repeat;
}
[PICS_GENERATE_SPATEM] tc_spatem.timeout {
log("*** " & testcasename() & ": DEBUG: Processing SPATEM ***");
f_prepare_spatem(v_payload);
f_send(v_payload);
tc_spatem.start;
repeat;
}
[PICS_GENERATE_IVIM] tc_ivim.timeout {
log("*** " & testcasename() & ": DEBUG: Processing IVIM ***");
f_prepare_ivim(v_payload);
f_send(v_payload);
tc_ivim.start;
repeat;
}
} // End of 'alt' statement
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
......
module ItsRSUsSimulator_TestSystem {
// LibIts
import from ITS_Container language "ASN.1:1997" all;
import from DSRC language "ASN.1:1997" all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_TypesAndValues all;
......@@ -17,6 +21,8 @@ module ItsRSUsSimulator_TestSystem {
var GeoArea vc_geoArea := {};
var template (value) RsuMessagesValueList vc_rsuMessagesValueList := {};
var integer vc_denmEventCounter := 0;
var SequenceNumber vc_sequenceNumber := 0;
var MsgCount vc_msgIssueRevision := 0;
timer tc_cam := PICS_CAM_FREQUENY;
timer tc_denm := PICS_DENM_FREQUENY;
......
......@@ -11,6 +11,7 @@ module ItsRSUsSimulator_TypesAndValues {
import from SPATEM_PDU_Descriptions language "ASN.1:1997" all;
import from IVIM_PDU_Descriptions language "ASN.1:1997" all;
import from SSEM_PDU_Descriptions language "ASN.1:1997" all;
import from DSRC language "ASN.1:1997" all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
......@@ -106,7 +107,24 @@ module ItsRSUsSimulator_TypesAndValues {
* @desc MAPEM setup
*/
group mapemDataStructures {
// TODO To be done
/**
* @desc Describe the parameter for each MAPEM event
*/
type record MapemParm {
IntersectionGeometryList intersections,
RoadSegmentList roadSegments optional
} // End of type MapemParm
/**
*
* @desc List of MAPEM parms per RSU
* <pre>
* v_intersection := PICS_MAPEM_PARMS_RSUs[PX_RSU_ID - 1].intersections[v_idx];
* </pre>
*/
type record of MapemParm MapemParmList;
} // End of group mapemDataStructures
/**
......
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