Commit 47f4d24e authored by garciay's avatar garciay

Update template names for MAPEM/SPATEM

Enhance RSUsimulator
parent 28b03d5f
......@@ -595,7 +595,7 @@ module ItsSpatem_TpFunctions {
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
v_spatemReq := valueof(m_spatemReq(m_spatemPdu(m_spat)));
v_spatemReq := valueof(m_spatemReq(m_spatemPdu(m_defaultSpatem)));
mapemSpatemPort.send(v_spatemReq) ;
f_sleep(PX_TAC);
......
......@@ -31,6 +31,12 @@ module ItsRSUsSimulator_Functions {
// LibItsMapemSpatemm
import from LibItsMapemSpatem_Templates all;
// LibItsMapemSpatemm
import from LibItsIvim_Templates all;
// LibItsMapemSpatemm
import from LibItsSremSsem_Templates all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_Functions all;
......@@ -101,7 +107,21 @@ module ItsRSUsSimulator_Functions {
}
// SPATEM
if (PICS_GENERATE_SPATEM) {
// TODO
// Build the list of the DENM events
for (v_counter := 0; v_counter < lengthof(PICS_SPATEM_PARMS_RSUs[PX_RSU_ID - 1]); v_counter := v_counter + 1) {
v_spatems[v_counter] :=
m_spatemParm(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
m_spatem(
PICS_SPATEM_PARMS_RSUs[PX_RSU_ID - 1][v_counter].intersections,
"SignalGroupID #" & int2str(PICS_SPATEM_PARMS_RSUs[PX_RSU_ID - 1][v_counter].signalGroupID)
));
for (var integer v_intersection := 0; v_intersection < lengthof(v_spatems[v_counter].spat.intersections); v_intersection := v_intersection + 1) {
vc_states[v_counter][v_intersection] := v_spatems[v_counter].spat.intersections[v_intersection].states;
} // End of 'for' statement
// TODO Build SPATEM with dynamic values
} // End of 'for' statement
// TODO Build SPATEM with dynamic values
}
// IVIM
if (PICS_GENERATE_IVIM) {
......@@ -130,20 +150,19 @@ module ItsRSUsSimulator_Functions {
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
} // End of 'for' statement
}
// 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
)
v_cam :=
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
......@@ -206,6 +225,7 @@ module ItsRSUsSimulator_Functions {
out template (value) Payload p_payload
) runs on ItsRSUsSimulator {
// Update dynamic parms
vc_rsuMessagesValueList[PX_RSU_ID - 1].denms[vc_denmEventCounter].denm.management.referenceTime := f_getCurrentTime();
p_payload := valueof(
f_adaptPayload(
......@@ -238,10 +258,47 @@ module ItsRSUsSimulator_Functions {
}
function f_prepare_spatem(
in template (value) SPATEM p_spatem,
out template (value) Payload p_payload
) runs on ItsRSUsSimulator {
var template (value) SPATEM v_spatem := p_spatem; // Make a copy
p_payload := {}; // FIXME To be developped
// Rebuild SPATEM message
for (var integer v_intersection := 0; v_intersection < lengthof(v_spatem.spat.intersections); v_intersection := v_intersection + 1) {
var template (value) MovementList v_states := vc_states[PX_RSU_ID - 1][v_intersection];
select (vc_spatemStatesId) {
case (0) {
v_spatem.spat.intersections[v_intersection].states[0] := v_states[0];
v_spatem.spat.intersections[v_intersection].states[1] := v_states[1];
v_spatem.spat.intersections[v_intersection].states[2] := v_states[2];
}
case (1) {
v_spatem.spat.intersections[v_intersection].states[0] := v_states[1];
v_spatem.spat.intersections[v_intersection].states[1] := v_states[2];
v_spatem.spat.intersections[v_intersection].states[2] := v_states[0];
}
case (2) {
v_spatem.spat.intersections[v_intersection].states[0] := v_states[2];
v_spatem.spat.intersections[v_intersection].states[1] := v_states[0];
v_spatem.spat.intersections[v_intersection].states[2] := v_states[1];
}
case else {
}
} // End of 'select' statement
} // End of 'for' statement
vc_spatemStatesId := (vc_spatemStatesId + 1) mod 4; // TODO To be refined
p_payload := valueof(
f_adaptPayload(
bit2oct(
encvalue(
valueof(
v_spatem
))),
PICS_MAPEM_BTP_DESTINATION_PORT,
PICS_MAPEM_BTP_SOURCE_PORT
)
);
}
......@@ -331,7 +388,32 @@ module ItsRSUsSimulator_Functions {
function f_processSrem(
in GeoNetworkingPdu p_geoNetworkingPdu
) runs on ItsRSUsSimulator {
log("SREM=", p_geoNetworkingPdu)
log("SREM=", p_geoNetworkingPdu);
if (ispresent(p_geoNetworkingPdu.gnPacket.packet.payload.decodedPayload)) {
if (ispresent(p_geoNetworkingPdu.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload)) {
if (ischosen(p_geoNetworkingPdu.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.sremPacket)) {
var SignalRequestMessage v_signalRequestMessage := p_geoNetworkingPdu.gnPacket.packet.payload.decodedPayload.btpPacket.payload.decodedPayload.sremPacket.srm;
var template (value) SSEM v_ssem := vc_rsuMessagesValueList[PX_RSU_ID - 1].ssem;
var template (value) Payload v_payload;
log(v_signalRequestMessage);
// Build response
// TODO v_ssem.ssm.status
v_payload := valueof(
f_adaptPayload(
bit2oct(
encvalue(
valueof(
v_ssem
))),
PICS_SSEM_BTP_DESTINATION_PORT,
PICS_SSEM_BTP_SOURCE_PORT
)
);
} // else, ignore message
} // else, ignore message
} // else, ignore message
// TODO Process message, and send SSEM
}
......
......@@ -176,6 +176,22 @@ module ItsRSUsSimulator_Templates {
} // End of group mapemTemplates
group spatemTemplates {
template (value) SPATEM m_spatemParm(
in template (value) StationID p_stationID,
in template (value) SPAT p_spat
) := {
header := {
protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
messageID := ItsPduHeader_messageID_spatem_,
stationID := p_stationID
},
spat := p_spat
}
} // End of group spatemTemplates
group ivimTemplates {
} // End of group ivimTemplates
......
......@@ -93,8 +93,10 @@ module ItsRSUsSimulator_TestCases {
}
[PICS_GENERATE_SPATEM] tc_spatem.timeout {
log("*** " & testcasename() & ": DEBUG: Processing SPATEM ***");
f_prepare_spatem(v_payload);
f_send(v_payload);
for (var integer v_counter := 0; v_counter < lengthof(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatems); v_counter := v_counter + 1) {
f_prepare_spatem(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatems[v_counter], v_payload);
f_send(v_payload);
}
tc_spatem.start;
repeat;
}
......
......@@ -16,13 +16,36 @@ module ItsRSUsSimulator_TestSystem {
* @desc Test component for ITS Network and Transport layer
*/
type component ItsRSUsSimulator extends ItsGeoNetworking {
/**
* @dec RSU position
*/
var LongPosVector vc_longPosVectorRsu := {};
/**
* @dec RSU Geonetworking area
*/
var GeoArea vc_geoArea := {};
/**
* @dec Supported sent messages templates: one or more from CAM, DENM, MAPEM, SPATEM, IVIM, SSEM
* @see PICS_GENERATE_xxx
*/
var template (value) RsuMessagesValueList vc_rsuMessagesValueList := {};
/**
* @dec DENM event counter: one RSU can send one or mode different DENM
*/
var integer vc_denmEventCounter := 0;
/**
* @dec DENM sequence number index
*/
var SequenceNumber vc_sequenceNumber := 0;
var MsgCount vc_msgIssueRevision := 0;
/**
* @dec List of MovementState per intersection and per RSU
*/
var template (value) MovementListPerIntersectionRsu vc_states;
/**
* @dec Current SPATEM state
*/
var integer vc_spatemStatesId := 0;
timer tc_cam := PICS_CAM_FREQUENY;
timer tc_denm := PICS_DENM_FREQUENY;
......
......@@ -113,25 +113,59 @@ module ItsRSUsSimulator_TypesAndValues {
*/
type record MapemParm {
IntersectionGeometryList intersections,
RoadSegmentList roadSegments optional
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;
type record of MapemParm MapemParmListRsu;
} // End of group mapemDataStructures
/**
* @desc SPATEM setup
*/
group spatemDataStructures {
/**
* @desc Describe the parameter for each SPATEM event
*/
type record SignalGroupParm {
SignalGroupID signalGroupID,
IntersectionStateList intersections
} // End of type SignalGroupParm
/**
* @desc List of SignalGroup parms for one RSU
* <pre>
* v_movementEvent := PICS_SPATEM_PARMS_RSU_1[v_signalGroupID].states[v_idx];
* </pre>
*/
type record of SignalGroupParm SignalGroupParmList;
/**
* @desc List of all RSUs SignalGroups parms
* <pre>
* v_movementEvent := PICS_SPATEM_PARMS_RSU_1[PX_RSU_ID - 1].states[v_idx];
* </pre>
*/
type record of SignalGroupParmList SpatemParmRsu;
type record of MovementList MovementListPerIntersection;
type record of MovementListPerIntersection MovementListPerIntersectionRsu;
} // End of group spatemDataStructures
/**
* @desc IVIM setup
*/
group ivimDataStructures {
// TODO To be done
// TODO
} // End of group ivimDataStructures
/**
......
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