Exemplo n.º 1
0
        public void SetAnalysisMode(AnalysisMode mode)
        {
            ObserverController.Mode = mode;
            var agents = ObserverController.Agents;

            switch (mode)
            {
            case AnalysisMode.TolerableFaults:
                agents.Select(agent => agent.ConfigurationUpdateFailed).SuppressActivations();
                Workpieces.Select(workpiece => workpiece.IncorrectlyPositionedFault).SuppressActivations();
                Workpieces.Select(workpiece => workpiece.ToolApplicationFailed).SuppressActivations();
                Robots.Select(robot => robot.SwitchToWrongToolFault).SuppressActivations();
                Carts.Select(cart => cart.Lost).SuppressActivations();
                ObserverController.ReconfigurationFailure.SuppressActivation();
                break;

            case AnalysisMode.IntolerableFaults:
                Faults.SuppressActivations();
                agents.Select(agent => agent.ConfigurationUpdateFailed).MakeNondeterministic();
                Workpieces.Select(workpiece => workpiece.IncorrectlyPositionedFault).MakeNondeterministic();
                Workpieces.Select(workpiece => workpiece.ToolApplicationFailed).MakeNondeterministic();
                Robots.Select(robot => robot.SwitchToWrongToolFault).MakeNondeterministic();
                Carts.Select(cart => cart.Lost).MakeNondeterministic();
                ObserverController.ReconfigurationFailure.MakeNondeterministic();
                break;

            case AnalysisMode.AllFaults:
                return;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }