Class GasDetector
- All Implemented Interfaces:
Serializable, MeasurementDeviceInterface, NamedInterface
A gas detector measures the concentration of specific gases in the air, typically reporting in percentage of Lower Explosive Limit (%LEL) for combustible gases, or ppm for toxic gases. It is commonly used in Fire & Gas (F&G) systems for emergency shutdown (ESD) applications.
Key features:
- Measures gas concentration as %LEL (0-100%) or ppm
- Configurable alarm thresholds (typically 20% LEL and 60% LEL)
- Supports both combustible gas (LEL) and toxic gas (ppm) detection
- Integration with alarm system for multi-level warnings
- Location/zone identification for spatial awareness
- Reset capability for testing and normal operation restoration
Typical usage in ESD system with gas detection:
// Create gas detector for hydrocarbon detection
GasDetector gasDetector = new GasDetector("GD-101", GasDetector.GasType.COMBUSTIBLE);
gasDetector.setLocation("Separator Area");
// Configure two-level alarm (20% LEL warning, 60% LEL high alarm)
AlarmConfig alarmConfig = AlarmConfig.builder().highLimit(20.0) // 20% LEL - Warning
.highHighLimit(60.0) // 60% LEL - High alarm
.delay(2.0) // 2 second confirmation
.unit("%LEL").build();
gasDetector.setAlarmConfig(alarmConfig);
// Simulate gas detection
gasDetector.setGasConcentration(25.0); // 25% LEL detected
// Check detector state
if (gasDetector.getGasConcentration() > 20.0) {
System.out.println("Gas alarm - evacuate area");
}
if (gasDetector.getGasConcentration() > 60.0) {
// Activate ESD
esdSystem.activate();
}
Common applications:
- Hydrocarbon leak detection (methane, propane, etc.)
- H2S (hydrogen sulfide) monitoring
- CO (carbon monoxide) detection
- Toxic gas monitoring
- Confined space monitoring
- Version:
- $Id: $Id
- Author:
- ESOL
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of gas detector types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleCurrent gas concentration reading.private StringGas species being detected (e.g., "methane", "H2S", "CO").private GasDetector.GasTypeType of gas being detected.private StringDetector location/zone identifier.private doubleLower Explosive Limit in ppm (for combustible gases).private doubleDetector response time in seconds.private static final longSerialization version UID.Fields inherited from class MeasurementDeviceBaseClass
unitFields inherited from class NamedBaseClass
name -
Constructor Summary
ConstructorsConstructorDescriptionGasDetector(String name) Constructor for GasDetector with combustible gas type (LEL).GasDetector(String name, GasDetector.GasType gasType) Constructor for GasDetector with specified gas type.GasDetector(String name, GasDetector.GasType gasType, String location) Constructor for GasDetector with location. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidConfigures measurement range based on gas type.doubleconvertPercentLELToPpm(double percentLEL) Converts %LEL to ppm based on the gas's LEL.doubleconvertPpmToPercentLEL(double ppm) Converts ppm to %LEL based on the gas's LEL.voidDisplays the current state of the gas detector.doubleGets the current gas concentration.Gets the gas species being detected.Gets the detector type.Gets the detector location.doubleGets the Lower Explosive Limit.doubleGets the measured value of the gas detector.doublegetMeasuredValue(String unit) Gets the measured value in the specified unit.doubleGets the detector response time.booleanisGasDetected(double threshold) Checks if gas is detected above threshold.booleanisHighAlarm(double highThreshold) Checks if high alarm condition exists (typically 60% LEL or high ppm).voidreset()Resets the detector reading to zero (for testing or calibration).voidsetGasConcentration(double concentration) Sets the gas concentration reading.voidsetGasSpecies(String species) Sets the gas species being detected.voidsetLocation(String location) Sets the detector location.voidsetLowerExplosiveLimit(double lel) Sets the Lower Explosive Limit for the gas being detected.voidsetResponseTime(double responseTime) Sets the detector response time.toString()Gets a string representation of the gas detector state.Methods inherited from class MeasurementDeviceBaseClass
acknowledgeAlarm, applySignalModifiers, doConditionAnalysis, evaluateAlarm, getAlarmConfig, getAlarmState, getConditionAnalysisMaxDeviation, getConditionAnalysisMessage, getDelaySteps, getMaximumValue, getMeasuredPercentValue, getMinimumValue, getNoiseStdDev, getOnlineMeasurementValue, getOnlineSignal, getUnit, isLogging, isOnlineSignal, runConditionAnalysis, setAlarmConfig, setConditionAnalysis, setConditionAnalysisMaxDeviation, setDelaySteps, setIsOnlineSignal, setLogging, setMaximumValue, setMinimumValue, setNoiseStdDev, setOnlineMeasurementValue, setOnlineSignal, setQualityCheckMessage, setRandomSeed, setUnitMethods inherited from class NamedBaseClass
getName, getTagName, setName, setTagNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface MeasurementDeviceInterface
equals, getOnlineValue, hashCodeMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagName
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
gasType
Type of gas being detected. -
gasConcentration
private double gasConcentrationCurrent gas concentration reading. -
gasSpecies
Gas species being detected (e.g., "methane", "H2S", "CO"). -
location
Detector location/zone identifier. -
lowerExplosiveLimit
private double lowerExplosiveLimitLower Explosive Limit in ppm (for combustible gases). -
responseTime
private double responseTimeDetector response time in seconds.
-
-
Constructor Details
-
GasDetector
Constructor for GasDetector with combustible gas type (LEL).- Parameters:
name- name of gas detector
-
GasDetector
Constructor for GasDetector with specified gas type.- Parameters:
name- name of gas detectorgasType- type of gas being detected (COMBUSTIBLE, TOXIC, or OXYGEN)
-
GasDetector
Constructor for GasDetector with location.- Parameters:
name- name of gas detectorgasType- type of gas being detectedlocation- location or zone where detector is installed
-
-
Method Details
-
configureRangeForType
private void configureRangeForType()Configures measurement range based on gas type. -
setGasConcentration
public void setGasConcentration(double concentration) Sets the gas concentration reading.For COMBUSTIBLE type: value is in %LEL (0-100%) For TOXIC type: value is in ppm For OXYGEN type: value is in %O2
- Parameters:
concentration- gas concentration in appropriate units for detector type
-
getGasConcentration
public double getGasConcentration()Gets the current gas concentration.- Returns:
- gas concentration in detector's units
-
isGasDetected
public boolean isGasDetected(double threshold) Checks if gas is detected above threshold.For combustible gases: typically > 20% LEL is considered a detection For toxic gases: depends on gas type (e.g., H2S > 10 ppm)
- Parameters:
threshold- threshold value in detector's units- Returns:
- true if gas concentration exceeds threshold
-
isHighAlarm
public boolean isHighAlarm(double highThreshold) Checks if high alarm condition exists (typically 60% LEL or high ppm).- Parameters:
highThreshold- high alarm threshold- Returns:
- true if concentration exceeds high threshold
-
reset
public void reset()Resets the detector reading to zero (for testing or calibration). -
setGasSpecies
Sets the gas species being detected.- Parameters:
species- gas species name (e.g., "methane", "H2S", "CO", "propane")
-
getGasSpecies
-
getGasType
-
setLocation
Sets the detector location.- Parameters:
location- location or zone identifier
-
getLocation
-
setLowerExplosiveLimit
public void setLowerExplosiveLimit(double lel) Sets the Lower Explosive Limit for the gas being detected.This is used to convert between ppm and %LEL. For example: - Methane: 50,000 ppm (5% vol) - Propane: 21,000 ppm (2.1% vol) - Hydrogen: 40,000 ppm (4% vol)
- Parameters:
lel- Lower Explosive Limit in ppm
-
getLowerExplosiveLimit
public double getLowerExplosiveLimit()Gets the Lower Explosive Limit.- Returns:
- LEL in ppm
-
convertPpmToPercentLEL
public double convertPpmToPercentLEL(double ppm) Converts ppm to %LEL based on the gas's LEL.- Parameters:
ppm- concentration in parts per million- Returns:
- concentration as percentage of LEL
-
convertPercentLELToPpm
public double convertPercentLELToPpm(double percentLEL) Converts %LEL to ppm based on the gas's LEL.- Parameters:
percentLEL- concentration as percentage of LEL- Returns:
- concentration in ppm
-
setResponseTime
public void setResponseTime(double responseTime) Sets the detector response time.- Parameters:
responseTime- response time in seconds (T90 time)
-
getResponseTime
public double getResponseTime()Gets the detector response time.- Returns:
- response time in seconds
-
getMeasuredValue
public double getMeasuredValue()Gets the measured value of the gas detector.Returns current gas concentration in detector's units (%LEL, ppm, or %O2).
- Returns:
- gas concentration
-
getMeasuredValue
Gets the measured value in the specified unit.Supported units depend on gas type: - COMBUSTIBLE: "%LEL", "% LEL" - TOXIC: "ppm" - OXYGEN: "%O2", "% O2"
- Specified by:
getMeasuredValuein interfaceMeasurementDeviceInterface- Overrides:
getMeasuredValuein classMeasurementDeviceBaseClass- Parameters:
unit- engineering unit- Returns:
- gas concentration in specified unit
-
displayResult
public void displayResult()Displays the current state of the gas detector.- Specified by:
displayResultin interfaceMeasurementDeviceInterface- Overrides:
displayResultin classMeasurementDeviceBaseClass
-
toString
-