Skip to content

Compressor

Represents a compressor unit operation that raises the pressure of a gas or vapor stream using adiabatic or polytropic compression. Supports multiple calculation modes including outlet pressure, pressure ratio, power required, and performance curves.

DWSIM.UnitOperations.UnitOperations.Compressor
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← Compressor

At a glance

Compressor in the example flowsheet

Port Index Connected in the example
Inlet, material 0 Gas-in
Inlet, energy 1 K-1 power
Outlet, material 0 Gas-out

Example

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

fs = (Flowsheet.Create("CompressorExample")
      .WithCompounds("Methane", "Ethane", "Propane")
      .WithPropertyPackage(PropertyPackages.PengRobinson))

gas_in = (fs.AddMaterialStream("Gas-in")
          .At(Q.Celsius(30.0), Q.Bar(20.0))
          .SetCompoundMolarFlow("Methane", 90.0)     # mol/s
          .SetCompoundMolarFlow("Ethane", 7.0)
          .SetCompoundMolarFlow("Propane", 3.0))
gas_out = fs.AddMaterialStream("Gas-out")
power = fs.AddEnergyStream("K-1 power")

compressor = (fs.AddCompressor("K-1")
              .WithOutletPressure(Q.Bar(60.0))
              .WithAdiabaticEfficiencyPercent(75.0)
              .ConnectFeed(gas_in)
              .ConnectProduct(gas_out)
              .ConnectEnergyFeed(power, 1))      # energy inlet is port 1

fs.AutoLayout()
fs.Solve()

k1 = compressor.Object
print(f"Power required  = {k1.DeltaQ:.1f} kW")
print(f"Outlet T        = {gas_out.TemperatureK - 273.15:.1f} C")
print(f"Adiabatic head  = {k1.AdiabaticHead:.0f} m")
print(f"Adiabatic coeff = {k1.AdiabaticCoefficient:.3f}")
print(f"Mass flow       = {gas_in.Object.GetMassFlow():.3f} kg/s")

Output

Power required  = 395.1 kW
Outlet T        = 133.4 C
Adiabatic head  = 17613 m
Adiabatic coeff = 1.282
Mass flow       = 1.787 kg/s

DWSIM 10.2.11.0, generated 2026-10-08.

Calculation modes

Set with CalcMode (CalculationMode). The mode decides which properties are inputs; every other one is a result and is overwritten by the calculation.

Mode Value What it does Inputs
OutletPressure 0 Outlet conditions calculated from a specified outlet pressure. PROP_CO_1, PROP_CO_4
Delta_P 1 Outlet conditions calculated from a specified pressure increase (Pa). PROP_CO_0, PROP_CO_1
EnergyStream 2 Power input read from the connected energy stream. PROP_CO_1
PowerRequired 3 Outlet pressure calculated to consume the specified power. PROP_CO_1, PROP_CO_3
Head 4 Outlet pressure calculated from a specified polytropic or adiabatic head. PROP_CO_1, AdiabaticHead
Curves 5 Outlet conditions determined from pump performance curves. PROP_CO_1, RotationSpeed
PressureRatio 6 Outlet conditions calculated from a specified pressure ratio. PROP_CO_1, PressureRatio

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 in
PROP_CO_0 Pressure Increase Pa Delta_P
PROP_CO_1 Adiabatic Efficiency % all modes
PROP_CO_2 Temperature Difference K (difference) result
PROP_CO_3 Power Required kW PowerRequired
PROP_CO_4 Pressure Pa OutletPressure
PolytropicEfficiency Polytropic Efficiency % result
AdiabaticCoefficient Adiabatic Coefficient result
PolytropicCoefficient Polytropic Coefficient result
AdiabaticHead Adiabatic Head m Head
PolytropicHead Polytropic Head m result
RotationSpeed Rotation Speed rpm Curves
PressureRatio PressureRatio

Dynamic mode

Extra properties used when the flowsheet runs in dynamic mode.

Name Unit
Flow Conductance [kg/s]/[Pa^0.5]
Volume m3
Minimum Pressure Pa
Initialize using Inlet Stream
Reset Content
Rotational Inertia
Current Speed
Target Speed
Motor Torque
Surge Flow Fraction
Surge Alarm
Design Inlet Volumetric Flow m3/s
Integrate Casing Holdup
Rated Speed

Learn more

API members

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

Constructors

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

Initializes a new default instance of the Compressor class.

public Compressor()
Public Sub New()

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

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

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

Properties

AdiabaticCoefficient: Gets or sets the calculated adiabatic head coefficient.

Gets or sets the calculated adiabatic head coefficient.

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

AdiabaticEfficiency: Gets or sets the adiabatic (isentropic) efficiency (%).

Gets or sets the adiabatic (isentropic) efficiency (%).

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

AdiabaticHead: Gets or sets the calculated adiabatic head (J/kg).

Gets or sets the calculated adiabatic head (J/kg).

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

CalcMode: Gets or sets the active calculation mode.

Gets or sets the active calculation mode.

