ItsCam_TpFunctions.ttcn 146 KB
Newer Older
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Set vehicle role
                f_utTriggerEvent(m_setVehicleRole(c_vehicleRole_roadWork));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_roadWorks_any ))){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_INA_BV_05
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_06
             */
            function f_CAM_MSD_INA_BV_06() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_RESCUE) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_RESCUE need to be set to true");
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Set vehicle role
                f_utTriggerEvent(m_setVehicleRole(c_vehicleRole_rescue));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_rescue_any ))){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_INA_BV_06
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_07
             */
            function f_CAM_MSD_INA_BV_07() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_EMERGENCY) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_EMERGENCY need to be set to true");
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Set vehicle role
                f_utTriggerEvent(m_setVehicleRole(c_vehicleRole_emergency));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_emergency_any ))){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_INA_BV_07
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_08
             */
            function f_CAM_MSD_INA_BV_08() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_SAFETY_CAR) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_SAFETY_CAR need to be set to true");
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Set vehicle role
                f_utTriggerEvent(m_setVehicleRole(c_vehicleRole_safetyCar));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_safetyCar_any ))){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_INA_BV_08
            
        } // end group camInformationAdaptation
        
        group camGenerationFrequency {
            
            group CAM_MSD_GFQ_TI_01 {
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_GFQ_TI_01
                 */
                function f_CAM_MSD_GFQ_TI_01() runs on ItsCam {
                    
                    // Local variables
                    timer t_minTransInterval := PICS_T_GENCAMMIN * 0.90;
                    var SpeedValue v_speedValues[5] := { 1000, 2000, 3000, 4000, 5000 } //cm/s
                    var integer v_cntSpeed, v_cntTime;
                    var FncRetCode v_ret;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }              
                    
                    // Test component configuration
                    f_cfUp();
                    
                    // Test adapter configuration
                    
                    // Preamble
garciay's avatar
garciay committed
                    f_prInitialState(e_dynamicPosition1500m);
                    camPort.clear;
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                            tc_ac.stop;
                            t_minTransInterval.start;
                            log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                        }
                    }
                    
                    // Test Body
                    for (v_cntSpeed:=0; v_cntSpeed<lengthof(v_speedValues); v_cntSpeed:=v_cntSpeed + 1) {
                        for (v_cntTime:=0; v_cntTime<10; v_cntTime:=v_cntTime + 1) {
                            v_ret := f_CAM_MSD_GFQ_TI_01_helper(t_minTransInterval);
                            select (v_ret) {
                                case (e_error) {
                                    log("*** " & testcasename() & ": FAIL: CAM message received BEFORE expiry of the minimum generation timer interval ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                case (e_timeout) {
                                    log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                                }
                            }
                            t_minTransInterval.start;
                        }
                        f_changeSpeed(v_speedValues[v_cntSpeed]);
                    }
                    t_minTransInterval.stop;
                    log("*** " & testcasename() & ": PASS: Generation of CAM messages was successful ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_GFQ_TI_01
                
                function f_CAM_MSD_GFQ_TI_01_helper(timer t_minTransInterval) runs on ItsCam return FncRetCode {
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )) {
                            tc_ac.stop;
                            if (t_minTransInterval.running) {
                                return e_error;
                            }
                        }
                        [] t_minTransInterval.timeout {
                            repeat;
                        }
                        [] tc_ac.timeout {
                            t_minTransInterval.stop;
                            return e_timeout;
                        }
                    }
                    
                    return e_success;
                } // end function f_CAM_MSD_GFQ_TI_01
                
            } // end group CAM_MSD_GFQ_TI_01
            
            group CAM_MSD_GFQ_TI_02 {
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_GFQ_TI_02
                 */
                function f_CAM_MSD_GFQ_TI_02() runs on ItsCam {
                    
                    // Local variables
                    timer t_maxTransInterval := PICS_T_GENCAMMAX * 1.10;
                    var integer v_cntSpeed, v_cntTime;
                    var FncRetCode v_ret;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }              
                    
                    // Test component configuration
                    f_cfUp();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prInitialState();
                    camPort.clear;
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                            tc_ac.stop;
                            t_maxTransInterval.start;
                            log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                        }
                    }
                    
                    // Test Body
                    for (v_cntTime:=0; v_cntTime<10; v_cntTime:=v_cntTime + 1) {
                        v_ret := f_CAM_MSD_GFQ_TI_02_helper(t_maxTransInterval);
                        select (v_ret) {
                            case (e_error) {
                                log("*** " & testcasename() & ": FAIL: No CAM message received BEFORE expiry of the maximum generation timer interval ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            case (e_timeout) {
                                log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                        }
                    }
                    t_maxTransInterval.stop;
                    log("*** " & testcasename() & ": PASS: Generation of CAM messages was successful ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_GFQ_TI_02
                
                function f_CAM_MSD_GFQ_TI_02_helper(timer t_maxTransInterval) runs on ItsCam return FncRetCode {
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )) {
                            tc_ac.stop;
                            t_maxTransInterval.stop;
                            t_maxTransInterval.start;
                        }
                        [] t_maxTransInterval.timeout {
                            return e_error;
                        }
                        [] tc_ac.timeout {
                            t_maxTransInterval.stop;
                            return e_timeout;
                        }
                    }
                    
                    return e_success
                } // end function f_CAM_MSD_GFQ_TI_02
                
            } //end group CAM_MSD_GFQ_TI_02
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_TI_03
             */
            function f_CAM_MSD_GFQ_TI_03() runs on ItsCam {
                
                // Local variables
                timer t_maxTransInterval_min := PICS_T_GENCAMMAX * 0.90;
                timer t_maxTransInterval_max := PICS_T_GENCAMMAX * 1.10;
                timer t_interval_1_measure := PX_TWAIT;
                timer t_interval_1_min;
                timer t_interval_1_max;
                var float v_interval_1_min;
                var float v_interval_1_max;
                var integer v_N_GenCam := 3;
                var integer v_i;
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
garciay's avatar
garciay committed
                f_prInitialState(e_dynamicPosition1500m);
                              
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        t_interval_1_measure.start;
                        tc_ac.stop;                        
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_changeSpeed(1000);
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        var float v_measured := t_interval_1_measure.read;
                        log("Elapsed time since last CAM: ", v_measured);
                        tc_ac.stop;
                        v_interval_1_min := v_measured * 0.8;
                        v_interval_1_max := v_measured * 1.2;
                        log("*** " & testcasename() & ": INFO: Initial conditions: Condition 1 CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions:  Condition 1 CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                for (v_i:=1; v_i <= v_N_GenCam; v_i:=v_i+1) {
                    t_interval_1_min.start(v_interval_1_min);
                    t_interval_1_max.start(v_interval_1_max);
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                            if (t_interval_1_min.running) {
                                log("*** " & testcasename() & ": INCONC: Initial conditions: Condition 2 CAM#", v_i, " message received BEFORE INTERVAL_1 expired ***");
                                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                            }
                            t_interval_1_max.stop;
                            log("*** " & testcasename() & ": INFO: Initial conditions: Condition 2 CAM#", v_i, " message received ***");
                        }
                        [] t_interval_1_min.timeout {
                            repeat;
                        }
                        [] t_interval_1_max.timeout {
                            log("*** " & testcasename() & ": INCONC: Initial conditions: Condition 2 CAM#", v_i, " message not received ***");
                            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                        }
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_maxTransInterval_min.start;
                t_maxTransInterval_max.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        if (t_maxTransInterval_min.running) {
                            log("*** " & testcasename() & ": FAIL: Next CAM message received BEFORE T_GenCamMax expired ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        t_maxTransInterval_max.stop;
                        log("*** " & testcasename() & ": PASS: Next CAM message received AFTER T_GenCamMax expired ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] t_maxTransInterval_min.timeout {
                        repeat;
                    }
                    [] t_maxTransInterval_max.timeout {
                        log("*** " & testcasename() & ": FAIL: Next CAM message not received AFTER T_GenCamMax expired ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_TI_03
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_BV_04
             */
            function f_CAM_MSD_GFQ_BV_04() runs on ItsCam {
                
                // Local variables
                timer t_genCam_dcc := PICS_T_GENCAMDCC * 0.90;
                timer t_genCam_min := PICS_T_GENCAMMIN * 1.10;
                var CamInd v_camPdu;
                var HeadingValue v_headingValue;
                var HeadingValue v_changeHeadingValue := 50; // 4° == 40
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_HF_BV ( mw_HF_BV_heading( ? ) ) )) -> value v_camPdu {
                        tc_ac.stop;
                        v_headingValue := v_camPdu.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.heading.headingValue;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_changeHeading(v_changeHeadingValue);
                t_genCam_dcc.timeout;
                t_genCam_min.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_HF_BV ( mw_HF_BV_heading( (v_headingValue + v_changeHeadingValue) mod 3600) ) )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] t_genCam_min.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_BV_04
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_BV_05
             */
            function f_CAM_MSD_GFQ_BV_05() runs on ItsCam {
                
                // Local variables
                timer t_genCam_dcc := PICS_T_GENCAMDCC * 0.90;
                var ReferencePosition v_referencePosition, v_expectedReferencePosition;
                var float v_changePosValue := 8.0; // 8 >> 4m
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
garciay's avatar
garciay committed
                f_prInitialState(e_dynamicPosition200m);
                
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any  )) -> value v_camPdu {
                        tc_ac.stop;
                        v_referencePosition := v_camPdu.msgIn.cam.camParameters.basicContainer.referencePosition;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_expectedReferencePosition := f_computePositionUsingDistance(v_referencePosition, v_changePosValue);
garciay's avatar
garciay committed
                
                if (PICS_GNSS_SCENARIO_SUPPORT == false) {
garciay's avatar
garciay committed
                f_utChangePosition ( valueof ( UtChangePosition: {
                                latitude := v_expectedReferencePosition.latitude - v_referencePosition.latitude,
                                longitude := v_expectedReferencePosition.longitude - v_referencePosition.longitude,
garciay's avatar
garciay committed
                            elevation := 0 } ) );
garciay's avatar
garciay committed
                
                t_genCam_dcc.timeout;
                t_genCam_dcc.start;
                    [] camPort.receive(mw_camInd ( mw_camMsg_BC_refPos ( v_expectedReferencePosition ) )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] t_genCam_dcc.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_BV_05
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_BV_06
             */
            function f_CAM_MSD_GFQ_BV_06() runs on ItsCam {
                
                // Local variables
                timer t_genCam_dcc := PICS_T_GENCAMDCC * 0.90;
                timer t_genCam_min := PICS_T_GENCAMMIN * 1.10;
                var CamInd v_camPdu;
                var SpeedValue v_speedValue;
                var SpeedValue v_changeSpeedValue := 60; // 0,5 m/s << 0,6 m/s == 60 cm/s
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
garciay's avatar
garciay committed
                f_prInitialState(e_dynamicPosition1500m);
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_HF_BV ( mw_HF_BV_speed( ? ) ) )) -> value v_camPdu {
                        tc_ac.stop;
                        v_speedValue := v_camPdu.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_changeSpeed(v_changeSpeedValue);
                t_genCam_dcc.timeout;
                t_genCam_min.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_HF_BV ( mw_HF_BV_speed( (v_speedValue + v_changeSpeedValue) mod 16384 ) ) )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] t_genCam_min.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_BV_06
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_TI_07
             */
            function f_CAM_MSD_GFQ_TI_07() runs on ItsCam {
                
                // Local variables
                timer t_maxTransInterval_min := PICS_T_GENCAMMAX * 0.90;
                timer t_maxTransInterval_max := PICS_T_GENCAMMAX * 1.10;
                timer t_genCam_measure := PX_TWAIT;
                timer t_genCam_min;
                timer t_genCam_max;
                var float v_genCam_min;
                var float v_genCam_max;
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
garciay's avatar
garciay committed
                f_prInitialState(e_dynamicPosition1500m);
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        t_genCam_measure.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_changeSpeed(1000);
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        var float v_measured := t_genCam_measure.read;
                        tc_ac.stop;
                        v_genCam_min := v_measured * 0.9;
                        v_genCam_max := v_measured * 1.1;
                        log("*** " & testcasename() & ": INFO: Initial conditions: Anticipated CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: Anticipated CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_genCam_min.start(v_genCam_min);
                t_genCam_max.start(v_genCam_max);
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        if (t_genCam_min.running) {
                            log("*** " & testcasename() & ": FAIL: Anticipated CAM message received BEFORE T_GenCam expired ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        t_genCam_max.stop;
                        log("*** " & testcasename() & ": PASS: Anticipated CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] t_genCam_min.timeout {
                        repeat;
                    }
                    [] t_genCam_max.timeout {
                        log("*** " & testcasename() & ": FAIL: Anticipated CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_TI_07
            
            /**
             * @desc    TP Function for TC_CAM_MSD_GFQ_TI_08
             */
            function f_CAM_MSD_GFQ_TI_08() runs on ItsCam {
                
                // Local constants
                const float c_minTime := 0.90;
                const float c_maxTime := 1.10;
                if (not PICS_CAM_GENERATION or not PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION amd PICS_RSU required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();

                // Preamble
                f_prInitialState();
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        if ( ( tc_ac.read  > c_minTime )) {
                            log("*** " & testcasename() & ": PASS: CAM message received in time***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            log("*** " & testcasename() & ": FAIL: CAM message not received in time***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_GFQ_TI_08
            
        } // end group camGenerationFrequency

        group camLowerLayerParameters {
            
            /**
             * @desc    TP Function for TC_CAM_MSD_PAR_BV_01
             */
            function f_CAM_MSD_PAR_BV_01() runs on ItsCam {
                
                // Local variables
                const UInt8 c_gnNhBtpB := 2;
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camIndWithGnParameters(mw_camMsg_any, c_gnNhBtpB)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message encapsultated in BTP-B packet received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] camPort.receive(mw_camIndWithGnParameters(mw_camMsg_any, omit)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INCONC: no GN NH information in CamInd ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);  
                    }                    
                    [] camPort.receive(mw_camInd(mw_camMsg_any)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message received, but not encapsulated in BTP-B packet ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                    }                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_PAR_BV_01

            /**
             * @desc    TP Function for TC_CAM_MSD_PAR_BV_02
             */
            function f_CAM_MSD_PAR_BV_02() runs on ItsCam {
                
                // Local variables
                const UInt8 c_gnHtTsb := 5;
                const UInt8 c_GnHstSingleHop := 0;
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camIndWithGnParameters(mw_camMsg_any, -, c_gnHtTsb, c_GnHstSingleHop)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message encapsulated in SHB packet received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] camPort.receive(mw_camIndWithGnParameters(mw_camMsg_any, -, omit, omit)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": INCONC: no GN HT/HST information in CamInd ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);  
                    }                    
                    [] camPort.receive(mw_camInd(mw_camMsg_any)) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message received, but not encapsulated in SHB packet ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                    }                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_PAR_BV_02
            
            /**
             * @desc    TP Function for TC_CAM_MSD_PAR_BV_03
             */
            function f_CAM_MSD_PAR_BV_03() runs on ItsCam {
                
                // Local variables
                var CamInd v_camInd;
                
                // Test control
                if (not PICS_CAM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camIndWithGnParameters(mw_camMsg_any)) -> value v_camInd { 
                        tc_ac.stop;
                        if(not ispresent(v_camInd.gnLifetime)) {
                            log("*** " & testcasename() & ": INCONC: no GN lifetime information in CamInd ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);  
                        }
                        if(v_camInd.gnLifetime <= 1000) {
                            log("*** " & testcasename() & ": PASS: Expected CAM message received encapsulted in GN packet with correct lifetime value ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": FAIL: Expected CAM message received encapsulted in GN packet with incorrect lifetime value ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);                            
                        }  
                    }                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_PAR_BV_03
        } // end group camLowerLayerParameters

        group camGenerationSSP{
            function f_CAM_MSD_SSP_BO_XX(
                            in Oct8 p_certHashedId8,
                            in template(value) UtCamTrigger p_utEvent,