Skip to content

Biogas Upgrader

Biogas upgrader. Two-stage algebraic model: Stage 1 - H2S polishing (ZnO bed / caustic wash), default 99 % removal. Only active when H2SCompound names a compound present in the feed; it is unassigned by default, since a desulfurized feed is the common case. Stage 2 - CO2 bulk removal (water scrubbing / amine / PSA / membrane), user-selectable efficiency and CH4 loss per technology. With PurityMode set to Target, the CO2 removal is solved for the methane mole fraction in TargetCH4Purity. Splits the biogas feed into an Upgraded Gas (RNG-spec) outlet and an Off-gas outlet. References: Ryckebosch, Drouillon and Vervaeren, Biomass and Bioenergy 35 (2011) 1633-1645; Sun et al., Renewable and Sustainable Energy Reviews 51 (2015) 521-532; Angelidaki et al., Biotechnology Advances 36 (2018) 452-466; ISO 6976 (calorific value, density, Wobbe index); EN 16723-1 (biomethane for injection in the natural gas network).

DWSIM.UnitOperations.UnitOperations.UnitOp_BiogasUpgrader
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← UnitOp_BiogasUpgrader

At a glance

Biogas Upgrader in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Raw biogas
Outlet, material 0 Biomethane
Outlet, material 1 Off-gas

Example

This code runs on every build of this site, and the output below is what it printed.