public Compressor.CalculationMode CalcMode { get; set; }
Public Property CalcMode As Compressor.CalculationMode

CurveEff: Gets or sets the efficiency read from the performance curve (%).

Gets or sets the efficiency read from the performance curve (%).

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

CurveFlow: Gets or sets the volumetric flow rate read from the performance curve (m³/s).

Gets or sets the volumetric flow rate read from the performance curve (m³/s).

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

CurveHead: Gets or sets the head read from the performance curve (m).

Gets or sets the head read from the performance curve (m).

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

CurvePower: Gets or sets the power read from the performance curve (kW).

Gets or sets the power read from the performance curve (kW).

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

Curves: Gets or sets the dictionary of performance curves keyed by rotation speed (RPM).

Gets or sets the dictionary of performance curves keyed by rotation speed (RPM).

public Dictionary<int, Dictionary<string, Curve>> Curves { get; set; }
Public Property Curves As Dictionary(Of Integer, Dictionary(Of String, Curve))

CurvesDB: Gets or sets the serialized performance curves database string.

Gets or sets the serialized performance curves database string.

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

DeltaP: Gets or sets the pressure increase across the compressor (Pa).

Gets or sets the pressure increase across the compressor (Pa).

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

DeltaQ: Gets or sets the shaft power required (kW).

Gets or sets the shaft power required (kW).

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

DeltaT: Gets or sets the calculated temperature change across the compressor (K).

Gets or sets the calculated temperature change across the compressor (K).

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

DesignInletVolumetricFlow: Inlet volumetric flow (m3/s) recorded by the last steady-state calculation.

Inlet volumetric flow (m3/s) recorded by the last steady-state calculation. The dynamic surge alarm compares the running inlet flow against a fraction of this value.

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

EquipmentTypes: Gets the list of equipment sub-types available for this compressor.

Gets the list of equipment sub-types available for this compressor.

public override List<string> EquipmentTypes { get; }
Public Overrides ReadOnly Property EquipmentTypes As List(Of String)

EquipType: Gets or sets the equipment sub-type identifier string.

Gets or sets the equipment sub-type identifier string.

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

HasPropertiesForDynamicMode: Gets a value indicating whether this unit operation exposes properties for dynamic mode.

Gets a value indicating whether this unit operation exposes properties for dynamic mode.

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

HeatDuty: Gets or sets the shaft power (kW) as a proxy for DeltaQ.

Gets or sets the shaft power (kW) as a proxy for DeltaQ.

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

IgnorePhase: Gets or sets whether the phase check is bypassed during calculation.

Gets or sets whether the phase check is bypassed during calculation.

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

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

Gets a value indicating whether this unit operation 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 category (PressureChangers).

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

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

OutletTemperature: Gets or sets the calculated outlet temperature (K).

Gets or sets the calculated outlet temperature (K).

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

PolytropicCoefficient: Gets or sets the calculated polytropic head coefficient.

Gets or sets the calculated polytropic head coefficient.

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

PolytropicEfficiency: Gets or sets the polytropic efficiency (%).

Gets or sets the polytropic efficiency (%).

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

PolytropicHead: Gets or sets the calculated polytropic head (J/kg).

Gets or sets the calculated polytropic head (J/kg).

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

POut: Gets or sets the specified outlet pressure (Pa).

Gets or sets the specified outlet pressure (Pa).

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

PressureIncrease: Gets or sets the pressure increase (Pa) as a proxy for DeltaP.

Gets or sets the pressure increase (Pa) as a proxy for DeltaP.

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

PressureRatio: Gets or sets the specified pressure ratio (outlet/inlet).

Gets or sets the specified pressure ratio (outlet/inlet).

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

ProcessPath: Gets or sets the thermodynamic process path (adiabatic or polytropic).

Gets or sets the thermodynamic process path (adiabatic or polytropic).

public Compressor.ProcessPathType ProcessPath { get; set; }
Public Property ProcessPath As Compressor.ProcessPathType

Speed: Gets or sets the operating rotation speed (RPM) used for curve interpolation.

Gets or sets the operating rotation speed (RPM) used for curve interpolation.

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

SupportsDynamicMode: Gets a value indicating whether this unit operation supports dynamic simulation mode.

Gets a value indicating whether this unit operation supports dynamic simulation mode.

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

TemperatureChange: Gets or sets the temperature change (K) as a proxy for DeltaT.

Gets or sets the temperature change (K) as a proxy for DeltaT.

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

Methods

Calculate(object): Performs the compressor calculation: determines outlet pressure, temperature, and power consumption using the...

Performs the compressor calculation: determines outlet pressure, temperature, and power consumption using the selected CalcMode and ProcessPath.

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 compressor via XML serialization.

Creates a deep copy of this compressor via XML serialization.

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

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

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

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

CreateCurves(): Creates an empty set of performance curves for one rotational speed: head ('HEAD'), efficiency ('EFF') and power...

Creates an empty set of performance curves for one rotational speed: head ("HEAD"), efficiency ("EFF") and power ("POWER").

public Dictionary<string, Curve> CreateCurves()
Public Function CreateCurves() As Dictionary(Of String, Curve)

