ItsCam_TestCases.ttcn 185 KB
Newer Older
filatov's avatar
filatov committed
             *         }
             *         then {
             *             the IUT sends a valid CAM
             *                 containing cam
             *                     containing camParameters
             *                         containing specialVehicleContainer
             *                             containing dangerousGoodsContainer
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/INA/BV-04
             * @reference ETSI EN 302 637-2 , Annex B.13
             */
            testcase TC_CAM_MSD_INA_BV_04() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                
                // Test control
                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);  
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_INA_BV_04
            
            /**
             * @desc Check that roadWorksContainerBasic is included if 
             *       vehicleRole is set to roadWork(4).
             * <pre>
             * Pics Selection: PICS_ROADWORKS
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT’s vehicle role being set to roadWork(4)
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             a CAM is generated
             *         }
             *         then {
             *             the IUT sends a valid CAM
             *                 containing cam
             *                     containing camParameters
             *                         containing specialVehicleContainer
             *                             containing roadWorksContainerBasic
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/INA/BV-05
             * @reference ETSI EN 302 637-2 , Annex B.14
             */
            testcase TC_CAM_MSD_INA_BV_05() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                
                // Test control
                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);  
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_INA_BV_05
            
            /**
             * @desc Check that rescueContainer is included if vehicleRole is 
             *       set to rescue(5).
             * <pre>
             * Pics Selection: PICS_RESCUE
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT’s vehicle role being set to rescue(5)
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             a CAM is generated
             *         }
             *         then {
             *             the IUT sends a valid CAM
             *                 containing cam
             *                     containing camParameters
             *                         containing specialVehicleContainer
             *                             containing rescueContainer
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/INA/BV-06
             * @reference ETSI EN 302 637-2 , Annex B.15
             */
            testcase TC_CAM_MSD_INA_BV_06() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                
                // Test control
                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);  
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_INA_BV_06
            
            /**
             * @desc Check that emergencyContainer is included if vehicleRole 
             *       is set to emergency(6).
             * <pre>
             * Pics Selection: PICS_EMERGENCY
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT’s vehicle role being set to emergency(6)
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             a CAM is generated
             *         }
             *         then {
             *             the IUT sends a valid CAM
             *                 containing cam
             *                     containing camParameters
             *                         containing specialVehicleContainer
             *                             containing emergencyContainer
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/INA/BV-07
             * @reference ETSI EN 302 637-2 , Annex B.16
             */
            testcase TC_CAM_MSD_INA_BV_07() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                
                // Test control
                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);  
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_INA_BV_07
            
            /**
             * @desc Check that safetyCarContainer is included if vehicleRole 
             *       is set to safetyCar(7).
             * <pre>
             * Pics Selection: PICS_SAFETY_CAR
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT’s vehicle role being set to safetyCar(7)
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             a CAM is generated
             *         }
             *         then {
             *             the IUT sends a valid CAM
             *                 containing cam
             *                     containing camParameters
             *                         containing specialVehicleContainer
             *                             containing safetyCarContainer
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/INA/BV-08
             * @reference ETSI EN 302 637-2 , Annex B.17
             */
            testcase TC_CAM_MSD_INA_BV_08() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                
                // Test control
                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);  
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_INA_BV_08
            
        } // end group camInformationAdaptation
        
        group camGenerationFrequency {
            
            group CAM_MSD_GFQ_BV_01 {
                
                /**
                 * @desc Check that CAMs are not generated more frequently than 
                 *       T_GenCamMin.
                 * <pre>
                 * Pics Selection: PICS_T_GENCAMMIN
                 * Initial conditions: 
                 *     with {
                 *         the IUT being in the "initial state"
                 *     }
                 * Expected behaviour:
                 *     ensure that {
                 *         when {
                 *             IUT sends a CAM
                 *         }
                 *         then {
                 *             the IUT does not send any CAM before expiry of T_GenCamMin
                 *         }
                 *     }
                 * </pre>
                 * 
                 * @version   0.0.2
                 * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-01
                 * @reference ETSI EN 302 637-2 , clause 6.1.3
                 */
                testcase TC_CAM_MSD_GFQ_BV_01() runs on ItsCam system ItsCamSystem {
                    
                    // Local variables
                    timer t_minTransInterval := PICS_T_GENCAMMIN * 0.95;
                    var SpeedValue v_speedValues[5] := { 1000, 2000, 3000, 4000, 5000 } //cm/s
                    var integer v_cntSpeed, v_cntTime;
                    var FncRetCode v_ret;
                    
                    // Test control
                    
                    // 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_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);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // 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_BV_01(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);
filatov's avatar
filatov committed
                                }
                                case (e_timeout) {
                                    log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                                }
                            }
                            t_minTransInterval.start;
                        }
                        f_utTriggerEvent(m_changeSpeed(v_speedValues[v_cntSpeed]));
                    }
                    t_minTransInterval.stop;
                    log("*** " & testcasename() & ": PASS: Generation of CAM messages was successful ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end TC_CAM_MSD_GFQ_BV_01
                
                function f_CAM_MSD_GFQ_BV_01(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_BV_01
                
            } // end group CAM_MSD_GFQ_BV_01
            
            group CAM_MSD_GFQ_BV_02 {
                
                /**
                 * @desc Check that CAMs are not generated less frequently than 
                 *       T_GenCamMax.
                 * <pre>
                 * Pics Selection: PICS_T_GENCAMMAX
                 * Initial conditions: 
                 *     with {
                 *         the IUT being in the "initial state"
                 *     }
                 * Expected behaviour:
                 *     ensure that {
                 *         when {
                 *             IUT sends a CAM
                 *         }
                 *         then {
                 *             the IUT sends another CAM before expiry of T_GenCamMax
                 *         }
                 *     }
                 * </pre>
                 * 
                 * @version   0.0.2
                 * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-02
                 * @reference ETSI EN 302 637-2 , clause 6.1.3
                 */
                testcase TC_CAM_MSD_GFQ_BV_02() runs on ItsCam system ItsCamSystem {
                    
                    // Local variables
                    timer t_maxTransInterval := PICS_T_GENCAMMAX * 1.05;
                    var integer v_cntSpeed, v_cntTime;
                    var FncRetCode v_ret;
                    
                    // Test control
                    
                    // 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);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Test Body
                    for (v_cntTime:=0; v_cntTime<10; v_cntTime:=v_cntTime + 1) {
                        v_ret := f_CAM_MSD_GFQ_BV_02(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);
filatov's avatar
filatov committed
                            }
                            case (e_timeout) {
                                log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                            }
                        }
                    }
                    t_maxTransInterval.stop;
                    log("*** " & testcasename() & ": PASS: Generation of CAM messages was successful ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poDefault();
                    f_cfDown();
                    
                } // end TC_CAM_MSD_GFQ_BV_02
                
                function f_CAM_MSD_GFQ_BV_02(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_BV_01
                
            } //end group CAM_MSD_GFQ_BV_02
            
            /**
             * @desc Check that TGenCam is set to T_GenCamMax after generating 
             *       N_GenCam due to condition 2.
             * <pre>
             * Pics Selection: PICS_T_GENCAMMAX
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT having sent a CAM at time TIME_1
             *         the IUT having sent an anticipated CAM due to condition 2 at time (TIME_1 + INTERVAL_1)
             *         the IUT having sent (N_GenCam - 1) subsequent CAMs every INTERVAL_1
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             the IUT sends CAM
             *         }
             *         then {
             *             the IUT sends another CAM after expiry of T_GenCamMax
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-03
             * @reference ETSI EN 302 637-2 , clause 6.1.3
             */
            testcase TC_CAM_MSD_GFQ_BV_03() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                timer t_maxTransInterval_min := PICS_T_GENCAMMAX * 0.95;
                timer t_maxTransInterval_max := PICS_T_GENCAMMAX * 1.05;
                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
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                              
                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);
