Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ITS - Intelligent Transport Systems
ITS
Commits
03cf2f24
Commit
03cf2f24
authored
Sep 16, 2016
by
garciay
Browse files
Tart adding UC6 simulator
parent
5fadbdfe
Changes
8
Hide whitespace changes
Inline
Side-by-side
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn
View file @
03cf2f24
...
...
@@ -25,6 +25,9 @@ module ItsRSUsSimulator_Functions {
import
from
LibItsBtp_TypesAndValues
all
;
import
from
LibItsBtp_Templates
all
;
// LibItsCam
import
from
LibItsCam_Templates
all
;
// LibItsDenm
import
from
LibItsDenm_Templates
all
;
...
...
@@ -103,6 +106,29 @@ module ItsRSUsSimulator_Functions {
}
// End of group rsuConfigurationFunctions
function
f_initialiseVehicleSimulatorComponent
(
in
ItsRSUsSimulator
p_component
,
out
template
(
omit
)
CAM
p_cam
)
runs
on
ItsRSUsSimulator
{
p_cam
:=
m_camMsg_vehicle
(
f_getTsStationId
(),
f_getCurrentTime
()
mod
65536
,
// Shall be updated in function f_prepare_vehicle_cam
m_rsuPosition
(
PICS_USECASE6_VEHICLE_POSITIONS
[
0
].
latitude
,
// Shall be updated in function f_prepare_vehicle_cam
PICS_USECASE6_VEHICLE_POSITIONS
[
0
].
longitude
// Shall be updated in function f_prepare_vehicle_cam
)
);
map
(
p_component
:
geoNetworkingPort
,
system
:
geoNetworkingPort
);
}
// End of function f_initialiseVehicleSimulatorComponent
function
f_uninitialiseVehicleSimulatorComponent
(
in
ItsRSUsSimulator
p_component
)
runs
on
ItsRSUsSimulator
{
p_component
.
done
;
unmap
(
p_component
:
geoNetworkingPort
,
system
:
geoNetworkingPort
);
}
// End of function f_uninitialiseVehicleSimulatorComponent
function
f_setup_rsu
(
in
integer
p_rsu_id
)
runs
on
ItsRSUsSimulator
{
...
...
@@ -288,7 +314,7 @@ module ItsRSUsSimulator_Functions {
e_any
)
);
}
// End of function f_prepare_
cam
}
// End of function f_prepare_
beacon
function
f_prepare_cam
(
out
template
(
value
)
Payload
p_payload
...
...
@@ -360,13 +386,13 @@ module ItsRSUsSimulator_Functions {
var
TimeMark
v_currentTimeMark
:=
f_getCurrentTimeMark
();
if
(
vc_currentPhaseStartTime
==
36001
)
{
vc_currentPhaseStartTime
:=
v_currentTimeMark
;
vc_endPhaseStartTime
:=
f_computeEndPhaseStartTime
(
vc_currentPhaseStartTime
,
vc_repitition_duration
[
vc_spatemStatesId
]);
vc_currentPhaseStartTime
:=
v_currentTimeMark
;
vc_endPhaseStartTime
:=
f_computeEndPhaseStartTime
(
vc_currentPhaseStartTime
,
vc_repitition_duration
[
vc_spatemStatesId
]);
}
if
(
v_currentTimeMark
>=
vc_endPhaseStartTime
)
{
vc_spatemStatesId
:=
(
vc_spatemStatesId
+
1
)
mod
vc_spatemStatesNum
;
// Change state
vc_currentPhaseStartTime
:=
v_currentTimeMark
;
vc_endPhaseStartTime
:=
f_computeEndPhaseStartTime
(
vc_currentPhaseStartTime
,
vc_repitition_duration
[
vc_spatemStatesId
]);
vc_currentPhaseStartTime
:=
v_currentTimeMark
;
vc_endPhaseStartTime
:=
f_computeEndPhaseStartTime
(
vc_currentPhaseStartTime
,
vc_repitition_duration
[
vc_spatemStatesId
]);
}
log
(
"vc_currentPhaseStartTime = "
,
vc_currentPhaseStartTime
);
log
(
"vc_endPhaseStartTime = "
,
vc_endPhaseStartTime
);
...
...
@@ -487,6 +513,35 @@ module ItsRSUsSimulator_Functions {
return
v_payload
;
}
// End of function f_adaptPayload
function
f_send_vehicle_cam
(
in
template
(
value
)
CAM
p_cam
,
in
integer
p_idx
)
runs
on
ItsRSUsSimulator
{
// Local variables
var
template
(
value
)
Payload
v_payload
;
p_cam
.
cam
.
generationDeltaTime
:=
f_getCurrentTime
()
mod
65536
;
// See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
p_cam
.
cam
.
camParameters
.
basicContainer
.
referencePosition
:=
PICS_USECASE6_VEHICLE_POSITIONS
[
p_idx
];
v_payload
:=
valueof
(
f_adaptPayload
(
bit2oct
(
encvalue
(
valueof
(
p_cam
))),
PICS_CAM_BTP_DESTINATION_PORT
,
PICS_CAM_BTP_SOURCE_PORT
)
);
vc_longPosVectorRsu
:=
PICS_UC6_VEHICLE_POSITION
;
vc_longPosVectorRsu
.
latitude
:=
PICS_USECASE6_VEHICLE_POSITIONS
[
p_idx
].
latitude
;
vc_longPosVectorRsu
.
longitude
:=
PICS_USECASE6_VEHICLE_POSITIONS
[
p_idx
].
longitude
;
vc_geoArea
:=
PICS_UC6_VEHICLE_GEOAREA
;
vc_geoArea
.
area
.
geoAreaPosLatitude
:=
PICS_USECASE6_VEHICLE_POSITIONS
[
p_idx
].
latitude
;
vc_geoArea
.
area
.
geoAreaPosLongitude
:=
PICS_USECASE6_VEHICLE_POSITIONS
[
p_idx
].
longitude
;
f_send
(
v_payload
,
PICS_CAM_ITS_AID
);
}
// End of function f_send_vehicle_cam
function
f_send
(
in
template
(
value
)
Payload
p_payload
,
in
UInt32
p_its_aid
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pics.ttcn
View file @
03cf2f24
...
...
@@ -540,6 +540,22 @@ module ItsRSUsSimulator_Pics {
}
// End of group rsuParameters
/**
* @desc This group describes the BEACON common settings for the RSUs CAM message broadcast
*/
group
beaconParams
{
/**
* @desc Common settings
*/
group
beaconCommonSettings
{
modulepar
UInt32
PICS_BEACON_ITS_AID
:=
38
;
}
// End of group beaconCommonSettings
}
// End of group beaconParams
/**
* @desc This group describes the CAM common settings for the RSUs CAM message broadcast
*/
...
...
@@ -558,23 +574,81 @@ module ItsRSUsSimulator_Pics {
}
// End of group camCommonSettings
}
// End of group camParams
/**
* @desc This group describes the BEACON common settings for the RSUs CAM message broadcast
*/
group
beaconParams
{
/**
* @desc Common settings
*/
group
beaconCommonSettings
{
group
camUseCase6
{
modulepar
UInt32
PICS_BEACON_ITS_AID
:=
38
;
group
camUseCase6SyncLocation
{
modulepar
LongPosVector
PICS_UC6_DETECTION_POINT
:=
{
gnAddr
:=
{
typeOfAddress
:=
e_manual
,
stationType
:=
e_unknown
,
stationCountryCode
:=
0
,
mid
:=
'000000000000'O
},
timestamp_
:=
0
,
latitude
:=
1234
,
longitude
:=
1234
,
pai
:=
'0'
B
,
speed
:=
0
,
heading
:=
0
}
/**
* @desc Maximum synchronisation area to start sending CAM
*/
modulepar
float
PICS_UC6_DETECTION_EPSILLON
:=
19.0
;
// 2.0;
}
// End of group beaconCommonSettings
}
// End of group camUseCase6SyncLocation
group
camUseCase6VehicleDescription
{
modulepar
LongPosVector
PICS_UC6_VEHICLE_POSITION
:=
{
gnAddr
:=
{
typeOfAddress
:=
e_manual
,
stationType
:=
e_passengerCar
,
stationCountryCode
:=
33
,
mid
:=
'
AABBCCDDEEFF
'
O
},
timestamp_
:=
0
,
latitude
:=
0
,
longitude
:=
0
,
pai
:=
'0'
B
,
speed
:=
30
,
heading
:=
0
}
modulepar
GeoArea
PICS_UC6_VEHICLE_GEOAREA
:=
{
shape
:=
e_geoElip
,
area
:=
{
geoAreaPosLatitude
:=
0
,
geoAreaPosLongitude
:=
0
,
distanceA
:=
5
,
distanceB
:=
3
,
angle
:=
0
}
}
}
// End of group camUseCase6VehicleDescription
modulepar
Usecase6VehiclePositions
PICS_USECASE6_VEHICLE_POSITIONS
:=
{
{
latitude
:=
435525352
,
longitude
:=
103003415
,
positionConfidenceEllipse
:=
{
semiMajorConfidence
:=
SemiAxisLength_oneCentimeter_
,
semiMinorConfidence
:=
SemiAxisLength_oneCentimeter_
,
semiMajorOrientation
:=
HeadingValue_wgs84North_
},
altitude
:=
{
altitudeValue
:=
AltitudeValue_referenceEllipsoidSurface_
,
altitudeConfidence
:=
unavailable
}
}
}
}
// End of group camUseCase6
}
// End of group
rsu
Param
eter
s
}
// End of group
cam
Params
/**
* @desc This group describes the DENM common settings for the each use cases and for each RSU.
...
...
@@ -5532,9 +5606,9 @@ module ItsRSUsSimulator_Pics {
modulepar
boolean
PICS_GENERATE_BEACON
:=
false
;
modulepar
boolean
PICS_GENERATE_CAM
:=
tru
e
;
modulepar
boolean
PICS_GENERATE_CAM
:=
fals
e
;
modulepar
boolean
PICS_GENERATE_DENM
:=
tru
e
;
modulepar
boolean
PICS_GENERATE_DENM
:=
fals
e
;
modulepar
boolean
PICS_GENERATE_IVIM
:=
false
;
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pixits.ttcn
View file @
03cf2f24
...
...
@@ -28,7 +28,7 @@ module ItsRSUsSimulator_Pixits {
* @desc Indicate which Use Case to simulate
* @remark Used only for DENM
*/
modulepar
integer
PX_ETSI_USE_CASE_ID
:=
1
;
modulepar
integer
PX_ETSI_USE_CASE_ID
:=
6
;
/**
* @desc Indicate which zone to simulate
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Templates.ttcn
View file @
03cf2f24
...
...
@@ -127,10 +127,15 @@ module ItsRSUsSimulator_Templates {
* @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
(
present
)
UInt8
p_hopLimit
:=
?
,
in
template
(
value
)
NextHeader
p_nextHeader
)
modifies
mw_geoNwTsbPacketWithNextHeader
:=
{
)
modifies
mw_geoNwShbPacket
:=
{
commonHeader
:=
mw_commonHeaderWithHopLimit
(
p_nextHeader
,
m_shbHeaderType
,
p_hopLimit
),
payload
:=
{
decodedPayload
:=
{
btpPacket
:=
mw_btpB
(
...
...
@@ -143,6 +148,29 @@ module ItsRSUsSimulator_Templates {
}
}
/**
* @desc Receive template for GeoNetworking CAM 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_geoNwShbPacketWithNextHeader_cam
(
in
template
(
present
)
LongPosVector
p_sourceLongPosVec
:=
?
,
in
template
(
present
)
UInt8
p_hopLimit
:=
?
,
in
template
(
value
)
NextHeader
p_nextHeader
)
modifies
mw_geoNwShbPacket
:=
{
payload
:=
{
decodedPayload
:=
{
btpPacket
:=
mw_btpB
(
PICS_CAM_BTP_DESTINATION_PORT
,
PICS_CAM_BTP_SOURCE_PORT
,
?
)
},
rawPayload
:=
?
}
}
}
// End of group geoNetworkingTemplates
group
positionTemplates
{
...
...
@@ -167,6 +195,27 @@ module ItsRSUsSimulator_Templates {
}
}
// End of template m_rsuPosition
/**
* @desc Receive template for long position vector with strict position check
* @param p_longPosVector The base long position vector
*/
template
LongPosVector
mw_longPosVectorPosition_vendors
(
in
template
(
value
)
LongPosVector
p_longPosVector
)
modifies
mw_longPosVectorPosition
:=
{
gnAddr
:=
{
typeOfAddress
:=
?
,
stationType
:=
?
,
stationCountryCode
:=
?
,
mid
:=
complement
(
p_longPosVector
.
gnAddr
.
mid
)
},
timestamp_
:=
?
,
latitude
:=
?
,
longitude
:=
?
,
//FIXME May the delta factor should be based on the actual speed value -> low speed=lower delta, high speed=higher delta
speed
:=
?
,
heading
:=
?
}
}
// End of group positionTemplates
group
camTemplates
{
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestCases.ttcn
View file @
03cf2f24
...
...
@@ -4,6 +4,10 @@ module ItsRSUsSimulator_TestCases {
import
from
LibCommon_VerdictControl
all
;
import
from
LibCommon_Sync
all
;
// LibIts
import
from
ITS_Container
language
"ASN.1:1997"
all
;
import
from
CAM_PDU_Descriptions
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_Functions
all
;
...
...
@@ -11,6 +15,10 @@ module ItsRSUsSimulator_TestCases {
import
from
LibItsGeoNetworking_TestSystem
all
;
import
from
LibItsGeoNetworking_TypesAndValues
all
;
import
from
LibItsGeoNetworking_Templates
all
;
import
from
LibItsGeoNetworking_Functions
{
function
f_distance
};
// LibItsDenm
import
from
LibItsDenm_Templates
all
;
...
...
@@ -72,7 +80,7 @@ module ItsRSUsSimulator_TestCases {
f_processSrem
(
v_gnInd
.
msgIn
);
repeat
;
}
[]
geoNetworkingPort
.
receive
(
/*
[] geoNetworkingPort.receive(
mw_geoNwInd(
mw_geoNwPdu(
mw_geoNwTsbPacketWithNextHeader_denm(
...
...
@@ -83,7 +91,7 @@ module ItsRSUsSimulator_TestCases {
log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
// Nothing to do, just for logging purposes
repeat;
}
}
*/
[]
geoNetworkingPort
.
receive
(
mw_geoNwInd
(
?
))
->
value
v_gnInd
{
// Receive a message
log
(
"*** "
&
testcasename
()
&
": DEBUG: Recieving unsollicited message ***"
);
// Nothing to do, just for logging purposes
...
...
@@ -147,6 +155,124 @@ module ItsRSUsSimulator_TestCases {
// Postamble
f_cf01Down
();
}
}
// End of TC_RSUSIMU_BV_01
/**
* @remark: All PICS_GENERATE_xxx = false
* PICS_CAM_FREQUENCY = 0.1
*/
testcase
TC_RSUSIMU_BV_02
()
runs
on
ItsRSUsSimulator
system
ItsRSUsSimulatorSystem
{
// Local variables
var
VehiclesSimulator
v_vehicles
:=
{};
var
integer
v_vehiclesIdx
:=
0
;
var
charstring
v_stationIDs
:=
""
;
var
charstring
v_stationID
;
var
GeoNetworkingInd
v_gnInd
;
var
CfEvent
v_cfEvent
;
// Test control
// Test component configuration
f_cf01Up
();
// Test adapter configuration
// Preamble
f_selfOrClientSyncAndVerdictPreamble
(
c_prDone
,
e_success
);
// Test Body
tc_ac
.
start
;
alt
{
[]
geoNetworkingPort
.
receive
(
mw_geoNwInd
(
mw_geoNwPdu
(
mw_geoNwShbPacketWithNextHeader_cam
(
mw_longPosVectorPosition_vendors
(
PICS_UC6_VEHICLE_POSITION
),
?
,
e_btpB
))))
->
value
v_gnInd
{
// Receive a DENM message
tc_ac
.
stop
;
// Check if already processed
v_stationID
:=
int2str
(
v_gnInd
.
msgIn
.
gnPacket
.
packet
.
payload
.
decodedPayload
.
btpPacket
.
payload
.
decodedPayload
.
camPacket
.
header
.
stationID
);
if
(
regexp
(
v_stationID
,
charstring
:
"([1-9]#(1,6)),"
,
0
)
==
""
)
{
// Non simulated vehicle
// Compute point intersection
if
(
LibItsGeoNetworking_Functions
.
f_distance
(
v_gnInd
.
msgIn
.
gnPacket
.
packet
.
extendedHeader
.
shbHeader
.
srcPosVector
,
PICS_UC6_DETECTION_POINT
)
<=
PICS_UC6_DETECTION_EPSILLON
)
{
v_vehicles
[
v_vehiclesIdx
]
:=
ItsRSUsSimulator
.
create
(
"Node"
&
int2char
(
v_vehiclesIdx
+
65
))
alive
;
v_vehicles
[
v_vehiclesIdx
].
start
(
f_startVehicleSimulator
(
v_vehicles
[
v_vehiclesIdx
],
v_vehiclesIdx
));
v_vehiclesIdx
:=
v_vehiclesIdx
+
1
;
v_stationIDs
:=
v_stationIDs
&
v_stationID
&
","
;
}
}
else
{
// Nothing to do
}
tc_ac
.
start
;
repeat
;
}
[]
geoNetworkingPort
.
receive
{
// Receive a message
log
(
"*** "
&
testcasename
()
&
": DEBUG: Recieving unsollicited message ***"
);
// Nothing to do, just for logging purposes
tc_ac
.
stop
;
tc_ac
.
start
;
repeat
;
}
[]
cfPort
.
receive
(
CfEvent
:?
)
->
value
v_cfEvent
{
log
(
"*** "
&
testcasename
()
&
": DEBUG: Configuration port command:"
,
v_cfEvent
,
" ***"
);
if
(
f_process_cf_event
(
v_cfEvent
)
==
true
)
{
repeat
;
}
all
component
.
stop
;
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
testcasename
()
&
": DEBUG: No CAM message received ***"
);
all
component
.
stop
;
}
}
// End of 'alt' statement
f_selfOrClientSyncAndVerdictTestBody
(
c_tbDone
,
e_success
);
// Postamble
for
(
var
integer
v_idx
:=
0
;
v_idx
<
lengthof
(
v_vehicles
);
v_idx
:=
v_idx
+
1
)
{
v_vehicles
[
v_idx
].
done
;
}
// End of 'for' statement
f_cf01Down
();
}
// End of TC_RSUSIMU_BV_02
group
tc_RSUSIMU_BV_02
{
function
f_startVehicleSimulator
(
in
ItsRSUsSimulator
p_component
,
in
integer
p_idx
)
runs
on
ItsRSUsSimulator
{
// Local variables
var
integer
v_idx
:=
0
;
var
template
(
value
)
CAM
v_cam
;
f_initialiseVehicleSimulatorComponent
(
p_component
,
v_cam
);
tc_cam
.
start
;
alt
{
[]
tc_cam
.
timeout
{
log
(
"*** "
&
testcasename
()
&
": DEBUG: Processing CAM ***"
);
f_send_vehicle_cam
(
v_cam
,
v_idx
);
v_idx
:=
v_idx
+
1
;
if
(
v_idx
<
lengthof
(
PICS_USECASE6_VEHICLE_POSITIONS
))
{
tc_cam
.
start
;
repeat
;
}
// else, terminate
}
}
// End of 'altstep' statement
f_uninitialiseVehicleSimulatorComponent
(
p_component
);
}
// End of f_startVehicleSimulator
}
// End of group tc_RSUSIMU_BV_02
}
// End of module ItsRSUsSimulator_TestCases
\ No newline at end of file
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestControl.ttcn
View file @
03cf2f24
...
...
@@ -2,12 +2,15 @@ module ItsRSUsSimulator_TestControl {
// AtsRSUsSimulator
import
from
ItsRSUsSimulator_TestCases
all
;
import
from
LibItsGeoNetworking_Template
s
all
;
import
from
ItsRSUsSimulator_Pixit
s
all
;
control
{
execute
(
TC_RSUSIMU_BV_01
());
if
(
PX_ETSI_USE_CASE_ID
!=
6
)
{
execute
(
TC_RSUSIMU_BV_01
());
}
else
{
execute
(
TC_RSUSIMU_BV_02
());
}
}
}
// End of module ItsRSUsSimulator_TestControl
\ No newline at end of file
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TestSystem.ttcn
View file @
03cf2f24
...
...
@@ -99,6 +99,8 @@ module ItsRSUsSimulator_TestSystem {
port
ConfigRsuSimulatorPort
cfPort
;
}
type
record
of
ItsRSUsSimulator
VehiclesSimulator
;
group
configRsuSimulatorTypes
{
type
record
CfInitialize
{
};
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_TypesAndValues.ttcn
View file @
03cf2f24
...
...
@@ -101,7 +101,6 @@ module ItsRSUsSimulator_TypesAndValues {
}
// End of type CamParm
/**
*
* @desc List of CAM parms per RSU
* <pre>
* vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector;
...
...
@@ -109,6 +108,11 @@ module ItsRSUsSimulator_TypesAndValues {
*/
type
record
of
RsuParm
RsuParmList
;
/**
* @desc List of simulated vehicle positions for UC6
*/
type
record
of
ReferencePosition
Usecase6VehiclePositions
;
}
// End of group camDataStructures
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment