/// <summary>Determines if any enabled sensors are currently in alarm.</summary> /// <param name="returnEvent">The event should only be provided for the final PostBump (PurgeAfterBump) check as sensors will be put into bump fault.</param> /// <remarks>INS-6723, INS-1735</remarks> private bool IsInstrumentInAlarm(Instrument instrument, InstrumentBumpTestEvent returnEvent) { bool instrumentInAlarm = false; const string funcMsg = "IsInstrumentInAlarm: "; foreach (InstalledComponent ic in instrument.InstalledComponents) { if (!(ic.Component is Sensor)) { continue; } Sensor sensor = (Sensor)ic.Component; if (sensor.IsBumpEnabled(GasEndPoints) == false) // why do we check this? - JMP, 8/2015 { Log.Debug(String.Format("{0}Sensor in position={1} is not bump enabled", funcMsg, ic.Position)); continue; } if (sensor.Enabled == false) { Log.Debug(String.Format("{0}Sensor in position={1} is not enabled", funcMsg, ic.Position)); continue; } // If sensor is in a cal/zero-failure state, then it's not reading gas. if (SensorGasResponse.IsFailedCalibrationStatus(sensor.CalibrationStatus)) { Log.Debug(String.Format("{0}Sensor in position={1} has {2} status", funcMsg, ic.Position, sensor.CalibrationStatus)); continue; } if (IsSensorInAlarm(sensor, ic.Position) == true) { // This method is only intended to be called once when returnEvent is not null, // and only for the PostBump (PurgeAfterBump) purge. if (returnEvent != null) { SensorGasResponse sgr = GetSensorGasResponse(returnEvent, sensor); // If instrument is still in alarm after purge is finishes, then we are setting the // sensor's bump fault flag. if (sgr != null && sgr.Status == Status.Passed) { Log.Debug(String.Format("{0}Setting sensor to FAILED", funcMsg)); sgr.Status = Status.Failed; _instrumentController.SetSensorBumpFault(ic.Position, true); } } instrumentInAlarm = true; } } Log.Debug(String.Format("{0}returned {1}", funcMsg, instrumentInAlarm ? "IN ALARM" : "NOT in alarm")); return(instrumentInAlarm); }