filatov's avatar
filatov committed
                    }
                }
                f_utTriggerEvent(m_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);
filatov's avatar
filatov committed
                    }
                }
                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);
filatov's avatar
filatov committed
                            }
                            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);
filatov's avatar
filatov committed
                        }
                    }
                }
                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);
filatov's avatar
filatov committed
                        }
                        t_maxTransInterval_max.stop;
                        log("*** " & testcasename() & ": PASS: Next CAM message received AFTER T_GenCamMax expired ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] 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);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_GFQ_BV_03
            
            /**
             * @desc Check that CAM is generated immediately when the time 
             *       elapsed since the last CAM generation is equal or larger 
             *       than T_GenCam_Dcc and the absolute difference between 
             *       current direction of the originating ITS-S (towards North) 
             *       and  direction included in previous CAM exceeds 4°.
             * <pre>
             * Pics Selection: PICS_T_GENCAMDCC
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT having sent a CAM at time TIME_1
             *             containing cam
             *                 containing camParameters
             *                     containing highFrequencyContainer
             *                         containing basicVehicleContainerHighFrequency
             *                             containing heading set to HEADING_1
             *         the IUT not having sent any CAM since T_GenCam_Dcc
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             T_GenCam_Dcc expires
             *             and the IUT is alerted that abs(CurrentHeading – HEADING_1) > 4°
             *         }
             *         then {
             *             the IUT sends a CAM immediately
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-04
             * @reference ETSI EN 302 637-2 , clause 6.1.3
             */
            testcase TC_CAM_MSD_GFQ_BV_04() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                timer t_genCam_Dcc := PICS_T_GENCAMDCC * 0.95;
                var CamInd v_camPdu;
                var HeadingValue v_headingValue;
                var HeadingValue v_changeHeadingValue := 50; // 4° == 40
                
                // Test control
                
                // 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;
                        t_genCam_Dcc.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);
filatov's avatar
filatov committed
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_genCam_Dcc.timeout;
                f_utTriggerEvent(m_changeHeading(v_changeHeadingValue));
                t_genCam_Dcc.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);
