Skip to content

Energy Stream

Represents an energy stream that carries a heat or power flow between unit operations in a flowsheet. Implements CAPE-OPEN identification and collection interfaces.

DWSIM.UnitOperations.Streams.EnergyStream
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← EnergyStream

At a glance

Energy Stream in the example flowsheet

Port Index Connected in the example
Inlet, energy 0
Outlet, energy 0 E-1

Example

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

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

water_in = (fs.AddMaterialStream("Water-in")
            .At(Q.Celsius(25.0), Q.Bar(3.0))
            .WithMassFlow(Q.KgPerSecond(2.0)))
water_out = fs.AddMaterialStream("Water-out")

duty = fs.AddEnergyStream("Q-1").WithEnergyFlow(Q.Kilowatts(500.0))

heater = (fs.AddHeater("E-1")
          .WithCalcMode(Heater.CalculationMode.EnergyStream)   # the heater takes its duty from Q-1
          .ConnectFeed(water_in)
          .ConnectProduct(water_out)
          .ConnectEnergyFeed(duty, 1))                         # energy inlet is port 1

fs.AutoLayout()
fs.Solve()

h_in = water_in.Object.Phases[0].Properties.enthalpy       # kJ/kg
h_out = water_out.Object.Phases[0].Properties.enthalpy
print(f"Energy flow     = {duty.EnergyFlowKW:.1f} kW")
print(f"Outlet T        = {water_out.TemperatureK - 273.15:.2f} C")
print(f"m (h_out - h_in) = {2.0 * (h_out - h_in):.1f} kW")

Output

Energy flow     = 500.0 kW
Outlet T        = 84.76 C
m (h_out - h_in) = 500.0 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_ES_0 Amount of heat flow carried by this stream. kW yes

Learn more

API members

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

Constructors

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

Initializes a new default instance of the EnergyStream class.

public EnergyStream()
Public Sub New()

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

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

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

Properties

EnergyFlow: Power (energy) associated with this stream.

Power (energy) associated with this stream.

public override double? EnergyFlow { get; set; }
Public Overrides Property EnergyFlow As Double?

HasPropertiesForDynamicMode: Gets a value indicating whether this energy stream exposes properties specific to dynamic mode.

Gets a value indicating whether this energy stream exposes properties specific to dynamic mode.

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

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

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

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

ObjectClass: Gets or sets the simulation object class for this energy stream.

Gets or sets the simulation object class for this energy stream.

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

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

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

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

Methods

Assign(EnergyStream): Copies the energy flow property from the specified source energy stream to this instance.

Copies the energy flow property from the specified source energy stream to this instance.

Parameter Type Description
ASource EnergyStream The source EnergyStream whose properties are copied.
public void Assign(EnergyStream ASource)
Public Sub Assign(ASource As EnergyStream)

Calculate(object): Marks the energy stream as calculated (clears its dirty state).

Marks the energy stream as calculated (clears its dirty state).

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 stream by serializing and deserializing via XML.

Creates a deep copy of this energy stream 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 stream if it is open.

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

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

CreateParamCol(): Creates the CAPE-OPEN real parameters exposed by this energy stream: 'work' (the energy flow, in J/s)...

Creates the CAPE-OPEN real parameters exposed by this energy stream: "work" (the energy flow, in J/s), "temperatureLow" and "temperatureHigh" (in K).

public void CreateParamCol()
Public Sub CreateParamCol()

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

Opens or activates the editing form for this energy stream.

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

GetDisplayDescription(): Returns the localized display description for the energy stream object type.

Returns the localized display description for the energy stream object type.

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

GetDisplayName(): Returns the localized display name for the energy stream object type.

Returns the localized display name for the energy stream object type.

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

GetEnergyConsumption(): Returns the current energy flow value of the stream in watts (SI).

Returns the current energy flow value of the stream in watts (SI).

public override double GetEnergyConsumption()
Public Overrides Function GetEnergyConsumption() As Double

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

Returns the raw bytes of the energy stream 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 stream filtered by the specified property type.

Returns the list of property identifiers available for this energy stream filtered by the specified property type.

Parameter Type Description
proptype PropertyType The type of properties to retrieve (read-only, read-write, write-read, or all).
public override string[] GetProperties(PropertyType proptype)
Public Overrides Function GetProperties(proptype As PropertyType) As String()

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

Returns a human-readable description for the specified property identifier.

Parameter Type Description
p String The property identifier 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 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 (e.g., "PROP_ES_0").
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_ES_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

GetReport(IUnitsOfMeasure, CultureInfo, string): Generates a plain-text report of the energy stream results using the specified unit system and formatting options.

Generates a plain-text report of the energy stream results using the specified unit system and formatting options.

Parameter Type Description
su IUnitsOfMeasure The unit system to use for property values in the report.
ci CultureInfo The culture info used for number formatting.
numberformat String The numeric format string applied to 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

GetStructuredReport(): Generates a structured report of the energy stream results as a list of labeled tuples for display.

Generates a structured report of the energy stream results as a list of labeled tuples for display.

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

Init(): Initializes the CAPE-OPEN parameter collection of this energy stream (skipped when running on Mono) and marks the...

Initializes the CAPE-OPEN parameter collection of this energy stream (skipped when running on Mono) and marks the stream as initialized.

public void Init()
Public Sub Init()

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

Executes the dynamic simulation model step for this energy stream (no-op for energy streams).

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

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 (e.g., "PROP_ES_0").
propval Object The property value to set 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

SetValue(double): Sets the energy flow of this stream directly using a value in kilowatts.

Sets the energy flow of this stream directly using a value in kilowatts.

Parameter Type Description
energyflow_kW Double The energy flow value in kilowatts (kW).
public void SetValue(double energyflow_kW)
Public Sub SetValue(energyflow_kW As Double)

ThrowCAPEException(ref Exception, string, string, string, string, string, string, int): Stores CAPE-OPEN error information and throws a CapeComputationException wrapping the original exception.

Stores CAPE-OPEN error information and throws a CapeComputationException wrapping the original exception.

Parameter Type Description
ex Exception The original exception that triggered the CAPE-OPEN error.
name String The name of the component raising the exception.
description String A human-readable description of the error.
interf String The name of the CAPE-OPEN interface where the error occurred.
moreinfo String Additional information about the error condition.
operation String The name of the operation that failed.
scope String The scope in which the error occurred.
code Int32 The CAPE-OPEN error code.
public void ThrowCAPEException(ref Exception ex, string name, string description, string interf, string moreinfo, string operation, string scope, int code)
Public Sub ThrowCAPEException(ex As Exception, name As String, description As String, interf As String, moreinfo As String, operation As String, scope As String, code As Integer)

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 energy stream, if any.

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

public object f
Public f As Object