Skip to content

Equilibrium Reactor

Represents an Equilibrium Reactor that determines product composition by minimising the Gibbs free energy along reaction-extent coordinates for a set of equilibrium-type reactions. Supports isothermal, adiabatic, and outlet-temperature operating modes.

DWSIM.UnitOperations.Reactors.Reactor_Equilibrium
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← Reactor ← Reactor_Equilibrium

At a glance

Equilibrium Reactor in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Syngas
Inlet, energy 1 Q
Outlet, material 0 Shifted gas
Outlet, material 1 Liquid

Example

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

fs = (Flowsheet.Create("EquilibriumReactorExample")
      .WithCompounds("Carbon monoxide", "Water", "Carbon dioxide", "Hydrogen")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

# CO + H2O <-> CO2 + H2, ln(Keq) = 4577.8/T - 4.33 on an activity basis in the vapor
stoich = Dictionary[String, Double]()
stoich["Carbon monoxide"] = -1.0
stoich["Water"] = -1.0
stoich["Carbon dioxide"] = 1.0
stoich["Hydrogen"] = 1.0
shift = fs.DefineEquilibriumReaction("WGS", stoich, "Carbon monoxide", "Vapor",
                                     "Activity", "", "4577.8/T - 4.33")
fs.ReactionSet("Shift").Add(shift)

syngas = (fs.AddMaterialStream("Syngas")
          .At(Q.Celsius(400.0), Q.Bar(20.0))
          .WithMolarFlow(Q.MolPerSecond(10.0))
          .SetCompoundMolarFlow("Carbon monoxide", 2.0)
          .SetCompoundMolarFlow("Water", 4.0)
          .SetCompoundMolarFlow("Carbon dioxide", 0.5)
          .SetCompoundMolarFlow("Hydrogen", 3.5))
shifted = fs.AddMaterialStream("Shifted gas")
liquid = fs.AddMaterialStream("Liquid")          # empty here, but the port must be connected
duty = fs.AddEnergyStream("Q")

reactor = (fs.AddEquilibriumReactor("R-1")
           .Isothermal()
           .WithReactionSet("Shift")
           .WithPressureDrop(Q.Bar(0.0))
           .ConnectFeed(syngas, 0)
           .ConnectProduct(shifted, 0)
           .ConnectProduct(liquid, 1)
           .ConnectEnergyFeed(duty, 1))

fs.AutoLayout()
fs.Solve()

y = {c: shifted.OverallMoleFraction(c) for c in ("Carbon monoxide", "Water", "Carbon dioxide", "Hydrogen")}
k_calc = y["Carbon dioxide"] * y["Hydrogen"] / (y["Carbon monoxide"] * y["Water"])
print(f"CO conversion        = {100.0 * reactor.Object.ComponentConversions['Carbon monoxide']:.1f} %")
print(f"Outlet CO            = {100.0 * y['Carbon monoxide']:.2f} mol %")
print(f"Outlet H2            = {100.0 * y['Hydrogen']:.2f} mol %")
print(f"Keq from outlet      = {k_calc:.2f} (correlation: {math.exp(4577.8 / 673.15 - 4.33):.2f})")
print(f"Heat removed         = {-reactor.HeatDutyKW:.1f} kW")

Output

CO conversion        = 80.8 %
Outlet CO            = 3.84 mol %
Outlet H2            = 51.16 mol %
Keq from outlet      = 11.85 (correlation: 11.83)
Heat removed         = 61.1 kW

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
PROP_EQ_0 Pressure Drop Pa yes
PROP_EQ_1 Outlet Temperature K yes
Calculation Mode Select the calculation mode of this reactor. result
Initial Gibbs Energy kW result
Final Gibbs Energy kW result
Carbon monoxide: Conversion % result
Water: Conversion % result
Carbon dioxide: Conversion % result
Hydrogen: Conversion % result
WGS: Extent mol/s result

Dynamic mode

Extra properties used when the flowsheet runs in dynamic mode.

Name Unit
Operating Pressure (Dynamics) Pa
Liquid Level m
Volume m3
Height m
Minimum Pressure Pa
Initialize using Inlet Stream
Reset Contents

Learn more

API members

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

Constructors

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

Initializes a new default instance of the Reactor_Equilibrium class.

public Reactor_Equilibrium()
Public Sub New()

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

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

Parameter Type Description
name String The display name of the equilibrium reactor.
description String A brief description of the equilibrium reactor.
public Reactor_Equilibrium(string name, string description)
Public Sub New(name As String, description As String)

Properties

ComponentIDs: Gets or sets the list of compound IDs participating in the equilibrium reactions.

Gets or sets the list of compound IDs participating in the equilibrium reactions.

public List<string> ComponentIDs { get; set; }
Public Property ComponentIDs As List(Of String)

ExternalLoopMaximumIterations: Gets or sets the maximum number of iterations for the outer energy-balance loop.

Gets or sets the maximum number of iterations for the outer energy-balance loop.

public int ExternalLoopMaximumIterations { get; set; }
Public Property ExternalLoopMaximumIterations As Integer

ExternalLoopTolerance: Gets or sets the convergence tolerance for the outer (energy-balance) iteration loop.

Gets or sets the convergence tolerance for the outer (energy-balance) iteration loop.

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

FinalGibbsEnergy: Gets or sets the final total Gibbs free energy of the system (kJ/mol) after reaction.

Gets or sets the final total Gibbs free energy of the system (kJ/mol) after reaction.

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

HasPropertiesForDynamicMode: Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.

Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.

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

InitialGibbsEnergy: Gets or sets the initial total Gibbs free energy of the system (kJ/mol) before reaction.

Gets or sets the initial total Gibbs free energy of the system (kJ/mol) before reaction.

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

InternalLoopMaximumIterations: Gets or sets the maximum number of iterations for the inner optimisation loop.

Gets or sets the maximum number of iterations for the inner optimisation loop.

public int InternalLoopMaximumIterations { get; set; }
Public Property InternalLoopMaximumIterations As Integer

InternalLoopTolerance: Gets or sets the convergence tolerance for the inner (reaction-extent) optimisation loop.

Gets or sets the convergence tolerance for the inner (reaction-extent) optimisation loop.

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

MobileCompatible: Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.

Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.

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

PreviousReactionExtents: Gets or sets the dictionary of reaction extents from the previous iteration, used for warm-starting.

Gets or sets the dictionary of reaction extents from the previous iteration, used for warm-starting.

public Dictionary<string, double> PreviousReactionExtents { get; set; }
Public Property PreviousReactionExtents As Dictionary(Of String, Double)

ReactionExtents: Gets or sets the dictionary of calculated reaction extents, keyed by reaction ID.

Gets or sets the dictionary of calculated reaction extents, keyed by reaction ID.

public Dictionary<string, double> ReactionExtents { get; set; }
Public Property ReactionExtents As Dictionary(Of String, Double)

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

Gets a value indicating whether this reactor supports dynamic simulation mode.

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

UseIPOPTSolver: Gets or sets whether the IPOPT solver is used for the optimisation (otherwise a simplex method is used).

Gets or sets whether the IPOPT solver is used for the optimisation (otherwise a simplex method is used).

public bool UseIPOPTSolver { get; set; }
Public Property UseIPOPTSolver As Boolean

UsePreviousSolution: Gets or sets whether the solver uses the previous solution as a starting point.

Gets or sets whether the solver uses the previous solution as a starting point.

public bool UsePreviousSolution { get; set; }
Public Property UsePreviousSolution As Boolean

Methods

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)

