About the name

Physics determines what a plant does next.

At the scale of a process plant, physical and chemical processes are deterministic. The future state follows from the current state, the inputs and the parameters, through conservation laws and thermodynamics. Determyn, a coined spelling of determine, is named for that idea. This page follows it through the engine’s equations for one vessel.

Swipe an equation sideways to see all of it.

One vessel

The engine’s reference plant is a synthetic gas train. Its inlet separator, V-101, is a horizontal drum 2 m across and 6 m long. PIC-101 holds it at 28 bar absolute on the gas outlet valve PV-101, and LIC-101 holds the level at 0.8 m. The fluid has twenty components, from nitrogen to m-xylene.

The engine models V-101 as a liquid zone and a vapor zone sharing the volume and the pressure. The state is the inventory: each zone’s moles of each component and its internal energy, 42 numbers. Away from the minimum holdups they obey these balances.

nᵢᴸ, nᵢⱽ
moles of component i in the liquid and vapor zones, mol; differential states
Uᴸ, Uⱽ
internal energy of each zone, J; differential states
Fₖᴸ, Fₖⱽ
molar flows of the liquid and vapor parts of the stream at nozzle k, mol/s, positive into the drum and free to change sign
xi,k, yi,k
mole fractions of component i in those parts; an outflow carries its zone’s composition
hₖᴸ, hₖⱽ
molar enthalpies of those parts, J/mol; each pure component as an ideal gas at 298.15 K has h = 0
Nᵢ, N
interphase transfer of component i and in total, mol/s, positive for evaporation
hⱽ
molar enthalpy of the vapor zone, J/mol, carried by the transferred moles
Qint
heat from the vapor zone to the liquid zone, W
W
work the liquid zone does on the vapor zone as its volume changes, W

The transfer, heat and work terms leave one zone and enter the other, so mass and energy close exactly. V-101 has no heater, its heat loss is not modeled, and there is no reaction term yet.

Temperature and pressure follow

Temperature and pressure are not states. The inventory and the vessel fix them: each zone’s energy must equal its moles times its molar internal energy, the zone volumes must fill the drum, and the liquid volume sets the level through the filled angle β.

Tᴸ, Tⱽ
zone temperatures, K; algebraic unknowns
P
the common pressure, Pa; algebraic
β
filled angle of the horizontal shell, rad; algebraic. Unlike an arccos form of the level, these formulas are defined for any value a Newton iterate takes, and the liquid heel keeps the solution inside (0, 2π)
nᴸ, nⱽ
total moles of each zone, mol; x, y: their compositions, xᵢ = nᵢᴸ/nᴸ and yᵢ = nᵢⱽ/nⱽ
u, v
molar internal energy, J/mol, and molar volume, m³/mol, from the property package, each on its own zone’s root
V
drum volume, m³; with flat ends (heads are not modeled yet) it is πRs²Ls, 18.85 m³ for V-101
Ls, Rs
shell length, 6 m, and radius, 1 m
ℓ
liquid level, m

These four rows are the UV problem. No separate flash solves them; they join the plant’s other equations in one Newton iteration. A standalone UV flash is planned.

On stable roots the rows are well posed. At fixed molar volume a phase’s internal energy rises with temperature, because cv is positive, and its pressure falls as its volume grows. The four rows then have a nonsingular Jacobian near a solution, so the inventory fixes the temperatures, the pressure and the level.

Peng-Robinson

The molar properties come from the Peng-Robinson (PR) equation of state in its 1976 form, with the one-fluid quadratic mixing rule.

P, T, v
pressure, Pa; temperature, K; molar volume, m³/mol
R
molar gas constant, 8.314462618 J/(mol·K)
Tc,i, Pc,i, ωᵢ
critical temperature, K, critical pressure, Pa, and acentric factor of component i
aᵢ, bᵢ
attraction parameter, Pa·m⁶/mol², and covolume, m³/mol, of component i
αᵢ, κᵢ
alpha function and its slope parameter
a, b
the phase’s mixture attraction parameter and covolume
xᵢ
mole fractions of the phase
kᵢⱼ
binary interaction parameter, symmetric (kᵢⱼ = kⱼᵢ, kᵢᵢ = 0) and independent of temperature

The 1976 κ applies at every ω; the 1978 revision differs only above ω = 0.49, beyond n-decane’s 0.488. The kᵢⱼ are cited to their sources, and a missing pair fails the build unless the fluid system declares it zero, as the reference fluid does for 107 of its 190 pairs.

The engine solves the cubic in Z and takes the enthalpy as a departure from the ideal gas.

Z
compressibility factor
A, B
dimensionless attraction and covolume parameters
h, u
molar enthalpy and molar internal energy of the phase, J/mol
hⁱᵍ
ideal-gas enthalpy, J/mol, zero for each pure component at Tref = 298.15 K
a′
da/dT, from analytic derivatives of the alpha functions
cp,iⁱᵍ
ideal-gas heat capacity of component i, J/(mol·K), a polynomial whose coefficients C₀,ᵢ to C₄,ᵢ come from the component database

Cardano’s formula gives the roots, two Newton steps polish each, and only roots with Z > B count: the smallest for the liquid zone, the largest for the vapor. If the requested root is missing or near the spinodal, the call still returns a finite root, flagged as clamped. That keeps NaN out of the solver, but where a root vanishes the switch to the other one is a jump, so the argument above holds only while no root is clamped.

By default PR runs untranslated: the standard Peneloux shift, fitted for Soave-Redlich-Kwong, takes propane’s liquid from 6.5 to 15 percent too dense. Against reference equations for methane, propane and n-butane at reduced temperatures from 0.5 to 0.95, PR saturated liquid densities range from 12.8 percent high to 7.7 percent low, and vapor pressures fall within 0.9 percent above 0.6.

Between the zones

The zones are not forced into equilibrium, which keeps the equations well posed as a phase appears, disappears or runs low. Mass crosses at a finite rate driven by the fugacity difference, each zone’s coefficients taken at its own temperature.

φᵢ
fugacity coefficient of component i in a phase, from Peng-Robinson at that phase’s root; in the first line a, b, A, B, Z and the xⱼ are that phase’s, and aᵢⱼ = (1 − kᵢⱼ)√(aᵢaⱼ)
Dᵢ
fugacity difference divided by the pressure, positive when component i tends to evaporate
fᵢᴸ, fᵢⱽ
fugacities of component i in the liquid and vapor zones, Pa
kmt
interphase rate constant, mol/s; by default 100 mol/(s·m³) times the vessel volume, and tunable
r
smoothed positive part, equal to max(D, 0) outside a band of width 10⁻⁶ around zero and continuously differentiable, with r(D) − r(−D) = D exactly
χᴸ, χⱽ
zone availabilities, 0 at the minimum holdup and 1 from twice it up, a smooth step in between
UAint
conductance between the zones, W/K

With both zones above twice their minimum holdup, χᴸ = χⱽ = 1 and Nᵢ = kmt Dᵢ. A large kmt drives the fugacities together, but equilibrium also needs a large UAint to equalize the temperatures. A smaller kmt gives real lags, such as slow re-flashing after a pressure drop.

The crossing moles carry the vapor zone’s molar enthalpy, an approximation to each component’s partial molar enthalpy that keeps total energy exact and puts the latent heat on the liquid. The work W = P dVᴸ/dt would raise the index; dummy derivatives, the temperature and pressure rates carried as algebraic unknowns, keep the index at 1 and the energy exact.

The outlet valve

Links set flows from the pressures at their ends. PV-101 follows the ISA-75.01 gas sizing equation, made smooth through zero flow and through choking.

ṁ
mass flow, kg/s, of either sign
N₆ = 2.73
the standard’s constant for kg/h, kPa and kg/m³; the factors 3600 and 1000 convert to kg/s and Pa
Fp
piping geometry factor, 1; Cv: flow coefficient, 800 for PV-101
f(λ)
inherent characteristic at valve position λ, linear for PV-101
p₁, ρ₁
pressure, Pa, and density, kg/m³, of the upstream end, blended smoothly over 10 Pa around zero pressure difference
Δpeff
pressure difference across the valve, Pa; it equals pfrom − pto unless a connected holdup is at its minimum
xp
pressure-drop ratio; xT: pressure-differential ratio factor at choked flow, 0.7
Fγ
specific-heat-ratio factor; γ: ratio of specific heats, taken as cp/(cp − R) from the inlet’s molar heat capacity
Y
expansion factor
s, |·|_δ
regularized signed square root and smooth absolute value of a pressure difference Δp
δ = 1 Pa, εx = 10⁻⁴
smoothing widths, both registry parameters

The plain signed root of Δp has an infinite slope at zero, so Newton breaks down exactly where flows stop or reverse. The regularized root s has slope 1/√δ there and stays within a relative δ²/(4Δp²) of the plain root once |Δp| ≫ δ. Newton’s method, its reuse of one Jacobian across steps and the error control all need continuous derivatives, so every max, min, absolute value and switch that would put a kink in a residual is smoothed this way, its width a registry parameter. Links are quasi-steady, apart from the compressor’s duct inertia, so water hammer is outside the model.

One system

