Pipe Network¶
DWSIM Plus
Available with a DWSIM Plus (Patreon) subscription.
![]()
Pipe Network unit operation: a flowsheet block that contains a network of sources, sinks, nodes, pipe segments and equipment (valves, pumps, compressors, separators, wells, relief devices and others) drawn on its own diagram, and solves the pressures and flows of the whole network against the material streams connected to its boundary ports.
DWSIM.UnitOperations.PipeNetworkUnitOperation
Assembly DWSIM.UnitOperations.PipeNetwork.dll · Object ← BaseClass ← UnitOpBaseClass ← PipeNetworkUnitOperation
At a glance¶

| Port | Index | Connected in the example |
|---|---|---|
| Inlet, material | 0 |
Supply |
| Inlet, material | 1 |
|
| Inlet, material | 2 |
|
| Inlet, material | 3 |
|
| Inlet, material | 4 |
|
| Inlet, material | 5 |
|
| Inlet, material | 6 |
|
| Inlet, material | 7 |
|
| Inlet, material | 8 |
|
| Inlet, material | 9 |
|
| Inlet, material | 10 |
|
| Inlet, material | 11 |
|
| Inlet, material | 12 |
|
| Inlet, material | 13 |
|
| Inlet, material | 14 |
|
| Inlet, material | 15 |
|
| Inlet, material | 16 |
|
| Inlet, material | 17 |
|
| Inlet, material | 18 |
|
| Inlet, material | 19 |
|
| Inlet, material | 20 |
|
| Inlet, material | 21 |
|
| Inlet, material | 22 |
|
| Inlet, material | 23 |
|
| Inlet, material | 24 |
|
| Inlet, material | 25 |
|
| Inlet, material | 26 |
|
| Inlet, material | 27 |
|
| Inlet, material | 28 |
|
| Inlet, material | 29 |
|
| Outlet, material | 0 |
Demand-1 |
| Outlet, material | 1 |
Demand-2 |
| Outlet, material | 2 |
|
| Outlet, material | 3 |
|
| Outlet, material | 4 |
|
| Outlet, material | 5 |
|
| Outlet, material | 6 |
|
| Outlet, material | 7 |
|
| Outlet, material | 8 |
|
| Outlet, material | 9 |
|
| Outlet, material | 10 |
|
| Outlet, material | 11 |
|
| Outlet, material | 12 |
|
| Outlet, material | 13 |
|
| Outlet, material | 14 |
|
| Outlet, material | 15 |
|
| Outlet, material | 16 |
|
| Outlet, material | 17 |
|
| Outlet, material | 18 |
|
| Outlet, material | 19 |
|
| Outlet, material | 20 |
|
| Outlet, material | 21 |
|
| Outlet, material | 22 |
|
| Outlet, material | 23 |
|
| Outlet, material | 24 |
|
| Outlet, material | 25 |
|
| Outlet, material | 26 |
|
| Outlet, material | 27 |
|
| Outlet, material | 28 |
|
| Outlet, material | 29 |
Example¶
This code runs on every build of this site, and the output below is what it printed.
fs = (Flowsheet.Create("PipeNetworkExample")
.WithCompound("Water")
.WithPropertyPackage(PropertyPackages.SteamTables))
net = fs.AddPipeNetwork("NET-1") # nodal Newton solver, incompressible model for water
# Each Add* places a block inside the network and returns its node; As[T]() gives the block.
res = net.AddReservoir("RES")
n1, n2, n3, n4 = (net.AddNode(t) for t in ("N1", "N2", "N3", "N4"))
main, br1, br2 = (net.AddWaterPipe(t) for t in ("MAIN", "BR1", "BR2"))
d1, d2 = net.AddSink("D1"), net.AddSink("D2")
reservoir = res.As[Reservoir]()
reservoir.ElevationM = 50.0 # reservoir base 50 m above the network
reservoir.LevelM = 5.0 # 5 m of water above the base
for node, length, diameter in ((main, 800.0, 0.25), (br1, 400.0, 0.15), (br2, 600.0, 0.15)):
pipe = node.As[WaterPipe]()
pipe.LengthM = length
pipe.DiameterM = diameter
pipe.RoughnessM = 4.6e-5 # commercial steel
for node, demand in ((d1, 20.0), (d2, 15.0)):
sink = node.As[Sink]()
sink.BoundarySpec = BoundarySpecification.MassFlow
sink.MassFlowSpec = demand # kg/s
# Pipes join nodes; boundaries attach to nodes, never straight to a pipe.
net.ConnectChain(res, n1, main, n2, br1, n3, d1)
net.ConnectChain(n2, br2, n4, d2)
# Every boundary needs a flowsheet stream: a feed for the reservoir, a product for each sink.
for node, tag in ((res, "Supply"), (d1, "Demand-1"), (d2, "Demand-2")):
stream = (net.AttachStream(node, tag)
.SetCompoundMassFlow("Water", 10.0)
.At(Q.Celsius(20.0), Q.Bar(5.0)))
stream.Object.Calculate() # initial state; the network overwrites it
net.AutoLayout()
fs.Solve()
for node in (n1, n2, n3, n4):
print(f"{node.Tag} pressure = {node.As[Node]().Pressure / 1e5:.3f} bar")
for node in (main, br1, br2):
pipe = node.As[WaterPipe]()
print(f"{node.Tag:4s} flow = {pipe.MassFlow:5.1f} kg/s, pressure drop = {pipe.PressureDropResult / 1000:5.1f} kPa")
Output
N1 pressure = 6.407 bar
N2 pressure = 6.266 bar
N3 pressure = 5.955 bar
N4 pressure = 5.994 bar
MAIN flow = 35.0 kg/s, pressure drop = 14.1 kPa
BR1 flow = 20.0 kg/s, pressure drop = 31.1 kPa
BR2 flow = 15.0 kg/s, pressure drop = 27.2 kPa
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.
All 141 properties
| ID | Name | Unit (SI) | Input |
|---|---|---|---|
Initialize Streams |
yes | ||
Solver |
yes | ||
Nodal Flow Model |
yes | ||
Compressible Gas Energy Model |
yes | ||
Nodal Max Outer Iterations |
yes | ||
Nodal Stall Iterations |
yes | ||
Nodal Stall Improvement |
yes | ||
Nodal Outer Tolerance |
yes | ||
Nodal Outer Temperature Tolerance |
K (difference) | yes | |
Nodal Flow Tolerance |
yes | ||
Nodal Composition Tolerance |
yes | ||
Refine With Direct Evaluation |
yes | ||
Richardson Extrapolation |
yes | ||
Direct Evaluation Time Limit (s) |
yes | ||
Use PVT Table |
yes | ||
PVT Table Nodes |
yes | ||
Direct Evaluation Too Slow |
yes | ||
Solver Progress After (s) |
yes | ||
Diagram Refresh Rate |
yes | ||
Nodal Outer Relaxation |
yes | ||
Solver Relative Error Tolerance |
yes | ||
Solver Max Iterations |
yes | ||
Default Pressure Drop Correlation |
yes | ||
Default Pressure Tolerance |
Pa | yes | |
Default Temperature Tolerance |
K (difference) | yes | |
Default Max Pressure Iterations |
yes | ||
Default Max Temperature Iterations |
yes | ||
Accelerate Pipe Energy Balance |
yes | ||
Pipe Flash Pressure Trigger |
yes | ||
Pipe Flash Temperature Trigger |
K (difference) | yes | |
Reset Warm Start |
yes | ||
Status |
result | ||
Warm Start |
result | ||
Active Relief Scenario |
yes | ||
Relief Scenarios |
result | ||
Governing Relief Scenario |
result | ||
Relief Scenarios Pass |
result | ||
Number of Network Objects |
result | ||
Mass Balance Residual |
result | ||
Pressure Balance Residual |
result | ||
Energy Balance Residual |
result | ||
RES: Base Elevation |
m | yes | |
RES: Liquid Level |
m | yes | |
RES: Surface Pressure |
Pa | yes | |
RES: Fluid Density |
kg/m3 | yes | |
RES: Datum Pressure |
Pa | result | |
RES: Pressure |
Pa | result | |
RES: Temperature |
K | result | |
RES: Mass Flow |
kg/s | result | |
RES: Molar Flow |
mol/s | result | |
RES: Volumetric Flow |
m3/s | result | |
RES: Residual Error |
result | ||
N1: Pressure Estimate |
Pa | yes | |
N1: Rigorous Heat Balance |
yes | ||
N1: Pressure |
Pa | result | |
N1: Temperature |
K | result | |
N1: Mass Flow |
kg/s | result | |
N1: Molar Flow |
mol/s | result | |
N1: Volumetric Flow |
m3/s | result | |
N1: Mass Balance Residual |
result | ||
N1: Pressure Balance Residual |
result | ||
N1: Energy Balance Residual |
result | ||
N2: Pressure Estimate |
Pa | yes | |
N2: Rigorous Heat Balance |
yes | ||
N2: Pressure |
Pa | result | |
N2: Temperature |
K | result | |
N2: Mass Flow |
kg/s | result | |
N2: Molar Flow |
mol/s | result | |
N2: Volumetric Flow |
m3/s | result | |
N2: Mass Balance Residual |
result | ||
N2: Pressure Balance Residual |
result | ||
N2: Energy Balance Residual |
result | ||
N3: Pressure Estimate |
Pa | yes | |
N3: Rigorous Heat Balance |
yes | ||
N3: Pressure |
Pa | result | |
N3: Temperature |
K | result | |
N3: Mass Flow |
kg/s | result | |
N3: Molar Flow |
mol/s | result | |
N3: Volumetric Flow |
m3/s | result | |
N3: Mass Balance Residual |
result | ||
N3: Pressure Balance Residual |
result | ||
N3: Energy Balance Residual |
result | ||
N4: Pressure Estimate |
Pa | yes | |
N4: Rigorous Heat Balance |
yes | ||
N4: Pressure |
Pa | result | |
N4: Temperature |
K | result | |
N4: Mass Flow |
kg/s | result | |
N4: Molar Flow |
mol/s | result | |
N4: Volumetric Flow |
m3/s | result | |
N4: Mass Balance Residual |
result | ||
N4: Pressure Balance Residual |
result | ||
N4: Energy Balance Residual |
result | ||
MAIN: Length |
m | yes | |
MAIN: Diameter |
mm | yes | |
MAIN: Roughness |
m | yes | |
MAIN: Elevation Change |
m | yes | |
MAIN: Hazen-Williams C |
yes | ||
MAIN: Use Hazen-Williams |
yes | ||
MAIN: Mass Flow |
kg/s | result | |
MAIN: Volumetric Flow |
m3/s | result | |
MAIN: Pressure Drop |
Pa | result | |
BR1: Length |
m | yes | |
BR1: Diameter |
mm | yes | |
BR1: Roughness |
m | yes | |
BR1: Elevation Change |
m | yes | |
BR1: Hazen-Williams C |
yes | ||
BR1: Use Hazen-Williams |
yes | ||
BR1: Mass Flow |
kg/s | result | |
BR1: Volumetric Flow |
m3/s | result | |
BR1: Pressure Drop |
Pa | result | |
BR2: Length |
m | yes | |
BR2: Diameter |
mm | yes | |
BR2: Roughness |
m | yes | |
BR2: Elevation Change |
m | yes | |
BR2: Hazen-Williams C |
yes | ||
BR2: Use Hazen-Williams |
yes | ||
BR2: Mass Flow |
kg/s | result | |
BR2: Volumetric Flow |
m3/s | result | |
BR2: Pressure Drop |
Pa | result | |
D1: Boundary Specification |
yes | ||
D1: Pressure Setpoint |
Pa | yes | |
D1: Mass Flow Setpoint |
kg/s | yes | |
D1: Molar Flow Setpoint |
mol/s | yes | |
D1: Volumetric Flow Setpoint |
m3/s | yes | |
D1: Pressure |
Pa | result | |
D1: Temperature |
K | result | |
D1: Mass Flow |
kg/s | result | |
D1: Molar Flow |
mol/s | result | |
D1: Volumetric Flow |
m3/s | result | |
D1: Residual Error |
result | ||
D2: Boundary Specification |
yes | ||
D2: Pressure Setpoint |
Pa | yes | |
D2: Mass Flow Setpoint |
kg/s | yes | |
D2: Molar Flow Setpoint |
mol/s | yes | |
D2: Volumetric Flow Setpoint |
m3/s | yes | |
D2: Pressure |
Pa | result | |
D2: Temperature |
K | result | |
D2: Mass Flow |
kg/s | result | |
D2: Molar Flow |
mol/s | result | |
D2: Volumetric Flow |
m3/s | result | |
D2: Residual Error |
result |
Learn more¶
-
User guide
-
FluentAPI
API members¶
Public members declared by this class. Inherited members are documented on the base classes.
Constructors¶
PipeNetworkUnitOperation(): Initializes a new default instance of the PipeNetworkUnitOperation class with an empty network, the diagram surface...
Initializes a new default instance of the PipeNetworkUnitOperation class with an empty network, the diagram surface and the prototypes of every available block type.
Properties¶
ActiveReliefScenario: The relief scenario imposed on the relief devices before every solve; empty leaves each device's own relieving rate...
The relief scenario imposed on the relief devices before every solve; empty leaves each device's own relieving rate in force.
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.
CompressibleGasEnergyModel: Energy treatment of the compressible-gas branches: adiabatic (Fanno) or isothermal.
Energy treatment of the compressible-gas branches: adiabatic (Fanno) or isothermal.
Description: Gets the description of this unit operation type ('Pipe Network Unit Operation').
Gets the description of this unit operation type ("Pipe Network Unit Operation").
DirectEvaluationTimeLimit: Cost ceiling, in seconds, for evaluating the pipes directly instead of through the fitted surrogate.
Cost ceiling, in seconds, for evaluating the pipes directly instead of through the fitted surrogate. Direct evaluation costs a full hydraulic profile per dP and per derivative: cheap on a surface network, ruinous on a well whose tubing is discretized into many increments (4.6 s against 700+ s on the samples). A previous solve's wall time is the only measure of which kind of network this is, so it governs BOTH the refinement pass and whether a warm-started solve drops the surrogate.
DirectEvaluationTooSlow: Set the first time a direct-evaluation run on THIS network had to be abandoned on the clock, and saved with the...
Set the first time a direct-evaluation run on THIS network had to be abandoned on the clock, and saved with the flowsheet. The cost of evaluating the pipes directly cannot be predicted (a network whose surrogate pass takes seconds can need minutes without the fit), so it is measured once and remembered; keeping it in memory only would make every reopening of the file pay the discovery again. Clear it after changing the network's geometry.
DynamicDiagramRefreshRate: Refresh the open network editor every N steps of a dynamic run.
Refresh the open network editor every N steps of a dynamic run. Rebuilding it is not free: it clears both connection grids, lists every material stream in the flowsheet and builds a fresh thermal profile editor, all of which a fast integration would otherwise do at every step. 0 leaves the editor alone until the run ends; 1, the default, is what it always did.
GlobalPipeThermalProperties: Gets or sets the thermal profile (heat exchange with the surroundings) applied to every pipe segment that uses the...
Gets or sets the thermal profile (heat exchange with the surroundings) applied to every pipe segment that uses the network's global settings.
InitializeStreams: Gets or sets whether the next solve rebuilds the internal streams and initial estimates from the boundary...
Gets or sets whether the next solve rebuilds the internal streams and initial estimates from the boundary specifications instead of starting from the previous solution. Set automatically when the network topology changes and cleared after a successful solve. Default true.
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.
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.
NetworkGraphicObjects: Gets or sets the graphic objects of the network diagram, keyed by the name of the block each one represents.
Gets or sets the graphic objects of the network diagram, keyed by the name of the block each one represents.
NetworkObjects: Gets or sets the blocks of the network (sources, sinks, nodes, pipes, equipment), keyed by their internal name.
Gets or sets the blocks of the network (sources, sinks, nodes, pipes, equipment), keyed by their internal name.
NodalCompositionTolerance: Mole-fraction change tolerance of the compositional outer loop.
Mole-fraction change tolerance of the compositional outer loop. The composition sweep is the slowest of the four coupled variables and was the one the stopping rule never checked: on a gas-lifted or commingled network the loop would stop with the pressures settled to 1e-7 Pa while the mixture at the injection node was still moving by ~1e-4 per iteration, and that mixture sets the holdup, hence the branch ΔP, hence the rate.
NodalFlowModel: Modelo de escoamento do ramo para o solver NodalNewton (incompressivel ou composicional).
Modelo de escoamento do ramo para o solver NodalNewton (incompressivel ou composicional).
NodalFlowTolerance: Relative flow-change tolerance of the compositional outer loop, scaled by the largest branch flow.
Relative flow-change tolerance of the compositional outer loop, scaled by the largest branch flow. Pressure and temperature alone do not pin the operating point down: on a flat IPR x VLP crossing the pressures settle while the rate is still moving, and the loop would stop with ~1e-3 of flow error, different for every starting guess.
NodalMaxOuterIterations: Iteration budget of the compositional outer loop.
Iteration budget of the compositional outer loop. 50 was too tight for a stiff well: the Production Well sample contracts by a factor of ~0.88 per iteration, so it walks steadily toward the tolerance and simply runs out of iterations short of it. The late iterations are cheap (~0.2 s against the ~18 s the first one costs), so the extra headroom buys convergence for little.
NodalOuterRelaxation: Under-relaxation factor of the compositional outer loop of the nodal solver, between 0 and 1.
Under-relaxation factor of the compositional outer loop of the nodal solver, between 0 and 1. 1.0 (default) applies no relaxation; values < 1 stabilize large or stiff networks.
NodalOuterTemperatureTolerance: Temperature tolerance of the compositional outer loop, in K.
Temperature tolerance of the compositional outer loop, in K. This used to be NodalOuterTolerance as well, one number standing for both a pressure in pascal and a temperature in kelvin. The pressure side carries a relative floor, so on a 32 MPa well it is really asking for 1e-5 relative; the temperature side got the bare 1 K, which on a 350 K stream is 3e-3 relative, three hundred times looser. A gas condensate stopped once with the outer loop still wanting to move node temperatures by 0.023 K and once by 0.35 K, both inside the old tolerance and both reported converged, and the two answers were 1.5e-3 apart. The default is ten times the pipe's own temperature tolerance. Below that the outer loop would be asking for node temperatures resolved more finely than the pipes that produce them.
NodalOuterTolerance: Pressure tolerance of the compositional outer loop, in Pa, floored relative to the largest node potential in...
Pressure tolerance of the compositional outer loop, in Pa, floored relative to the largest node potential in Calculate.
ObjectClass: Gets or sets the simulation object class category (pressure changers).
Gets or sets the simulation object class category (pressure changers). The setter always assigns PressureChangers.
OptimizeEquilibriumCalcs: Gets or sets whether the nodes skip recalculating (flashing) their inlet streams before mixing them, which saves...
Gets or sets whether the nodes skip recalculating (flashing) their inlet streams before mixing them, which saves equilibrium calculations at the cost of using the inlet states as they are. Default false.
PipeAccelerateEnergyBalance: Whether each pipe relaxes its energy balance by Wegstein's method rather than the fixed half step.
Whether each pipe relaxes its energy balance by Wegstein's method rather than the fixed half step. Off by default.
PipeCalculateEquilibrium: Gets or sets whether the pipe segments that use the global settings run phase-equilibrium flashes along each segment.
Gets or sets whether the pipe segments that use the global settings run phase-equilibrium flashes along each segment. Default true.
PipeCalculateEquilibriumIntervalInSteps: Gets or sets the interval, in pipe calculation increments, between phase-equilibrium flashes for the pipe segments...
Gets or sets the interval, in pipe calculation increments, between phase-equilibrium flashes for the pipe segments that use the global settings. Default 1 (flash at every increment).
PipeCalculateEquilibriumPressureTrigger: Relative pressure change along a pipe that forces a flash even when the interval above would have skipped one, so...
Relative pressure change along a pipe that forces a flash even when the interval above would have skipped one, so raising that interval stays safe on a fluid whose phase behaviour changes quickly. Zero disables it.
PipeCalculateEquilibriumTemperatureTrigger: The same in temperature, in K.
The same in temperature, in K.
PipeDefaultIncludeEmulsionEffect: Gets or sets whether the pipe segments that use the global settings include the oil-water emulsion viscosity effect...
Gets or sets whether the pipe segments that use the global settings include the oil-water emulsion viscosity effect in the pressure drop. Default false.
PipeDefaultMaxPressureIterations: Gets or sets the maximum number of pressure iterations of the pipe segments that use the global settings.
Gets or sets the maximum number of pressure iterations of the pipe segments that use the global settings. Default 100.
PipeDefaultMaxTemperatureIterations: Gets or sets the maximum number of temperature iterations of the pipe segments that use the global settings.
Gets or sets the maximum number of temperature iterations of the pipe segments that use the global settings. Default 100.
PipeDefaultPressureTolerance: Gets or sets the pressure convergence tolerance of the pipe segments that use the global settings, in Pa.
Gets or sets the pressure convergence tolerance of the pipe segments that use the global settings, in Pa. Default 10 Pa.
PipeDefaultTemperatureTolerance: Gets or sets the temperature convergence tolerance of the pipe segments that use the global settings, in K.
Gets or sets the temperature convergence tolerance of the pipe segments that use the global settings, in K. Default 0.01 K.
PipeSlurryViscosityMode: Gets or sets the slurry viscosity model of the pipe segments that use the global settings: 0 = disabled, 1 = Yoshida...
Gets or sets the slurry viscosity model of the pipe segments that use the global settings: 0 = disabled, 1 = Yoshida et al.
Prefix: Gets the default name prefix for this unit operation ('PNET-').
Gets the default name prefix for this unit operation ("PNET-").
PvtTableNodes: Nodes per axis of that grid.
Nodes per axis of that grid. The interpolation error falls as the square of the spacing, so a modest grid goes a long way; 20 by 20 is 400 flashes to build.
RefineWithDirectEvaluation: After a cold compositional solve, solve once more from its result with the branches evaluating the pipe directly...
After a cold compositional solve, solve once more from its result with the branches evaluating the pipe directly instead of through the ΔP(w) surrogate. Costs roughly one extra (much cheaper, warm-started) solve and removes the surrogate's ~2e-3 bias on the flow.
RichardsonExtrapolation: Evaluate every pipe on two grids and extrapolate away the leading discretisation error.
Evaluate every pipe on two grids and extrapolate away the leading discretisation error. The increment walk is first order, so the shipped discretisations carry more error than anything else in the model: on the Multi-Well Pad sample the export rate moves 3% between 6 increments per pipe and a converged grid, against 0.02% of surrogate bias. Refining the grid pays for that at eight times the cost for six times less error; extrapolating from two grids costs three pipe calculations instead of one and removes the first-order term outright. Off by default: it triples the cost of every pipe evaluation, and it changes the answer of every existing network, which is the user's call to make rather than a silent upgrade.
ShowDiagramGrid: Whether the designer draws the background grid.
Whether the designer draws the background grid. Lives on the surface, which is not serialized, so it is exposed here to travel with the network instead of resetting to the default every time the file is reopened.
SnapToDiagramGrid: Whether dragging a block snaps it to the grid.
Whether dragging a block snaps it to the grid. Persisted for the same reason as ShowDiagramGrid.
Solver: Gets or sets the network solver: Simplex (0, minimizes the balance residual, refined with projected BFGS when...
Gets or sets the network solver: Simplex (0, minimizes the balance residual, refined with projected BFGS when needed), IPOPT (1), NewtonFull (2) and NewtonSimplified (3) (both solved by projected BFGS), or NodalNewton (4, nodal Newton/GGA solver, the default). Below the required subscription level the nodal solver falls back to Simplex at solve time without changing this value.
SolverMaxIterations: Gets or sets the maximum number of iterations (function evaluations for Simplex) of the Simplex, IPOPT and Newton...
Gets or sets the maximum number of iterations (function evaluations for Simplex) of the Simplex, IPOPT and Newton solvers. Default 1000.
SolverProgressAfterSeconds: Once a compositional solve has run this long, it starts reporting one line per outer iteration even without the...
Once a compositional solve has run this long, it starts reporting one line per outer iteration even without the designer's solver console open: on the heavy field cases a solve can take minutes, and the residual trail is the only way to tell converging from stuck.
SolverRelativeErrorTolerance: Gets or sets the convergence tolerance on the total relative balance residual used by the Simplex, IPOPT and Newton...
Gets or sets the convergence tolerance on the total relative balance residual used by the Simplex, IPOPT and Newton solvers. Default 1e-4.
StallImprovement: How much the residual has to fall to count as an improvement, as a fraction.
How much the residual has to fall to count as an improvement, as a fraction. Without a margin, an iterate that is better in the tenth digit resets the stall counter forever.
StallIterations: How many outer iterations without a real improvement in the pressure residual before the loop gives up and delivers...
How many outer iterations without a real improvement in the pressure residual before the loop gives up and delivers its best iterate. 25 leaves room for the Production Well, which walks down at ~0.88 per iteration and does improve, while cutting the ESP well short: that one cycles between two pressure fields and finds nothing new after about twenty iterations, yet used to ride the cap of 150 on every solve. Zero disables the check.
SupportsDynamicMode: The network is quasi-steady in dynamic mode: at every pressure-flow step it is re-solved in steady state against...
The network is quasi-steady in dynamic mode: at every pressure-flow step it is re-solved in steady state against that instant's boundary conditions. It holds no inventory, so it carries no state between steps beyond the warm start, and it does not vote on the adaptive integrator's error estimate (see GetDynamicContents). Valid while the dynamics of interest are slower than the line's transit time, which covers everything driven by control. It is NOT a transient hydraulic model: no surge, no line pack.
UsePvtTable: Tabulate each branch's fluid over pressure and temperature once and read the pipe's per-increment properties off...
Tabulate each branch's fluid over pressure and temperature once and read the pipe's per-increment properties off that grid instead of flashing at every increment. Off by default, and off it changes nothing: the branch keeps the flowsheet's own package and its own flash. On, a flash is still run wherever the table cannot answer honestly, which is outside the grid and across the phase envelope.
Methods¶
ActuatorsMoving(): True while any block has an actuator that has not reached its command.
True while any block has an actuator that has not reached its command. The integrator has no other way to know the network is still moving with its boundaries frozen.
Calculate(object): Calculates the object.
Calculates the object.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
ClearPvtCache(): Drops every tabulated fluid.
Drops every tabulated fluid. Called wherever the warm start is dropped, because the same events (a different feed, different compounds) invalidate both.
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.
CloseEditForm(): Closes the editor of this object, if it is open.
Closes the editor of this object, if it is open.
CommandActuator(IActuatedBlock, double): Takes a command for an actuated block.
Takes a command for an actuated block. Returns true when the command was queued, which means the caller must NOT write the value: the actuator will get there over the next steps. Outside dynamic mode, and for a block whose time constant and dead time are both zero, it returns false and the write happens as it always did. That is what keeps a steady-state solve, and every network built before actuators existed, behaving exactly the same.
| Parameter | Type | Description |
|---|---|---|
block |
IActuatedBlock |
|
value |
Double |
CreateConnectors(): Creates the graphic connector definitions on the flowsheet: PortCount inlet ports down the left side...
Creates the graphic connector definitions on the flowsheet: PortCount inlet ports down the left side and as many outlet ports down the right side, keeping existing connections on the first ports. The energy connector is disabled.
CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode: 'Pressure-Flow Calculation Rate' (re-solve every N...
Registers the dynamic properties for dynamic simulation mode: "Pressure-Flow Calculation Rate" (re-solve every N pressure-flow steps), "Fail Mode" (0 = hold the last solution and warn, 1 = abort the integration) and "Max Solve Time (s)" (wall-clock limit per step, 0 = none).
DisplayEditForm(): Opens the editor of this object.
Opens the editor of this object. A host that has no editor for it does nothing.
Draw(object): Draws the unit operation icon on the given SkiaSharp canvas.
Draws the unit operation icon on the given SkiaSharp canvas.
| Parameter | Type | Description |
|---|---|---|
g |
Object |
The SkiaSharp canvas. |
EnsureTablesOnSurface(): Re-establishes the tables' link back to this network and makes sure each one is on the drawing surface.
Re-establishes the tables' link back to this network and makes sure each one is on the drawing surface. The link is not something the XML can carry, and a designer may open on a surface that was rebuilt (layout import, clone) since the tables were loaded.
eval_f(int, double[], bool, out double): IPOPT callback: evaluates the objective function (FunctionValue).
IPOPT callback: evaluates the objective function (FunctionValue). Not referenced by the current solver path, which calls the IPOPT wrapper with FunctionValue directly.
| Parameter | Type | Description |
|---|---|---|
n |
Int32 |
Number of variables. |
x |
Double[] |
The variable values. |
new_x |
Boolean |
Whether x changed since the last callback. Not used. |
obj_value |
Double |
Receives the objective function value. |
eval_g(int, double[], bool, int, out double[]): IPOPT callback: evaluates the constraint functions.
IPOPT callback: evaluates the constraint functions. The problem has no constraints, so an empty array is returned.
| Parameter | Type | Description |
|---|---|---|
n |
Int32 |
Number of variables. |
x |
Double[] |
The variable values. |
new_x |
Boolean |
Whether x changed since the last callback. Not used. |
m |
Int32 |
Number of constraints. |
g |
Double[] |
Receives the constraint values (empty). |
eval_grad_f(int, double[], bool, out double[]): IPOPT callback: evaluates the objective gradient (FunctionGradient).
IPOPT callback: evaluates the objective gradient (FunctionGradient).
| Parameter | Type | Description |
|---|---|---|
n |
Int32 |
Number of variables. |
x |
Double[] |
The variable values. |
new_x |
Boolean |
Whether x changed since the last callback. Not used. |
grad_f |
Double[] |
Receives the gradient vector. |
eval_h(int, double[], bool, double, int, double[], bool, int, out int[], out int[], out double[]): IPOPT callback: returns the Hessian of the objective, computed by finite differences.
IPOPT callback: returns the Hessian of the objective, computed by finite differences. The row and column index arrays are returned zero-filled.
| Parameter | Type | Description |
|---|---|---|
n |
Int32 |
Number of variables. |
x |
Double[] |
The variable values. |
new_x |
Boolean |
Whether x changed since the last callback. Not used. |
obj_factor |
Double |
Scaling factor of the objective. Not used. |
m |
Int32 |
Number of constraints. Not used. |
lambda |
Double[] |
Constraint multipliers. Not used. |
new_lambda |
Boolean |
Whether lambda changed since the last callback. Not used. |
nele_hess |
Int32 |
Number of nonzero elements in the Hessian. |
iRow |
Int32[] |
Receives the row indices of the nonzero elements. |
jCol |
Int32[] |
Receives the column indices of the nonzero elements. |
values |
Double[] |
Receives the Hessian values. |
eval_jac_g(int, double[], bool, int, int, out int[], out int[], out double[]): IPOPT callback: returns the sparsity structure and values of the constraint Jacobian (a fixed pattern with all...
IPOPT callback: returns the sparsity structure and values of the constraint Jacobian (a fixed pattern with all values set to -1).
| Parameter | Type | Description |
|---|---|---|
n |
Int32 |
Number of variables. |
x |
Double[] |
The variable values. |
new_x |
Boolean |
Whether x changed since the last callback. Not used. |
m |
Int32 |
Number of constraints. |
nele_jac |
Int32 |
Number of nonzero elements in the Jacobian. |
iRow |
Int32[] |
Receives the row indices of the nonzero elements. |
jCol |
Int32[] |
Receives the column indices of the nonzero elements. |
values |
Double[] |
Receives the values of the nonzero elements. |
FindReliefLoadCase(string): Finds a relief load case by its identifier or, failing that, by its name (case-insensitive).
Finds a relief load case by its identifier or, failing that, by its name (case-insensitive).
| Parameter | Type | Description |
|---|---|---|
idOrName |
String |
The load case identifier or name. |
FindReliefScenario(string): The scenario of that name, or null.
The scenario of that name, or null.
| Parameter | Type | Description |
|---|---|---|
name |
String |
FunctionGradient(double[]): Computes the gradient of FunctionValue by central finite differences (1 % relative step, or 0.01 absolute for zero...
Computes the gradient of FunctionValue by central finite differences (1 % relative step, or 0.01 absolute for zero variables).
| Parameter | Type | Description |
|---|---|---|
x |
Double[] |
The scaled unknowns at which the gradient is evaluated. |
FunctionValue(double[]): Objective function of the Simplex, IPOPT and Newton solvers: writes the unknowns into the boundary and node streams...
Objective function of the Simplex, IPOPT and Newton solvers: writes the unknowns into the boundary and node streams, calculates every network block in order and returns the sum of the squared relative mass, pressure and energy balance residuals.
| Parameter | Type | Description |
|---|---|---|
vars |
Double[] |
The scaled unknowns: boundary flows (divided by the maximum flow), boundary pressures (divided by the maximum pressure) and node split fractions. |
GetChartModel(string): Builds an OxyPlot model of a pipe's profile: pressure on the left axis, temperature on the right, distance on the x...
Builds an OxyPlot model of a pipe's profile: pressure on the left axis, temperature on the right, distance on the x axis, in the flowsheet's units.
| Parameter | Type | Description |
|---|---|---|
name |
String |
GetChartModelNames(): Chart names the PFD chart object can embed: the pressure and temperature profile of every solved pipe segment.
Chart names the PFD chart object can embed: the pressure and temperature profile of every solved pipe segment.
GetDefaultProperties(): Returns the properties shown by default in the flowsheet property table for this unit operation.
Returns the properties shown by default in the flowsheet property table for this unit operation.
GetDisplayDescription(): Returns the description string for this unit operation type.
Returns the description string for this unit operation type.
GetDisplayName(): Returns the display name for this unit operation type.
Returns the display name for this unit operation type.
GetDynamicContents(): NaN, and it has to stay NaN: the adaptive integrator builds its error estimate from the change in each object's...
NaN, and it has to stay NaN: the adaptive integrator builds its error estimate from the change in each object's contents, and a network with no inventory has no opinion to offer there.
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.
GetPreferredGraphicObjectHeight(): Returns the preferred height of the flowsheet graphic object, in pixels.
Returns the preferred height of the flowsheet graphic object, in pixels.
GetPreferredGraphicObjectWidth(): Default size of the block on the flowsheet, large enough for its ports.
Default size of the block on the flowsheet, large enough for its ports.
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. |
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. |
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. |
GetPvtEntry(string, MaterialStream, double, double, double, double): The tabulated package for one branch, building the table the first time it is asked for and whenever the fluid or...
The tabulated package for one branch, building the table the first time it is asked for and whenever the fluid or the operating range has moved out from under the stored one.
| Parameter | Type | Description |
|---|---|---|
key |
String |
|
template |
MaterialStream |
|
pLo |
Double |
|
pHi |
Double |
|
tLo |
Double |
|
tHi |
Double |
HasHigherTierAccess(): True when the subscription covers the blocks and analysis tools added after the original pipe network.
True when the subscription covers the blocks and analysis tools added after the original pipe network. The designer asks before opening one of those tools or dropping one of those blocks, so the user is told up front instead of at solve time.
HigherTierMessage(string): Message shown when a higher-tier feature is used without the subscription for it.
Message shown when a higher-tier feature is used without the subscription for it.
| Parameter | Type | Description |
|---|---|---|
feature |
String |
intermediate(IpoptAlgorithmMode, int, double, double, double, double, double, double, double, double, int): IPOPT intermediate callback, called once per iteration: tells IPOPT whether to continue.
IPOPT intermediate callback, called once per iteration: tells IPOPT whether to continue.
| Parameter | Type | Description |
|---|---|---|
alg_mod |
IpoptAlgorithmMode |
The current algorithm phase. Not used. |
iter_count |
Int32 |
The current iteration count. |
obj_value |
Double |
The current objective function value. |
inf_pr |
Double |
Primal infeasibility. Not used. |
inf_du |
Double |
Dual infeasibility. Not used. |
mu |
Double |
Barrier parameter. Not used. |
d_norm |
Double |
Norm of the primal step. Not used. |
regularization_size |
Double |
Hessian regularization. Not used. |
alpha_du |
Double |
Dual step size. Not used. |
alpha_pr |
Double |
Primal step size. Not used. |
ls_trials |
Int32 |
Number of line search trials. Not used. |
IsHigherTierBlock(ISimulationObject): Blocks that came after the original pipe network and therefore sit on the higher subscription tier: the well and...
Blocks that came after the original pipe network and therefore sit on the higher subscription tier: the well and flow-control equipment (IPR, choke, ESP, gas lift, pressure control valve), the reservoir boundary, the dedicated water pipe, and a pipe driven by a deviation survey. Tested by concrete type, not by NetworkObjType: GasLift and Reservoir are Sources and report themselves as such.
| Parameter | Type | Description |
|---|---|---|
o |
ISimulationObject |
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. |
OrderObjectsForCalculation(): Orders the network blocks for calculation by walking downstream from the sources through the outlet connections.
Orders the network blocks for calculation by walking downstream from the sources through the outlet connections. Sources and sinks are excluded; a block reached by several paths appears once per path.
OrderObjectsForCalculation0(): Orders the network blocks for calculation by walking upstream from the sinks through the inlet connections and then...
Orders the network blocks for calculation by walking upstream from the sinks through the inlet connections and then reversing the levels, so the blocks farthest from the sinks come first. Each block appears once; sources and sinks are excluded. This is the ordering used by the Simplex, IPOPT and Newton solvers.
PerformPostCalcValidation(): Post-calculation validation of the outlet streams.
Post-calculation validation of the outlet streams. Does nothing for this unit operation.
PopulateEditorPanel(object): Populates the cross-platform editor panel with controls.
Populates the cross-platform editor panel with controls. Only the Avalonia editor panel is supported; other containers are left unchanged.
| Parameter | Type | Description |
|---|---|---|
container |
Object |
The editor panel (layout container) to populate. |
RequiredAccessLevel(): Subscription level this network needs: 3 once it uses anything beyond the original feature set, 2 otherwise.
Subscription level this network needs: 3 once it uses anything beyond the original feature set, 2 otherwise.
RestoreDynamicState(object): Restores the state saved by SaveDynamicState: the solver warm start, the actuator commands and...
Restores the state saved by SaveDynamicState: the solver warm start, the actuator commands and clock, and the actuated values of the blocks. A missing or older state clears the actuator commands.
| Parameter | Type | Description |
|---|---|---|
state |
Object |
The state object returned by a previous SaveDynamicState call. |
ReturnInstance(string): Creates and returns a new instance for deserialization.
Creates and returns a new instance for deserialization.
| Parameter | Type | Description |
|---|---|---|
typename |
String |
The type name to instantiate. |
RunDynamicModel(): Runs one dynamic-mode integration step: on the pressure-flow half of the step (every N steps, as set by...
Runs one dynamic-mode integration step: on the pressure-flow half of the step (every N steps, as set by "Pressure-Flow Calculation Rate") it moves the actuators and re-solves the network in steady state against the current boundary conditions. Requires the higher subscription tier.
RunReliefScenarios(string, Action<string>): Runs every relief scenario and leaves the network solved under the governing one (or under leaveOn).
Runs every relief scenario and leaves the network solved under the governing one (or under leaveOn). Returns the report, also kept in LastReliefReport.
| Parameter | Type | Description |
|---|---|---|
leaveOn |
String |
|
progress |
Action<String> |
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.
SaveDynamicState(): The warm start is the only thing that has to survive between the integrator's attempts at a step.
The warm start is the only thing that has to survive between the integrator's attempts at a step. Without this override the base class would answer for the accumulation stream this unit does not have, the state would never be restored, and the two half-steps of step doubling would start from a different guess than the full step, turning the error estimate into noise. Deliberately NOT routed through SaveData(): that path is licence-gated and throws when the gate dips, which would abort an entire integration over a transient.
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. |
SetupStreamForCalc(MaterialStream): Prepares an internal network stream for calculation: assigns this unit operation's property package and flowsheet to...
Prepares an internal network stream for calculation: assigns this unit operation's property package and flowsheet to it and makes it the package's current stream.
| Parameter | Type | Description |
|---|---|---|
stream |
MaterialStream |
The material stream to prepare. |
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.
Fields¶
DiagramEditorControl: The classic (WinForms) network diagram editor control hosted by the editor window, if open.
The classic (WinForms) network diagram editor control hosted by the editor window, if open. Not saved with the flowsheet.
DiagramSurface: The SkiaSharp drawing surface that holds the network diagram shown in the network designer.
The SkiaSharp drawing surface that holds the network diagram shown in the network designer.
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.
ObjectList: Prototype instances of every block type available in the network designer, keyed by display name (e.g.
Prototype instances of every block type available in the network designer, keyed by display name (e.g. "Pipe Segment", "Valve"). Used to build the designer palette and to create new blocks.
PipeDefaultPressureDropCorrelation: Pressure drop correlation applied to every pipe segment that uses the network's global settings.
Pressure drop correlation applied to every pipe segment that uses the network's global settings. Default Beggs and Brill.
PortCount: Number of inlet and of outlet ports of the block on the flowsheet.
Number of inlet and of outlet ports of the block on the flowsheet.
StreamSolverProgress: When true, the nodal solver writes one progress line per iteration to the flowsheet message log.
When true, the nodal solver writes one progress line per iteration to the flowsheet message log. Set by the network designer while its solver console is open. Not saved with the flowsheet.