Skip to content

Energy Recycle

Represents an energy recycle convergence block that iterates energy stream values until the recycle loop converges within the specified tolerance.

DWSIM.UnitOperations.SpecialOps.EnergyRecycle
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← SpecialOpBaseClass ← EnergyRecycle

At a glance

Energy Recycle in the example flowsheet

Port Index Connected in the example
Inlet, energy 0 Q-recovered
Outlet, energy 0 Q-return

Example

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

fs = (Flowsheet.Create("EnergyRecycleExample")
      .WithCompound("Water")
      .WithPropertyPackage(PropertyPackages.SteamTables))

feed = fs.AddMaterialStream("Feed").At(Q.Celsius(25.0), Q.Bar(10.0)).WithMassFlow(Q.KgPerSecond(2.0))
preheated = fs.AddMaterialStream("Preheated")
hot = fs.AddMaterialStream("Hot")
product = fs.AddMaterialStream("Product")
q_recovered = fs.AddEnergyStream("Q-recovered")            # leaves the cooler
q_return = fs.AddEnergyStream("Q-return").WithEnergyFlow(Q.Kilowatts(0.0))   # first guess
q_steam = fs.AddEnergyStream("Q-steam")

preheater = (fs.AddHeater("H-1")
             .WithCalcMode(Heater.CalculationMode.EnergyStream)   # duty comes from Q-return
             .ConnectFeed(feed).ConnectProduct(preheated).ConnectEnergyFeed(q_return, 1))
steam_heater = (fs.AddHeater("H-2").WithOutletTemperature(Q.Celsius(150.0))
                .ConnectFeed(preheated).ConnectProduct(hot).ConnectEnergyFeed(q_steam, 1))
cooler = (fs.AddCooler("C-1").WithOutletTemperature(Q.Celsius(60.0))
          .ConnectFeed(hot).ConnectProduct(product).ConnectEnergyProduct(q_recovered, 0))

recycle = (fs.AddUnitOperation(ObjectType.OT_EnergyRecycle, "ER-1")
           .ConnectEnergyFeed(q_recovered, 0)
           .ConnectEnergyProduct(q_return, 0))
er = recycle.Object.__implementation__

fs.AutoLayout()
fs.Solve()          # the solver iterates the loop until the energy recycle converges

print(f"Heat recovered      = {q_recovered.EnergyFlowKW:.1f} kW (returned {q_return.EnergyFlowKW:.1f} kW)")
print(f"Preheated feed      = {preheated.TemperatureK - 273.15:.2f} C")
print(f"Steam heater duty   = {steam_heater.HeatDutyKW:.1f} kW")
print(f"Energy recycle      = converged in {er.IterationsTaken} iterations, error {er.ConvergenceHistory.EnergyE:.2e} kW")

Output

Heat recovered      = 761.2 kW (returned 761.2 kW)
Preheated feed      = 115.76 C
Steam heater duty   = 292.4 kW
Energy recycle      = converged in 2 iterations, error 0.00e+00 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_ER_0 Maximum Iterations yes
PROP_ER_1 Power Tolerance kW yes
PROP_ER_2 Power Error kW result

Learn more

API members

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

Constructors

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

Initializes a new default instance of the EnergyRecycle class.

public EnergyRecycle()
Public Sub New()

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

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

Parameter Type Description
name String The display name of the energy recycle block.
description String A brief description of the energy recycle block.
public EnergyRecycle(string name, string description)
Public Sub New(name As String, description As String)

Properties

