Class ImpurityMonitor

All Implemented Interfaces:
Serializable, MeasurementDeviceInterface, ProcessElementInterface, NamedInterface

public class ImpurityMonitor extends StreamMeasurementDeviceBaseClass
Phase-partitioned composition tracking device for monitoring impurity concentrations across gas, liquid, and aqueous phases. Designed for CO2 injection systems where light impurities (H2, N2, CH4) preferentially partition into the gas phase during two-phase conditions.

The monitor tracks:

  • Overall (bulk) composition of each tracked component
  • Gas phase composition and enrichment factor (y/z) for each component
  • Liquid phase composition for each component
  • Phase fractions (gas/liquid mass and mole fractions)
  • Alarm conditions when concentrations exceed configurable thresholds

Usage example:

ImpurityMonitor monitor = new ImpurityMonitor("WH-H2-Monitor", stream);
monitor.addTrackedComponent("hydrogen", 0.04); // Track H2, alarm at 4 mol%
monitor.addTrackedComponent("nitrogen", 0.10); // Track N2, alarm at 10 mol%
// After process.run():
double h2InGas = monitor.getGasPhaseMoleFraction("hydrogen");
double enrichment = monitor.getEnrichmentFactor("hydrogen");
Map<String, Map<String, Double>> report = monitor.getFullReport();
Version:
1.0
Author:
neqsim
See Also:
  • Field Details

    • serialVersionUID

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

      private String primaryComponent
      Primary component to report via getMeasuredValue().
    • trackedComponents

      private final Map<String,Double> trackedComponents
      Components to track with optional alarm thresholds (mol fraction).
  • Constructor Details

    • ImpurityMonitor

      public ImpurityMonitor(StreamInterface stream)
      Constructor for ImpurityMonitor with default name.
      Parameters:
      stream - the stream to monitor
    • ImpurityMonitor

      public ImpurityMonitor(String name, StreamInterface stream)
      Constructor for ImpurityMonitor with specified name.
      Parameters:
      name - the device name/tag
      stream - the stream to monitor
  • Method Details

    • addTrackedComponent

      public void addTrackedComponent(String componentName, double alarmThresholdMolFrac)
      Adds a component to the tracked list. The alarm threshold is in mole fraction (e.g. 0.04 for 4%).
      Parameters:
      componentName - the name of the component as registered in the fluid
      alarmThresholdMolFrac - the gas phase mole fraction threshold for alarm (0 to disable)
    • addTrackedComponent

      public void addTrackedComponent(String componentName)
      Adds a component to track without an alarm threshold.
      Parameters:
      componentName - the name of the component
    • setPrimaryComponent

      public void setPrimaryComponent(String componentName)
      Sets the primary component whose gas phase concentration is returned by getMeasuredValue(String).
      Parameters:
      componentName - the component name
    • getGasPhaseMoleFraction

      public double getGasPhaseMoleFraction(String componentName)
      Gets the gas phase mole fraction of the specified component.
      Parameters:
      componentName - the component name
      Returns:
      the gas phase mole fraction, or NaN if gas phase absent or component not found
    • getLiquidPhaseMoleFraction

      public double getLiquidPhaseMoleFraction(String componentName)
      Gets the liquid phase mole fraction of the specified component.
      Parameters:
      componentName - the component name
      Returns:
      the liquid phase mole fraction, or NaN if liquid phase absent or component not found
    • getBulkMoleFraction

      public double getBulkMoleFraction(String componentName)
      Gets the bulk (overall) mole fraction of the specified component.
      Parameters:
      componentName - the component name
      Returns:
      the overall mole fraction, or NaN if component not found
    • getEnrichmentFactor

      public double getEnrichmentFactor(String componentName)
      Gets the enrichment factor (K-value) for a component: y_gas / z_feed.
      Parameters:
      componentName - the component name
      Returns:
      the enrichment factor, or NaN if not in two-phase conditions
    • getNumberOfPhases

      public int getNumberOfPhases()
      Gets the number of phases in the stream.
      Returns:
      the number of phases
    • getGasPhaseFraction

      public double getGasPhaseFraction()
      Gets the gas phase mole fraction (beta) of the stream. Returns 0 if single-phase liquid, 1 if single-phase gas.
      Returns:
      the gas phase mole fraction (0 to 1)
    • isAlarmExceeded

      public boolean isAlarmExceeded(String componentName)
      Checks whether the gas phase concentration of a component exceeds its alarm threshold.
      Parameters:
      componentName - the component name
      Returns:
      true if the gas phase mole fraction exceeds the configured alarm threshold
    • getFullReport

      public Map<String, Map<String,Double>> getFullReport()
      Generates a full report with phase-partitioned composition for all tracked components.
      Returns:
      a map of component name to a map of property name to value
    • getMeasuredValue

      public double getMeasuredValue()
      Returns the gas phase mole fraction of the primary component as a percentage.
      Returns:
      the gas phase mole fraction of the primary component in mol%
    • getMeasuredValue

      public double getMeasuredValue(String unit)

      Get Measured value in specified unit.

      Specified by:
      getMeasuredValue in interface MeasurementDeviceInterface
      Overrides:
      getMeasuredValue in class MeasurementDeviceBaseClass
      Parameters:
      unit - a String object
      Returns:
      a double
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface MeasurementDeviceInterface
      Overrides:
      displayResult in class MeasurementDeviceBaseClass