Skip to content

Material Stream Mapper

DWSIM Plus

Available with a DWSIM Plus (Patreon) subscription.

Logical block that copies a source material stream to a target stream and optionally overrides the target's flow, temperature, pressure, flash specification and individual compound amounts, and redirects the mass flow of source compounds to other compounds (compound mappings).

DWSIM.UnitOperations.ExtensionPack.MaterialStreamMapper
Assembly DWSIM.UnitOperations.ExtensionPack.dll · Object ← BaseClass ← UnitOpBaseClass ← MaterialStreamMapper

At a glance

Material Stream Mapper in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Source
Outlet, material 0 Target

Example

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

fs = (Flowsheet.Create("MapperExample")
      .WithCompounds("Methane", "Propane", "Isobutane", "N-butane")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

source = (fs.AddMaterialStream("Source")
          .At(Q.Celsius(40.0), Q.Bar(20.0))
          .SetCompoundMassFlow("Methane", 1.0)
          .SetCompoundMassFlow("Propane", 0.3)
          .SetCompoundMassFlow("Isobutane", 0.0)
          .SetCompoundMassFlow("N-butane", 0.2))
target = fs.AddMaterialStream("Target")

# The outlet starts as a copy of the inlet; the overrides then change it.
mapper = (fs.AddMaterialStreamMapper("MAP-1")
          .WithOverrideTemperature(True, 273.15 + 15.0)   # K
          .WithOverridePressure(True, 5.0e5)               # Pa
          .MapCompound("N-butane", "Isobutane")            # mass of n-butane goes to isobutane
          .ConnectFeed(source)
          .ConnectProduct(target))

fs.AutoLayout()
fs.Solve()

t = target.Object
print(f"Target T          = {target.TemperatureK - 273.15:.1f} C")
print(f"Target P          = {t.GetPressure() / 1e5:.2f} bar")
print(f"Target mass flow  = {t.GetMassFlow():.3f} kg/s")
print(f"Target isobutane  = {t.GetCompoundMassFlow('Isobutane'):.3f} kg/s")
print(f"Target n-butane   = {t.GetCompoundMassFlow('N-butane'):.3f} kg/s")

Output

Target T          = 15.0 C
Target P          = 5.00 bar
Target mass flow  = 1.500 kg/s
Target isobutane  = 0.200 kg/s
Target n-butane   = 0.000 kg/s

DWSIM 10.2.11.0, generated 2026-10-08.

Learn more

API members

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

Constructors

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

Initializes a new default instance of the MaterialStreamMapper class.

public MaterialStreamMapper()
Public Sub New()

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

Initializes a new instance of the MaterialStreamMapper 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.
public MaterialStreamMapper(string Name, string Description)
Public Sub New(Name As String, Description As String)

Properties

ComponentDescription: Gets or sets the CAPE-OPEN component description for this unit operation.

Gets or sets the CAPE-OPEN component description for this unit operation.

public override string ComponentDescription { get; set; }
Public Overrides Property ComponentDescription As String

ComponentName: Gets or sets the CAPE-OPEN component name for this unit operation.

Gets or sets the CAPE-OPEN component name for this unit operation.

public override string ComponentName { get; set; }
Public Overrides Property ComponentName As String

CompoundAmountOverrides: Gets or sets the per-compound amount overrides applied to the target stream: each sets a compound's mass flow, molar...

Gets or sets the per-compound amount overrides applied to the target stream: each sets a compound's mass flow, molar flow or a percentage of its mass flow in the source stream.

public List<CompoundAmountOverride> CompoundAmountOverrides { get; set; }
Public Property CompoundAmountOverrides As List(Of CompoundAmountOverride)

CompoundMaps: Gets or sets the compound mappings as pairs {source compound, target compound}: the source compound's mass flow in...

Gets or sets the compound mappings as pairs {source compound, target compound}: the source compound's mass flow in the inlet stream is moved to the target compound in the outlet stream, and the source compound's flow in the outlet is set to zero. Applied after the compound amount overrides.

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

IsPremium: Gets a value indicating whether this unit operation requires a premium (Patreon) subscription.

Gets a value indicating whether this unit operation requires a premium (Patreon) subscription. Always True.

public bool IsPremium { get; }
Public ReadOnly Property IsPremium As Boolean

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.

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

ObjectClass: Gets or sets the simulation object class category (logical).

Gets or sets the simulation object class category (logical).

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

OverrideFlashSpec: Gets or sets whether the target stream uses OverrideFlashSpecValue as its flash...

Gets or sets whether the target stream uses OverrideFlashSpecValue as its flash specification. When False, the target keeps the source's specification. Default False.

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

OverrideFlashSpecValue: Gets or sets the flash specification (e.g.

Gets or sets the flash specification (e.g. temperature and pressure, pressure and enthalpy) applied to the target stream when OverrideFlashSpec is True.

public StreamSpec OverrideFlashSpecValue { get; set; }
Public Property OverrideFlashSpecValue As StreamSpec

OverrideFlow: Gets or sets whether the total flow of the target stream is replaced by OverrideFlowValue.

Gets or sets whether the total flow of the target stream is replaced by OverrideFlowValue. Default False.

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

OverrideFlowType: Gets or sets the kind of flow set by the flow override: mass, molar or volumetric.

Gets or sets the kind of flow set by the flow override: mass, molar or volumetric.

public FlowSpec OverrideFlowType { get; set; }
Public Property OverrideFlowType As FlowSpec

OverrideFlowUnits: Gets or sets the units of OverrideFlowValue (e.g.

Gets or sets the units of OverrideFlowValue (e.g. "kg/s", "kmol/h", "m3/h"). Default "kg/s".

public string OverrideFlowUnits { get; set; }
Public Property OverrideFlowUnits As String

OverrideFlowValue: Gets or sets the flow override value, in the units given by OverrideFlowUnits.

Gets or sets the flow override value, in the units given by OverrideFlowUnits. Default 1.0.

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

OverridePressure: Gets or sets whether the target stream pressure is replaced by OverridePressureValue (the...

Gets or sets whether the target stream pressure is replaced by OverridePressureValue (the flash specification becomes temperature and pressure). Default False.

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

OverridePressureUnits: Gets or sets the units of OverridePressureValue (e.g.

Gets or sets the units of OverridePressureValue (e.g. "Pa", "kPa", "bar"). Default "Pa".

public string OverridePressureUnits { get; set; }
Public Property OverridePressureUnits As String

OverridePressureValue: Gets or sets the pressure override value, in the units given by OverridePressureUnits.

Gets or sets the pressure override value, in the units given by OverridePressureUnits. Default 101325.

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

OverrideTemperature: Gets or sets whether the target stream temperature is replaced by...

Gets or sets whether the target stream temperature is replaced by OverrideTemperatureValue (the flash specification becomes temperature and pressure). Default False.

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

OverrideTemperatureUnits: Gets or sets the units of OverrideTemperatureValue ('K', 'C', 'F' or 'R').

Gets or sets the units of OverrideTemperatureValue ("K", "C", "F" or "R"). Default "K".

public string OverrideTemperatureUnits { get; set; }
Public Property OverrideTemperatureUnits As String

OverrideTemperatureValue: Gets or sets the temperature override value, in the units given by...

Gets or sets the temperature override value, in the units given by OverrideTemperatureUnits. Default 298.15.

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

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)

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.

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

CloseEditForm(): Closes the editor of this object, if it is open.

Closes the editor of this object, if it is open.

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

DisplayEditForm(): Opens the editor of this object.

Opens the editor of this object. A host that has no editor for it does nothing.

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

GetDisplayDescription(): Returns the description string for this unit operation type.

Returns the description string for this unit operation type.

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

GetDisplayName(): Returns the display name for this unit operation type.

Returns the display name for this unit operation type.

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

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.

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

LoadData(List<XElement>): Restores the unit operation state from a list of XML elements previously produced by SaveData.

Restores the unit operation state from a list of XML elements previously produced by SaveData.

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

PerformPostCalcValidation(): Post-calculation validation of the outlet stream.

Post-calculation validation of the outlet stream. Does nothing for this unit operation.

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

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

Serializes the unit operation state to a list of XML elements for persistence.

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

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.

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

Validate(): Validates the object, checking its connections and other parameters.

Validates the object, checking its connections and other parameters.

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

Fields

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

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

public EditingForm_MSMapper f
Public f As EditingForm_MSMapper