filatov's avatar
filatov committed
                    }
                    [] t_genCam_Dcc.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_GFQ_BV_04
            
            /**
             * @desc Check that CAM is generated immediately when the time 
             *       elapsed since the last CAM generation is equal or larger 
             *       than T_GenCam_Dcc and the current position and position 
             *       included in previous CAM exceeds 4 m.
             * <pre>
             * Pics Selection: PICS_T_GENCAMDCC
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT having sent a CAM at time TIME_1
             *             containing cam
             *                 containing camParameters
             *                     containing basicContainer 
             *                         containing referencePosition set to POSITION_1
             *         the IUT not having sent any CAM since T_GenCam_Dcc
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             T_GenCam_Dcc expires
             *             and the IUT is alerted that distance(CurrentPosition – POSITION_1) > 4 m
             *         }
             *         then {
             *             the IUT sends a CAM immediately
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-05
             * @reference ETSI EN 302 637-2 , clause 6.1.3
             */
            testcase TC_CAM_MSD_GFQ_BV_05() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                timer t_genCam_Dcc := PICS_T_GENCAMDCC * 0.95;
                var CamInd v_camPdu;
                var ReferencePosition v_referencePosition;
                var integer v_changePosValue := 4; // 4m
                
                // Test control
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                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;
                        t_genCam_Dcc.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);
filatov's avatar
filatov committed
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_genCam_Dcc.timeout;
                v_referencePosition := f_computePositionUsingDistance(v_referencePosition, v_changePosValue);
                f_utChangePosition ( valueof ( UtChangePosition: {
filatov's avatar
filatov committed
                            latitude := v_referencePosition.latitude,
                            longitude := v_referencePosition.longitude,
filatov's avatar
filatov committed
                t_genCam_Dcc.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_BC_refPos ( v_referencePosition ) )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] t_genCam_Dcc.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_GFQ_BV_05
            
            /**
             * @desc Check that CAM is generated immediately when the time 
             *       elapsed since the last CAM generation is equal or larger 
             *       than T_GenCam_Dcc and the absolute difference between 
             *       current speed and speed included in previous CAM 
             *       exceeds 0,5 m/s.
             * <pre>
             * Pics Selection: PICS_T_GENCAMDCC
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT having sent a CAM at time TIME_1
             *             containing cam
             *                 containing camParameters
             *                     containing highFrequencyContainer
             *                         containing basicVehicleContainerHighFrequency
             *                             containing speed set to SPEED_1
             *         the IUT not having sent any CAM since T_GenCam_Dcc
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *            T_GenCam_Dcc expires
             *            and the IUT is alerted that abs(CurrentSpeed – SPEED_1) > 0,5 m/s
             *         }
             *         then {
             *             the IUT sends a CAM immediately
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-06
             * @reference ETSI EN 302 637-2 , clause 6.1.3
             */
            testcase TC_CAM_MSD_GFQ_BV_06() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                timer t_genCam_Dcc := PICS_T_GENCAMDCC * 0.95;
                var CamInd v_camPdu;
                var SpeedValue v_speedValue;
                var SpeedValue v_changeSpeedValue := 50; // 0,5 m/s == 50 cm/s
                
                // Test control
                
                // 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_speed( ? ) ) )) -> value v_camPdu {
                        tc_ac.stop;
                        v_speedValue := v_camPdu.msgIn.cam.camParameters.highFrequencyContainer.basicVehicleContainerHighFrequency.speed.speedValue;
                        t_genCam_Dcc.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);
filatov's avatar
filatov committed
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_genCam_Dcc.timeout;
                f_utTriggerEvent(m_changeSpeed(v_changeSpeedValue));
                t_genCam_Dcc.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);
filatov's avatar
filatov committed
                    }
                    [] t_genCam_Dcc.timeout {
                        log("*** " & testcasename() & ": FAIL: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_GFQ_BV_06
            
            /**
             * @desc Check that CAM is generated immediately when the time 
             *       elapsed since the last CAM generation is equal or larger 
             *       than T_GenCam and equal or larger than T_GenCam_Dcc.
             * <pre>
             * Pics Selection: PICS_T_GENCAM AND PICS_T_GENCAMDCC
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *         the IUT having sent a CAM
             *     }
             * Expected behaviour:
             *     ensure that {
             *         when {
             *             T_GenCam expires
             *             and T_GenCam_Dcc expires
             *         }
             *         then {
             *             the IUT sends another CAM
             *         }
             *     }
             * </pre>
             * 
             * @version   0.0.2
             * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSD/GFQ/BV-07
             * @reference ETSI EN 302 637-2 , clause 6.1.3
             */
            testcase TC_CAM_MSD_GFQ_BV_07() runs on ItsCam system ItsCamSystem {
                
                // Local variables
                timer t_maxTransInterval_min := PICS_T_GENCAMMAX * 0.95;
                timer t_maxTransInterval_max := PICS_T_GENCAMMAX * 1.05;
                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