Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
Rate constant
The forward rate constant of a reaction at a temperature.
k = A T^b exp(−E_a ÷ RT)
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Equilibrium constant in concentration units
K_c of a reaction, used to get the reverse rate from the forward one.
K_c = exp(−Σ νᵢ gᵢ⁄RT) × (P₀ ÷ RT)^Δν
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Net production rates
The rate at which each species is made or used by all reactions together.
rate = (k_f Π C^ν − k_f ÷ K_c Π C^ν) × third-body sum; ωᵢ = Σ νᵢ × rate
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Closed-vessel reactor
Concentrations, and temperature when adiabatic, over time.
dCᵢ/dt = ωᵢ; adiabatic: dT/dt = −Σ uᵢ ωᵢ ÷ Σ Cᵢ c_v,ᵢ, u = RT (H⁄RT − 1), c_v = R (C_p⁄R − 1)
Reaction mechanisms in a closed vessel process/mechanism.js64-bit- CadCraft
- BimCraft
-
Standard gravity
g, used for the liquid head across a valve.
g = 9.80665 m/s²
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Jacobian by differences
The matrix of derivatives of the plant's rates with respect to its states.
Jᵢⱼ = (fᵢ(y + h eⱼ) − fᵢ(y)) ÷ h, h = 1e-7 × max(|yⱼ|, 1e-3)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
One implicit Euler step
The state after one step of size h.
x − y − h f(t + h, x) = 0, (I − hJ) Δx = −residual, repeated
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Stiff integrator
The state at the end time, with every accepted step on the way.
y_new = 2 y_(two half steps) − y_(one full step); error = max |half − full| ÷ (atol + rtol max(|y|, |y_half|)); h ← h × clamp(0.9 ÷ √error, 0.2, 4)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Valve characteristic
The fraction of full flow at a valve opening.
linear: x; equal percentage: R^(x − 1), 0 at x = 0, R = 50 unless given; quick opening: √x
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
PID controller output
The output of a controller between 0 and 1.
e = ±(pv − sp) ÷ span; out = bias + K_c (e + I ÷ T_i + T_d (e − D_f) ÷ t_f), clamped to [0, 1]
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Flow through a valve from a tank
The volume flow through a valve from the liquid heads on its two sides.
Δp = ρ g (h_from − h_to + Δz); q = k × f(x) × √(max(Δp, 0) ÷ ρ)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Tank level and gas pressure rates
How fast a tank level and a gas vessel pressure change.
dh/dt = (q_in − q_out) ÷ A; dP/dt = R T ÷ V × (n_in − n_out)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Stirred reactor balances
The rate of change of each concentration and of the temperature in a constant-volume reactor.
r = k₀ exp(−E ÷ RT) Π C^n; dC/dt = q⁄V (C_in − C) + ν r; dT/dt = q⁄V (T_in − T) − ΔH r ÷ (ρ c_p) − UA (T − T_j) ÷ (ρ c_p V) + Q ÷ (ρ c_p V)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Plant simulation
The trends of every state and controller output from time zero to the end time.
integrate from each output time to the next (end ÷ 200 apart, or the next scripted event) with rtol 1e-6, atol 1e-9
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Process model from a step test
Gain, time constant and dead time of a first-order model fitted to a step response.
K = Δy ÷ Δu; τ = 1.5 (t₆₃ − t₂₈); θ = max(0, t₆₃ − τ)
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Controller tuning rules
P, PI or PID settings from the fitted gain, time constant and dead time.
Ziegler–Nichols PI: K_c = 0.9 τ ÷ (K θ), T_i = 3.33 θ; IMC PI: K_c = (τ + θ⁄2) ÷ (K (λ + θ⁄2)), T_i = τ + θ⁄2; SIMC: K_c = τ ÷ (K (τ_c + θ)), T_i = min(τ, 4 (τ_c + θ))
Dynamic simulation and controller tuning process/dynamics.js64-bit- CadCraft
- BimCraft
-
Tear stream from the iteration vector
A stream rebuilt from the component flows, temperature and pressure the recycle iteration is working on.
nᵢ = max(xᵢ, 0); F = Σ nᵢ; z = n ÷ F; state from a PT flash
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Recycle convergence test
Whether the tear streams have stopped changing from one pass to the next.
error = max |g(x)ᵢ − xᵢ| ÷ (|xᵢ| + scaleᵢ) < tol, scale = 1e-6 F_max (flows), 1 (T), 1000 (P)
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Wegstein acceleration
The next guess of each tear variable from its last two passes.
s = (g − g_prev) ÷ (x − x_prev); q = clamp(s ÷ (s − 1), −5, 0); x_next = q x + (1 − q) g
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Broyden acceleration
The next guess of all tear variables together, from an updated inverse Jacobian.
H ← H + (Δx − H ΔF) (Δxᵀ H) ÷ (Δxᵀ H ΔF); x_next = x − H F, F = x − g(x)
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Design specifications
The value of a unit parameter that makes a stream property hit its target.
residual = (value − target) ÷ (|target| + 1e-6); one bounded spec: scan 48 intervals, then a bracketed root to 1e-12; otherwise Newton to 1e-10
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Property a specification reads
The stream or unit value a design specification is compared with.
flow of a component = F × zᵢ
Flowsheet solver and unit operations process/flowsheet.js64-bit- CadCraft
- BimCraft
-
Feed stream
A feed's total flow and mole fractions from component flows, mass flows or a total with fractions.
F = Σ nᵢ; zᵢ = nᵢ ÷ F; from mass: nᵢ = mᵢ ÷ Mᵢ
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Mass flow of a stream
The mass flow in kg/s from the molar flow and composition.
ṁ = F × Σ zᵢ Mᵢ
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Volume flow of a stream
The volume flow in m³/s, phase by phase.
Q = Σ_phases F × fraction × V_molar(T, P, x)
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Mixer
The outlet of several streams mixed at the lowest inlet pressure.
nᵢ = Σ F zᵢ; H_flow = Σ F H; outlet from a flash at that enthalpy
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Splitter
Outlets that share one stream by given fractions.
F_k = F × f_k ÷ Σ f
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Pump
The shaft work and outlet state of a pump.
w = V_liquid (P_out − P_in) ÷ η; W = F w; outlet at H_in + w
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Compressor and expander
The work and outlet state from an isentropic step and an efficiency.
h_s from a flash at P_out and the inlet entropy; compressor: h = H_in + (h_s − H_in) ÷ η; expander: h = H_in + η (h_s − H_in)
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Component splitter
Two outlets that each take a set fraction of every component.
aᵢ = F zᵢ fᵢ; bᵢ = F zᵢ (1 − fᵢ); Q = F_a H_a + F_b H_b − F H
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Two-stream heat exchanger
The outlet states, duty, log-mean temperature difference, UA and smallest approach of a counter-current exchanger.
duty = F_hot (H_in − H_out); LMTD = (ΔT₁ − ΔT₂) ÷ ln(ΔT₁ ÷ ΔT₂), or ΔT₁ when |ΔT₁ − ΔT₂| < 1e-9; UA = duty ÷ LMTD
Flowsheet solver and unit operations process/stream.js64-bit- CadCraft
- BimCraft
-
Inside diameter of a pipe size
The inside diameter in meters of a nominal pipe size or a size in millimeters.
D = (OD − 2 × wall) × 0.0254 (inches from the schedule 40 table); D = mm ÷ 1000
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Colebrook–White friction factor
The turbulent Darcy friction factor from the implicit Colebrook–White equation.
1 ÷ √f = −2 log₁₀(ε ÷ (3.7D) + 2.51 ÷ (Re √f))
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Swamee–Jain friction factor
The turbulent Darcy friction factor from an explicit formula.
f = 0.25 ÷ (log₁₀(ε ÷ (3.7D) + 5.74 ÷ Re^0.9))²
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Friction factor
The Darcy friction factor for any Reynolds number.
Re < 2300: 64 ÷ Re; Re ≥ 4000: Swamee–Jain; between: (1 − w) × 64 ÷ 2300 + w × f(4000), w = (Re − 2300) ÷ 1700
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Erosional velocity
The velocity above which API RP 14E warns of erosion, in m/s.
v_e = C × 0.3048 ÷ √(ρ × 0.062427961), C = 100
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Pressure drop of one line
Velocity, Reynolds number, friction factor and the friction, fitting and static parts of the pressure drop.
A = πD² ÷ 4; v = ṁ ÷ (ρA); Re = ρvD ÷ μ; Δp = f (L ÷ D) ρv² ÷ 2 + K ρv² ÷ 2 + ρ g Δz
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Fluid of a stream
The density, mass flow and phase of a solved stream for the line calculation.
ρ = mass flow ÷ volume flow; gas when vapor fraction ≥ 0.999, liquid when ≤ 0.001, else two-phase
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Pipe in a flowsheet
The outlet pressure of a pipe unit, with the gas density taken at the mean pressure.
ρ_mean = ρ_in × (P_in + P_out) ÷ 2 ÷ P_in; repeat until |ΔP_out| < 1e-6 P_in
Line sizing and pressure drop process/hydraulics.js64-bit- CadCraft
- BimCraft
-
Length, rise and bends of a 3D pipe run
A pipe run's length and rise in meters and its count of elbows, from its points in millimeters.
L = Σ |pᵢ − pᵢ₋₁| ÷ 1000; Δz = (z_last − z_first) ÷ 1000; bend angle = acos(a·b ÷ (|a||b|))
Line sizing and pressure drop process/model.js64-bit- CadCraft
- BimCraft
-
Hydraulics of every linked line
The pressure drop, velocity and erosion screening of each stream that has a line or a pipe run.
Line sizing and pressure drop process/model.js64-bit- CadCraft
- BimCraft
-
Stream table
The table of streams drawn on the P&ID and exported: temperature, pressure, flows, velocity, line drop and composition.
T (°C) = T − 273.15; P (bar) = P ÷ 1e5; mass (kg/h) = ṁ × 3600; rounded with toPrecision to 5, 3 or 4 significant digits
Line sizing and pressure drop process/model.js64-bit- CadCraft
- BimCraft
-
Pipe size for a velocity target
The smallest nominal pipe size whose velocity is at or under the target.
v = (ṁ ÷ ρ) ÷ (πD² ÷ 4) ≤ v_max, sizes tried from smallest to largest
Line sizing and pressure drop process/synth.js64-bit- CadCraft
- BimCraft
-
Rescaling a plant to a production rate
The factor applied to the feed so a chosen stream carries the asked-for tonnes per day of a component.
k = (t/d × 1000 ÷ 86400) ÷ (F zᵢ Mᵢ)
Line sizing and pressure drop process/synth.js64-bit- CadCraft
- BimCraft
-
Stream segments from enthalpies
A process stream with phase change as a list of pieces with constant heat capacity flow rate.
12 equal temperature steps; CP = |F (H_k − H_{k−1}) ÷ (T_k − T_{k−1})|
Pinch analysis process/pinch.js64-bit- CadCraft
- BimCraft
-
Problem table
The minimum hot and cold utility and the pinch temperature for a minimum approach.
shift hot streams by −ΔT_min⁄2 and cold by +ΔT_min⁄2; net_k = Σ (±CP)(T_hi − T_lo); Q_H = −min of the running sum; Q_C = last running sum + Q_H
Pinch analysis process/pinch.js64-bit- CadCraft
- BimCraft
-
Composite curves
The hot and cold composite curves as lists of enthalpy and temperature points.
H_{k+1} = H_k + (Σ CP of the streams present) × (T_{k+1} − T_k); cold curve shifted by Q_C
Pinch analysis process/pinch.js64-bit- CadCraft
- BimCraft
-
Area target
The minimum heat-exchange area for the composite curves with vertical heat transfer.
A = Σ_intervals (Σ_streams CPᵢ ΔTᵢ ÷ hᵢ) ÷ ΔT_lm, ΔT_lm = (d₀ − d₁) ÷ ln(d₀ ÷ d₁)
Pinch analysis process/pinch.js64-bit- CadCraft
- BimCraft
-
Minimum number of units
The fewest exchangers, heaters and coolers for maximum energy recovery.
above the pinch: streams + (1 if Q_H > 1e-9) − 1; below: streams + (1 if Q_C > 1e-9) − 1
Pinch analysis process/pinch.js64-bit- CadCraft
- BimCraft
-
Purchased cost of one item
The purchased cost of an equipment item of a given size, in base-year dollars or scaled by a cost index.
C₀ = 10^(K₁ + K₂ log₁₀ A + K₃ (log₁₀ A)²); C = C₀ × I_now ÷ I_base
Capital and operating cost process/cost.js64-bit- CadCraft
- BimCraft
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.