/// <summary> /// Initializes a new instance with only one computing module. /// </summary> /// <param name="startState">Indicates the initial state of the action sequence. </param> public DigitalPart(ActionSequenceStates startState) { ComputingModules = new[] { new ComputingModule(startState) }; _comparisonFunction = Enumerable.Any; InitializeSensors(); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="startState"> Indicates the initial state of the action sequence. </param> public ComputingModule(ActionSequenceStates startState) { _actionSequence = new ActionSequence(this, startState); //_systemHealth is initialized with child components of HealthMonitoring _systemHealth = new HealthMonitoring[] { new HealthSwitch(this), new HealthPressureSensor(this), new HealthDoors(this), new HealthGears(this) }; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="mode">Indicates the mode the digital part is operating in: Any, All, One.</param> /// <param name="count">Indicates how many computing modules are to be used.</param> /// <param name="startState">Indicates the indital state of the action sequence.</param> public DigitalPart(Mode mode, int count, ActionSequenceStates startState) { ComputingModules = new ComputingModule[count]; for (var i = 0; i < count; i++) { ComputingModules[i] = new ComputingModule(startState); } if (mode == Mode.All) { _comparisonFunction = Enumerable.All; } else { _comparisonFunction = Enumerable.Any; } InitializeSensors(); }
/// <summary> /// Initializes a new instance /// </summary> /// <param name="module"> An instance of the computing module that initializes the action sequence. </param> /// <param name="startState"> The initial state of the action sequence state machine. </param> public ActionSequence(ComputingModule module, ActionSequenceStates startState) { _module = module; _stateMachine = startState; }