public static void TC_CrashDetectionWhileEngineOff()
    {
        // Initialize signals
        Report.TestStep("Initialize all signals...");
        LockingTestLibrary.ResetLockingTestSignals();

        // Set lock state to locked
        Report.TestStep("Set initial lock state to locked...");
        LockRequest.Value   = LockRequest.Request_lock;
        EngineRunning.Value = 0;
        Velocity.Value      = 0;
        Execution.Wait(LockRequestWaitTime.GetValue());

        // Simulate crash
        Report.TestStep("Simulate crash...");
        CrashDetected.Value = 1;
        Execution.Wait(CrashDetectionWaitingTime.GetValue());

        // Check lock state is locked
        Report.TestStep("Check expected lock state to be locked.");
        if (LockState.Value != LockState.Locked)
        {
            Report.TestStepFail("Lock state is 'unlocked'. Expected lock state is 'locked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'locked' as expected.");
        }

        // Reset signals
        Report.TestStep("Rest all signals...");
        LockingTestLibrary.ResetLockingTestSignals();
    }
    public static void TC_LockStatically()
    {
        // Initialize the system
        Report.TestStep("Initialize the system...");
        LockingTestLibrary.ResetLockingTestSignals();

        // Check lock function when engine is off
        Report.TestStep("Check lock function when engine is off...");
        EngineRunning.Value = 0;
        LockRequest.Value   = LockRequest.Request_lock;
        Execution.Wait(LockRequestWaitTime.GetValue());
        if (LockState.Value != LockState.Locked)
        {
            Report.TestStepFail("Lock state is 'unlocked'. Expected lock state is 'locked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'locked' as expected.");
        }

        // Check lock function when engine is  running
        Report.TestStep("Check lock function when engine is running...");
        EngineRunning.Value = 1;
        LockRequest.Value   = LockRequest.Request_lock;
        Execution.Wait(SysPars.LockingTests.LockRequestWaitTime.GetValue());
        if (LockState.Value != LockState.Locked)
        {
            Report.TestStepFail("Lock state is 'unlocked'. Expected lock state is 'locked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'locked' as expected.");
        }

        // Reset the system
        LockingTestLibrary.ResetLockingTestSignals();
    }
예제 #3
0
    public static void CrashDetection(int engineOn, double velocity)
    {
        // Initialize signals
        Report.TestStep("Initialize all signals...");
        ResetLockingTestSignals();

        // Set lock state to locked
        Report.TestStep("Set initial lock state to locked...");
        EngineRunning.Value = engineOn;
        Velocity.Value      = velocity;
        LockRequest.Value   = LockRequest.Request_lock;
        Execution.Wait(LockRequestWaitTime.GetValue());

        // Simulate crash
        Report.TestStep("Simulate crash...");
        CrashDetected.Value = 1;
        Execution.Wait(CrashDetectionWaitingTime.GetValue());

        // Check lock state is unlocked
        Report.TestStep("Check expected lock state to be unlocked.");
        if (LockState.Value != LockState.Unlocked)
        {
            Report.TestStepFail("Lock state is 'locked'. Expected lock state is 'unlocked'.");
        }
        else
        {
            Report.TestStepPass("Lock state is 'unlocked' as expected.");
        }

        // Check if the car remains opened, even if the velocity increases to higher than the lock-velocity
        if (engineOn == 1)
        {
            Report.TestStep("Check if the car remains opened, even if the velocity increases to higher than the lock-velocity");

            // Increase velocity to a higher value than lock-velocity

            double increasedVelocity = velocity + 10;
            if (increasedVelocity < LockVelocity.GetValue())
            {
                increasedVelocity = LockVelocity.GetValue() + 10;
            }

            Report.TestStep("Increase velocity: Set velocity to " + increasedVelocity);
            Velocity.Value = increasedVelocity;
            Execution.Wait(CrashDetectionWaitingTime.GetValue());

            // Check lock state is still unlocked
            Report.TestStep("Check expected lock state to be unlocked.");
            if (LockState.Value != LockState.Unlocked)
            {
                Report.TestStepFail("Lock state is 'locked'. Expected lock state is 'unlocked'.");
            }
            else
            {
                Report.TestStepPass("Lock state is 'unlocked' as expected.");
            }
        }

        // Reset signals
        Report.TestStep("Rest all signals...");
        ResetLockingTestSignals();
    }