Commit 679bb02b authored by garciay's avatar garciay
Browse files

Add a configuration port to the RSUsimulator

parent 01fb72fc
......@@ -3,7 +3,7 @@
<plugin id="org.etsi.ttcn.codec.MainCodec" name="Main Codec" provider-name="STF462" version="1.0.0.0">
<runtime>
<library name="MainCodec.jar"/>
<library name="../build"/>
<library name="../../build"/>
</runtime>
<dependency>
<reference id="com.testingtech.ttworkbench.sa"/>
......
......@@ -51,7 +51,7 @@ module ItsRSUsSimulator_Functions {
import from ItsRSUsSimulator_Pics all;
import from ItsRSUsSimulator_Pixits all;
group geoConfigurationFunctions {
group rsuConfigurationFunctions {
/**
* @desc This configuration features:
......@@ -64,18 +64,11 @@ module ItsRSUsSimulator_Functions {
function f_cf01Up() runs on ItsRSUsSimulator {
// Local variables
var template (value) DenmParmContainers v_denmParmContainers;
var template (omit) DENMs v_denms := omit;
var template (omit) CAM v_cam := omit;
var template (omit) MAPEM v_mapem := omit;
var template (omit) SPATEMs v_spatems := omit;
var template (omit) IVIM v_ivim := omit;
var template (omit) SSEM v_ssem := omit;
var integer v_counter;
// Map
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
map(self:cfPort, system:cfPort);
map(self:geoNetworkingPort, system:geoNetworkingPort);
// Connect
......@@ -85,118 +78,12 @@ module ItsRSUsSimulator_Functions {
// Initialise secured mode
f_initialiseSecuredMode();
//Initialze the IUT
// f_initialState();
//Initialze the Config module
cfPort.send(CfInitialize:{});
// Initialisations
vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector;
// 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) {
// 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) {
// Build the list of the MAPEM events
v_ivim :=
m_ivimParm(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
m_ivimStructure(
m_iviManagementContainer(
PICS_IVIM_PARMS_RSUs[PX_RSU_ID - 1].provider,
PICS_IVIM_PARMS_RSUs[PX_RSU_ID - 1].iviIdentificationNumber,
0//IviStatus_new_
)));
// Update ivi status
v_ivim.ivi.mandatory.validFrom := f_getCurrentTime();
// TODO Add more?
}
// 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][PX_ETSI_ZONE_ID]); v_counter := v_counter + 1) {
var DenmEventsParmsPerZone v_denmEventsParmsPerZone := PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][PX_ETSI_ZONE_ID];
v_denmParmContainers := m_denmParmContainers(
PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
f_incDenmSequenceNumber(),
PICS_DENM_REPETITION_INTERVAL,
v_denmEventsParmsPerZone[v_counter].eventPosition,
v_denmEventsParmsPerZone[v_counter].causeCodeType,
v_denmEventsParmsPerZone[v_counter].eventHistory,
v_denmEventsParmsPerZone[v_counter].traces
);
v_denms[v_counter] := valueof(
m_denmPdu(
m_denm(
v_denmParmContainers.managementContainer,
v_denmParmContainers.situationContainer,
v_denmParmContainers.locationContainer
)));
if (ispresent(v_denmEventsParmsPerZone[v_counter].roadWorksContainerExtended)) {
v_denms[v_counter].denm.alacarte := m_alacarte(v_denmEventsParmsPerZone[v_counter].roadWorksContainerExtended);
}
} // End of 'for' statement
}
// CAM
if (PICS_GENERATE_CAM) {
// Build the list of the CAM events
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
vc_rsuMessagesValueList[PX_RSU_ID - 1] :=
m_rsuProfile(
v_cam,
v_denms,
v_mapem,
v_spatems,
v_ivim,
v_ssem
);
if (PICS_RSU_PARAMS[PX_RSU_ID - 1].geoShape == e_geoCircle) {
vc_geoArea := f_computeCircularArea(vc_longPosVectorRsu, PICS_RSU_PARAMS[PX_RSU_ID - 1].geoParms.radius);
} else {
log("*** " & testcasename() & ": INCONC: Wrong PICS_RSU_GEOAREA_FORM event initialisation ***");
setverdict(inconc);
stop;
}
f_setup_rsu(vc_rsu_id);
} // End of function f_cf01Up
function f_cf01Down() runs on ItsRSUsSimulator {
......@@ -208,6 +95,7 @@ module ItsRSUsSimulator_Functions {
// Unmap
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
unmap(self:cfPort, system:cfPort);
unmap(self:geoNetworkingPort, system:geoNetworkingPort);
// Disconnect
......@@ -215,7 +103,163 @@ module ItsRSUsSimulator_Functions {
} // End of function f_cf01Down
} // End of group geoConfigurationFunctions
} // End of group rsuConfigurationFunctions
function f_setup_rsu(
in integer p_rsu_id
) runs on ItsRSUsSimulator {
// Local variables
var template (value) DenmParmContainers v_denmParmContainers;
var template (omit) DENMs v_denms := omit;
var template (omit) CAM v_cam := omit;
var template (omit) MAPEM v_mapem := omit;
var template (omit) SPATEMs v_spatems := omit;
var template (omit) IVIM v_ivim := omit;
var template (omit) SSEM v_ssem := omit;
var integer v_counter;
vc_longPosVectorRsu := PICS_RSU_PARAMS[p_rsu_id].longPosVector;
// 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[p_rsu_id].intersections,
PICS_MAPEM_PARMS_RSUs[p_rsu_id].roadSegments
));
// Update revision fields
v_mapem.map_.intersections[0].revision := f_incMsgIssueRevision();
// TODO Add more?
}
// SPATEM
if (PICS_GENERATE_SPATEM) {
// Build the list of the DENM events
for (v_counter := 0; v_counter < lengthof(PICS_SPATEM_PARMS_RSUs[p_rsu_id]); v_counter := v_counter + 1) {
v_spatems[v_counter] :=
m_spatemParm(
PICS_RSU_PARAMS[p_rsu_id].stationID,
m_spatem(
PICS_SPATEM_PARMS_RSUs[p_rsu_id][v_counter].intersections,
"SignalGroupID #" & int2str(PICS_SPATEM_PARMS_RSUs[p_rsu_id][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) {
// Build the list of the MAPEM events
v_ivim :=
m_ivimParm(
PICS_RSU_PARAMS[p_rsu_id].stationID,
m_ivimStructure(
m_iviManagementContainer(
PICS_IVIM_PARMS_RSUs[p_rsu_id].provider,
PICS_IVIM_PARMS_RSUs[p_rsu_id].iviIdentificationNumber,
0//IviStatus_new_
),
{ PICS_IVIM_PARMS_RSUs[p_rsu_id].iviContainer }
));
// Update ivi status
v_ivim.ivi.mandatory.validFrom := f_getCurrentTime();
}
// DENM
if (PICS_GENERATE_DENM) {
// Build the list of the DENM events for the specified RSU (PX_RSU_ID) and the given zone (PX_ETSI_ZONE_ID)
for (v_counter := 0; v_counter < lengthof(PICS_DENM_EVENTS_RSU[p_rsu_id][PX_ETSI_ZONE_ID - 1]); v_counter := v_counter + 1) {
var DenmEventsParmsPerZone v_denmEventsParmsPerZone := PICS_DENM_EVENTS_RSU[p_rsu_id][PX_ETSI_ZONE_ID - 1];
v_denmParmContainers := m_denmParmContainers(
PICS_RSU_PARAMS[p_rsu_id].stationID,
f_incDenmSequenceNumber(),
PICS_DENM_REPETITION_INTERVAL,
v_denmEventsParmsPerZone[v_counter].eventPosition,
v_denmEventsParmsPerZone[v_counter].causeCodeType,
v_denmEventsParmsPerZone[v_counter].eventHistory,
v_denmEventsParmsPerZone[v_counter].traces
);
v_denms[v_counter] := valueof(
m_denmPdu(
m_denm(
v_denmParmContainers.managementContainer,
v_denmParmContainers.situationContainer,
v_denmParmContainers.locationContainer
)));
if (ispresent(v_denmEventsParmsPerZone[v_counter].roadWorksContainerExtended)) {
v_denms[v_counter].denm.alacarte := m_alacarte(v_denmEventsParmsPerZone[v_counter].roadWorksContainerExtended);
}
} // End of 'for' statement
}
// CAM
if (PICS_GENERATE_CAM) {
// Build the list of the CAM events
v_cam :=
m_camParm(
PICS_RSU_PARAMS[p_rsu_id].stationID,
m_rsuPosition(
vc_longPosVectorRsu.latitude,
vc_longPosVectorRsu.longitude
),
PICS_RSU_PARAMS[p_rsu_id].pathHistory
);
}
// Build the messages value list for this RSU
vc_rsuMessagesValueList[p_rsu_id] :=
m_rsuProfile(
v_cam,
v_denms,
v_mapem,
v_spatems,
v_ivim,
v_ssem
);
if (PICS_RSU_PARAMS[p_rsu_id].geoShape == e_geoCircle) {
vc_geoArea := f_computeCircularArea(vc_longPosVectorRsu, PICS_RSU_PARAMS[p_rsu_id].geoParms.radius);
} else {
log("*** " & testcasename() & ": INCONC: Wrong PICS_RSU_GEOAREA_FORM event initialisation ***");
setverdict(inconc);
stop;
}
} // End of function f_setup_rsu
function f_process_cf_event(
in CfEvent p_cfEvent
) runs on ItsRSUsSimulator return boolean {
var template (value) CfResult v_result := true;
// Terminate simulation
if (p_cfEvent == "stop") {
if (ispresent(vc_rsuMessagesValueList[PX_RSU_ID - 1].cam)) {
tc_cam.stop;
}
if (ispresent(vc_rsuMessagesValueList[PX_RSU_ID - 1].denms)) {
tc_denm.stop;
}
if (ispresent(vc_rsuMessagesValueList[PX_RSU_ID - 1].mapem)) {
tc_mapem.stop;
}
if (ispresent(vc_rsuMessagesValueList[PX_RSU_ID - 1].spatems)) {
tc_spatem.stop;
}
if (ispresent(vc_rsuMessagesValueList[PX_RSU_ID - 1].ivim)) {
tc_ivim.stop;
}
} else {
v_result := false;
}
cfPort.send(v_result);
return false;
} // End of function f_process_cf_event
function f_prepare_cam(
out template (value) Payload p_payload
......@@ -233,7 +277,7 @@ module ItsRSUsSimulator_Functions {
PICS_CAM_BTP_SOURCE_PORT
)
);
}
} // End of function f_prepare_cam
function f_prepare_denm(
out template (value) Payload p_payload
......@@ -252,7 +296,7 @@ module ItsRSUsSimulator_Functions {
)
);
vc_denmEventCounter := (vc_denmEventCounter + 1) mod lengthof(vc_rsuMessagesValueList[PX_RSU_ID - 1].denms);
}
} // End of function f_prepare_denm
function f_prepare_mapem(
out template (value) Payload p_payload
......@@ -269,7 +313,7 @@ module ItsRSUsSimulator_Functions {
PICS_MAPEM_BTP_SOURCE_PORT
)
);
}
} // End of function f_prepare_mapem
function f_prepare_spatem(
in template (value) SPATEM p_spatem,
......@@ -314,7 +358,7 @@ module ItsRSUsSimulator_Functions {
)
);
}
} // End of function f_prepare_spatem
function f_prepare_ivim(
out template (value) Payload p_payload
......@@ -331,7 +375,7 @@ module ItsRSUsSimulator_Functions {
PICS_IVIM_BTP_SOURCE_PORT
)
);
}
} // End of function f_prepare_ivim
function f_adaptPayload(
in template (value) octetstring p_finalPayload,
......@@ -386,7 +430,7 @@ module ItsRSUsSimulator_Functions {
}
return v_payload;
}
} // End of function f_adaptPayload
function f_send(
in template (value) Payload p_payload,
......@@ -407,7 +451,7 @@ module ItsRSUsSimulator_Functions {
c_defaultHopLimit
));
f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_geoNetworkingPdu, p_its_aid)));
}
} // End of function f_send
function f_processSrem(
in GeoNetworkingPdu p_geoNetworkingPdu
......@@ -439,7 +483,7 @@ module ItsRSUsSimulator_Functions {
} // else, ignore message
} // else, ignore message
} // else, ignore message
}
} // End of function f_processSrem
function f_incLocalSeqNumber() runs on ItsRSUsSimulator return UInt16 {
vc_localSeqNumber := (vc_localSeqNumber + 1) mod 65536;
......
......@@ -691,10 +691,10 @@ module ItsRSUsSimulator_Pics {
eventHistory := PICS_Z1_D1_Hx,
traces := PICS_Z1_D1_Tx,
roadWorksContainerExtended := {
lightBarSirenInUse := omit,
lightBarSirenInUse := LightBarSirenInUse_sirenActivated_,
closedLanes := {
hardShoulderStatus := availableForDriving,
drivingLaneStatus := '0001'B
drivingLaneStatus := '10'B
},
restriction := omit,
speedLimit := 30,
......@@ -802,10 +802,10 @@ module ItsRSUsSimulator_Pics {
eventHistory := PICS_Z1_D2_Hx,
traces := PICS_Z1_D2_Tx,
roadWorksContainerExtended := {
lightBarSirenInUse := omit,
lightBarSirenInUse := LightBarSirenInUse_lightBarActivated_,
closedLanes := {
hardShoulderStatus := availableForDriving,
drivingLaneStatus := '0011'B
drivingLaneStatus := '1100'B
},
restriction := omit,
speedLimit := 30,
......@@ -909,7 +909,7 @@ module ItsRSUsSimulator_Pics {
lightBarSirenInUse := omit,
closedLanes := {
hardShoulderStatus := closed,
drivingLaneStatus := '01'B
drivingLaneStatus := '11001'B
},
restriction := omit,
speedLimit := 30,
......@@ -3040,7 +3040,109 @@ module ItsRSUsSimulator_Pics {
countryCode := '0000000001'B,
providerIdentifier := 13
},
iviIdentificationNumber := 12
iviIdentificationNumber := 12,
iviContainer := { // FIXME To be enhanced to support different values
giv := {
{
detectionZoneIds := {
1
},
its_Rrid := omit,
relevanceZoneIds := {
2
},
direction := 0, //Direction_sameDirection_,
driverAwarenessZoneIds := omit,
minimumAwarenessTime := omit,
applicableLanes := {
1, // LanePosition_outermostDrivingLane_,
2 // LanePosition_secondLaneFromOutside_
},
iviType:= 1, //IviType_regulatoryMessages_,
iviPurpose := omit,
laneStatus := omit,
vehicleCharacteristics := omit,
driverCharacteristics := omit,
layoutId := omit,
preStoredlayoutId := omit,
roadSignCodes := {
{
layoutComponentId := omit,
code := {
iso14823 := {
pictogramCode := {
countryCode := omit,
serviceCategoryCode := {
trafficSignPictogram := regulatory
},
pictogramCategoryCode := {
nature := 5,
serialNumber := 57
}
},
attributes := {
{
spe := {
spm := 100,
mns := omit,
unit := 0
}
}
}
}
}
}
},
extraText := omit
},
{
detectionZoneIds := {
1
},
its_Rrid := omit,
relevanceZoneIds := {
2
},
direction := 0, //Direction_sameDirection_,
driverAwarenessZoneIds := omit,
minimumAwarenessTime := omit,
applicableLanes := {
1, // LanePosition_outermostDrivingLane_,
2 // LanePosition_secondLaneFromOutside_
},
iviType:= 1, //IviType_regulatoryMessages_,
iviPurpose := omit,
laneStatus := omit,
vehicleCharacteristics := omit,
driverCharacteristics := omit,
layoutId := omit,
preStoredlayoutId := omit,
roadSignCodes := {
{
layoutComponentId := omit,
code := {
iso14823 := {
pictogramCode := {
countryCode := omit,
serviceCategoryCode := {
trafficSignPictogram := regulatory
},
pictogramCategoryCode := {
nature := 5,
serialNumber := 44
}
},
attributes := omit
}
}
}
},
extraText := omit
}
}
}
} // End of PICS_IVIM_PARMS_RSU_1
} // End of group ivimZone1
......@@ -3085,15 +3187,15 @@ module ItsRSUsSimulator_Pics {
group generationFrequencies {
modulepar boolean PICS_GENERATE_CAM := true;
modulepar boolean PICS_GENERATE_CAM := false;
modulepar boolean PICS_GENERATE_DENM := true;
modulepar boolean PICS_GENERATE_IVIM := true;
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;
......
......@@ -118,6 +118,29 @@ module ItsRSUsSimulator_Templates {
}
}
/**
* @desc Receive template for GeoNetworking DENM Packet
* @param p_destinationShortPosVec Short position vector of destination
* @param p_seqNumber Sequence number of GeoUnicast packet
* @param p_nextHeader Id of next header
*/
template (present) GnNonSecuredPacket mw_geoNwTsbPacketWithNextHeader_denm(
in template (present) UInt16 p_seqNumber := ?,
in template (present) LongPosVector p_sourceLongPosVec := ?,
in template (value) NextHeader p_nextHeader
) modifies mw_geoNwTsbPacketWithNextHeader := {
payload := {
decodedPayload := {
btpPacket := mw_btpB(
PICS_DENM_BTP_DESTINATION_PORT,
PICS_DENM_BTP_SOURCE_PORT,
?
)
},
rawPayload := ?
}
}
} // End of group geoNetworkingTemplates
group positionTemplates {
......