示例#1
0
        /// <summary>
        ///   Executes a transition of the model.
        /// </summary>
        protected override void ExecuteTransition()
        {
            //TODO: _resetRewards();

            foreach (var fault in RuntimeModel.NondeterministicFaults)
            {
                fault.Reset();
            }

            if (_activateIndependentFaultsAtStepBeginning)
            {
                // Note: Faults get activated and their effects occur, but they are not notified yet of their activation.
                foreach (var fault in RuntimeModel.NondeterministicFaults)
                {
                    fault.TryActivate();
                }
            }

            RuntimeModel.ExecuteStep();

            if (!_activateIndependentFaultsAtStepBeginning)
            {
                // force activation of non-transient faults
                foreach (var fault in RuntimeModel.NondeterministicFaults)
                {
                    if (!(fault is Modeling.TransientFault))
                    {
                        fault.TryActivate();
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        ///   Replays the transition of the counter example with the zero-baesd <paramref name="transitionIndex" />.
        /// </summary>
        /// <param name="choiceResolver">The choice resolver that should be used to resolve nondeterministic choices.</param>
        /// <param name="transitionIndex">The zero-based index of the transition that should be replayed.</param>
        internal unsafe void Replay(ChoiceResolver choiceResolver, int transitionIndex)
        {
            if (StepCount == 0)
            {
                return;
            }

            choiceResolver.Clear();
            choiceResolver.PrepareNextState();
            choiceResolver.SetChoices(ReplayInfo[transitionIndex]);

            fixed(byte *state = States[transitionIndex])
            RuntimeModel.Deserialize(state);

            foreach (var fault in RuntimeModel.NondeterministicFaults)
            {
                fault.Reset();
            }

            if (transitionIndex == 0)
            {
                RuntimeModel.ExecuteInitialStep();
            }
            else
            {
                RuntimeModel.ExecuteStep();
            }

            RuntimeModel.NotifyFaultActivations();
        }
示例#3
0
        /// <summary>
        ///   Executes a transition of the model.
        /// </summary>
        protected override void ExecuteTransition()
        {
            //TODO: _resetRewards();

            RuntimeModel.ExecuteStep();


            switch (_minimalizationMode)
            {
            case EffectlessFaultsMinimizationMode.Disable:
                // Activate all faults
                // Note: Faults get activated and their effects occur, but they are not notified yet of their activation.
                foreach (var fault in RuntimeModel.NondeterministicFaults)
                {
                    fault.TryActivate();
                }
                break;

            case EffectlessFaultsMinimizationMode.DontActivateEffectlessTransientFaults:
                // Activate all non-transient faults
                foreach (var fault in RuntimeModel.NondeterministicFaults)
                {
                    if (!(fault is Modeling.TransientFault))
                    {
                        fault.TryActivate();
                    }
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#4
0
        /// <summary>
        ///   Runs a step of the simulation. Returns <c>false</c> to indicate that the simulation is completed.
        /// </summary>
        public void SimulateStep()
        {
            Prune();

            var state = stackalloc byte[_runtimeModel.StateVectorSize];

            if (_counterExample == null)
            {
                _runtimeModel.ExecuteStep();

                _runtimeModel.Serialize(state);
                AddState(state);
            }
            else
            {
                if (_stateIndex + 1 >= _counterExample.StepCount)
                {
                    return;
                }

                _counterExample.DeserializeState(_stateIndex + 1);
                _runtimeModel.Serialize(state);

                EnsureStatesMatch(state, _counterExample.GetState(_stateIndex + 1));

                AddState(state);
                Replay();
            }
        }
示例#5
0
        /// <summary>
        ///   Executes a transition of the model.
        /// </summary>
        protected override void ExecuteTransition()
        {
            //TODO: _resetRewards();

            foreach (var fault in RuntimeModel.NondeterministicFaults)
            {
                fault.Reset();
            }

            // Note: Faults get activated and their effects occur, but they are not notified yet of their activation.
            foreach (var fault in RuntimeModel.OnStartOfStepFaults)
            {
                fault.TryActivate();
            }
            foreach (var fault in RuntimeModel.OnCustomFaults)
            {
                if (fault.HasCustomDemand())
                {
                    fault.TryActivate();
                }
                else
                {
                    fault.Activation = Activation.Suppressed;
                }
            }

            RuntimeModel.ExecuteStep();

            for (var i = 0; i < RuntimeModel.NondeterministicFaults.Length; i++)
            {
                RuntimeModel.NondeterministicFaults[i].RestoreActivation(SavedActivations[i]);
            }
        }
示例#6
0
        /// <summary>
        ///   Executes a transition of the model.
        /// </summary>
        protected override void ExecuteTransition()
        {
            foreach (var fault in RuntimeModel.NondeterministicFaults)
            {
                fault.Reset();
            }

            RuntimeModel.ExecuteStep();
        }
 /// <summary>
 ///   Executes a transition of the model.
 /// </summary>
 protected override void ExecuteTransition()
 {
     RuntimeModel.ExecuteStep();
 }