The compiler joins V-101, its valves, the pump, the compressor and the exchangers into one implicit differential-algebraic system of about 580 unknowns. The controllers run outside it, once per tick, and their outputs enter as inputs held over the next tick.

F
every residual row in the plant, one per unknown
yd
differential variables, such as component moles, zone energies, liquid-full junction pressures, exchanger wall temperatures, valve positions, machine speeds and the compressor’s mass flow
ya
algebraic variables, such as temperatures, gas and vessel pressures, fill angles, the flows of pipes, valves and pumps, and the vessel’s dummy derivatives
θ
parameters from the registry, constant between events
uₖ
inputs held over tick k (500 ms by default), such as valve and speed commands from the controllers, boundary pressures, temperatures and compositions, and equipment status
det ∂F/∂(ẏd, ya) ≠ 0
the index-1 condition
Δtₙ, q, αn,j
step size, s; order, 1 to 5; and coefficients of the backward differentiation formula
G
the residual with ẏ replaced by that formula
J, Δy⁽ᵐ⁾
Newton iteration matrix and the update at iteration m

The system is built to be index 1: the matrix in the determinant is nonsingular except at special states, such as a spinodal, where the integrator shortens the step. Elsewhere the implicit function theorem makes the algebraic variables and derivatives continuously differentiable functions of the differential states, inputs and parameters, on the branch through a consistent initial point. Locally the system is then an ordinary differential equation with a locally Lipschitz right side, which a bare square root would break at zero flow, so exactly one solution passes through that point. That is what deterministic means here.

IDA integrates it with backward differentiation formulas of order 1 to 5 and a modified Newton iteration, at a default relative tolerance of 10⁻⁸. The Jacobian is exact, from forward-mode automatic differentiation, and KLU factors it.

Discontinuities, such as a pump start, are applied only at ticks, followed by a consistent re-initialization. A restored snapshot reproduces a run bit for bit on the same build. Steady states come today from a settle run; a steady-state solver and a cold start from rest are still to come.

Deterministic, not predetermined

Predetermined means fixed in advance, whatever anyone does. Deterministic means the outcome follows from the state and the inputs. Change an input and the future changes with it, which is what makes a simulator useful.

An operator moves the PIC-101 set point, LV-101 fails closed, or the compressor trips. The set-point move reaches the equations through the controller’s output, as a change in u at the following ticks; the failure and the trip change u directly. Training, startup and shutdown, and control testing rest on this. A historian cannot show the result of a move nobody made.

What tuning determines

A stable controlled plant forgets small errors in its initial state. Start V-101’s level 5 cm high, and LIC-101 brings it back. Only an inventory that no controller or throughflow corrects keeps its error.

Parameter errors persist. If the model’s Cv for PV-101 is 10 percent high, PIC-101 still holds 28 bar, with the valve about 0.45 open where the plant’s sits at 0.50. Integral control moves the error from the pressure to the controller’s output, where it never decays. A wrong lag or metal mass biases the transients instead.

So tuning has to determine the parameters from the plant’s own records. It is in development: the estimator is built and under test, with no acceptance results yet. It solves weighted least squares in noise units, with priors, inside the registry’s bounds.

θ
physical parameters, such as valve Cv, exchanger UA, actuator lags and kmt
ξ
fit coordinates; ξⱼ = ln θⱼ for most parameters, so that a step is relative, and ξⱼ = θⱼ for the rest
ŷe,k
the engine’s prediction of measurement k in experiment e, a steady average or a step-response trace
ye,k
the prepared historian value
σe,k
noise standard deviation, from the record’s spread in steady periods
ξⱼ⁰, σⱼξ
starting value and prior spread, from a datasheet, a document or an engine default
ξmin, ξmax
bounds from the engine’s parameter registry

The fit runs in stages: hydraulics, then heat transfer, then dynamics, each carrying the earlier results as priors. Identifiability is judged locally, from linearized sensitivities and the Fisher information. A parameter the data cannot see or separate stays out, and the record names the combination its partners carry, such as the sum of two series resistances with no pressure measured between them.

The limits

Deterministic here describes the averaged quantities a plant measures. Turbulence and bubble nucleation vary at small scales; they enter the equations through averages such as friction factors and transfer coefficients.

No model is perfect. Instruments drift, some inputs go unmeasured, and parameters change as exchangers foul and valves wear. The fit tests for drift and step changes, and it reports a mismatch the equations cannot represent, such as an undocumented bypass, instead of folding it into a Cv. So fidelity has to be measured on events the fit never saw. The planned fidelity report will do that unit by unit and state its limits.

The equations are the same for every plant. The parameters have to be determined from each plant’s own history.