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¶

| 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¶
-
User guide
-
FluentAPI
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.
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. |
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.
CO2Compound: Gets or sets the name of the carbon dioxide compound.
Gets or sets the name of the carbon dioxide compound. Default "Carbon dioxide".
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.
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.
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.
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.
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.
MethaneCompound: Gets or sets the name of the methane compound.
Gets or sets the name of the methane compound. Default "Methane".
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.
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.
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.
ObjectClass: Gets or sets the simulation object class category (Separators).
Gets or sets the simulation object class category (Separators). The getter always returns Separators.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
WaterCompound: Gets or sets the name of the water compound.
Gets or sets the name of the water compound. Default "Water".
Methods¶
ApplyTechnologyDefaults(): Apply default removal efficiencies for the selected technology.
Apply default removal efficiencies for the selected technology.
Calculate(object): Calculates the object.
Calculates the object.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
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.
CloseEditForm(): Closes the editor of this object, if it is open.
Closes the editor of this object, if it is open.
DeCalculate(): Decalculates the object.
Decalculates the object.
DisplayEditForm(): Opens the editor of this object.
Opens the editor of this object. A host that has no editor for it does nothing.
GetDisplayDescription(): Returns the localized description string for this unit operation type.
Returns the localized description string for this unit operation type.
GetDisplayName(): Returns the localized display name for this unit operation type.
Returns the localized display name for this unit operation type.
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.
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. |
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. |
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. |
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. |
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. |
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.
Fields¶