Class BiogasUpgrader

All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, ProcessElementInterface, SimulationInterface, NamedInterface

public class BiogasUpgrader extends ProcessEquipmentBaseClass
Biogas upgrader for producing biomethane from raw biogas.

Removes CO2, H2S, and other impurities from raw biogas to produce pipeline-quality biomethane suitable for grid injection or vehicle fuel. Internally uses component-selective splitting to model the separation, with technology-specific removal efficiencies and energy consumption.

Upgrading Technologies

Technology comparison for biogas upgrading
Technology CO2 Removal CH4 Recovery Energy (kWh/Nm3)
WATER_SCRUBBING 96-98% 98% 0.25-0.30
AMINE_SCRUBBING 99% 99.9% 0.12-0.15
MEMBRANE 96-98% 99.5% 0.20-0.30
PSA 97-98% 98% 0.20-0.25

Usage example:

BiogasUpgrader upgrader = new BiogasUpgrader("BGU-1", rawBiogasStream);
upgrader.setTechnology(BiogasUpgrader.UpgradingTechnology.AMINE_SCRUBBING);
upgrader.run();

StreamInterface biomethane = upgrader.getBiomethaneOutStream();
StreamInterface offgas = upgrader.getOffgasOutStream();
double methaneContent = upgrader.getBiomethaneMethanePercent();
double wobbe = upgrader.getWobbeIndex();
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

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

      private static final org.apache.logging.log4j.Logger logger
      Logger instance.
    • inletStream

      private StreamInterface inletStream
      Inlet raw biogas stream.
    • technology

      Upgrading technology.
    • co2RemovalEfficiency

      private double co2RemovalEfficiency
      CO2 removal efficiency override (NaN = use technology default).
    • methaneRecovery

      private double methaneRecovery
      Methane recovery override (NaN = use technology default).
    • h2sRemovalEfficiency

      private double h2sRemovalEfficiency
      H2S removal efficiency override (NaN = use technology default).
    • specificEnergyKWhPerNm3

      private double specificEnergyKWhPerNm3
      Specific energy override in kWh/Nm3 (NaN = use technology default).
    • outletPressureBara

      private double outletPressureBara
      Target outlet pressure for biomethane in bara.
    • biomethaneOutStream

      private StreamInterface biomethaneOutStream
      Upgraded biomethane (methane-rich) outlet stream.
    • offgasOutStream

      private StreamInterface offgasOutStream
      Off-gas (CO2-rich) outlet stream.
    • biomethaneMethanePercent

      private double biomethaneMethanePercent
      Methane content in biomethane product (vol%).
    • biomethaneCO2Percent

      private double biomethaneCO2Percent
      CO2 content in biomethane product (vol%).
    • wobbeIndex

      private double wobbeIndex
      Wobbe index of biomethane product in MJ/Nm3.
    • energyConsumptionKW

      private double energyConsumptionKW
      Energy consumption in kW.
    • methaneSlipPercent

      private double methaneSlipPercent
      Methane slip to off-gas as percent of inlet methane.
    • rawBiogasFlowNm3PerHr

      private double rawBiogasFlowNm3PerHr
      Raw biogas flow rate in Nm3/hr.
    • biomethaneFlowNm3PerHr

      private double biomethaneFlowNm3PerHr
      Biomethane product flow rate in Nm3/hr.
    • hasRun

      private boolean hasRun
      Whether the upgrader has been run.
  • Constructor Details

    • BiogasUpgrader

      public BiogasUpgrader(String name)
      Creates a biogas upgrader with the given name.
      Parameters:
      name - equipment name
    • BiogasUpgrader

      public BiogasUpgrader(String name, StreamInterface inletStream)
      Creates a biogas upgrader with the given name and inlet stream.
      Parameters:
      name - equipment name
      inletStream - the raw biogas inlet stream
  • Method Details

    • setInletStream

      public void setInletStream(StreamInterface stream)
      Sets the inlet raw biogas stream.
      Parameters:
      stream - the inlet stream
    • getInletStream

      public StreamInterface getInletStream()
      Gets the inlet stream.
      Returns:
      inlet stream
    • setTechnology

      public void setTechnology(BiogasUpgrader.UpgradingTechnology tech)
      Sets the upgrading technology.
      Parameters:
      tech - the upgrading technology
    • getTechnology

      public BiogasUpgrader.UpgradingTechnology getTechnology()
      Gets the upgrading technology.
      Returns:
      upgrading technology
    • setCO2RemovalEfficiency

      public void setCO2RemovalEfficiency(double efficiency)
      Sets the CO2 removal efficiency override.
      Parameters:
      efficiency - CO2 removal efficiency (0-1)
    • setMethaneRecovery

      public void setMethaneRecovery(double recovery)
      Sets the methane recovery override.
      Parameters:
      recovery - methane recovery (0-1)
    • setH2SRemovalEfficiency

      public void setH2SRemovalEfficiency(double efficiency)
      Sets the H2S removal efficiency override.
      Parameters:
      efficiency - H2S removal efficiency (0-1)
    • setSpecificEnergy

      public void setSpecificEnergy(double energy)
      Sets the specific energy consumption override in kWh per Nm3 raw biogas.
      Parameters:
      energy - specific energy in kWh/Nm3
    • setOutletPressure

      public void setOutletPressure(double pressureBara)
      Sets the target outlet pressure for the biomethane stream in bara.
      Parameters:
      pressureBara - outlet pressure in bara
    • getBiomethaneOutStream

      public StreamInterface getBiomethaneOutStream()
      Returns the upgraded biomethane outlet stream.
      Returns:
      biomethane outlet stream, or null if not yet run
    • getOffgasOutStream

      public StreamInterface getOffgasOutStream()
      Returns the off-gas (CO2-rich) outlet stream.
      Returns:
      off-gas outlet stream, or null if not yet run
    • getBiomethaneMethanePercent

      public double getBiomethaneMethanePercent()
      Returns the methane content of the biomethane product as volume percent.
      Returns:
      methane content in vol%
    • getBiomethaneCO2Percent

      public double getBiomethaneCO2Percent()
      Returns the CO2 content of the biomethane product as volume percent.
      Returns:
      CO2 content in vol%
    • getWobbeIndex

      public double getWobbeIndex()
      Returns the Wobbe index of the biomethane product in MJ/Nm3.
      Returns:
      Wobbe index
    • getEnergyConsumptionKW

      public double getEnergyConsumptionKW()
      Returns the energy consumption of the upgrading process in kW.
      Returns:
      energy consumption in kW
    • getMethaneSlipPercent

      public double getMethaneSlipPercent()
      Returns the methane slip to the off-gas as a percentage of inlet methane.
      Returns:
      methane slip in percent
    • getRawBiogasFlowNm3PerHr

      public double getRawBiogasFlowNm3PerHr()
      Returns the raw biogas volumetric flow rate in Nm3/hr.
      Returns:
      raw biogas flow rate
    • getBiomethaneFlowNm3PerHr

      public double getBiomethaneFlowNm3PerHr()
      Returns the biomethane product volumetric flow rate in Nm3/hr.
      Returns:
      biomethane flow rate
    • getInletStreams

      public List<StreamInterface> getInletStreams()
      Returns all inlet streams connected to this equipment. Subclasses override to report their specific inlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology without instanceof checks.
      Returns:
      unmodifiable list of inlet streams (empty by default)
    • getOutletStreams

      public List<StreamInterface> getOutletStreams()
      Returns all outlet streams produced by this equipment. Subclasses override to report their specific outlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology without instanceof checks.
      Returns:
      unmodifiable list of outlet streams (empty by default)
    • run

      public void run(UUID id)
      Runs the biogas upgrader simulation.

      Applies technology-specific removal efficiencies to selectively split inlet biogas components into a methane-rich biomethane stream and a CO2-rich off-gas stream. Both outlet streams are flashed at the outlet conditions.

      Parameters:
      id - UUID for this run
    • calculateQualityMetrics

      private void calculateQualityMetrics(SystemInterface biomethaneFluid, double ch4Recovery, double energyPerNm3)
      Calculates biomethane quality metrics after the split.
      Parameters:
      biomethaneFluid - the biomethane fluid system
      ch4Recovery - the methane recovery used
      energyPerNm3 - specific energy consumption in kWh/Nm3
    • getMoleFractionPercent

      private double getMoleFractionPercent(SystemInterface fluid, String componentName)
      Returns the mole fraction of a component as a percentage.
      Parameters:
      fluid - the fluid system
      componentName - component name
      Returns:
      mole fraction in percent (0-100)
    • getResults

      public Map<String,Object> getResults()
      Returns a map of key results from the upgrader simulation.
      Returns:
      map of result name to value
    • toJson

      public String toJson()
      Returns a JSON string with the upgrader results.
      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class ProcessEquipmentBaseClass
      Returns:
      JSON results string
    • toString

      public String toString()
      Overrides:
      toString in class Object