Commit 28b03d5f authored by garciay's avatar garciay
Browse files

Add MAPEM support

parent 39200759
Loading
Loading
Loading
Loading
+70 −20
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ module ItsRSUsSimulator_Functions {
    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;
@@ -27,6 +28,9 @@ module ItsRSUsSimulator_Functions {
    // LibItsDenm
    import from LibItsDenm_Templates all;
    
    // LibItsMapemSpatemm
    import from LibItsMapemSpatem_Templates all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
@@ -80,15 +84,37 @@ module ItsRSUsSimulator_Functions {
            
            // Initialisations
            vc_longPosVectorRsu := PICS_RSU_PARAMS[PX_RSU_ID - 1].longPosVector;
            // TODO MAPEM
            // TODO IVIM
            // MAPEM
            if (PICS_GENERATE_MAPEM) {
                // Build the list of the MAPEM events
                v_mapem := 
                    m_mapemParm(
                        PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
                        m_mapem(
                            f_getMsgIssueRevision(),
                            PICS_MAPEM_PARMS_RSUs[PX_RSU_ID - 1].intersections,
                            PICS_MAPEM_PARMS_RSUs[PX_RSU_ID - 1].roadSegments
                ));
                // Update revision fields
                v_mapem.map_.intersections[0].revision := f_incMsgIssueRevision();
                // TODO Add more?
            }
            // SPATEM
            if (PICS_GENERATE_SPATEM) {
                // TODO
            }
            // IVIM
            if (PICS_GENERATE_IVIM) {
                // TODO
            }
            // DENM
            if (PICS_GENERATE_DENM) {
                // 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) {
                    // Build DENM with dynamic values
                    v_denmParmContainers := m_denmParmContainers(
                        PICS_RSU_PARAMS[PX_RSU_ID - 1].stationID,
                        f_getDenmSequenceNumber(),
                        f_incDenmSequenceNumber(),
                        PICS_DENM_REPETITION_INTERVAL,
                        PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].eventPosition,
                        PICS_DENM_EVENTS_RSU[PX_RSU_ID - 1][v_counter].causeCodeType,
@@ -106,6 +132,7 @@ module ItsRSUsSimulator_Functions {
                    }
                } // End of 'for' loop
            }
            // CAM
            if (PICS_GENERATE_CAM) {
                // Build the list of the CAM events
                v_cam := valueof(
@@ -197,8 +224,17 @@ module ItsRSUsSimulator_Functions {
                             out template (value) Payload p_payload
    ) runs on ItsRSUsSimulator {
        
        p_payload := {}; // FIXME To be developped
        
        p_payload := valueof(
            f_adaptPayload(
                bit2oct(
                    encvalue(
                        valueof(
                            vc_rsuMessagesValueList[PX_RSU_ID - 1].mapem
                ))),
                PICS_MAPEM_BTP_DESTINATION_PORT,
                PICS_MAPEM_BTP_SOURCE_PORT
            )
        );
    }
    
    function f_prepare_spatem(
@@ -304,8 +340,22 @@ module ItsRSUsSimulator_Functions {
        return vc_localSeqNumber;
    }
    
    function f_incMsgIssueRevision() runs on ItsRSUsSimulator return MsgCount {
        vc_msgIssueRevision := (vc_msgIssueRevision + 1) mod 128; // See MsgCount declaration
        return vc_msgIssueRevision;
    }
    
    function f_getMsgIssueRevision() runs on ItsRSUsSimulator return MsgCount {
        return vc_msgIssueRevision;
    }
    
    function f_incDenmSequenceNumber() runs on ItsRSUsSimulator return SequenceNumber {
        vc_sequenceNumber := (vc_sequenceNumber + 1) mod 65536; // See SequenceNumber declaration
        return vc_sequenceNumber;
    }
    
    function f_getDenmSequenceNumber() runs on ItsRSUsSimulator return SequenceNumber {
        return 12345; // FIXME To be refined
        return vc_sequenceNumber;
    }
    
} // End of module ItsRSUsSimulator_Functions
 No newline at end of file
+144 −23
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ module ItsRSUsSimulator_Pics {
                    trafficFlowRule                         := passToRight,
                    referenceDenms                          := omit
                }

            } // End of PICS_Z1_D2_EP
            
            modulepar DenmParm PICS_Z1_D3_EP := {
@@ -256,6 +257,7 @@ module ItsRSUsSimulator_Pics {
                    trafficFlowRule                         := passToRight,
                    referenceDenms                          := omit
                }

            } // End of PICS_Z1_D3_EP
            
        } // End of group denmZone1 
@@ -299,20 +301,137 @@ module ItsRSUsSimulator_Pics {
        } // End of group mapemCommonParams
        
        group mapemZone1 {
            // TODO To be done
            
            modulepar MapemParm PICS_MAPEM_PARMS_RSU_1 := {
                intersections := {
                    { // Start of intersection #0
                        name                                := "PICS_MAPEM_PARMS_RSU_1",
                        id := {
                            region                          := 0,
                            id                              := 0
                        },
                        revision                            := 0,
                        refPoint := {
                            lat                             := 435517392,
                            long                            := 103018217,
                            elevation                       := omit,
                            regional                        := omit
                        },
                        laneWidth                           := omit,
                        speedLimits                         := omit,
                        laneSet := {
                            { // Start of Lane #1
                                laneID                      :=  1,
                                name                        := omit,
                                ingressApproach             := 1,
                                egressApproach              := 1,
                                laneAttributes := {
                                    directionalUse          := '10'B,
                                    sharedWith              := '0000000000'B,
                                    laneType := {
                                        vehicle             := '00000000'B
                                    },
                                    regional                := omit
                                },
                                maneuvers                   := omit,
                                nodeList := {
                                    nodes := {
                                        {
                                            delta := {
                                                node_XY1 := {
                                                    x       := -10,
                                                    y       := 10
                                                }
                                            },
                                            attributes      := omit
                                        },
                                        {
                                            delta := {
                                                node_XY1 := {
                                                    x       := -10,
                                                    y       := 10
                                                }
                                            },
                                            attributes      := omit
                                        }
                                    }
                                },
                                connectsTo := {
                                    {
                                        connectingLane := {
                                            lane            := 1,
                                            maneuver        := omit
                                        }, 
                                        remoteIntersection  := omit,  
                                        signalGroup         := 1,    
                                        userClass           := omit, 
                                        connectionID        := omit
                                    }
                                },
                                overlays                    := omit,
                                regional                    := omit
                            }, // End of Lane #1
                            { // Start of Lane #2
                                laneID                      :=  1,
                                name                        := omit,
                                ingressApproach             := 1,
                                egressApproach              := 2,
                                laneAttributes := {
                                    directionalUse          := '01'B,
                                    sharedWith              := '0000000000'B,
                                    laneType := {
                                        vehicle             := '00000000'B
                                    },
                                    regional                := omit
                                },
                                maneuvers                   := omit,
                                nodeList := {
                                    nodes := {
                                        {
                                            delta := {
                                                node_XY1 := {
                                                    x       := -10,
                                                    y       := 10
                                                }
                                            },
                                            attributes      := omit
                                        },
                                        {
                                            delta := {
                                                node_XY1 := {
                                                    x       := -10,
                                                    y       := 10
                                                }
                                            },
                                            attributes      := omit
                                        }
                                    }
                                },
                                connectsTo                  := omit,
                                overlays                    := omit,
                                regional                    := omit
                            } // End of Lane #1
                        }, // End of LaneSet
                        preemptPriorityData                 := omit,
                        regional                            := omit
                    } // End of intersection #0
                }, // End of field intersections
                roadSegments := omit
            }
            
        } // End of group mapemZone1 
        
        group mapemZone2 {
            // TODO To be done
        } // End of group mapemZone2 
            
        group mapemUseCase1 {
            // TODO To be done
        } // End of group mapemUseCase1 
            modulepar MapemParm PICS_MAPEM_PARMS_RSU_2 := {
            }
            
        group mapemUseCase2 {
            // TODO To be done
        } // End of group mapemUseCase2 
        } // End of group mapemZone2 
        
        modulepar MapemParmList PICS_MAPEM_PARMS_RSUs := {
            PICS_MAPEM_PARMS_RSU_1,
            PICS_MAPEM_PARMS_RSU_2
        } // End of PICS_MAPEM_PARMS_RSU
        
    } // End of group mapemEvents 
    
