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¶

| 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.16.0, generated 2026-11-11.
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.
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. |
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.
EOHasEquations: Equations of their own for reactions in the vapor or in the liquid with activity, fugacity, mole fraction or partial...
Equations of their own for reactions in the vapor or in the liquid with activity, fugacity, mole fraction or partial pressure as the basis, adiabatic, isothermal or at a set outlet temperature, with a vapor and a liquid outlet: each reaction at its constant at the temperature plus its approach, the bases taken at the overall composition as the unit takes them. The unit's own solver stops when the squares of the logarithms of the ratios to the constants sum to 1e-3; these equations close them to 1e-6.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
SupportsDynamicMode: Gets a value indicating whether this reactor supports dynamic simulation mode.
Gets a value indicating whether this reactor supports dynamic simulation mode.
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).
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.
Methods¶
Calculate(object): Calculates the object.
Calculates the object.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
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 |
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 |
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 |
CloneXML(): Creates a deep copy of this reactor via XML serialization.
Creates a deep copy of this reactor via XML serialization.
CloseEditForm(): Closes and disposes the editing form.
Closes and disposes the editing form.
CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode.
Registers the dynamic properties for dynamic simulation mode.
DeCalculate(): Clears the calculated results from the outlet material streams.
Clears the calculated results from the outlet material streams.
DisplayDynamicsEditForm(): Opens or activates the dynamics property editor form for this reactor.
Opens or activates the dynamics property editor form for this reactor.
DisplayEditForm(): Opens or activates the editing form for this reactor.
Opens or activates the editing form for this reactor.
EOEquationCount(IEquationOrientedContext): How many equations the object adds, for the streams connected to it.
How many equations the object adds, for the streams connected to it.
| Parameter | Type | Description |
|---|---|---|
context |
IEquationOrientedContext |
EOEquationName(IEquationOrientedContext, int): What equation k says, for the solver's messages.
What equation k says, for the solver's messages.
| Parameter | Type | Description |
|---|---|---|
context |
IEquationOrientedContext |
|
k |
Int32 |
EOJacobian(IEquationOrientedContext, double[], Action<int, int, double>): False: a black box is differenced by the solver.
False: a black box is differenced by the solver.
| Parameter | Type | Description |
|---|---|---|
context |
IEquationOrientedContext |
|
x |
Double[] |
|
add |
Action<Int32,Int32,Double> |
EOParameters(): Nothing: as a black box, the object's own calculation reads any of its properties.
Nothing: as a black box, the object's own calculation reads any of its properties.
EOResiduals(IEquationOrientedContext, double[], double[], int): Writes the residuals, each divided by its tolerance, into r from position row.
Writes the residuals, each divided by its tolerance, into r from position row.
| Parameter | Type | Description |
|---|---|---|
context |
IEquationOrientedContext |
|
x |
Double[] |
|
r |
Double[] |
|
row |
Int32 |
EOVariables(IEquationOrientedContext): The indices of the variables the residuals read, the object's own parameters the solver moves included.
The indices of the variables the residuals read, the object's own parameters the solver moves included.
| Parameter | Type | Description |
|---|---|---|
context |
IEquationOrientedContext |
GetDisplayDescription(): Returns the localised display description for this reactor.
Returns the localised display description for this reactor.
GetDisplayName(): Returns the localised display name for this reactor.
Returns the localised display name for this reactor.
GetIconBitmapBytes(): Returns the icon bitmap as a byte array.
Returns the icon bitmap as a byte array.
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 |
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 |
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 |
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 |
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 |
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.
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> |
RunDynamicModel(): Executes one dynamic simulation time step for the equilibrium reactor.
Executes one dynamic simulation time step for the equilibrium reactor.
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.
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 |
UpdateEditForm(): Refreshes the editing form with updated data.
Refreshes the editing form with updated data.
Validate(): Validates that inlet and outlet streams are connected before calculation.
Validates that inlet and outlet streams are connected before calculation.
Fields¶