Calculate_Internal(object): Internal solver that minimises Gibbs energy using IPOPT or simplex to find the equilibrium extents.

Internal solver that minimises Gibbs energy using IPOPT or simplex to find the equilibrium extents.

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

Calculate_Internal_Old(object): Legacy internal solver method retained for backward compatibility.

Legacy internal solver method retained for backward compatibility.

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

Calculate_Relaxation(object): Solves the equilibrium reactions using a successive-relaxation approach, processing reactions one at a time.

Solves the equilibrium reactions using a successive-relaxation approach, processing reactions one at a time.

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

CloneXML(): Creates a deep copy of this reactor via XML serialization.

Creates a deep copy of this reactor via XML serialization.

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

CloseEditForm(): Closes and disposes the editing form.

Closes and disposes the editing form.

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

CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode.

Registers the dynamic properties for dynamic simulation mode.

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

DeCalculate(): Clears the calculated results from the outlet material streams.

Clears the calculated results from the outlet material streams.

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

DisplayDynamicsEditForm(): Opens or activates the dynamics property editor form for this reactor.

Opens or activates the dynamics property editor form for this reactor.

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

DisplayEditForm(): Opens or activates the editing form for this reactor.

Opens or activates the editing form for this reactor.

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

GetDisplayDescription(): Returns the localised display description for this reactor.

Returns the localised display description for this reactor.

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

GetDisplayName(): Returns the localised display name for this reactor.

Returns the localised display name for this reactor.

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

GetIconBitmapBytes(): Returns the icon bitmap as a byte array.

Returns the icon bitmap as a byte array.

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

GetProperties(PropertyType): Returns an array of property identifiers for the specified property type.

Returns an array of property identifiers for the specified property type.

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

GetPropertyDescription(string): Returns a human-readable description of the specified property.

Returns a human-readable description of the specified property.

Parameter Type Description
p String
public override string GetPropertyDescription(string p)
Public Overrides Function GetPropertyDescription(p As String) As String

GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit string for the specified property.

Returns the unit string for the specified property.

Parameter Type Description
prop String
su IUnitsOfMeasure
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 the specified property, converted to the given unit system.

Returns the value of the specified property, converted to the given unit system.

Parameter Type Description
prop String
su IUnitsOfMeasure
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 report of the reactor results using the specified units and format.

Generates a plain-text report of the reactor results using the specified units and format.

Parameter Type Description
su IUnitsOfMeasure
ci CultureInfo
numberformat String
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

GetStructuredReport(): Generates a structured report of the reactor results as a list of typed tuples.

Generates a structured report of the reactor results as a list of typed tuples.

public override List<Tuple<ReportItemType, string[]>> GetStructuredReport()
Public Overrides Function GetStructuredReport() As List(Of Tuple(Of ReportItemType, String()))

LoadData(List<XElement>): Restores the reactor state, including reaction extents and component IDs, from XML.

Restores the reactor state, including reaction extents and component IDs, from XML.

Parameter Type Description
data List<XElement>
public override bool LoadData(List<XElement> data)
Public Overrides Function LoadData(data As List(Of XElement)) As Boolean

RunDynamicModel(): Executes one dynamic simulation time step for the equilibrium reactor.

Executes one dynamic simulation time step for the equilibrium reactor.

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

SaveData(): Serializes the reactor state, including reaction extents and component IDs, to XML.

Serializes the reactor state, including reaction extents and component IDs, to XML.

public override List<XElement> SaveData()
Public Overrides Function SaveData() As List(Of XElement)

SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property from the given value and unit system.

Sets the value of the specified property from the given value and unit system.

Parameter Type Description
prop String
propval Object
su IUnitsOfMeasure
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(): Refreshes the editing form with updated data.

Refreshes the editing form with updated data.

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

Validate(): Validates that inlet and outlet streams are connected before calculation.

Validates that inlet and outlet streams are connected before calculation.

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

Fields

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

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

public object f
Public f As Object