fs = (Flowsheet.Create("BiogasUpgraderExample")
      .WithCompounds("Methane", "Carbon dioxide", "Hydrogen sulfide", "Water", "Nitrogen")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

# about 500 Nm3/h of raw biogas: 60 % CH4, 37 % CO2, 2000 ppm H2S, water vapour, N2
biogas = (fs.AddMaterialStream("Raw biogas")
          .At(Q.Celsius(30.0), Q.Bar(8.0))
          .SetCompoundMolarFlow("Methane", 3.72)              # mol/s
          .SetCompoundMolarFlow("Carbon dioxide", 2.29)
          .SetCompoundMolarFlow("Hydrogen sulfide", 0.0124)
          .SetCompoundMolarFlow("Water", 0.026)
          .SetCompoundMolarFlow("Nitrogen", 0.15))
biomethane = fs.AddMaterialStream("Biomethane")
offgas = fs.AddMaterialStream("Off-gas")

up = (fs.AddBiogasUpgrader("U-1")
      .WithTechnology(BiogasUpgraderTech.WaterScrubbing)
      .ConnectFeed(biogas, 0)
      .ConnectProduct(biomethane, 0)
      .ConnectProduct(offgas, 1))
up.Object.ApplyTechnologyDefaults()          # CO2 removal and CH4 slip typical of the technology
up.WithH2SCompound("Hydrogen sulfide").WithH2SRemoval(0.99)

fs.AutoLayout()
fs.Solve()

gas = biomethane.Object.Phases[0]
n_gas = gas.Properties.molarflow                         # mol/s
print(f"Biomethane flow  = {n_gas * 0.022414 * 3600.0:.0f} Nm3/h")
print(f"Methane content  = {gas.Compounds['Methane'].MoleFraction * 100.0:.1f} mol %")
print(f"CO2 content      = {gas.Compounds['Carbon dioxide'].MoleFraction * 100.0:.2f} mol %")
print(f"H2S content      = {gas.Compounds['Hydrogen sulfide'].MoleFraction * 1e6:.0f} ppmv")
print(f"Methane recovery = {up.Object.Result_CH4RecoveryFraction * 100.0:.1f} %")

Output

Biomethane flow  = 321 Nm3/h
Methane content  = 91.6 mol %
CO2 content      = 4.60 mol %
H2S content      = 31 ppmv
Methane recovery = 98.0 %

DWSIM 10.2.11.0, generated 2026-10-08.

Properties

IDs accepted by GetPropertyValue, SetPropertyValue, the sensitivity analysis, the optimizer, the Adjust block and dynamic events. Units are SI; pass another unit system to GetPropertyValue to get them converted.

ID Name Unit (SI) Input
Technology - yes
H2S Removal - yes
CO2 Removal - yes
CH4 Loss - yes
H2O Removal - yes
Target CH4 Purity - yes
Methane Compound - yes
CO2 Compound - yes
H2S Compound - yes
Water Compound - yes
N2 Compound - yes
Purity Mode - yes
N2 Removal - yes
Feed Mass kg/s result
Upgraded Mass kg/s result
Offgas Mass kg/s result
Upgraded CH4 Fraction - result
CH4 Recovery - result
Upgraded CH4 Mole Fraction - result
CO2 Removal Applied - result
Maximum CH4 Mole Fraction - result
Higher Heating Value MJ/m3 result
Relative Density - result
Wobbe Index MJ/m3 result

Learn more

API members

Public members declared by this class. Inherited members are documented on the base classes.

Constructors

UnitOp_BiogasUpgrader(): Initializes a new default instance of the UnitOp_BiogasUpgrader class.

Initializes a new default instance of the UnitOp_BiogasUpgrader class.

public UnitOp_BiogasUpgrader()
Public Sub New()

UnitOp_BiogasUpgrader(string, string): Initializes a new instance of the UnitOp_BiogasUpgrader class with a name and description.

Initializes a new instance of the UnitOp_BiogasUpgrader class with a name and description.

Parameter Type Description
name String The name of this unit operation.
description String A brief description of this unit operation.
public UnitOp_BiogasUpgrader(string name, string description)
Public Sub New(name As String, description As String)

Properties

CH4LossFraction: Gets or sets the fraction (0-1) of the methane compound lost to the off-gas outlet.

Gets or sets the fraction (0-1) of the methane compound lost to the off-gas outlet. Default 0.01.

public double CH4LossFraction { get; set; }
Public Property CH4LossFraction As Double

CO2Compound: Gets or sets the name of the carbon dioxide compound.

Gets or sets the name of the carbon dioxide compound. Default "Carbon dioxide".

public string CO2Compound { get; set; }
Public Property CO2Compound As String

CO2RemovalEfficiency: Gets or sets the fraction (0-1) of the CO2 compound sent to the off-gas outlet.

Gets or sets the fraction (0-1) of the CO2 compound sent to the off-gas outlet. Default 0.95. Ignored when PurityMode is Target; the removal solved then is in Result_CO2RemovalApplied.

public double CO2RemovalEfficiency { get; set; }
Public Property CO2RemovalEfficiency As Double

H2ORemovalEfficiency: Gets or sets the fraction (0-1) of the water compound sent to the off-gas outlet.

Gets or sets the fraction (0-1) of the water compound sent to the off-gas outlet. Default 0.98.

public double H2ORemovalEfficiency { get; set; }
Public Property H2ORemovalEfficiency As Double

H2SCompound: Gets or sets the name of the hydrogen sulfide compound.

Gets or sets the name of the hydrogen sulfide compound. Empty by default; while it is empty, any H2S in the feed passes to the upgraded gas and a warning is shown.

public string H2SCompound { get; set; }
Public Property H2SCompound As String

H2SRemovalEfficiency: Gets or sets the fraction (0-1) of the H2S compound sent to the off-gas outlet.

Gets or sets the fraction (0-1) of the H2S compound sent to the off-gas outlet. Applied only when H2SCompound is assigned. Default 0.99.

public double H2SRemovalEfficiency { get; set; }
Public Property H2SRemovalEfficiency As Double

IsBio: Gets a value indicating that this unit operation belongs to the Bio group of the object palette.

Gets a value indicating that this unit operation belongs to the Bio group of the object palette. Always True.

public bool IsBio { get; }
Public ReadOnly Property IsBio As Boolean

MethaneCompound: Gets or sets the name of the methane compound.

Gets or sets the name of the methane compound. Default "Methane".

public string MethaneCompound { get; set; }
Public Property MethaneCompound As String

MobileCompatible: Gets a value indicating whether this unit operation is compatible with mobile interfaces.

Gets a value indicating whether this unit operation is compatible with mobile interfaces. Always False.

public override bool MobileCompatible { get; }
Public Overrides ReadOnly Property MobileCompatible As Boolean

N2Compound: Gets or sets the name of the nitrogen compound.

Gets or sets the name of the nitrogen compound. Empty by default. When assigned, N2RemovalFraction of it goes to the off-gas and the rest to the upgraded gas; unassigned, nitrogen, like every unassigned compound, goes entirely to the upgraded gas.

public string N2Compound { get; set; }
Public Property N2Compound As String

N2RemovalFraction: Gets or sets the fraction (0-1) of the nitrogen compound sent to the off-gas outlet.

Gets or sets the fraction (0-1) of the nitrogen compound sent to the off-gas outlet. Applied only when N2Compound is assigned. Default 0 (nitrogen behaves as an inert that stays in the upgraded gas). ApplyTechnologyDefaults sets 0 for water scrubbing and amine, 0.2 for PSA and 0.05 for membranes.

public double N2RemovalFraction { get; set; }
Public Property N2RemovalFraction As Double

ObjectClass: Gets or sets the simulation object class category (Separators).

Gets or sets the simulation object class category (Separators). The getter always returns Separators.

public override SimulationObjectClass ObjectClass { get; set; }
Public Overrides Property ObjectClass As SimulationObjectClass

PurityMode: Gets or sets how TargetCH4Purity is used.

Gets or sets how TargetCH4Purity is used. Report (default) keeps CO2RemovalEfficiency as the input. Target solves the CO2 removal for the target methane mole fraction, given the other split fractions: f_CO2 = 1 - [n_CH4 (1 - f_CH4) (1/y* - 1) - sum over i other than CH4 and CO2 of n_i (1 - f_i)] / n_CO2. When the result falls outside 0-1 it is clamped and a warning names the highest purity the other fractions allow.

public BiogasUpgraderPurityMode PurityMode { get; set; }
Public Property PurityMode As BiogasUpgraderPurityMode

Result_CH4RecoveryFraction: Gets or sets the fraction (0-1) of the feed methane recovered in the upgraded gas, on a mass basis.

Gets or sets the fraction (0-1) of the feed methane recovered in the upgraded gas, on a mass basis. Calculated result.

public double Result_CH4RecoveryFraction { get; set; }
Public Property Result_CH4RecoveryFraction As Double

Result_CO2RemovalApplied: Gets or sets the CO2 removal fraction (0-1) used in the last calculation...

Gets or sets the CO2 removal fraction (0-1) used in the last calculation: CO2RemovalEfficiency in Report mode, the solved value in Target mode. Calculated result.

public double Result_CO2RemovalApplied { get; set; }
Public Property Result_CO2RemovalApplied As Double

Result_FeedMass_kgs: Gets or sets the feed mass flow, in kg/s.

Gets or sets the feed mass flow, in kg/s. Calculated result.

public double Result_FeedMass_kgs { get; set; }
Public Property Result_FeedMass_kgs As Double

Result_HHV_MJm3: Gets or sets the ideal-gas gross (higher) calorific value of the upgraded gas per unit volume, in MJ/m3, following...

Gets or sets the ideal-gas gross (higher) calorific value of the upgraded gas per unit volume, in MJ/m3, following ISO 6976: combustion at 25 °C, metering at 0 °C and 101.325 kPa. Calculated result.

public double Result_HHV_MJm3 { get; set; }
Public Property Result_HHV_MJm3 As Double

Result_MaxCH4MoleFraction: Gets or sets the highest methane mole fraction (0-1) the upgraded gas can reach with every other split fraction as...

Gets or sets the highest methane mole fraction (0-1) the upgraded gas can reach with every other split fraction as set and all the CO2 removed. Calculated result.

public double Result_MaxCH4MoleFraction { get; set; }
Public Property Result_MaxCH4MoleFraction As Double

Result_OffgasMass_kgs: Gets or sets the off-gas mass flow, in kg/s.

Gets or sets the off-gas mass flow, in kg/s. Calculated result.

public double Result_OffgasMass_kgs { get; set; }
Public Property Result_OffgasMass_kgs As Double

Result_RelativeDensity: Gets or sets the ideal-gas relative density of the upgraded gas to dry air (ISO 6976, M_air = 28.9626 g/mol).

Gets or sets the ideal-gas relative density of the upgraded gas to dry air (ISO 6976, M_air = 28.9626 g/mol). Calculated result.

public double Result_RelativeDensity { get; set; }
Public Property Result_RelativeDensity As Double

Result_UpgradedCH4Fraction: Gets or sets the methane mass fraction in the upgraded gas (0-1).

Gets or sets the methane mass fraction in the upgraded gas (0-1). Calculated result. Purity specifications are molar; see Result_UpgradedCH4MoleFraction.

public double Result_UpgradedCH4Fraction { get; set; }
Public Property Result_UpgradedCH4Fraction As Double

Result_UpgradedCH4MoleFraction: Gets or sets the methane mole fraction in the upgraded gas (0-1), the basis of TargetCH4Purity...

Gets or sets the methane mole fraction in the upgraded gas (0-1), the basis of TargetCH4Purity and of biomethane specifications such as EN 16723-1. Calculated result.

public double Result_UpgradedCH4MoleFraction { get; set; }
Public Property Result_UpgradedCH4MoleFraction As Double

Result_UpgradedMass_kgs: Gets or sets the upgraded gas mass flow, in kg/s.

Gets or sets the upgraded gas mass flow, in kg/s. Calculated result.

public double Result_UpgradedMass_kgs { get; set; }
Public Property Result_UpgradedMass_kgs As Double

Result_WobbeIndex: Gets or sets the gross (superior) Wobbe index of the upgraded gas, in MJ/m3: W = HHV_v / sqrt(d), with...

Gets or sets the gross (superior) Wobbe index of the upgraded gas, in MJ/m3: W = HHV_v / sqrt(d), with Result_HHV_MJm3 and Result_RelativeDensity on the ISO 6976 ideal-gas basis (combustion 25 °C, metering 0 °C, 101.325 kPa). Calculated result.

public double Result_WobbeIndex { get; set; }
Public Property Result_WobbeIndex As Double

SupportsDynamicMode: Gets a value indicating whether this unit operation supports dynamic simulation mode.

Gets a value indicating whether this unit operation supports dynamic simulation mode. Always False; it is calculated as a steady-state model.

public override bool SupportsDynamicMode { get; }
Public Overrides ReadOnly Property SupportsDynamicMode As Boolean

TargetCH4Purity: Gets or sets the target methane mole fraction of the upgraded gas (0-1).

Gets or sets the target methane mole fraction of the upgraded gas (0-1). Used only when PurityMode is Target; in Report mode it is stored and shown for reference. Default 0.96.

public double TargetCH4Purity { get; set; }
Public Property TargetCH4Purity As Double

Technology: Gets or sets the CO2 removal technology: WaterScrubbing (0), Amine (1), PSA (2) or MembraneSeparation (3).

Gets or sets the CO2 removal technology: WaterScrubbing (0), Amine (1), PSA (2) or MembraneSeparation (3). ApplyTechnologyDefaults uses it to set CO2RemovalEfficiency, CH4LossFraction and N2RemovalFraction; the split itself reads only those values. Default Amine.

public BiogasUpgraderTech Technology { get; set; }
Public Property Technology As BiogasUpgraderTech

WaterCompound: Gets or sets the name of the water compound.

Gets or sets the name of the water compound. Default "Water".

public string WaterCompound { get; set; }
Public Property WaterCompound As String

Methods

ApplyTechnologyDefaults(): Apply default removal efficiencies for the selected technology.

Apply default removal efficiencies for the selected technology.

public void ApplyTechnologyDefaults()
Public Sub ApplyTechnologyDefaults()

Calculate(object): Calculates the object.

Calculates the object.

Parameter Type Description
args Object
public override void Calculate(object args = null)
Public Overrides Sub Calculate(args As Object = Nothing)

CloneXML(): Creates a deep copy of this object by round-tripping through XML serialization.

Creates a deep copy of this object by round-tripping through XML serialization.

public override object CloneXML()
Public Overrides Function CloneXML() As Object

CloseEditForm(): Closes the editor of this object, if it is open.

Closes the editor of this object, if it is open.

public override void CloseEditForm()
Public Overrides Sub CloseEditForm()

DeCalculate(): Decalculates the object.

Decalculates the object.

public override void DeCalculate()
Public Overrides Sub DeCalculate()

DisplayEditForm(): Opens the editor of this object.

Opens the editor of this object. A host that has no editor for it does nothing.

public override void DisplayEditForm()
Public Overrides Sub DisplayEditForm()

GetDisplayDescription(): Returns the localized description string for this unit operation type.

Returns the localized description string for this unit operation type.

public override string GetDisplayDescription()
Public Overrides Function GetDisplayDescription() As String

GetDisplayName(): Returns the localized display name for this unit operation type.

Returns the localized display name for this unit operation type.

public override string GetDisplayName()
Public Overrides Function GetDisplayName() As String

GetIconBitmapBytes(): Returns the raw bytes of the icon image for this unit operation.

Returns the raw bytes of the icon image for this unit operation.

public override byte[] GetIconBitmapBytes()
Public Overrides Function GetIconBitmapBytes() As Byte()

GetProperties(PropertyType): Get a list of all properties of the object.

Get a list of all properties of the object.

Parameter Type Description
proptype PropertyType Type of the property.
public override string[] GetProperties(PropertyType proptype)
Public Overrides Function GetProperties(proptype As PropertyType) As String()

GetPropertyUnit(string, IUnitsOfMeasure): Gets the units of a property.

Gets the units of a property.

Parameter Type Description
prop String Property identifier.
su IUnitsOfMeasure Units system to use. Null to use the default (SI) system.
public override string GetPropertyUnit(string prop, IUnitsOfMeasure su = null)
Public Overrides Function GetPropertyUnit(prop As String, su As IUnitsOfMeasure = Nothing) As String

GetPropertyValue(string, IUnitsOfMeasure): Returns the value of a named property, converting from SI to the current unit system.

Returns the value of a named property, converting from SI to the current unit system. Falls back to extra properties if the property is not found in the base implementation.

Parameter Type Description
prop String The property identifier string.
su IUnitsOfMeasure Optional units-of-measure system used for conversion; uses the shared SI system when Nothing.
public override object GetPropertyValue(string prop, IUnitsOfMeasure su = null)
Public Overrides Function GetPropertyValue(prop As String, su As IUnitsOfMeasure = Nothing) As Object

GetReport(IUnitsOfMeasure, CultureInfo, string): Generates a plain-text results report for this unit operation.

Generates a plain-text results report for this unit operation.

Parameter Type Description
su IUnitsOfMeasure The unit system used for formatting output values.
ci CultureInfo The culture info used for number formatting.
numberformat String A .NET numeric format string (e.g. "G6") applied to output values.
public override string GetReport(IUnitsOfMeasure su, CultureInfo ci, string numberformat)
Public Overrides Function GetReport(su As IUnitsOfMeasure, ci As CultureInfo, numberformat As String) As String

SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of a property.

Sets the value of a property.

Parameter Type Description
prop String Property identifier.
propval Object Property value to set at the specified units.
su IUnitsOfMeasure Units system to use. Null to use the default (SI) system.
public override bool SetPropertyValue(string prop, object propval, IUnitsOfMeasure su = null)
Public Overrides Function SetPropertyValue(prop As String, propval As Object, su As IUnitsOfMeasure = Nothing) As Boolean

UpdateEditForm(): Redraws the editor of this object with the current values, if it is open.

Redraws the editor of this object with the current values, if it is open.

public override void UpdateEditForm()
Public Overrides Sub UpdateEditForm()

Fields

f: The classic (WinForms) editor window open for this unit operation, if any.

The classic (WinForms) editor window open for this unit operation, if any. Not saved with the flowsheet.

public object f
Public f As Object