Newer
Older
// LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_DataStrings all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_Templates all;
import from LibItsCommon_Functions all;
import from LibItsCommon_Pixits all;
import from LibItsCommon_TestSystem all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Pics all;
import from LibItsGeoNetworking_Functions all;
import from LibItsGeoNetworking_TestSystem all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
import from ItsAutoInterop_TypesAndValues all;
import from ItsAutoInterop_Templates all;
import from ItsAutoInterop_TestSystem all;
group utFunctions {
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtAutoInteropTrigger p_event) runs on ItsBaseGeoNetworking {
//deactivate autoInteropPort default alts
utPort.send(p_event);
tc_wait.start;
alt {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
}
//activate autoInteropPort default alts
}
} // End of group utFunctions
group hmiFunctions {
/**
* @desc Requests to bring the HMI in an initial state
* @param p_init The initialisation to trigger.
*/
function f_hmiInitializeIut(template (value) HmiInitialize p_init) runs on ItsAutoInteropGeonetworking {
//deactivate autoInteropPort default alts
hmiPort.send(p_init);
tc_wait.start;
alt {
//FIXME RGY As discussed, port in type is changed to a top-level union type
// [] hmiPort.receive(HmiInitializeResult:true) {
[] hmiPort.receive(HmiAutoInteropResults:{hmiInitializeResult:=true}) {
tc_wait.stop;
log("*** f_hmiInitializeIhmi: INFO: EUT's HMI initialized ***");
}
[] hmiPort.receive {
tc_wait.stop;
log("*** f_hmiInitializeIhmi: INFO: EUT's HMI could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_hmiInitializeIhmi: INFO: EUT's HMI could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
}
//activate autoInteropPort default alts
}
} // End of group hmiFunctions
group preambles {
/**
* @desc Set up an EUT component
* @param p_eut The component reference
* @param p_scenario The GNSS scenario. Default: e_staticPosition
*/
function f_cfPtcUp(
in ItsAutoInteropGeonetworking p_eut,
in Scenario p_scenario := e_staticPosition // TODO Not used
) runs on ItsAutoInteropGeonetworking /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// EUT
//map(p_eut:acPort, system:acPort); Not used
//map(p_eut:utPort, system:utPort); Not used
map(p_eut:hmiPort, system:hmiPort);
map(p_eut:geoNetworkingPort, system:geoNetworkingPort);
connect(p_eut:syncPort, self:syncPort);
//activate(a_cfPtcDown()); // FIXME To be done
//Initialze the IUT
// MTC intializes IUT
f_initialState(p_scenario);
} // End of function f_cfPtcUp
/**
* @desc Set up MTC for configuration #1
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @param p_eut3 The component reference for EUT3
* @param p_eut4 The component reference for EUT4
* @see Draft ETSI TS yyy xxx-2 V0.0.8 (2017-02) Clause 5.3.1 CF-01: Verify complete forwarding message scenario
*/
function f_mtcCf01Up(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2,
inout ItsAutoInteropGeonetworking p_eut3,
inout ItsAutoInteropGeonetworking p_eut4
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// Create components
p_eut1 := ItsAutoInteropGeonetworking.create(c_compNodeB);
p_eut2 := ItsAutoInteropGeonetworking.create(c_compNodeC);
p_eut3 := ItsAutoInteropGeonetworking.create(c_compNodeD);
p_eut4 := ItsAutoInteropGeonetworking.create(c_compNodeE);
// Map & Connect
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
connect(self:syncPort, mtc:syncPort);
// EUT1/EUT2/EUT3/EUT4
connect(p_eut1:eutGeoNetworkingPort, p_eut2:eutGeoNetworkingPort); // EUT1 & EUT2 are on-link
connect(p_eut1:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort); // EUT1 & EUT3 are on-link
connect(p_eut2:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort); // EUT2 & EUT3 are on-link
connect(p_eut2:eutGeoNetworkingPort, p_eut4:eutGeoNetworkingPort); // EUT2 & EUT4 are on-link
connect(p_eut3:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort); // EUT3 & EUT4 are on-link
} // End of function f_mtcCf01Up
/**
* @desc Set up MTC for configuration #2
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @see Draft ETSI TS yyy xxx-2 V0.0.8 (2017-02) Clause 5.3.2 CF-02: Road Works Warning configuration
*/
function f_mtcCf02Up(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// Create components
p_eut1 := ItsAutoInteropGeonetworking.create(c_compNodeB);
p_eut2 := ItsAutoInteropGeonetworking.create(c_compNodeC);
// Map & Connect
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
connect(self:syncPort, mtc:syncPort);
// EUT1/EUT2
connect(p_eut1:eutGeoNetworkingPort, p_eut2:eutGeoNetworkingPort);
} // End of function f_mtcCf02Up
/**
* @desc Set up MTC for configuration #3
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @param p_eut3 The component reference for EUT3
* @see Draft ETSI TS yyy xxx-2 V0.0.8 (2017-02) Clause 5.3.3 CF-03: CA messages
*/
function f_mtcCf03Up(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2,
inout ItsAutoInteropGeonetworking p_eut3
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// Create components
p_eut1 := ItsAutoInteropGeonetworking.create(c_compNodeB);
p_eut2 := ItsAutoInteropGeonetworking.create(c_compNodeC);
p_eut3 := ItsAutoInteropGeonetworking.create(c_compNodeD);
// Map & Connect
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
connect(self:syncPort, mtc:syncPort);
// EUT1/EUT2/EUT3
connect(p_eut1:eutGeoNetworkingPort, p_eut2:eutGeoNetworkingPort);
connect(p_eut1:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
connect(p_eut2:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
} // End of function f_mtcCf03Up
/**
* @desc The default preamble.
*/
function f_prDefault() runs on ItsAutoInteropGeonetworking {
activate(ItsAutoInterop_Functions.a_default());
activate(LibItsGeoNetworking_Functions.a_default());
activate(LibItsGeoNetworking_Functions.a_utDefault());
activate(a_hmiDefault());
}
} // End of group preambles
group postambles {
/**
* @desc Shutdown an EUT component
* @param p_eut The component reference
*/
function f_cfPtcDown(
inout ItsAutoInteropGeonetworking p_eut
) runs on ItsAutoInteropGeonetworking /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// Wait components done
p_eut.done;
deactivate;
// EUT
unmap(p_eut:acPort, system:acPort);
unmap(p_eut:utPort, system:utPort);
unmap(p_eut:hmiPort, system:hmiPort);
unmap(p_eut:geoNetworkingPort, system:geoNetworkingPort);
disconnect(p_eut:syncPort, self:syncPort);
} // End of function f_cfPtcDown
/**
* @desc Shutdown MTC for configuration #1
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @param p_eut3 The component reference for EUT3
* @param p_eut4 The component reference for EUT4
* @see Draft ETSI TS yyy xxx-2 V0.0.8 (2017-02) Clause 5.3.1 CF-01: Verify complete forwarding message scenario
*/
function f_mtcCf01Down(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2,
inout ItsAutoInteropGeonetworking p_eut3,
inout ItsAutoInteropGeonetworking p_eut4
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// Wait components done
p_eut1.done;
p_eut2.done;
p_eut3.done;
p_eut4.done;
deactivate;
// Unmap & disconnect
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
disconnect(self:syncPort, mtc:syncPort);
// EUT1/EUT2/EUT3/EUT4
disconnect(p_eut1:eutGeoNetworkingPort, p_eut2:eutGeoNetworkingPort);
disconnect(p_eut1:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
disconnect(p_eut2:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
disconnect(p_eut2:eutGeoNetworkingPort, p_eut4:eutGeoNetworkingPort);
disconnect(p_eut3:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
} // End of function f_mtcCf01Down
/**
* @desc Shutdown MTC for configuration #2
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @see Draft ETSI TS yyy xxx-2 V0.0.8 (2017-02) Clause 5.3.2 CF-02: Road Works Warning configuration
*/
function f_mtcCf02Down(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// Wait components done
p_eut1.done;
p_eut2.done;
deactivate;
// Unmap & disconnect
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
disconnect(self:syncPort, mtc:syncPort);
} // End of function f_mtcCf02Down
/**
* @desc Shutdown MTC with three components
* @param p_eut1 The component reference for EUT1
* @param p_eut2 The component reference for EUT2
* @param p_eut3 The component reference for EUT3
*/
function f_mtcCf03Down(
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2,
inout ItsAutoInteropGeonetworking p_eut3
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
// Wait components done
p_eut1.done;
p_eut2.done;
p_eut3.done;
deactivate;
// Unmap & disconnect
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
disconnect(self:syncPort, mtc:syncPort);
// EUT1/EUT2/EUT3
disconnect(p_eut1:eutGeoNetworkingPort, p_eut2:eutGeoNetworkingPort);
disconnect(p_eut1:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
disconnect(p_eut3:eutGeoNetworkingPort, p_eut3:eutGeoNetworkingPort);
} // End of function f_mtcCf03Down
/**
* @desc The default postamble.
*/
function f_poDefault() runs on ItsAutoInteropGeonetworking {
deactivate;
}
} // End of group postambles
group autoInteropPosition {
/**
* @desc Compute distance between two points
* @param p_pointA First point
* @param p_pointB Second point
* @return Computed distance in meters
* @see fx_computeDistance
*/
function f_distance(
in LongPosVector p_pointA,
in LongPosVector p_pointB
) return float {
// log("*** f_distance: INFO: calling fx_computeDistance() ***");
return fx_computeDistance(p_pointA.latitude, p_pointA.longitude, p_pointB.latitude, p_pointB.longitude);
}
} // End of group autoInteropPosition
group autoInteropAltsteps {
/**
* @desc The base default.
*/
altstep a_default() runs on ItsAutoInteropGeonetworking {
mw_geoNwInd(
?
)) -> value v_gnInd { // Unexpected GeoNetworking message ==> require refine filtering above
// Re-send DEN message to the other EUTs
eutGeoNetworkingPort.send(
m_forward_geoNetworkingInd(
v_gnInd
));
[vc_gnDefaultActive] eutGeoNetworkingPort.receive { // Unexpected EutGeoNetworking message ==> require refine filtering above
log("*** a_default: ERROR: Received an unexpected message ***");
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
}
[] a_shutdown() {
log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}
/**
* @desc The default for handling HMI messages.
*/
altstep a_hmiDefault() runs on ItsAutoInteropGeonetworking {
var HmiNeighborEventInds v_hmiNeighborEventInds;
var HmiSignageEventInd v_hmiSignageEventInd;
[vc_hmiDefaultActive] hmiPort.receive(HmiNeighborEventInds:?) -> value v_hmiNeighborEventInds {
//store every upper tester indication received
vc_hmiNeighborEventIndsList[lengthof(vc_hmiNeighborEventIndsList)] := v_hmiNeighborEventInds;
repeat;
}
[vc_hmiDefaultActive] hmiPort.receive {
log("*** " & testcasename() & ": INFO: Received unexpected UT message from IUT ***");
repeat;
}
[vc_hmiDefaultActive] hmiPort.receive(HmiSignageEventInd:?) -> value v_hmiSignageEventInd {
//store every upper tester indication received
vc_hmiSignageEventIndList[lengthof(vc_hmiSignageEventIndList)] := v_hmiSignageEventInd;
repeat;
}
[vc_hmiDefaultActive] hmiPort.receive {
log("*** " & testcasename() & ": INFO: Received unexpected UT message from IUT ***");
repeat;
}
}
/**
* @desc Default handling cf01 de-initialisation.
*/
inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2,
inout ItsAutoInteropGeonetworking p_eut3,
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
log("*** a_mtcCf01Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}
/**
* @desc Default handling cf02 de-initialisation.
*/
altstep a_mtcCf02Down(
/*inout ItsAutoInteropGeonetworking p_eut1,
inout ItsAutoInteropGeonetworking p_eut2*/
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
log("*** a_mtcCf02Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}
/**
* @desc Default handling cf03 de-initialisation.
*/
altstep a_mtcCf03Down(
inout ItsAutoInteropGeonetworking p_eut2,
) runs on ItsMtc /* TITAN TODO: mtc ItsMtc system ItsAutoInteropGeoNetworkingSystem */ {
log("*** a_mtcCf03Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}
} // End of group autoInteropAltsteps
} // End of module ItsAutoInterop_Functions