Commit f1b6b105 authored by garciay's avatar garciay
Browse files

Add simulation for UC9 (RSU broadcast CAM with PCZ)

parent d2bcd4af
Loading
Loading
Loading
Loading
+50 −21
Original line number Diff line number Diff line
@@ -241,6 +241,20 @@ module ItsRSUsSimulator_Functions {
        // CAM
        if (vc_cam == true) {
            // Build the list of the CAM events
            if (PX_ETSI_USE_CASE_ID == 9) {
                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,
                        m_highFrequencyContainer_rsuContainerHighFrequency(
                            m_rSUContainerHighFrequency(
                                PICS_USECASE9_PCZ
                )));
            } else {
                v_cam := 
                    m_camParm(
                        PICS_RSU_PARAMS[p_rsu_id].stationID,
@@ -251,6 +265,7 @@ module ItsRSUsSimulator_Functions {
                        PICS_RSU_PARAMS[p_rsu_id].pathHistory
                );
            }
        } 
        if (vc_beacon == true) {
            // Build the list of the BeACON events
            v_beacon := 'AAAAAAAA'O; // TODO Use a PICS
@@ -558,6 +573,19 @@ module ItsRSUsSimulator_Functions {
    ) runs on ItsRSUsSimulator {
        var GeoNetworkingPdu v_geoNetworkingPdu;
        
        if (p_its_aid == 36) { // CAM 
            v_geoNetworkingPdu := valueof(m_geoNwPdu( // FIXME Use PIXIT parameter to get a fully configurable template
                m_geoNwTsbPacket_payload( // TODO modifes 'template (value) GnNonSecuredPacket m_geoNwBroadcastPacket' to set the field
                    f_incLocalSeqNumber(),
                    vc_longPosVectorRsu,
                    -,
                    -,
                    valueof(p_payload)
                ),
                m_defaultLifetime,
                c_defaultHopLimit
            ));
        } else {
            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,
@@ -570,6 +598,7 @@ module ItsRSUsSimulator_Functions {
                m_defaultLifetime,
                c_defaultHopLimit
            ));
        }
        f_sendGeoNetMessage(valueof(m_geoNwReq_linkLayerBroadcast(v_geoNetworkingPdu, p_its_aid)));
    } // End of function f_send
    
+39 −15
Original line number Diff line number Diff line
@@ -200,7 +200,8 @@ module ItsRSUsSimulator_Pics {
        } // End of group rsu4
        
        /**
         * @desc RSU #5
         * @desc RSU #5 - RSUs E
         * @remark Zone #8
         */
        group rsu5 {
            
@@ -219,8 +220,8 @@ module ItsRSUsSimulator_Pics {
                longPosVector := {
                    gnAddr        := PICS_RSU_GN_ADDRESS_RSU5,
                    timestamp_    := 0,
                    latitude      := 435563500,
                    longitude     := 103047450,
                    latitude      := 435838400,
                    longitude     := 103249780,
                    pai           := '0'B,
                    speed         := 0,
                    heading       := 0
@@ -241,7 +242,8 @@ module ItsRSUsSimulator_Pics {
        } // End of group rsu5
        
        /**
         * @desc RSU #6
         * @desc RSU #6 - RSUs F
         * @remark Zone #8
         */
        group rsu6 {
            
@@ -260,8 +262,8 @@ module ItsRSUsSimulator_Pics {
                longPosVector := {
                    gnAddr        := PICS_RSU_GN_ADDRESS_RSU6,
                    timestamp_    := 0,
                    latitude      := 435570660,
                    longitude     := 103019170,
                    latitude      := 435923480,
                    longitude     := 103375540,
                    pai           := '0'B,
                    speed         := 0,
                    heading       := 0
@@ -590,17 +592,22 @@ module ItsRSUsSimulator_Pics {
                        mid                   := '000000000000'O
                    },
                    timestamp_                                    := 0,
                    latitude                                      := 1234,
                    longitude                                     := 1234,
                    latitude                                      := 433310000,
                    longitude                                     := 101803000,
                    pai                                           := '0'B,
                    speed                                         := 0,
                    heading                                       := 0
                }
                } // End of PICS_UC6_DETECTION_POINT
                
                /**
                 * @desc Maximum synchronisation area to start sending CAM
                 */
                modulepar float PICS_UC6_DETECTION_DISTANCE := 11.0;
            
                /**
                 * @desc Maximum synchronisation area to start sending CAM
                 */
                modulepar float PICS_UC6_DETECTION_EPSILLON := 19.0;    // 2.0;
                modulepar float PICS_UC6_DETECTION_EPSILLON := 0.01;
            
            } // End of group camUseCase6SyncLocation 
            
@@ -619,7 +626,7 @@ module ItsRSUsSimulator_Pics {
                    pai                                           := '0'B,
                    speed                                         := 30,
                    heading                                       := 0
                }
                } // End of PICS_UC6_VEHICLE_POSITION
                
                modulepar GeoArea PICS_UC6_VEHICLE_GEOAREA := {
                    shape := e_geoElip,
@@ -630,7 +637,7 @@ module ItsRSUsSimulator_Pics {
                        distanceB                                 := 3,
                        angle                                     := 0
                    }
                }
                } // End of PICS_UC6_VEHICLE_GEOAREA
                
            } // End of group camUseCase6VehicleDescription 
            
@@ -1194,10 +1201,27 @@ module ItsRSUsSimulator_Pics {
                        altitudeConfidence := unavailable
                    }
                }
            }
            } // End of PICS_USECASE6_VEHICLE_POSITIONS
            
        } // End of group camUseCase6
        
        group camUseCase9 {
            
            modulepar ProtectedCommunicationZone PICS_USECASE9_PCZ_1 := {
                protectedZoneType        := cenDsrcTolling,
                expiryTime               := omit,
                protectedZoneLatitude    := 435924080,
                protectedZoneLongitude   := 103374530,
                protectedZoneRadius      := 500,
                protectedZoneID          := 1
            } // End of PICS_USECASE9_PCZ_1
            
            modulepar ProtectedCommunicationZonesRSU PICS_USECASE9_PCZ := {
                PICS_USECASE9_PCZ_1
            } // End of PICS_USECASE9_PCZ
            
        } // End of group camUseCase9
        
    } // End of group camParams 
    
    /**
@@ -6148,11 +6172,11 @@ module ItsRSUsSimulator_Pics {
        
        modulepar boolean PICS_GENERATE_BEACON   := false;
        
        modulepar boolean PICS_GENERATE_CAM      := false;
        modulepar boolean PICS_GENERATE_CAM      := true;
        
        modulepar boolean PICS_GENERATE_DENM     := false;
        
        modulepar boolean PICS_GENERATE_IVIM     := true;
        modulepar boolean PICS_GENERATE_IVIM     := false;
        
        modulepar boolean PICS_GENERATE_MAPEM    := false;
        
+3 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ module ItsRSUsSimulator_Pixits {
    /**
     * @desc Indicate which RSU to simulate
     */
    modulepar integer PX_RSU_ID := 1; 
    modulepar integer PX_RSU_ID := 6; 
    
    /**
     * @desc Indicate which Use Case to simulate
@@ -30,8 +30,9 @@ module ItsRSUsSimulator_Pixits {
     *         UC3 (TLM):  PX_ETSI_USE_CASE_ID := 3
     *         UC5 (IVIM): PX_ETSI_USE_CASE_ID := 5
     *         UC6 (CAM):  PX_ETSI_USE_CASE_ID := 6
     *         UC9 (CAM):  PX_ETSI_USE_CASE_ID := 9
     */
    modulepar integer PX_ETSI_USE_CASE_ID := 5;
    modulepar integer PX_ETSI_USE_CASE_ID := 9;
    
    /**
     * @desc Indicate which zone to simulate
+43 −16
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ module ItsRSUsSimulator_Templates {
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    import from LibCommon_DataStrings all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
@@ -74,6 +75,22 @@ module ItsRSUsSimulator_Templates {
            payload := p_payload
        } // End of template m_geoNwBroadcastPacket_payload
        
        /**
         * @desc    Send template for GeoNetworking TSB Packet
         * @param   p_seqNumber         Sequence number of TSB packet
         * @param   p_sourceLongPosVec  Long position vector of source
         * @param   p_hopLimit          The maximum number of hops (Default: c_defaultHopLimit)
         */
        template (value) GnNonSecuredPacket m_geoNwTsbPacket_payload(
                                                                     in template (value) UInt16 p_seqNumber,
                                                                     in template (value) LongPosVector p_sourceLongPosVec,
                                                                     in template (value) UInt8 p_hopLimit := c_defaultHopLimit,
                                                                     in template (value) TrafficClass p_trafficClass := m_trafficClass,
                                                                     in template (value) Payload p_payload
        ) modifies m_geoNwTsbPacket:= {
            payload :=  p_payload
        }
        
        /**
         * @desc    Receive template for GeoNetworking Unicast Packet
         * @param   p_destinationShortPosVec    Short position vector of destination
@@ -200,13 +217,13 @@ module ItsRSUsSimulator_Templates {
         * @param   p_longPosVector The base long position vector
         */
        template LongPosVector mw_longPosVectorPosition_vendors(
                                                                in template (value) LongPosVector p_longPosVector
        ) modifies mw_longPosVectorPosition := {
                                                                in template (value) Oct6 p_mid
        ) := {
            gnAddr := {
                typeOfAddress := ?,
                stationType := ?,
                stationCountryCode := ?,
                mid := complement(p_longPosVector.gnAddr.mid)
                mid := p_mid
            },
            timestamp_ := ?,
            latitude := ?,
@@ -220,10 +237,23 @@ module ItsRSUsSimulator_Templates {
    
    group camTemplates {
        
        template (value) CAM m_camParm(
        template (value) HighFrequencyContainer m_highFrequencyContainer_rsuContainerHighFrequency(
                                                                                                   in template (value) RSUContainerHighFrequency p_rsuContainerHighFrequency
        ) := {
            rsuContainerHighFrequency := p_rsuContainerHighFrequency
        }
        
        template (value) RSUContainerHighFrequency m_rSUContainerHighFrequency(
                                                                               in template (value) ProtectedCommunicationZonesRSU p_protectedCommunicationZonesRSU
        ) := {
            protectedCommunicationZonesRSU := p_protectedCommunicationZonesRSU
        }
        
        template (omit) CAM m_camParm(
                                      in template (value) StationID p_stationID,
                                      in template (value) ReferencePosition p_rsuPosition,
                                       in template (value) PathHistory p_pathHistory
                                      in template (value) PathHistory p_pathHistory,
                                      in template (omit) HighFrequencyContainer p_highFrequencyContainer := omit
        ) := {
            header := {
                protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
@@ -237,24 +267,21 @@ module ItsRSUsSimulator_Templates {
                        stationType := StationType_roadSideUnit_,
                        referencePosition := p_rsuPosition
                    },
                    highFrequencyContainer := {
                        rsuContainerHighFrequency := {
                            protectedCommunicationZonesRSU := omit/*{
                            }*/
                        }
                    },
                    lowFrequencyContainer := omit,/*{
                    highFrequencyContainer := p_highFrequencyContainer,
                    lowFrequencyContainer := {
                        basicVehicleContainerLowFrequency := {
                            vehicleRole := roadOperator,
                            exteriorLights := ExteriorLights_daytimeRunningLightsOn_,
                            exteriorLights := '00000000'B,
                            pathHistory := p_pathHistory
                        }
                    }*/
                    },
                    specialVehicleContainer := omit
                }
            }
        } // End of template m_camParm
        
        // TODO Add ProtectedZone
        
    } // End of group camTemplates
    
    group mapemTemplates {
+42 −14
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ module ItsRSUsSimulator_TestCases {
        // Test control
        
        // Test component configuration
        f_cf01Up();
        ItsRSUsSimulator_Functions.f_cf01Up();
            
        // Test adapter configuration
        
@@ -153,7 +153,7 @@ module ItsRSUsSimulator_TestCases {
        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        
        // Postamble
        f_cf01Down();
        ItsRSUsSimulator_Functions.f_cf01Down();
        
    } // End of TC_RSUSIMU_BV_01
    
@@ -173,7 +173,7 @@ module ItsRSUsSimulator_TestCases {
        // Test control
        
        // Test component configuration
        f_cf01Up();
        ItsRSUsSimulator_Functions.f_cf01Up();
            
        // Test adapter configuration
        
@@ -182,39 +182,62 @@ module ItsRSUsSimulator_TestCases {
        
        // Test Body
        tc_ac.start;
        geoNetworkingPort.clear;
        alt {
            [] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
                        mw_geoNwShbPacketWithNextHeader_cam(
                            mw_longPosVectorPosition_vendors(
                                PICS_UC6_VEHICLE_POSITION            // Ignore RSUsimultor CAM messages
                                PICS_UC6_VEHICLE_POSITION.gnAddr.mid            // Ignore RSUsimultor CAM messages
                            ),
                            ?,
                            -,
                            e_btpB
            )))) -> value v_gnInd { // Receive a DENM message
            )))) { // Receive a owner CAM message
                repeat;
            }
            [] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
                        mw_geoNwShbPacketWithNextHeader_cam(
                            -,/*mw_longPosVectorPosition_vendors(
                                PICS_UC6_VEHICLE_POSITION.gnAddr.mid            // Ignore RSUsimultor CAM messages
                            ),*/
                            -,
                            e_btpB
            )))) -> value v_gnInd { // Receive a CAM 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
                if (regexp(v_stationIDs, charstring:"(" & v_stationID & ",)", 0) == "") { // Vehicle already processed?
                    // Compute point intersection
                    if (LibItsGeoNetworking_Functions.f_distance(
                    var float v_distance := LibItsGeoNetworking_Functions.f_distance(
                        v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector,
                        PICS_UC6_DETECTION_POINT
                        ) <= PICS_UC6_DETECTION_EPSILLON
                    ) {
                    );
                    if (ff_abs(v_distance - PICS_UC6_DETECTION_DISTANCE) < PICS_UC6_DETECTION_EPSILLON) {
                        log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " in of area (", ff_abs(v_distance - PICS_UC6_DETECTION_DISTANCE), ") ***");
                        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 & ",";
                        //log("*** " & testcasename() & ": DEBUG: New v_stationIDs: " & v_stationIDs & " ***");
                    } else {
                        // Nothing to do
                        log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " out of area (", ff_abs(v_distance - PICS_UC6_DETECTION_DISTANCE), ") ***");
                    }
                } else {
                    // Nothing to do
                    //log("*** " & testcasename() & ": DEBUG: StationID: " & v_stationID & " already processed ***");
                }
                tc_ac.start;
                repeat;
            }
            [] geoNetworkingPort.receive { // Receive a message
            [] geoNetworkingPort.receive(
                mw_geoNwInd(
                    mw_geoNwPdu(
                        ?
            ))) { // Receive a CAM message
                log("*** " & testcasename() & ": DEBUG: Recieving unsollicited message ***");
                // Nothing to do, just for logging purposes
                tc_ac.stop;
@@ -239,7 +262,7 @@ module ItsRSUsSimulator_TestCases {
        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();
        ItsRSUsSimulator_Functions.f_cf01Down();
        
    } // End of TC_RSUSIMU_BV_02
    
@@ -254,12 +277,17 @@ module ItsRSUsSimulator_TestCases {
            var integer v_idx := 0;
            var template (value) CAM v_cam;
            
            //log("*** " & testcasename() & ": DEBUG: >>> f_startVehicleSimulator: " & int2str(p_idx) & " ***");
            f_initialiseVehicleSimulatorComponent(p_component, v_cam);
            
            tc_ca_uc6.start;
            alt {
                [] tc_cam.timeout {
                    log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
                /*[] cfPort.receive {
                    repeat;
                }*/
                [] tc_ca_uc6.timeout {
                    log("*** " & testcasename() & ": DEBUG: Processing CAM #" & int2str(v_idx) & " ***");
                    tc_ca_uc6.stop;
                    f_send_vehicle_cam(v_cam, v_idx);
                    v_idx := v_idx + 1;
                    if (v_idx < lengthof(PICS_USECASE6_VEHICLE_POSITIONS)) {