ItsRSUsSimulator_Templates.ttcn 9.93 KB
Newer Older
garciay's avatar
garciay committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
module ItsRSUsSimulator_Templates {
    
    // 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;
    import from DSRC language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Templates all;
    
    // LibItsCam
    import from LibItsCam_Templates all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    
    // LibItsMapemSpatem
    import from LibItsMapemSpatem_Templates all;
    
    // LibItsIvim
    import from LibItsIvim_Templates all;
    
    // AtsRSUsSimulator
    import from ItsRSUsSimulator_TypesAndValues all;
    import from ItsRSUsSimulator_Functions all;
    import from ItsRSUsSimulator_Pics all;
    
    template (omit) RsuMessagesValue m_rsuProfile(
                                                  in template (value) CAM p_cam,
                                                  in template (value) DENMs p_denms,
                                                  in template (omit) MAPEM p_mapem := omit,
                                                  in template (omit) SPATEM p_spatem := omit,
                                                  in template (omit) IVIM p_ivim := omit
    ) := {
        cam    := p_cam,
        denms  := p_denms,
        mapem  := p_mapem,
        spatem := p_spatem,
        ivim   := p_ivim
    } // End of template RsuMessagesValue

    group geoNetworkingTemplates {
        
        template (value) GnNonSecuredPacket m_geoNwBroadcastPacket_payload(
                                                                           in template (value) LongPosVector p_sourceLongPosVec,
                                                                           in template (value) UInt16 p_seqNumber,
                                                                           in template (value) GeoBroadcastArea p_broadcastArea,
                                                                           in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                                                                           in template (value) TrafficClass p_trafficClass := m_trafficClass,
                                                                           in template (value) Payload p_payload
        ) modifies m_geoNwBroadcastPacket := {
            payload := p_payload
        } // End of template m_geoNwBroadcastPacket_payload
        
        /**
         * @desc    Receive template for GeoNetworking Unicast 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_geoNwUnicastPacketWithNextHeader_srem(
            in template (present) ShortPosVector p_destinationShortPosVec,
            in template (present) UInt16 p_seqNumber,
            in template (present) NextHeader p_nextHeader
        ) modifies mw_geoNwUnicastPacketWithNextHeader := {
            payload := { 
                decodedPayload := { 
                    btpPacket := mw_btpB(
                        ?, // TODO PICS_SREM_BTP_DESTINATION_PORT 
                        ?, 
                        ?
                    )
                }, 
                rawPayload := ?
            }
        }
        
        
    } // End of group geoNetworkingTemplates 
    
    group positionTemplates {
        
        /**
         * @desc The test system reference position.
         */
        template (value) ReferencePosition m_rsuPosition(
                                                         in template (value) Latitude p_latitude,
                                                         in template (value) Longitude p_longitude
        ) := {
            latitude := f_integer2Latitude(valueof(p_latitude)),
            longitude := f_integer2Latitude(valueof(p_longitude)),
            positionConfidenceEllipse := {
                semiMajorConfidence   := SemiAxisLength_oneCentimeter_,
                semiMinorConfidence   := SemiAxisLength_oneCentimeter_,
                semiMajorOrientation  := HeadingValue_wgs84North_
            },
            altitude := {
                altitudeValue := AltitudeValue_referenceEllipsoidSurface_,
                altitudeConfidence := unavailable
            }
        } // End of template m_rsuPosition
        
    } // End of group positionTemplates
    
    group camTemplates {
        
        template (value) CAM m_camParm(
                                       in template (value) StationID p_stationID,
                                       in template (value) ReferencePosition p_rsuPosition,
                                       in template (value) PathHistory p_pathHistory
        ) := {
            header := {
                protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                messageID := ItsPduHeader_messageID_cam_,
                stationID := p_stationID
            },
            cam := {
                generationDeltaTime := 0, // Dynamic parameter
                camParameters := {
                    basicContainer := {
                        stationType := StationType_roadSideUnit_,
                        referencePosition := p_rsuPosition
                    },
                    highFrequencyContainer := {
                        rsuContainerHighFrequency := {
                            protectedCommunicationZonesRSU := omit/*{
                            }*/
                        }
                    },
                    lowFrequencyContainer := omit,/*{
                        basicVehicleContainerLowFrequency := {
                            vehicleRole := roadOperator,
                            exteriorLights := ExteriorLights_daytimeRunningLightsOn_,
                            pathHistory := p_pathHistory
                        }
                    }*/
                    specialVehicleContainer := omit
                }
            }
        } // End of template m_camParm
        
    } // End of group camTemplates
    
    group mapemTemplates {
        
    } // End of group mapemTemplates
    
    group ivimTemplates {
        
    } // End of group ivimTemplates
    
    group denmTemplates {
        
        template (value) DenmParmContainers m_denmParmContainers(
                                                                 in template (value) StationID p_originatingStationID,
                                                                 in template (value) SequenceNumber p_sequenceNumber,
                                                                 in template (value) ReferencePosition p_eventPosition,
                                                                 in template (value) CauseCodeType p_causeCodeType,
                                                                 in template (value) EventHistory p_eventHistory,
                                                                 in template (value) ValidityDuration p_validityDuration := 86400,
                                                                 in template (value) RelevanceDistance p_relevanceDistance := lessThan200m
        ) := {
            managementContainer := {
                actionID := {
                    originatingStationID    := p_originatingStationID,
                    sequenceNumber          := p_sequenceNumber
                },
                detectionTime               := f_getCurrentTime(),
                referenceTime               := 0,
                termination                 := omit,
                eventPosition               := p_eventPosition,
                relevanceDistance           := p_relevanceDistance,
                relevanceTrafficDirection   := omit,
                validityDuration            := p_validityDuration,
                transmissionInterval        := omit,
                stationType                 := StationType_roadSideUnit_
            }, // End of field managementContainer
            situationContainer := {
                informationQuality          := 0,
                eventType := {
                    causeCode               := p_causeCodeType,
                    subCauseCode            := 0
                },
                linkedCause                 := omit,
                eventHistory                := p_eventHistory
            }, // End of field situationContainer
            locationContainer := {
                eventSpeed := omit,
                eventPositionHeading := omit,
                traces := {
                    {
                        {
                            pathPosition := {
                                deltaLatitude := 0,
                                deltaLongitude := 0,
                                deltaAltitude := 0
                            },
                            pathDeltaTime := 0
                        }
                    }
                },
                roadType := omit 
            } // End of field locationContainer
            
        } // End of template m_denmParm
    } // End of group denmTemplates
    
} // End of module ItsRSUsSimulator_Templates