Skip to content

Thermo Property Editor

DWSIM Plus

Available with a DWSIM Plus (Patreon) subscription.

Thermo property editor: exposes the binary interaction parameters of the flowsheet property packages (PR, SRK, PR78, NRTL, UNIQUAC and Wilson) as object properties, so tools such as Adjust and sensitivity analysis can read and change them. It copies the source (inlet) stream to the target (outlet) stream unchanged.

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

At a glance

Thermo Property Editor in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Feed
Outlet, material 0 Copy

Example

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

def run(kij=None):
    fs = (Flowsheet.Create("ThermoEditorExample")
          .WithCompounds("Methane", "Carbon dioxide")
          .WithPropertyPackage(PropertyPackages.PengRobinson))
    feed = (fs.AddMaterialStream("Feed")
            .At(Q.Celsius(-40.0), Q.Bar(40.0))
            .SetCompoundMolarFlow("Methane", 60.0)
            .SetCompoundMolarFlow("Carbon dioxide", 40.0))
    copy = fs.AddMaterialStream("Copy")

    # The outlet is a copy of the inlet. The object's properties are the BIPs of the
    # flowsheet property packages, named "<package>: <c1> / <c2>: <parameter>".
    editor = (fs.AddThermoPropertyEditor("TPE-1")
              .ConnectFeed(feed)
              .ConnectProduct(copy))
    obj = editor.Object
    kij_id = next(p for p in obj.GetProperties(PropertyType.ALL) if p.endswith("Carbon dioxide: kij"))
    if kij is not None:
        obj.SetPropertyValue(kij_id, kij)    # set before the solve

    fs.AutoLayout()
    fs.Solve()
    vf = copy.Object.Phases[2].Properties.molarfraction
    return fs, editor, kij_id, obj.GetPropertyValue(kij_id), vf

fs, editor, kij_id, kij_db, vf_db = run()
print(f"Property ID    = {kij_id}")
print(f"kij (database) = {kij_db:.4f}, vapor fraction = {vf_db:.4f}")
for kij in (0.0, 0.15):
    fs, editor, _, k, vf = run(kij)
    print(f"kij            = {k:.4f}, vapor fraction = {vf:.4f}")

Output

Property ID    = Peng-Robinson (PR): Methane / Carbon dioxide: kij
kij (database) = 0.0793, vapor fraction = 0.8456
kij            = 0.0000, vapor fraction = 0.7715
kij            = 0.1500, vapor fraction = 0.8757

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
Peng-Robinson (PR): Methane / Carbon dioxide: kij yes

Learn more

API members

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

Constructors

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

Initializes a new default instance of the ThermoPropertyEditor class.

public ThermoPropertyEditor()
Public Sub New()

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

Initializes a new instance of the ThermoPropertyEditor 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 ThermoPropertyEditor(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

IsPremium: Gets a value indicating whether this unit operation is a premium (DWSIM Patreon) unit operation.

Gets a value indicating whether this unit operation is a premium (DWSIM Patreon) unit operation. Always True; the object palette lists it under the Premium category.

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

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()

GetProperties(PropertyType): Get a list of all properties of the object.

Get a list of all properties of the object.

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

GetPropertyUnit(string, IUnitsOfMeasure): Gets the units of a property.

Gets the units of a property.

Parameter Type Description
prop String Property identifier.
su IUnitsOfMeasure Units system to use. Null to use the default (SI) system.
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 a named property, converting from SI to the current unit system.

Returns the value of a named property, converting from SI to the current unit system. Falls back to extra properties if the property is not found in the base implementation.

Parameter Type Description
prop String The property identifier string.
su IUnitsOfMeasure Optional units-of-measure system used for conversion; uses the shared SI system when Nothing.
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 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 hook.

Post-calculation validation hook. Does nothing for this object.

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)

SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of a property.

Sets the value of a property.

Parameter Type Description
prop String Property identifier.
propval Object Property value to set at the specified units.
su IUnitsOfMeasure Units system to use. Null to use the default (SI) system.
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(): 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 object, if any.

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

public EditingForm_ThermoPropertyEditor f
Public f As EditingForm_ThermoPropertyEditor