AccelerationMethod: Gets or sets the convergence acceleration method (e.g.

Gets or sets the convergence acceleration method (e.g. None or Wegstein).

public AccelMethod AccelerationMethod { get; set; }
Public Property AccelerationMethod As AccelMethod

ContinuePastMaximumIterations: Asked whether the recycle should keep iterating past its maximum.

Asked whether the recycle should keep iterating past its maximum. The host assigns it; without one the recycle stops with a timeout, as the material recycle does.

public static Func<string, string, bool> ContinuePastMaximumIterations { get; set; }
Public Shared Property ContinuePastMaximumIterations As Func(Of String, String, Boolean)

ConvergenceHistory: Gets or sets the convergence history (current and previous energy values) for the recycle loop.

Gets or sets the convergence history (current and previous energy values) for the recycle loop.

public ConvergenceHistoryE ConvergenceHistory { get; set; }
Public Property ConvergenceHistory As ConvergenceHistoryE

ConvergenceParameters: Gets or sets the convergence tolerance parameters for the energy recycle loop.

Gets or sets the convergence tolerance parameters for the energy recycle loop.

public ConvergenceParametersE ConvergenceParameters { get; set; }
Public Property ConvergenceParameters As ConvergenceParametersE

HasPropertiesForDynamicMode: Gets a value indicating whether this energy recycle block exposes properties for dynamic mode.

Gets a value indicating whether this energy recycle block exposes properties for dynamic mode.

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

IterationCount: Gets or sets the current iteration counter during an active convergence run.

Gets or sets the current iteration counter during an active convergence run.

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

IterationsTaken: Gets or sets the total number of iterations taken during the last convergence run.

Gets or sets the total number of iterations taken during the last convergence run.

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

MaximumIterations: Gets or sets the maximum number of iterations allowed before convergence is considered failed.

Gets or sets the maximum number of iterations allowed before convergence is considered failed.

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

MobileCompatible: Gets a value indicating whether this energy recycle block is compatible with the DWSIM mobile interface.

Gets a value indicating whether this energy recycle block is compatible with the DWSIM mobile interface.

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

SupportsDynamicMode: Gets a value indicating whether this energy recycle block supports dynamic simulation mode.

Gets a value indicating whether this energy recycle block supports dynamic simulation mode.

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

WegsteinParameters: Gets or sets the Wegstein acceleration parameters used during convergence.

Gets or sets the Wegstein acceleration parameters used during convergence.

public WegsteinParameters WegsteinParameters { get; set; }
Public Property WegsteinParameters As WegsteinParameters

Methods

Calculate(object): Performs one iteration of the energy recycle convergence, applying optional Wegstein acceleration, and updates the...

Performs one iteration of the energy recycle convergence, applying optional Wegstein acceleration, and updates the connected outlet energy stream with the new energy flow value.

Parameter Type Description
args Object Optional calculation arguments (not used).
public override void Calculate(object args = null)
Public Overrides Sub Calculate(args As Object = Nothing)

CloneXML(): Creates a deep copy of this energy recycle block by serializing and deserializing via XML.

Creates a deep copy of this energy recycle block by serializing and deserializing via XML.

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

CloseEditForm(): Closes and disposes the editing form for this energy recycle block if it is open.

Closes and disposes the editing form for this energy recycle block if it is open.

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

DeCalculate(): Resets the iteration counter, effectively unsetting the convergence state.

Resets the iteration counter, effectively unsetting the convergence state.

public void DeCalculate()
Public Sub DeCalculate()

DisplayEditForm(): Opens or activates the editing form for this energy recycle block.

Opens or activates the editing form for this energy recycle block.

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

GetDisplayDescription(): Returns the localized display description for the energy recycle block type.

Returns the localized display description for the energy recycle block type.

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

GetDisplayName(): Returns the localized display name for the energy recycle block type.

Returns the localized display name for the energy recycle block type.

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

GetIconBitmapBytes(): Returns the raw bytes of the energy recycle icon image resource.

Returns the raw bytes of the energy recycle icon image resource.

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

GetProperties(PropertyType): Returns the list of property identifiers available for this energy recycle block filtered by property type.

Returns the list of property identifiers available for this energy recycle block filtered by property type.

Parameter Type Description
proptype PropertyType The type of properties to retrieve.
public override string[] GetProperties(PropertyType proptype)
Public Overrides Function GetProperties(proptype As PropertyType) As String()

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

Returns the unit string for the specified property in the given unit system.

Parameter Type Description
prop String The property identifier string.
su IUnitsOfMeasure The unit system to use; defaults to SI if not provided.
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 The property identifier string (e.g., "PROP_ER_0").
su IUnitsOfMeasure The unit system to use for conversion; defaults to SI if not provided.
public override object GetPropertyValue(string prop, IUnitsOfMeasure su = null)
Public Overrides Function GetPropertyValue(prop As String, su As IUnitsOfMeasure = Nothing) As Object

LoadData(List<XElement>): Restores the energy recycle state from a list of XML elements.

Restores the energy recycle state from a list of XML elements.

Parameter Type Description
data List<XElement> The list of XElement objects containing the serialized state.
public override bool LoadData(List<XElement> data)
Public Overrides Function LoadData(data As List(Of XElement)) As Boolean

MAX(object): Returns the maximum value from an array-like object.

Returns the maximum value from an array-like object.

Parameter Type Description
Vv Object An array whose maximum element is to be found.
public object MAX(object Vv)
Public Function MAX(Vv As Object) As Object

RunDynamicModel(): Executes the dynamic simulation model step for this energy recycle block (no-op).

Executes the dynamic simulation model step for this energy recycle block (no-op).

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

SaveData(): Serializes the energy recycle state to a list of XML elements for persistence.

Serializes the energy recycle state to a list of XML elements for persistence.

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

SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property after converting from the given unit system to SI.

Sets the value of the specified property after converting from the given unit system to SI.

Parameter Type Description
prop String The property identifier string.
propval Object The new value in the units of su.
su IUnitsOfMeasure The unit system of the supplied value; defaults to SI if not provided.
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 displayed data in the editing form if it is currently open.

Refreshes the displayed data in the editing form if it is currently open.

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

Fields

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

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

public object f
Public f As Object