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
f3ec837f
Commit
f3ec837f
authored
Jul 29, 2016
by
garciay
Browse files
First try of a RSU Simulator
parent
125c349d
Changes
8
Hide whitespace changes
Inline
Side-by-side
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn
0 → 100644
View file @
f3ec837f
module
ItsRSUsSimulator_Functions
{
// LibCommon
import
from
LibCommon_BasicTypesAndValues
all
;
import
from
LibCommon_DataStrings
all
;
import
from
LibCommon_VerdictControl
all
;
import
from
LibCommon_Sync
all
;
import
from
LibCommon_Time
all
;
// LibIts
import
from
ITS_Container
language
"ASN.1:1997"
all
;
import
from
CAM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
DENM_PDU_Descriptions
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_Functions
all
;
// LibItsBtp
import
from
LibItsBtp_TypesAndValues
all
;
import
from
LibItsBtp_Templates
all
;
// LibItsDenm
import
from
LibItsDenm_Templates
all
;
// LibItsGeoNetworking
import
from
LibItsGeoNetworking_TestSystem
all
;
import
from
LibItsGeoNetworking_Functions
all
;
import
from
LibItsGeoNetworking_Templates
all
;
import
from
LibItsGeoNetworking_TypesAndValues
all
;
import
from
LibItsGeoNetworking_Pixits
all
;
// AtsRSUsSimulator
import
from
ItsRSUsSimulator_TypesAndValues
all
;
import
from
ItsRSUsSimulator_TestSystem
all
;
import
from
ItsRSUsSimulator_Templates
all
;
import
from
ItsRSUsSimulator_Pics
all
;
import
from
ItsRSUsSimulator_Pixits
all
;
group
geoConfigurationFunctions
{
/**
* @desc This configuration features:
* - one ITS node (IUT)
* - two ITS nodes (nodeA, nodeB)
* - Area1 which only includes NodeB and IUT
* - Area2 which only includes NodeB
* NodeB being close to the area center
*/
function
f_cf01Up
()
runs
on
ItsRSUsSimulator
{
// Local variables
var
template
(
value
)
DenmParmContainers
v_denmParmContainers
;
var
DENMs
v_denms
:=
{};
var
integer
v_counter
;
// Map
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
geoNetworkingPort
,
system
:
geoNetworkingPort
);
// Connect
f_connect4SelfOrClientSync
();
activate
(
a_cf01Down
());
// Initialise secured mode
f_initialiseSecuredMode
();
//Initialze the IUT
f_initialState
();
// Initialisations
vc_longPosVectorRsu
:=
PICS_RSU_PARAMS
[
PX_RSU_ID
-
1
].
longPosVector
;
// TODO MAPEM
// TODO IVIM
// 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
)
{
v_denmParmContainers
:=
m_denmParmContainers
(
PICS_RSU_PARAMS
[
PX_RSU_ID
-
1
].
stationID
,
f_getDenmSequenceNumber
(),
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
)));
}
// End of 'for' loop
// Build the messages value list for this RSU
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
]
:=
valueof
(
m_rsuProfile
(
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_denms
));
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
;
}
// Sanity checks
if
(
not
isbound
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
]))
{
log
(
"*** "
&
testcasename
()
&
": INCONC: Wrong profiles initialisation ***"
);
setverdict
(
inconc
);
stop
;
}
else
if
(
not
isbound
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
cam
))
{
log
(
"*** "
&
testcasename
()
&
": INCONC: Wrong CAM initialisation ***"
);
setverdict
(
inconc
);
stop
;
}
else
if
(
not
isbound
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
denms
))
{
log
(
"*** "
&
testcasename
()
&
": INCONC: Wrong DENM initialisation ***"
);
setverdict
(
inconc
);
stop
;
}
}
// End of function f_cf01Up
function
f_cf01Down
()
runs
on
ItsRSUsSimulator
{
f_uninitialiseSecuredMode
();
// Unmap
unmap
(
self
:
acPort
,
system
:
acPort
);
unmap
(
self
:
utPort
,
system
:
utPort
);
unmap
(
self
:
geoNetworkingPort
,
system
:
geoNetworkingPort
);
// Disconnect
f_disconnect4SelfOrClientSync
();
}
// End of function f_cf01Down
}
// End of group geoConfigurationFunctions
function
f_prepare_cam
(
out
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
cam
.
cam
.
generationDeltaTime
:=
f_getCurrentTime
()
mod
65536
;
// See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
p_payload
:=
valueof
(
f_adaptPayload
(
bit2oct
(
encvalue
(
valueof
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
cam
))),
PICS_CAM_BTP_DESTINATION_PORT
,
PICS_CAM_BTP_SOURCE_PORT
)
);
}
function
f_prepare_denm
(
out
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
denms
[
vc_denmEventCounter
].
denm
.
management
.
referenceTime
:=
f_getCurrentTime
();
p_payload
:=
valueof
(
f_adaptPayload
(
bit2oct
(
encvalue
(
valueof
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
denms
[
vc_denmEventCounter
]
))),
PICS_DENM_BTP_DESTINATION_PORT
,
PICS_DENM_BTP_SOURCE_PORT
)
);
vc_denmEventCounter
:=
(
vc_denmEventCounter
+
1
)
mod
lengthof
(
vc_rsuMessagesValueList
[
PX_RSU_ID
-
1
].
denms
);
}
function
f_prepare_mapem
(
out
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
p_payload
:=
{};
// FIXME To be developped
}
function
f_prepare_spatem
(
out
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
p_payload
:=
{};
// FIXME To be developped
}
function
f_prepare_ivim
(
out
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
p_payload
:=
{};
// FIXME To be developped
}
function
f_adaptPayload
(
in
template
(
value
)
octetstring
p_finalPayload
,
in
template
(
value
)
BtpPortId
p_destPort
,
in
template
(
value
)
BtpPortId
p_srcPort
:=
0
)
return
template
(
value
)
Payload
{
var
template
(
value
)
Payload
v_payload
;
if
(
PX_GN_UPPER_LAYER
==
e_any
)
{
v_payload
:=
{
decodedPayload
:=
omit
,
rawPayload
:=
p_finalPayload
};
return
v_payload
;
}
if
(
PX_GN_UPPER_LAYER
==
e_ipv6
)
{
log
(
"*** "
&
testcasename
()
&
": INCONC: Layer IPv6 not supported ***"
);
setverdict
(
inconc
);
stop
;
}
if
(
PX_GN_UPPER_LAYER
==
e_btpA
)
{
v_payload
:=
{
decodedPayload
:=
{
btpPacket
:=
m_btpAWithPorts
(
p_destPort
,
p_srcPort
,
{
decodedPayload
:=
omit
,
rawPayload
:=
p_finalPayload
}
)
},
rawPayload
:=
''
O
};
return
v_payload
;
}
if
(
PX_GN_UPPER_LAYER
==
e_btpB
)
{
v_payload
:=
{
decodedPayload
:=
{
btpPacket
:=
m_btpBWithPorts
(
p_destPort
,
p_srcPort
,
{
decodedPayload
:=
omit
,
rawPayload
:=
p_finalPayload
}
)
},
rawPayload
:=
''
O
};
return
v_payload
;
}
return
v_payload
;
}
function
f_send
(
in
template
(
value
)
Payload
p_payload
)
runs
on
ItsRSUsSimulator
{
var
GeoNetworkingPdu
v_geoNetworkingPdu
;
v_geoNetworkingPdu
:=
valueof
(
m_geoNwPdu
(
// FIXME Use PIXIT parameter to get a fully configurable template
m_geoNwBroadcastPacket_payload
(
// TODO modifes 'template (value) GnNonSecuredPacket m_geoNwBroadcastPacket' to set the field
vc_longPosVectorRsu
,
f_incLocalSeqNumber
(),
f_geoArea2GeoBroadcastArea
(
vc_geoArea
),
-
,
-
,
valueof
(
p_payload
)
),
m_defaultLifetime
,
c_defaultHopLimit
));
f_sendGeoNetMessage
(
valueof
(
m_geoNwReq_linkLayerBroadcast
(
v_geoNetworkingPdu
)));
}
function
f_processSrem
(
in
GeoNetworkingPdu
p_geoNetworkingPdu
)
runs
on
ItsRSUsSimulator
{
// TODO Process message, and send SSEM
}
function
f_incLocalSeqNumber
()
runs
on
ItsRSUsSimulator
return
UInt16
{
vc_localSeqNumber
:=
(
vc_localSeqNumber
+
1
)
mod
65536
;
return
vc_localSeqNumber
;
}
function
f_getDenmSequenceNumber
()
runs
on
ItsRSUsSimulator
return
SequenceNumber
{
return
12345
;
// FIXME To be refined
}
}
// End of module ItsRSUsSimulator_Functions
\ No newline at end of file
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Pics.ttcn
0 → 100644
View file @
f3ec837f
module
ItsRSUsSimulator_Pics
{
// LibCommon
import
from
LibCommon_BasicTypesAndValues
all
;
// LibIts
import
from
ITS_Container
language
"ASN.1:1997"
all
;
import
from
CAM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
DENM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
MAPEM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
SPATEM_PDU_Descriptions
language
"ASN.1:1997"
all
;
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
;
// LibItsBtp
import
from
LibItsBtp_TypesAndValues
all
;
import
from
LibItsBtp_Templates
all
;
// LibItsGeoNetworking
import
from
LibItsGeoNetworking_TypesAndValues
all
;
// ItsRSUsSimulator
import
from
ItsRSUsSimulator_TypesAndValues
all
;
group
rsuParameters
{
group
rsu1
{
/**
* @desc RSU GN address
*/
modulepar
GN_Address
PICS_RSU_GN_ADDRESS_RSU1
:=
{
typeOfAddress
:=
e_manual
,
stationType
:=
e_roadSideUnit
,
stationCountryCode
:=
33
,
mid
:=
'
AABBCCDDEEFF
'
O
}
// End of PICS_RSU_GN_ADDRESS_RSU1
modulepar
RsuParm
PICS_RSU_1
:=
{
gnAddress
:=
PICS_RSU_GN_ADDRESS_RSU1
,
longPosVector
:=
{
gnAddr
:=
PICS_RSU_GN_ADDRESS_RSU1
,
timestamp_
:=
0
,
latitude
:=
435517392
,
longitude
:=
103018217
,
pai
:=
'0'
B
,
speed
:=
0
,
heading
:=
0
},
stationID
:=
1111111
,
geoShape
:=
e_geoCircle
,
geoParms
:=
{
radius
:=
500
},
pathHistory
:=
PICS_RSU_PATH_HISTORY_RSU1
}
// End of PICS_RSU_1
/**
* @desc Path history to approch the RSU
*/
modulepar
PathHistory
PICS_RSU_PATH_HISTORY_RSU1
:=
{};
}
// End of group rsu1
group
rsu2
{
// TODO To be done
}
// End of group rsu1
modulepar
RsuParmList
PICS_RSU_PARAMS
:=
{
PICS_RSU_1
// TODO To be done
}
// End of PICS_RSU_PARAMS
}
// End of group rsuParameters
group
camParams
{
group
camCommonParams
{
modulepar
BtpPortId
PICS_CAM_BTP_DESTINATION_PORT
:=
2001
;
modulepar
BtpPortId
PICS_CAM_BTP_SOURCE_PORT
:=
0
;
}
// End of group camCommonParams
}
// End of group rsuParameters
group
denmEvents
{
group
denmCommonParams
{
modulepar
BtpPortId
PICS_DENM_BTP_DESTINATION_PORT
:=
2002
;
modulepar
BtpPortId
PICS_DENM_BTP_SOURCE_PORT
:=
0
;
modulepar
PosConfidenceEllipse
PICS_DENM_POSITION_CONFIDENCE_ELLIPSE
:=
{
semiMajorConfidence
:=
SemiAxisLength_oneCentimeter_
,
semiMinorConfidence
:=
SemiAxisLength_oneCentimeter_
,
semiMajorOrientation
:=
HeadingValue_wgs84North_
}
// End of PICS_DENM_POSITION_CONFIDENCE_ELLIPSE
modulepar
Altitude
PICS_DENM_ALTITUDE
:=
{
altitudeValue
:=
AltitudeValue_referenceEllipsoidSurface_
,
altitudeConfidence
:=
unavailable
}
// End of PICS_DENM_ALTITUDE
}
// End of group denmCommonParams
group
denmZone1
{
modulepar
DenmParm
PICS_Z1_D1_EP
:=
{
eventPosition
:=
{
latitude
:=
435517392
,
longitude
:=
103018217
,
positionConfidenceEllipse
:=
PICS_DENM_POSITION_CONFIDENCE_ELLIPSE
,
altitude
:=
PICS_DENM_ALTITUDE
},
causeCodeType
:=
CauseCodeType_roadworks_
,
eventHistory
:=
{
{
eventPosition
:=
{
deltaLatitude
:=
-
3295
,
deltaLongitude
:=
-
2347
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
},
{
eventPosition
:=
{
deltaLatitude
:=
-
719
,
deltaLongitude
:=
-
7055
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
}
}
}
// End of PICS_Z1_D1_EP
modulepar
DenmParm
PICS_Z1_D2_EP
:=
{
eventPosition
:=
{
latitude
:=
435517392
,
longitude
:=
103018217
,
positionConfidenceEllipse
:=
PICS_DENM_POSITION_CONFIDENCE_ELLIPSE
,
altitude
:=
PICS_DENM_ALTITUDE
},
causeCodeType
:=
CauseCodeType_roadworks_
,
eventHistory
:=
{
{
eventPosition
:=
{
deltaLatitude
:=
-
3295
,
deltaLongitude
:=
-
2347
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
},
{
eventPosition
:=
{
deltaLatitude
:=
-
719
,
deltaLongitude
:=
-
7055
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
}
}
}
// End of PICS_Z1_D2_EP
modulepar
DenmParm
PICS_Z1_D3_EP
:=
{
eventPosition
:=
{
latitude
:=
435517392
,
longitude
:=
103018217
,
positionConfidenceEllipse
:=
PICS_DENM_POSITION_CONFIDENCE_ELLIPSE
,
altitude
:=
PICS_DENM_ALTITUDE
},
causeCodeType
:=
CauseCodeType_roadworks_
,
eventHistory
:=
{
{
eventPosition
:=
{
deltaLatitude
:=
-
3295
,
deltaLongitude
:=
-
2347
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
},
{
eventPosition
:=
{
deltaLatitude
:=
-
719
,
deltaLongitude
:=
-
7055
,
deltaAltitude
:=
0
},
eventDeltaTime
:=
omit
,
informationQuality
:=
0
}
}
}
// End of PICS_Z1_D3_EP
}
// End of group denmZone1
group
denmZone2
{
// TODO To be done
}
// End of group denmZone2
group
denmUseCase1
{
modulepar
DenmEventsParmsUseCase
PICS_DENM_PARMS_UC1_RWW
:=
{
PICS_Z1_D1_EP
,
PICS_Z1_D2_EP
,
PICS_Z1_D3_EP
}
// End of PICS_DENM_PARMS_UC1_RWW
}
// End of group denmUseCase1
group
denmUseCase2
{
// TODO To be done
}
// End of group denmUseCase2
modulepar
DenmEventsParmsUseCaseRsu
PICS_DENM_EVENTS_RSU
:=
{
PICS_DENM_PARMS_UC1_RWW
}
// End of PICS_DENM_EVENTS_RSU
}
// End of group denmEvents
group
mapemEvents
{
group
mapemCommonParams
{
modulepar
BtpPortId
PICS_MAPEM_BTP_DESTINATION_PORT
:=
2003
;
modulepar
BtpPortId
PICS_MAPEM_BTP_SOURCE_PORT
:=
0
;
modulepar
BtpPortId
PICS_SPATEM_BTP_DESTINATION_PORT
:=
2004
;
modulepar
BtpPortId
PICS_SPATEM_BTP_SOURCE_PORT
:=
0
;
}
// End of group mapemCommonParams
group
mapemZone1
{
// TODO To be done
}
// End of group mapemZone1
group
mapemZone2
{
// TODO To be done
}
// End of group mapemZone2
group
mapemUseCase1
{
// TODO To be done
}
// End of group mapemUseCase1
group
mapemUseCase2
{
// TODO To be done
}
// End of group mapemUseCase2
}
// End of group mapemEvents
group
ivimEvents
{
group
ivimCommonParams
{
modulepar
BtpPortId
PICS_IVIM_BTP_DESTINATION_PORT
:=
2005
;
modulepar
BtpPortId
PICS_IVIM_BTP_SOURCE_PORT
:=
0
;
}
// End of group ivimCommonParams
group
ivimZone1
{
// TODO To be done
}
// End of group ivimZone1
group
ivimZone2
{
// TODO To be done
}
// End of group ivimZone2
group
ivimUseCase1
{
// TODO To be done
}
// End of group ivimUseCase1
group
ivimUseCase2
{
// TODO To be done
}
// End of group ivimUseCase2
}
// End of group ivimEvents
group
generationFrequencies
{
/**
* @desc CAM frequency timer
*/
modulepar
float
PICS_CAM_FREQUENY
:=
0.1
;
/**
* @desc DENM frequency timer
*/
modulepar
float
PICS_DENM_FREQUENY
:=
0.1
;
/**
* @desc MAPEM frequency timer
*/
modulepar
float
PICS_MAPEM_FREQUENY
:=
0.1
;
/**