CreateDimensionsList(): Creates the dimensions list (Flow, Pressure, PressureDiff, Efficiency, Power).

Creates the dimensions list (Flow, Pressure, PressureDiff, Efficiency, Power).

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

CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode: flow conductance, casing volume and holdup options...

Registers the dynamic properties for dynamic simulation mode: flow conductance, casing volume and holdup options, minimum pressure, rotor inertia, current, target and rated speeds (RPM), motor torque, and the surge limit and alarm.

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

DeCalculate(): Resets the outlet material and energy streams to an uncalculated state.

Resets the outlet material and energy streams to an uncalculated state.

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

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

Opens or activates the editing form for this compressor.

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

GetCalculationModes(): Returns the list of available calculation mode names and IDs.

Returns the list of available calculation mode names and IDs.

public override string[] GetCalculationModes()
Public Overrides Function GetCalculationModes() As String()

GetChartModel(string): Builds an OxyPlot model of one map kind in the units of the first enabled curve, with the operating point marked...

Builds an OxyPlot model of one map kind in the units of the first enabled curve, with the operating point marked when the flow axis is an actual volumetric flow.

Parameter Type Description
name String
public override object GetChartModel(string name)
Public Overrides Function GetChartModel(name As String) As Object

GetChartModelNames(): Chart names the PFD chart object can embed: the performance map, one series per measured speed, with the operating...

Chart names the PFD chart object can embed: the performance map, one series per measured speed, with the operating point.

public override List<string> GetChartModelNames()
Public Overrides Function GetChartModelNames() As List(Of String)

GetDisplayDescription(): Returns the localized display description for the compressor type.

Returns the localized display description for the compressor type.

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

GetDisplayName(): Returns the localized display name for the compressor type.

Returns the localized display name for the compressor type.

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

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

Returns the raw bytes of the compressor icon image resource.

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

GetProperties(PropertyType): Returns the list of property identifiers available for this compressor.

Returns the list of property identifiers available for this compressor.

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

GetPropertyDescription(string): Returns a human-readable description for the specified property name, used in the property grid.

Returns a human-readable description for the specified property name, used in the property grid.

Parameter Type Description
p String The property display name.
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.

Returns the unit string for the specified property.

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_CO_0").
su IUnitsOfMeasure The unit system to use; 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 text report summarizing the compressor's inlet, outlet, and calculation parameters.

Generates a text report summarizing the compressor's inlet, outlet, and calculation parameters.

Parameter Type Description
su IUnitsOfMeasure The unit system for reported values.
ci CultureInfo The culture info used for number formatting.
numberformat String The numeric format string.
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 (tabular) results report for display in the UI.

Generates a structured (tabular) results report for display in the UI.

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

LoadData(List<XElement>): Restores the compressor state from a list of XML elements, including performance curves.

Restores the compressor state from a list of XML elements, including performance curves.

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

ReadCurveMap(double, double, double, ref double, ref double, ref double): Reads the performance map at a flow and a speed.

Reads the performance map at a flow and a speed. The curves of every measured speed are interpolated along their own flow axis (actual volumetric flow when the unit of that axis carries the @ P,T suffix, molar flow otherwise), and the readings are then interpolated across the measured speeds. Head, power and efficiency come back in SI (m, kW, fraction), and NaN where the machine has no enabled curve of that kind.

Parameter Type Description
qactual Double
qmolar Double
atspeed Double
head Double
power Double
efficiency Double
public void ReadCurveMap(double qactual, double qmolar, double atspeed, ref double head, ref double power, ref double efficiency)
Public Sub ReadCurveMap(qactual As Double, qmolar As Double, atspeed As Double, head As Double, power As Double, efficiency As Double)

RunDynamicModel(): Runs one dynamic-mode integration step.

Runs one dynamic-mode integration step. The rotor speed moves towards the target speed at a rate set by the motor torque and inertia. By default the compressor acts as a pressure-flow element and sets the outlet to the inlet pressure plus the pressure rise at the current flow and speed; with "Integrate Casing Holdup" enabled it integrates the casing volume as a capacity. The pressure rise comes from the curve map in Curves mode, or from the flow conductance scaled by the square of the speed ratio. The surge alarm is updated at the end.

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

SaveData(): Serializes the compressor state, including performance curve data, into a list of XML elements.

Serializes the compressor state, including performance curve data, into a list of XML elements.

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

SetCalculationMode(int): Sets the calculation mode by numeric ID and returns the mode name.

Sets the calculation mode by numeric ID and returns the mode name.

Parameter Type Description
modeID Int32 The integer ID of the desired calculation mode.
public override object SetCalculationMode(int modeID)
Public Overrides Function SetCalculationMode(modeID As Integer) As Object

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

Sets the value of the specified property from the given unit system.

Parameter Type Description
prop String The property identifier string.
propval Object The new value to assign.
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

UpdateDimensionsList(): Updates all dimension values from the current calculated results.

Updates all dimension values from the current calculated results.

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

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 unit operation, if any.

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

public object f
Public f As Object