ItsCam_TpFunctions.ttcn 146 KB
Newer Older
/**
 *    @author   ETSI STF484
 *    @version  $URL$
 *              $Id$
 *    @desc     CAM TP functions
 *
 */

module ItsCam_TpFunctions {
    
garciay's avatar
garciay committed
    import from LibItsCommon_Pixits all;

    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Pixits all;
    
garciay's avatar
garciay committed
    // LibItsCAM
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Functions all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Pics {modulepar all;}
    import from LibItsCam_Pixits {modulepar all;}
garciay's avatar
garciay committed
    // ASN.1
    import from ITS_Container language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;

    // 5.2.1
    group camMessageDissemination { 
        
        group camMessageFormat {
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_01
             */
            function f_CAM_MSD_FMT_BV_01() 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;
                }              
                
                // 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_camInd ( mw_camMsg_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_FMT_BV_01
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_02
             */
            function f_CAM_MSD_FMT_BV_02() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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_camInd ( mw_camMsg_LF_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message not received ***");
                        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_FMT_BV_02
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_03
             */
            function f_CAM_MSD_FMT_BV_03() runs on ItsCam {
                
                // Local variables
                timer t_minTransInterval := c_lowFrequencyGenerationTime * 1.10;
                var SpeedValue v_speedValues[5] := { 1000, 2000, 3000, 4000, 5000 } //cm/s
                var integer v_cntSpeed, v_cntTime;
                var CamInd v_camInd;
                var boolean v_nextCamWithLF := false;
                const integer c_cntTimeLimit := 10;
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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_LF_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) {
                    f_changeSpeed(v_speedValues[v_cntSpeed]);
                    v_cntTime := 0;
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_LF_any )) {
                            tc_ac.stop; 
                            v_cntTime := v_cntTime + 1;
                            if (v_cntTime == c_cntTimeLimit) { // Exit message loop
                                log("*** " & testcasename() & ": INFO: The subset of CAM messages including lowFrequencyContainer was received ***");
                                t_minTransInterval.start;
                                v_nextCamWithLF := false;                                
                            }
                            else {
                                log("*** " & testcasename() & ": INFO: CAM retransmission with LowFrequency container ***"); 
                                tc_ac.start;
                                t_minTransInterval.start;
                                v_nextCamWithLF := false;
                                repeat;
                            }
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )) -> value v_camInd {
                            tc_ac.stop;
                            if(v_nextCamWithLF == true) {
                                log("*** " & testcasename() & ": FAIL: No LowFrequency container in received CAM ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                log("*** " & testcasename() & ": INFO: CAM retransmission w/o LowFrequency container ***"); 
                                tc_ac.start;
                                repeat;
                        }
                        [] t_minTransInterval.timeout {
                            v_nextCamWithLF := true;
                            log("*** " & testcasename() & ": INFO: Next CAM shall contain LowFrequency container ***");
                            repeat;  
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    } 
                } 
                log("*** " & testcasename() & ": PASS: Generation of CAM messages including lowFrequencyContainer was successful ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_FMT_BV_03
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_04
             */
            function f_CAM_MSD_FMT_BV_04() runs on ItsCam {
                
                // Local variables
                var VehicleRole v_vehicleRole := c_vehicleRole_roadWork;
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                if (not PICS_SPECIALVEHICLECONTAINER) {
                    testcase.stop(testcasename() & ": PICS_SPECIALVEHICLECONTAINER needs 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(v_vehicleRole));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC_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_FMT_BV_04
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_05
             */
            function f_CAM_MSD_FMT_BV_05() runs on ItsCam {
                
                // Local variables
                timer t_minTransInterval := c_specialVehicleGenerationTime * 1.10;
                var VehicleRole v_vehicleRole := roadWork;
                var SpeedValue v_speedValues[5] := { 1000, 2000, 3000, 4000, 5000 } //cm/s
                var integer v_cntSpeed, v_cntTime;
                var CamInd v_camInd;
                var boolean v_nextCamWithSVC := false;
                const integer c_cntTimeLimit := 10;
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                if (not PICS_SPECIALVEHICLECONTAINER) {
                    testcase.stop(testcasename() & ": PICS_SPECIALVEHICLECONTAINER needs to be set to true");
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
garciay's avatar
garciay committed
                f_prInitialState(e_dynamicPosition1500m);
                // Set vehicle role
                f_utTriggerEvent(m_setVehicleRole(v_vehicleRole));
                camPort.clear;
                tc_ac.start;
                alt {
                     [] camPort.receive(mw_camInd ( mw_camMsg_SVC_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) {
                    f_changeSpeed(v_speedValues[v_cntSpeed]);
                    v_cntTime := 0;
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_SVC_any )) {
                            tc_ac.stop; 
                            v_cntTime := v_cntTime + 1;
                            if (v_cntTime == c_cntTimeLimit) { // Exit message loop
                                log("*** " & testcasename() & ": INFO: The subset of CAM messages including specialVehicleContainer was received ***");
                                t_minTransInterval.start;
                                v_nextCamWithSVC := false;                                
                            }
                            else {
                                log("*** " & testcasename() & ": INFO: CAM retransmission with SpecialVehicle container ***"); 
                                tc_ac.start;
                                t_minTransInterval.start;
                                v_nextCamWithSVC := false;
                                repeat;
                            }
                        }
                        [] camPort.receive(mw_camInd ( mw_camMsg_any )) -> value v_camInd {
                            tc_ac.stop;
                            if(v_nextCamWithSVC == true) {
                                log("*** " & testcasename() & ": FAIL: No SpecialVehicle container in received CAM ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            else {
                                log("*** " & testcasename() & ": INFO: CAM retransmission w/o SpecialVehicle container ***"); 
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] t_minTransInterval.timeout {
                            v_nextCamWithSVC := true;
                            log("*** " & testcasename() & ": INFO: Next CAM shall contain SpecialVehicle container ***");
                            repeat;  
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    } 
                } 
                log("*** " & testcasename() & ": PASS: Generation of CAM messages including SpecialVehicleContainer was successful ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_FMT_BV_05
            
        } // end group camMessageFormat
        
        group camInformationAdaptation {
            
            group camInVehicleData {
                
                type record of UtCamTrigger UtCamTriggers;
                type record of CAM CamPdus;
                
                function f_CAM_MSD_INA_BV_01(in charstring p_INFO, in template (value) UtCamTriggers p_utTriggers, in template (present) CamPdus p_camPdus) runs on ItsCam {
                    
                    // Local variables
                    var integer v_cnt;
                    
                    log("*** " & testcasename() & ": Checking INFO==" & p_INFO & " ***");
                    
                    if (lengthof(p_utTriggers) != lengthof(p_camPdus)) {
                        log("*** " & testcasename() & ": INCONC: Invalid testcase configuration: Number of event triggers and expected CAM messages differs ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    for (v_cnt:=0; v_cnt<lengthof(p_utTriggers); v_cnt:=v_cnt+1) {
                        f_utTriggerEvent(p_utTriggers[v_cnt]);
                        
                        tc_ac.start;
                        alt {
                            [] camPort.receive( mw_camInd ( p_camPdus[v_cnt] )){ 
                                tc_ac.stop;
                                if (v_cnt==lengthof(p_utTriggers)-1) {
                                    log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                                }
                                else {
                                    log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                }
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                        }
                    }
                }
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_01
                 */
                 // TODO yann/ifsttar: why 3601? 0 and 3600 indicates the north!!!!
                function f_CAM_MSD_INA_BV_01_01() runs on ItsCam {
                    
                    // Local variables
                    var CamInd v_camInd;
                    var template (present) CurvatureValue v_curVal := ?;
                    var boolean v_initialReceived := false;
                    const CurvatureValue c_curValOffset := 1;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & "c 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
                    log("*** " & testcasename() & ": Checking INFO==Curvature value ***");
                    
                    // change the curvature value to retrieve the current value
                    f_utTriggerEvent(m_changeCurvature(c_curValOffset));
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive( mw_camInd ( mw_camMsg_HF_BV(mw_HF_BV_curvature(v_curVal)) )) -> value v_camInd {
                            tc_ac.stop;
                            if (v_initialReceived) {
                                log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                            }
                            else {
                                log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                v_initialReceived := true;
                                //change again the curvature value and set the expectation to the measured value
                                if (v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.curvature.curvatureValue >= 0) {
                                    v_curVal := (v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.curvature.curvatureValue + c_curValOffset) mod 30001;
                                } else { // TODO Add negative value case
                                    v_curVal := v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.curvature.curvatureValue - c_curValOffset;
                                    if (valueof(v_curVal) < -30000) {
                                        v_curVal := 0; // yann/ifsttar TODO It's not a true negative modulus operation
                                f_utTriggerEvent(m_changeCurvature(c_curValOffset));
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] 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_01_01
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_02
                 */
                function f_CAM_MSD_INA_BV_01_02() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Brake pedal being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_brakePedalEngaged_) }, 
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_brakePedalActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_02
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_03
                 */
                function f_CAM_MSD_INA_BV_01_03() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Brake pedal being deactivated", 
                        { m_setAccelerationControlStatus(AccelerationControl_brakePedalEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_brakePedalActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_brakePedalActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_03
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_04
                 */
                function f_CAM_MSD_INA_BV_01_04() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Gas pedal being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_gasPedalEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_gasPedalActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_04
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_05
                 */
                function f_CAM_MSD_INA_BV_01_05() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Gas pedal being deactivated", 
                        { m_setAccelerationControlStatus(AccelerationControl_gasPedalEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_gasPedalActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_gasPedalActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_05
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_06
                 */
                function f_CAM_MSD_INA_BV_01_06() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Emergency brake being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_emergencyBrakeEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_emergencyBrakeActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_06
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_07
                 */
                function f_CAM_MSD_INA_BV_01_07() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Emergency brake being deactivated", 
                        { m_setAccelerationControlStatus(AccelerationControl_emergencyBrakeEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_emergencyBrakeActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_emergencyBrakeActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_07
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_08
                 */
                function f_CAM_MSD_INA_BV_01_08() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Collision warning being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_collisionWarningEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_collisionWarningActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_08
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_09
                 */
                function f_CAM_MSD_INA_BV_01_09() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Collision warning being deactivated",
                        { m_setAccelerationControlStatus(AccelerationControl_collisionWarningEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_collisionWarningActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_collisionWarningActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_09
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_10
                 */
                function f_CAM_MSD_INA_BV_01_10() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "ACC being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_accEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_accActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_10
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_11
                 */
                function f_CAM_MSD_INA_BV_01_11() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "ACC being deactivated",
                        { m_setAccelerationControlStatus(AccelerationControl_accEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_accActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_accActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_11
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_12
                 */
                function f_CAM_MSD_INA_BV_01_12() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Cruise control being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_cruiseControlEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_cruiseControl_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_12
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_13
                 */
                function f_CAM_MSD_INA_BV_01_13() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Cruise control being deactivated",
                        { m_setAccelerationControlStatus(AccelerationControl_cruiseControlEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_cruiseControl_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_cruiseControl_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_13
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_14
                 */
                function f_CAM_MSD_INA_BV_01_14() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Speed limiter being activated", 
                        { m_setAccelerationControlStatus(AccelerationControl_speedLimiterEngaged_) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_speedLimiterActive_On)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_14
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_15
                 */
                function f_CAM_MSD_INA_BV_01_15() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Speed limiter control being deactivated", 
                        { m_setAccelerationControlStatus(AccelerationControl_speedLimiterEngaged_), m_setAccelerationControlStatus(c_accCtrlIdle) },
                        { mw_camMsg_HF_BV(mw_HF_BV_accCtrl(mw_speedLimiterActive_On)), mw_camMsg_HF_BV(mw_HF_BV_accCtrl((omit, mw_speedLimiterActive_Off))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_15
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_16
                 */
                function f_CAM_MSD_INA_BV_01_16() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Low beam headlights being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_lowBeamHeadlightsOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_lowBeamLightsOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_16
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_17
                 */
                function f_CAM_MSD_INA_BV_01_17() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Low beam headlights being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_lowBeamHeadlightsOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_lowBeamLightsOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_lowBeamLightsOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_17
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_18
                 */
                function f_CAM_MSD_INA_BV_01_18() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "High beam headlights being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_highBeamHeadlightsOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_highBeamLightsOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_18
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_19
                 */
                function f_CAM_MSD_INA_BV_01_19() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "High beam headlights being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_highBeamHeadlightsOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_highBeamLightsOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_highBeamLightsOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_19
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_20
                 */
                function f_CAM_MSD_INA_BV_01_20() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Left turn signal being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_leftTurnSignalOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_leftTurnSignalOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_20
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_21
                 */
                function f_CAM_MSD_INA_BV_01_21() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Left turn signal being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_leftTurnSignalOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_leftTurnSignalOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_leftTurnSignalOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_21
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_22
                 */
                function f_CAM_MSD_INA_BV_01_22() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Right turn signal being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_rightTurnSignalOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_rightTurnSignalOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_22
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_23
                 */
                function f_CAM_MSD_INA_BV_01_23() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Right turn signal being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_rightTurnSignalOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_rightTurnSignalOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_rightTurnSignalOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_23
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_24
                 */
                function f_CAM_MSD_INA_BV_01_24() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01( 
                        "Daytime running lights being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_daytimeRunningLightsOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_daytimeRunningLightsOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_24
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_25
                 */
                function f_CAM_MSD_INA_BV_01_25() runs on ItsCam {
                    
                    // Local variables
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }              
                    
                    // Test control
                    
                    // Test component configuration
                    f_cfUp();
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prInitialState();
                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                    // Test Body
                    f_CAM_MSD_INA_BV_01(
                        "Daytime running lights being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_daytimeRunningLightsOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_daytimeRunningLightsOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_daytimeRunningLightsOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_25
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_26
                 */
                function f_CAM_MSD_INA_BV_01_26() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Reverse light being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_reverseLightOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_reverseLightOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_26
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_27
                 */
                function f_CAM_MSD_INA_BV_01_27() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Reverese light being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_reverseLightOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_reverseLightOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_reverseLightOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_27
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_28
                 */
                function f_CAM_MSD_INA_BV_01_28() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Fog lights being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_fogLightOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_fogLightOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_28
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_29
                 */
                function f_CAM_MSD_INA_BV_01_29() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Fog lights being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_fogLightOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_fogLightOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_fogLightOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_29
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_30
                 */
                function f_CAM_MSD_INA_BV_01_30() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Parking lights being activated", 
                        { m_setExteriorLightsStatus(ExteriorLights_parkingLightsOn_) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_parkingLightsOn)) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_30
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_31
                 */
                function f_CAM_MSD_INA_BV_01_31() runs on ItsCam {
                    
                    // Local variables
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    f_CAM_MSD_INA_BV_01(
                        "Parking lights being deactivated", 
                        { m_setExteriorLightsStatus(ExteriorLights_parkingLightsOn_), m_setExteriorLightsStatus(c_elAllLightsOff) },
                        { mw_camMsg_LF_BV(mw_LF_BV_extLights(mw_parkingLightsOn)), mw_camMsg_LF_BV(mw_LF_BV_extLights((omit, mw_parkingLightsOff))) }
                    );
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end f_CAM_MSD_INA_BV_01_31
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_32
                 */
                function f_CAM_MSD_INA_BV_01_32() runs on ItsCam {
                    
                    // Local variables
                    var CamInd v_camInd;
                    var template (present) HeadingValue v_headingVal := ?;
                    var boolean v_initialReceived := false;
                    const HeadingValue c_headingValOffset := 1;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    log("*** " & testcasename() & ": Checking INFO==Heading value ***");
                    
                    // change the heading value to retrieve the current value
                    f_changeHeading(c_headingValOffset);
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive( mw_camInd ( mw_camMsg_HF_BV(mw_HF_BV_heading(v_headingVal)) )) -> value v_camInd {
                            tc_ac.stop;
                            if (v_initialReceived) {
                                log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                            }
                            else {
                                log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                v_initialReceived := true;
                                //change again the heading value and set the expectation to the measured value
                                v_headingVal := (v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.heading.headingValue+c_headingValOffset) mod 3601;
                                f_changeHeading(c_headingValOffset);
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] 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_01_32
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_33
                 */
                function f_CAM_MSD_INA_BV_01_33() runs on ItsCam {
                    
                    // Local variables
                    var CamInd v_camInd;
                    var template (present) SpeedValue v_speedVal := ?;
                    var boolean v_initialReceived := false;
                    const SpeedValue c_speedValOffset := 100;
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    log("*** " & testcasename() & ": Checking INFO==Speed value ***");
                    
                    // change the speed value to retrieve the current value
                    f_changeSpeed(c_speedValOffset);
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive( mw_camInd ( mw_camMsg_HF_BV(mw_HF_BV_speed(v_speedVal)) )) -> value v_camInd {
                            tc_ac.stop;
                            if (v_initialReceived) {
                                log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                            }
                            else {
                                log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                v_initialReceived := true;
                                //change again the speed value and set the expectation to the measured value
                                v_speedVal := (v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue+c_speedValOffset) mod 16384;
                                f_changeSpeed(c_speedValOffset);
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] 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_01_33
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_34
                 */
                function f_CAM_MSD_INA_BV_01_34() runs on ItsCam {
                    
                    // Local variables
                    var CamInd v_camInd;
                    var DriveDirection v_driveVal := backward;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    log("*** " & testcasename() & ": Checking INFO==Drive direction value ***");
                    
                    // change the drive direction
                    f_utTriggerEvent(m_setDriveDirection(v_driveVal));
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive( mw_camInd ( mw_camMsg_HF_BV(mw_HF_BV_driveDirection(v_driveVal)) )) -> value v_camInd {
                            tc_ac.stop;
                            if (v_driveVal==forward) {
                                log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                            }
                            else {
                                log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                //change again the drive direction and set the expectation to the measured value
                                v_driveVal := forward;
                                f_utTriggerEvent(m_setDriveDirection(v_driveVal));
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] 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_01_34
                
                /**
                 * @desc    TP Function for TC_CAM_MSD_INA_BV_01_35
                 */
                function f_CAM_MSD_INA_BV_01_35() runs on ItsCam {
                    
                    // Local variables
                    var CamInd v_camInd;
                    var template (present) YawRateValue v_yawRateVal := ?;
                    var boolean v_initialReceived := false;
                    const YawRateValue c_yawRateValOffset := 1;
                    
                    // Test control
                    if (not PICS_CAM_GENERATION or PICS_RSU) {
                        log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                    log("*** " & testcasename() & ": Checking INFO==Yaw rate value ***");
                    
                    // change the yaw rate value to retrieve the current value
                    f_utTriggerEvent(m_changeYawRate(c_yawRateValOffset));
                    
                    tc_ac.start;
                    alt {
                        [] camPort.receive( mw_camInd ( mw_camMsg_HF_BV(mw_HF_BV_yawRate(v_yawRateVal)) )) -> value v_camInd {
                            tc_ac.stop;
                            if (v_initialReceived) {
                                log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success); 
                            }
                            else {
                                log("*** " & testcasename() & ": PRECONDITION: Expected CAM message received ***");
                                v_initialReceived := true;
                                //change again the yaw rate value and set the expectation to the measured value
                               v_yawRateVal := v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.yawRate.yawRateValue;
                                if (valueof(v_yawRateVal)>=32767) { // FIXME Yann/ifsttar: quid if we receive -32768
                                                                    // FIXME if current value is 32760 and offset applied, we shall not expect posiive value
1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196
                                    v_yawRateVal := -32766;
                                }
                                else {
                                    v_yawRateVal := v_camInd.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.yawRate.yawRateValue+c_yawRateValOffset;
                                }
                                f_utTriggerEvent(m_changeYawRate(c_yawRateValOffset));
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] 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_01_35
                
            } // end group camInVehicleData
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_02
             */
            function f_CAM_MSD_INA_BV_02() 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_PUBLICTRANS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_PUBLICTRANS 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_publicTransport));
                
                // Test Body
                log("*** " & testcasename() & ": Expected template: ", mw_camInd ( mw_camMsg_SVC( mw_publicTransport_any )), " ***");
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_publicTransport_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_02
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_03
             */
            function f_CAM_MSD_INA_BV_03() 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_SPECIALTRANS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_SPECIALTRANS 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_specialTransport));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_specialTransport_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_03
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_04
             */
            function f_CAM_MSD_INA_BV_04() 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_DANGEROUSGOODS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_DANGEROUSGOODS 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_dangerousGoods));
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_SVC( mw_dangerousGoods_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_04
            
            /**
             * @desc    TP Function for TC_CAM_MSD_INA_BV_05
             */
            function f_CAM_MSD_INA_BV_05() 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_ROADWORKS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_ROADWORKS 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_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,
                            in template(present) CAM pmw_CamMsg  
            ) 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_IS_IUT_SECURED) {
                    log("*** " & testcasename() & ": PICS_IS_IUT_SECURED required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                              
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                f_acTriggerSecEvent(m_setAtCertificate("")); // TODO Set constants for the certificate names
                
                // Preamble
                // TODO: initialize IUT with given certificate
                f_prInitialState( e_staticPosition, true, {
                    hashedId8 := p_certHashedId8
                });
                    
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // execute UT Command
                f_utTriggerEvent(p_utEvent);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd (  pmw_CamMsg )) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": PASS: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_SSP_BO_XX
                          
    
            function f_CAM_MSD_SSP_BO_01() runs on ItsCam {
                
                // TODO: make template for tolling
                log("*** " & testcasename() & ": This TC is not implemented yet ***");
                setverdict(inconc);
                stop;
            } // end f_CAM_MSD_SSP_BO_01

            function f_CAM_MSD_SSP_BO_02() runs on ItsCam {

                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_PUBLICTRANS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_PUBLICTRANS need to be set to true");
                }

                f_CAM_MSD_SSP_BO_XX(PX_CERT_IUT_CAM_02,
                                    m_setVehicleRole(c_vehicleRole_publicTransport),
                                    mw_camMsg_SVC ( mw_publicTransport_any )
                );

            } // end f_CAM_MSD_SSP_BO_02

            function f_CAM_MSD_SSP_BO_03() runs on ItsCam {

                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_SPECIALTRANS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_SPECIALTRANS need to be set to true");
                }
                f_CAM_MSD_SSP_BO_XX(PX_CERT_IUT_CAM_03,
                                    m_setVehicleRole(c_vehicleRole_specialTransport),
                                    mw_camMsg_SVC ( mw_specialTransport_any )
                );
            } // end f_CAM_MSD_SSP_BO_03
        }
                    
    } // end group camSSP
      
    group camMessageProcessing {
        
        /**
         * @desc    TP Function for TC_CAM_MSP_BV_01
         */
        function f_CAM_MSP_BV_01() runs on ItsCam {
            
            // Local variables
            var CamReq v_camReq;
            var integer i;
            
            // Test control
            if (not PICS_CAM_RECEPTION) {
                log("*** " & testcasename() & ": PICS_CAM_RECEPTION 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
            v_camReq := valueof(
                            m_camReq(
                                m_camMsg_vehicle(
                                    f_getTsStationId(),
                                    f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                    m_tsPosition
                                )
                            )
                        );
            camPort.send( v_camReq ) ;
            
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_camReq.msgOut, vc_utEvents[i].camMsg); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": PASS: CAM was transmitted to upper layer ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                log("*** " & testcasename() & ": FAIL: CAM was not transmitted to upper layer ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
            }
            
            // Postamble
            f_poDefault();
            f_cfDown();
            
        } // end f_CAM_MSP_BV_01
        
        group camProcessingSSP{
            /**
             * @desc    TP Function for TC_CAM_MSP_SSP_BV_XX
             * @param p_certName Certificate to be used to sign the CAM message
             * @param p_camMsg   CAM value template to be sent to IUT 
             */
            function f_CAM_MSP_SSP_BV_XX(
                in charstring p_certName,
                in template (value) CAM p_camMsg
            ) runs on ItsCam {
                
                // Local variables
                var CamReq v_camReq;
                var integer i;
                
                // Test control
                if (not PICS_CAM_RECEPTION) {
                    log("*** " & testcasename() & ": PICS_CAM_RECEPTION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                if (not PICS_IS_IUT_SECURED) {
                    log("*** " & testcasename() & ": PICS_IS_IUT_SECURED required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                // TODO: instruct adapter to use certName to sign the message 
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_camReq := valueof(
                                m_camReq(
                                )
                            );
                camPort.send( v_camReq ) ;
                
                f_sleep(PX_TNOAC);
                for(i:=0; i < lengthof(vc_utEvents) and not match(v_camReq.msgOut, vc_utEvents[i].camMsg); i:=i+1) {
                    // empty on purpose 
                }
                if(i < lengthof(vc_utEvents)) {
                    log("*** " & testcasename() & ": FAIL: CAM was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: CAM was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSP_SSP_BV_XX
    
            function f_CAM_MSP_SSP_BV_01() runs on ItsCam {
                // TODO: make template for tolling
                log("*** " & testcasename() & ": This TC is not implemented yet ***");
                setverdict(inconc);
                stop;
            } // end f_CAM_MSP_SSP_BV_01
    
            function f_CAM_MSP_SSP_BV_02() runs on ItsCam {
    
                f_CAM_MSP_SSP_BV_XX("CERT_TS_CAM_02",
                                m_camMsg_publicTransport(
                                    f_getTsStationId(),
                                    f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                    m_tsPosition
                                )
                );
            } // end f_CAM_MSP_SSP_BV_03
            
            function f_CAM_MSP_SSP_BV_03() runs on ItsCam {
    
                f_CAM_MSP_SSP_BV_XX("CERT_TS_CAM_03",
                                m_camMsg_specialTransport(
                                    f_getTsStationId(),
                                    f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                    m_tsPosition
                                )
                );
            } // end f_CAM_MSP_SSP_BV_03
        }// end group camProcessingSSP
    } // end group camMessageProcessing
    
} // end ItsCam_TpFunctions