Adjust¶
![]()
Represents an Adjust (controller) block that iterates a manipulated variable of one simulation object until the controlled variable of another object reaches a specified target value. Uses a bisection or secant numerical method with an optional reference object for relative targets.
DWSIM.UnitOperations.SpecialOps.Adjust
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← SpecialOpBaseClass ← Adjust
At a glance¶

This object has no stream connections; it acts on other objects through their properties.
Example¶
This code runs on every build of this site, and the output below is what it printed.
fs = (Flowsheet.Create("AdjustExample")
.WithCompound("Water")
.WithPropertyPackage(PropertyPackages.SteamTables))
feed = (fs.AddMaterialStream("Cold water")
.At(Q.Celsius(25.0), Q.Bar(2.0))
.WithMassFlow(Q.KgPerSecond(2.0)))
product = fs.AddMaterialStream("Hot water")
duty = fs.AddEnergyStream("Q-1")
heater = (fs.AddHeater("H-1")
.WithHeatAdded(Q.Kilowatts(100.0)) # first guess, the adjust changes it
.ConnectFeed(feed)
.ConnectProduct(product)
.ConnectEnergyFeed(duty, 1)) # energy inlet is port 1
def target(obj, prop):
info = SpecialOpObjectInfo()
info.ID = obj.Object.Name
info.Name = obj.Object.GraphicObject.Tag
info.PropertyName = prop
info.ObjectType = obj.Object.GetDisplayName()
return info
builder = fs.AddUnitOperation(ObjectType.OT_Adjust, "ADJ-1")
adj = builder.Object.__implementation__
adj.ManipulatedObjectData = target(heater, "PROP_HT_3") # heat added (kW)
adj.ControlledObjectData = target(product, "PROP_MS_0") # temperature
adj.ManipulatedObject = heater.Object
adj.ControlledObject = product.Object
adj.GraphicObject.__implementation__.ConnectedToMv = heater.Object.GraphicObject # drawing links
adj.GraphicObject.__implementation__.ConnectedToCv = product.Object.GraphicObject
adj.AdjustValue = 273.15 + 80.0 # target, in SI units (K)
adj.Tolerance = 0.01 # in the flowsheet display units (C here)
adj.SimultaneousAdjust = True # solved by the flowsheet solver
fs.AutoLayout()
fs.Solve()
h_in = feed.Object.Phases[0].Properties.enthalpy # kJ/kg
h_out = product.Object.Phases[0].Properties.enthalpy
print(f"Outlet temperature = {product.TemperatureK - 273.15:.3f} C (target 80 C)")
print(f"Heater duty found = {heater.HeatDutyKW:.2f} kW")
print(f"Check, m.(h2 - h1) = {2.0 * (h_out - h_in):.2f} kW")
Output
Outlet temperature = 80.000 C (target 80 C)
Heater duty found = 460.10 kW
Check, m.(h2 - h1) = 460.10 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 |
|---|---|---|---|
MinVal |
Manipulated Variable Minimum | yes | |
MaxVal |
Manipulated Variable Maximum | yes | |
AdjustValue |
Set-Point | yes | |
Tolerance |
Tolerance (Maximum Error) | yes | |
StepSize |
Initial Step Size | yes | |
MaximumIterations |
Maximum Iterations | yes |
Learn more¶
-
User guide
API members¶
Public members declared by this class. Inherited members are documented on the base classes.
Constructors¶
Adjust(): Initializes a new default instance of the Adjust class.
Initializes a new default instance of the Adjust class.
Adjust(string, string): Initializes a new instance of the Adjust class with a name and description.
Initializes a new instance of the Adjust class with a name and description.
| Parameter | Type | Description |
|---|---|---|
name |
String |
The display name of the adjust block. |
description |
String |
A brief description of the block. |
Properties¶
ControlledObject: Gets or sets the controlled simulation object instance (not serialized).
Gets or sets the controlled simulation object instance (not serialized).
ControlledVariable: Gets or sets the property identifier of the variable to be controlled (driven to the target value).
Gets or sets the property identifier of the variable to be controlled (driven to the target value).
CvOk: Gets or sets whether the controlled variable object and property are correctly configured.
Gets or sets whether the controlled variable object and property are correctly configured.
InitialEstimate: Gets or sets the optional initial estimate for the manipulated variable used to seed the solver.
Gets or sets the optional initial estimate for the manipulated variable used to seed the solver.
ManipulatedObject: Gets or sets the manipulated simulation object instance (not serialized).
Gets or sets the manipulated simulation object instance (not serialized).
ManipulatedVariable: Gets or sets the property identifier of the variable to be manipulated by the solver.
Gets or sets the property identifier of the variable to be manipulated by the solver.
MaximumIterations: Gets or sets the maximum number of solver iterations allowed before declaring non-convergence.
Gets or sets the maximum number of solver iterations allowed before declaring non-convergence.
MaxVal: Gets or sets the optional upper bound for the manipulated variable search range.
Gets or sets the optional upper bound for the manipulated variable search range.
MinVal: Gets or sets the optional lower bound for the manipulated variable search range.
Gets or sets the optional lower bound for the manipulated variable search range.
MobileCompatible: Gets a value indicating whether this block is compatible with the DWSIM mobile interface.
Gets a value indicating whether this block is compatible with the DWSIM mobile interface.
MvOk: Gets or sets whether the manipulated variable object and property are correctly configured.
Gets or sets whether the manipulated variable object and property are correctly configured.
ReferenceObject: Gets or sets the optional reference simulation object instance (not serialized).
Gets or sets the optional reference simulation object instance (not serialized).
ReferenceVariable: Gets or sets the property identifier of the optional reference variable used as a relative target basis.
Gets or sets the property identifier of the optional reference variable used as a relative target basis.
RvOk: Gets or sets whether the reference variable object and property are correctly configured.
Gets or sets whether the reference variable object and property are correctly configured.
SolvingMethodSelf: Gets or sets the solving method index used by this block (0 = bisection, 1 = secant, etc.).
Gets or sets the solving method index used by this block (0 = bisection, 1 = secant, etc.).
Status: Gets or sets a status message describing the outcome of the last calculation attempt.
Gets or sets a status message describing the outcome of the last calculation attempt.
StepSize: Gets or sets the step size used by the initial perturbation of the manipulated variable.
Gets or sets the step size used by the initial perturbation of the manipulated variable.
Methods¶
CloneXML(): Creates a deep copy of this adjust block via XML serialization.
Creates a deep copy of this adjust block via XML serialization.
CloseEditForm(): Closes and disposes the editing form for this adjust block if it is open.
Closes and disposes the editing form for this adjust block if it is open.
DisplayEditForm(): Opens or activates the editing form for this adjust block.
Opens or activates the editing form for this adjust block.
GetDisplayDescription(): Returns the localized display description for the adjust block type.
Returns the localized display description for the adjust block type.
GetDisplayName(): Returns the localized display name for the adjust block type.
Returns the localized display name for the adjust block type.
GetIconBitmapBytes(): Returns the raw bytes of the adjust block icon image resource.
Returns the raw bytes of the adjust block icon image resource.
GetProperties(PropertyType): Returns the list of property identifiers available for this adjust block.
Returns the list of property identifiers available for this adjust block.
| Parameter | Type | Description |
|---|---|---|
proptype |
PropertyType |
The type of properties to retrieve. |
GetPropertyDescription(string): Readable names for the property identifiers, which are the .NET property names.
Readable names for the property identifiers, which are the .NET property names.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit string for the specified property (always an empty string for this block).
Returns the unit string for the specified property (always an empty string for this block).
| Parameter | Type | Description |
|---|---|---|
prop |
String |
The property identifier string. |
su |
IUnitsOfMeasure |
The unit system to use; defaults to SI if not provided. |
GetPropertyValue(string, IUnitsOfMeasure): Returns the value of the specified property.
Returns the value of the specified property.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
The property identifier or name string. |
su |
IUnitsOfMeasure |
The unit system to use; defaults to SI if not provided. |
LoadData(List<XElement>): Restores the adjust block state from a list of XML elements.
Restores the adjust block state from a list of XML elements.
| Parameter | Type | Description |
|---|---|---|
data |
List<XElement> |
The list of XElement objects containing the serialized state. |
PerformAdjust(string, double, double): Solves the adjust with a numerical root finder: changes the manipulated variable and re-solves the flowsheet until...
Solves the adjust with a numerical root finder: changes the manipulated variable and re-solves the flowsheet until the controlled variable matches the target value (or the referenced variable plus the target offset). If the solver fails, the manipulated variable is restored to its initial value and the exception is rethrown.
| Parameter | Type | Description |
|---|---|---|
solver |
String |
Root finder to use (case-insensitive): "secant", "brent", "newton" or "ipopt". |
minval |
Double |
Optional lower bound of the manipulated variable, in the flowsheet's selected units. Used by the Brent and IPOPT solvers; when both bounds are given, the secant solver takes its limits from MinVal and MaxVal. |
maxval |
Double |
Optional upper bound of the manipulated variable, in the flowsheet's selected units, used in the same way as minval. |
SaveData(): Serializes the adjust block state to a list of XML elements for persistence.
Serializes the adjust block state to a list of XML elements for persistence.
SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property.
Sets the value of the specified property.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
The property identifier or name string. |
propval |
Object |
The new value to assign. |
su |
IUnitsOfMeasure |
The unit system of the supplied value; defaults to SI if not provided. |
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.
Fields¶