Class GasDetector

All Implemented Interfaces:
Serializable, MeasurementDeviceInterface, NamedInterface

public class GasDetector extends MeasurementDeviceBaseClass
Gas Detector instrument for detecting combustible or toxic gases.

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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • gasType

      private GasDetector.GasType gasType
      Type of gas being detected.
    • gasConcentration

      private double gasConcentration
      Current gas concentration reading.
    • gasSpecies

      private String gasSpecies
      Gas species being detected (e.g., "methane", "H2S", "CO").
    • location

      private String location
      Detector location/zone identifier.
    • lowerExplosiveLimit

      private double lowerExplosiveLimit
      Lower Explosive Limit in ppm (for combustible gases).
    • responseTime

      private double responseTime
      Detector response time in seconds.
  • Constructor Details

    • GasDetector

      public GasDetector(String name)
      Constructor for GasDetector with combustible gas type (LEL).
      Parameters:
      name - name of gas detector
    • GasDetector

      public GasDetector(String name, GasDetector.GasType gasType)
      Constructor for GasDetector with specified gas type.
      Parameters:
      name - name of gas detector
      gasType - type of gas being detected (COMBUSTIBLE, TOXIC, or OXYGEN)
    • GasDetector

      public GasDetector(String name, GasDetector.GasType gasType, String location)
      Constructor for GasDetector with location.
      Parameters:
      name - name of gas detector
      gasType - type of gas being detected
      location - 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

      public void setGasSpecies(String species)
      Sets the gas species being detected.
      Parameters:
      species - gas species name (e.g., "methane", "H2S", "CO", "propane")
    • getGasSpecies

      public String getGasSpecies()
      Gets the gas species being detected.
      Returns:
      gas species name
    • getGasType

      public GasDetector.GasType getGasType()
      Gets the detector type.
      Returns:
      gas detector type
    • setLocation

      public void setLocation(String location)
      Sets the detector location.
      Parameters:
      location - location or zone identifier
    • getLocation

      public String getLocation()
      Gets the detector location.
      Returns:
      location or zone identifier
    • 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

      public double getMeasuredValue(String unit)
      Gets the measured value in the specified unit.

      Supported units depend on gas type: - COMBUSTIBLE: "%LEL", "% LEL" - TOXIC: "ppm" - OXYGEN: "%O2", "% O2"

      Specified by:
      getMeasuredValue in interface MeasurementDeviceInterface
      Overrides:
      getMeasuredValue in class MeasurementDeviceBaseClass
      Parameters:
      unit - engineering unit
      Returns:
      gas concentration in specified unit
    • displayResult

      public void displayResult()
      Displays the current state of the gas detector.
      Specified by:
      displayResult in interface MeasurementDeviceInterface
      Overrides:
      displayResult in class MeasurementDeviceBaseClass
    • toString

      public String toString()
      Gets a string representation of the gas detector state.
      Overrides:
      toString in class Object
      Returns:
      string describing detector state