@@ -352,7 +471,9 @@ module ItsRSUsSimulator_Pics {
        
        modulepar boolean PICS_GENERATE_IVIM := true;
        
        modulepar boolean PICS_GENERATE_MAPEM_SPATEM := true;
        modulepar boolean PICS_GENERATE_MAPEM := true;
        
        modulepar boolean PICS_GENERATE_SPATEM := true;
        
        modulepar boolean PICS_GENERATE_SSEM := true;
        
@@ -369,17 +490,17 @@ module ItsRSUsSimulator_Pics {
        /**
         * @desc MAPEM frequency timer
         */
        modulepar float PICS_MAPEM_FREQUENY     := 0.1;
        modulepar float PICS_MAPEM_FREQUENY     := 2.0;
        
        /**
         * @desc SPATEMM frequency timer
         */
        modulepar float PICS_SPATEM_FREQUENY    := 5.0;
        modulepar float PICS_SPATEM_FREQUENY    := 2.0;
        
        /**
         * @desc IVIM frequency timer
         */
        modulepar float PICS_IVIM_FREQUENY      := 1.0;
        modulepar float PICS_IVIM_FREQUENY      := 2.0;
        
    } // End of group generationFrequencies 
    
+12 −0
Original line number Diff line number Diff line
@@ -162,6 +162,18 @@ module ItsRSUsSimulator_Templates {
    
    group mapemTemplates {
        
        template (value) MAPEM m_mapemParm(
                                       in template (value) StationID p_stationID,
                                       in template (value) MapData p_map
        ) := {
            header := {
                protocolVersion := ItsPduHeader_protocolVersion_currentVersion_,
                messageID := ItsPduHeader_messageID_mapem_,
                stationID := p_stationID
            },
            map_ := p_map
        }
        
    } // End of group mapemTemplates
    
    group ivimTemplates {
+24 −20
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ module ItsRSUsSimulator_TestCases {
    import from ItsRSUsSimulator_Templates all;
    import from ItsRSUsSimulator_TestSystem all;
    import from ItsRSUsSimulator_Functions all;
    import from ItsRSUsSimulator_Pics all;
    import from ItsRSUsSimulator_Pixits all;
    
    testcase TC_RSUSIMU_BV_01() runs on ItsRSUsSimulator system ItsGeoNetworkingSystem {
@@ -69,38 +70,41 @@ module ItsRSUsSimulator_TestCases {
                // Nothing to do, just for logging purposes
                repeat;
            }
            [] tc_cam.timeout {
            [PICS_GENERATE_CAM] tc_cam.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing CAM ***");
                f_prepare_cam(v_payload);
                f_send(v_payload);
                tc_cam.start;
                repeat;
            }
            [] tc_denm.timeout {
            [PICS_GENERATE_DENM] tc_denm.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing DENM ***");
                f_prepare_denm(v_payload);
                f_send(v_payload);
                tc_denm.start;
                repeat;
            }
//                [] tc_spatem.timeout {
//                    f_prepare_spatem(v_payload);
//                    f_send(v_payload);
//                    tc_spatem.start;
//                    repeat;
//                }
//                [] tc_mapem.timeout {
//                    f_prepare_spatem(v_payload);
//                    f_send(v_payload);
//                    tc_mapem.start;
//                    repeat;
//                }
//                [] tc_ivim.timeout {
//                    f_prepare_ivim(v_payload);
//                    f_send(v_payload);
//                    tc_ivim.start;
//                    repeat;
//                }
            [PICS_GENERATE_MAPEM] tc_mapem.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing MAPEM ***");
                f_prepare_mapem(v_payload);
                f_send(v_payload);
                tc_mapem.start;
                repeat;
            }
            [PICS_GENERATE_SPATEM] tc_spatem.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing SPATEM ***");
                f_prepare_spatem(v_payload);
                f_send(v_payload);
                tc_spatem.start;
                repeat;
            }
            [PICS_GENERATE_IVIM] tc_ivim.timeout {
                log("*** " & testcasename() & ": DEBUG: Processing IVIM ***");
                f_prepare_ivim(v_payload);
                f_send(v_payload);
                tc_ivim.start;
                repeat;
            }
        } // End of 'alt' statement
        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        
+6 −0
Original line number Diff line number Diff line
module ItsRSUsSimulator_TestSystem {
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from DSRC language "ASN.1:1997" all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_TypesAndValues all;
@@ -17,6 +21,8 @@ module ItsRSUsSimulator_TestSystem {
        var GeoArea vc_geoArea := {};
        var template (value) RsuMessagesValueList vc_rsuMessagesValueList := {};
        var integer vc_denmEventCounter := 0;
        var SequenceNumber vc_sequenceNumber := 0;
        var MsgCount vc_msgIssueRevision := 0;
        
        timer tc_cam    := PICS_CAM_FREQUENY;
        timer tc_denm   := PICS_DENM_FREQUENY;
Loading