Commit 28b03d5f authored by garciay's avatar garciay
Browse files

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
......@@ -80,7 +80,7 @@ module ItsRSUsSimulator_Pics {
modulepar BtpPortId PICS_CAM_BTP_DESTINATION_PORT := 2001;
modulepar BtpPortId PICS_CAM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_CAM_BTP_SOURCE_PORT := 0;
} // End of group camCommonParams
......@@ -92,7 +92,7 @@ module ItsRSUsSimulator_Pics {
modulepar BtpPortId PICS_DENM_BTP_DESTINATION_PORT := 2002;
modulepar BtpPortId PICS_DENM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_DENM_BTP_SOURCE_PORT := 0;
modulepar PosConfidenceEllipse PICS_DENM_POSITION_CONFIDENCE_ELLIPSE := {
semiMajorConfidence := SemiAxisLength_oneCentimeter_,
......@@ -116,10 +116,10 @@ module ItsRSUsSimulator_Pics {
modulepar DenmParm PICS_Z1_D1_EP := {
eventPosition := {
latitude := 435517392,
longitude := 103018217,
positionConfidenceEllipse := PICS_DENM_POSITION_CONFIDENCE_ELLIPSE,
altitude := PICS_DENM_ALTITUDE
latitude := 435517392,
longitude := 103018217,
positionConfidenceEllipse := PICS_DENM_POSITION_CONFIDENCE_ELLIPSE,
altitude := PICS_DENM_ALTITUDE
},
causeCodeType := CauseCodeType_roadworks_,
eventHistory := {
......@@ -208,6 +208,7 @@ module ItsRSUsSimulator_Pics {
trafficFlowRule := passToRight,
referenceDenms := omit
}
} // End of PICS_Z1_D2_EP
modulepar DenmParm PICS_Z1_D3_EP := {
......@@ -256,6 +257,7 @@ module ItsRSUsSimulator_Pics {
trafficFlowRule := passToRight,
referenceDenms := omit
}
} // End of PICS_Z1_D3_EP
} // End of group denmZone1
......@@ -288,32 +290,149 @@ module ItsRSUsSimulator_Pics {
group mapemCommonParams {
modulepar BtpPortId PICS_MAPEM_BTP_DESTINATION_PORT := 2003;
modulepar BtpPortId PICS_MAPEM_BTP_DESTINATION_PORT := 2003;
modulepar BtpPortId PICS_MAPEM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_MAPEM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_SPATEM_BTP_DESTINATION_PORT := 2004;
modulepar BtpPortId PICS_SPATEM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_SPATEM_BTP_SOURCE_PORT := 0;
} // End of group mapemCommonParams
group mapemZone1 {
// TODO To be done
modulepar MapemParm PICS_MAPEM_PARMS_RSU_1 := {
intersections := {
{ // Start of intersection #0
name := "PICS_MAPEM_PARMS_RSU_1",
id := {
region := 0,
id := 0
},
revision := 0,
refPoint := {
lat := 435517392,
long := 103018217,
elevation := omit,
regional := omit
},
laneWidth := omit,
speedLimits := omit,
laneSet := {
{ // Start of Lane #1
laneID := 1,
name := omit,
ingressApproach := 1,
egressApproach := 1,
laneAttributes := {
directionalUse := '10'B,
sharedWith := '0000000000'B,
laneType := {
vehicle := '00000000'B
},
regional := omit
},
maneuvers := omit,
nodeList := {
nodes := {
{
delta := {
node_XY1 := {
x := -10,
y := 10
}
},
attributes := omit
},
{
delta := {
node_XY1 := {
x := -10,
y := 10
}
},
attributes := omit
}
}
},
connectsTo := {
{
connectingLane := {
lane := 1,
maneuver := omit
},
remoteIntersection := omit,
signalGroup := 1,
userClass := omit,
connectionID := omit
}
},
overlays := omit,
regional := omit
}, // End of Lane #1
{ // Start of Lane #2
laneID := 1,
name := omit,
ingressApproach := 1,
egressApproach := 2,
laneAttributes := {
directionalUse := '01'B,
sharedWith := '0000000000'B,
laneType := {
vehicle := '00000000'B
},
regional := omit
},
maneuvers := omit,
nodeList := {
nodes := {
{
delta := {
node_XY1 := {
x := -10,
y := 10
}
},
attributes := omit
},
{
delta := {
node_XY1 := {
x := -10,
y := 10
}
},
attributes := omit
}
}
},
connectsTo := omit,
overlays := omit,
regional := omit
} // End of Lane #1
}, // End of LaneSet
preemptPriorityData := omit,
regional := omit
} // End of intersection #0
}, // End of field intersections
roadSegments := omit
}
} // End of group mapemZone1
group mapemZone2 {
// TODO To be done
modulepar MapemParm PICS_MAPEM_PARMS_RSU_2 := {
}
} // End of group mapemZone2
group mapemUseCase1 {
// TODO To be done
} // End of group mapemUseCase1
modulepar MapemParmList PICS_MAPEM_PARMS_RSUs := {
PICS_MAPEM_PARMS_RSU_1,
PICS_MAPEM_PARMS_RSU_2
} // End of PICS_MAPEM_PARMS_RSU
group mapemUseCase2 {
// TODO To be done
} // End of group mapemUseCase2
} // End of group mapemEvents
group ivimEvents {
......@@ -322,7 +441,7 @@ module ItsRSUsSimulator_Pics {
modulepar BtpPortId PICS_IVIM_BTP_DESTINATION_PORT := 2005;
modulepar BtpPortId PICS_IVIM_BTP_SOURCE_PORT := 0;
modulepar BtpPortId PICS_IVIM_BTP_SOURCE_PORT := 0;
} // End of group ivimCommonParams
......@@ -352,7 +471,9 @@ module ItsRSUsSimulator_Pics {
modulepar boolean PICS_GENERATE_IVIM := true;
modulepar boolean PICS_GENERATE_MAPEM_SPATEM := true;
modulepar boolean PICS_GENERATE_MAPEM := true;
modulepar boolean PICS_GENERATE_SPATEM := true;
modulepar boolean PICS_GENERATE_SSEM := true;
......@@ -369,17 +490,17 @@ module ItsRSUsSimulator_Pics {
/**
* @desc MAPEM frequency timer
*/
modulepar float PICS_MAPEM_FREQUENY := 0.1;
modulepar float PICS_MAPEM_FREQUENY := 2.0;
/**
* @desc SPATEMM frequency timer
*/
modulepar float PICS_SPATEM_FREQUENY := 5.0;
modulepar float PICS_SPATEM_FREQUENY := 2.0;
/**
* @desc IVIM frequency timer
*/
modulepar float PICS_IVIM_FREQUENY := 1.0;
modulepar float PICS_IVIM_FREQUENY := 2.0;
} // End of group generationFrequencies
......
......@@ -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