Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Parameter estimation

Parameter estimation fits a model’s kinetic parameters to laboratory or pilot data. Examples are rate constants, activation energies, reaction orders, Monod μmax and Ks, and yields. You import experiments (measured time series) from CSV files and choose the parameters to fit. FlowState then finds the values that best explain the data. It reports each estimate with a confidence interval and shows how well the model fits, and it can suggest when to take samples in the next experiment.

Open it from Tasks ▸ Parameter estimation…, or with Ctrl+K “Parameter estimation”. The experiments, the parameters and the last result are saved in the .flow file. A project that has no experiments is saved exactly as before.

What can be fitted

Each experiment names a target operation. FlowState simulates that operation’s kinetics under the experiment’s own conditions:

Target operationModel“Time” in the data
Kinetic Reaction (batch)Isothermal rate-law network, dC/dt = Σ ν·r(C, T)Batch time, h
Kinetic FermentationMonod growth with Luedeking–Piret product formation and maintenanceBatch time, h
Continuous reactor, PFRThe network integrated along the tube, with the adiabatic energy balance when the reactor is adiabaticResidence time, h
Continuous reactor, CSTRThe steady state at each residence timeResidence time τ, h (one steady state per row)

A parameter is any numeric input, given by its variable path, for example:

  • procedures/P-1/operations/REACT-1/kind/reactions/0/k_ref: the rate constant of reaction 1 at its reference temperature
  • procedures/P-1/operations/REACT-1/kind/reactions/0/ea_kj_mol: its activation energy
  • procedures/P-1/operations/REACT-1/kind/reactions/0/orders/A: the order in A
  • procedures/P-2/operations/FERMENT-1/kind/kinetics/mu_max, …/ks, …/yxs, …/alpha, …/beta, …/ms: the Monod constants and yields
  • procedures/R-1/operations/REACT-1/kind/kinetics/0/k_ref: the rate constant of a continuous reactor

The Parameters tab lists the candidate parameters of every target operation, so you can add them with one click. When several experiments share an operation, they share its parameters. This is how a rate constant and an activation energy are fitted together from runs at different temperatures.

Experiment files

An experiment is a CSV file. The first column is time. Each further column is one measured quantity. Lines that start with # describe the experiment:

# name: Run 60C
# target: P-1/REACT-1
# T: 60
# initial: A=100, B=0
# sigma: 2%
# sigma B: 0.5
time_h, A, B, conv:A
0,    100.0,  0.0,
0.5,  74.6,  25.1, 0.25
1.0,  55.3,  44.2,
2.0,  30.1,  70.3, 0.70
LineMeaning
# name:Experiment name (default: the file name)
# target:Procedure and operation, procedure/operation (procedure name or equipment tag)
# T:Temperature, °C. This is the batch temperature, or the feed or reactor temperature of a continuous reactor (default: the operation’s own setting)
# volume:Reacting volume, m³, which converts concentrations to masses (default 1)
# initial:Initial concentrations, or the feed concentrations of a continuous reactor, kg/m³
# rho_cp:Volumetric heat capacity of an adiabatic reactor, kJ/(m³·K) (default 4180)
# set <path>: valueAny other input, set for this experiment only
# sigma: / # sigma <column>:Measurement error: a standard deviation (0.5), a percentage (2%) or estimate

Time column. It may be named time, t or time_h. Name it time_min or time_s for minutes or seconds; FlowState converts these to hours.

Measured columns are matched to quantities by their header (a unit in brackets is ignored):

HeaderQuantity
a component name, e.g. A or A [kg/m3]Concentration, kg/m³
mass:AMass in the reacting volume, kg
conv:AConversion of A, 1 − C/C₀
TTemperature, °C (adiabatic continuous reactors)
biomass / X, substrate / S, product / P / titerFermentation states, kg/m³

Empty cells and NA are missing values. A measured species with no initial value starts at its measured value at t = 0. That value includes measurement noise, so give the initial concentrations under # initial: whenever you know them.

You can also edit an experiment after you import it. On the Experiments tab you can enable or disable it, change its target, temperature, volume and initial concentrations, and set the error model of each measured series. Preview with current values plots the data against the model as it stands now.

The fit

FlowState minimises the weighted sum of squares

χ²(θ) = Σᵢ ((ŷᵢ(θ) − yᵢ) / σᵢ)²

over every enabled experiment, using Levenberg–Marquardt within the parameter bounds. The model predictions ŷ and their sensitivities ∂ŷ/∂θ come from the forward sensitivity equations, which are integrated together with the model. A CSTR, or the Finite differences setting, uses finite differences of whole simulations instead.

  • Error models. Each measured series has a constant σ, a relative σ (a percentage of the measured value, with a floor near zero), or an estimated σ. Estimated σ are pooled per measured quantity across the experiments and found by Gaussian maximum likelihood together with the parameters.
  • Bounds and log scaling. Every parameter has a lower and an upper bound. Tick Log for positive parameters that may span several decades, such as rate constants and saturation constants. FlowState then estimates ln θ, and the confidence interval becomes asymmetric.
  • Starting values are the model’s current values unless you set them.

The fit runs in the background, and you can cancel it at any time.

Arrhenius parameters. k_ref and Ea are almost perfectly correlated when the reference temperature lies outside the range of the experiments. Set t_ref_c near the middle of your temperatures before fitting them together.

Results

The Results tab shows:

  • Estimates. Each parameter has its estimate, standard error, confidence interval (95 % by default, from the t-distribution with N − p degrees of freedom) and t-value. A t-value below the reference t means the data do not determine the parameter well. Parameters that end at a bound are flagged.
  • Lack-of-fit test. When every σ is known, χ² is compared with the χ² quantile for N − p degrees of freedom. Passing means the residuals are no larger than the stated measurement errors explain.
  • Charts.
    • Fit vs data: the measured points and the model curves over time.
    • Parity: measured against predicted values.
    • Residuals: the weighted residuals over time, with ±2σ lines.
    • Correlation: a heat map of the correlation matrix of the estimates. Values near ±1 mean two parameters cannot be told apart with these data.

Write fitted values to the model writes the ticked estimates into the operation as one undo step. Each value is logged with the provenance fitted from Run 40C, Run 60C, …, which the Settings pane shows next to the field.

Designing the next experiment

Next experiment (D-optimal sampling) suggests when to take samples in a repeat of an experiment, under the same conditions and measuring the same quantities. It chooses the times that maximise the determinant of the Fisher information of the existing data plus the new samples, evaluated at the latest estimates. It starts with a greedy choice and improves it by Fedorov exchange. The panel reports ln det F for the existing data alone, with the suggested samples, and with the same number of evenly spaced samples, so you can see what the design gains.

Command line

flowstate-cli estimate process.flow --experiment run40.csv --experiment run60.csv \
    --param procedures/P-1/operations/REACT-1/kind/reactions/0/k_ref:0.001:10:log \
    --param procedures/P-1/operations/REACT-1/kind/reactions/0/ea_kj_mol:1:200 \
    [--target P-1/REACT-1] [--sigma 2%] [--fd] [--design 6] [--json] [-o fitted.flow]
  • Experiments and parameters. Each --experiment file is added to the experiments stored in the project. --param path:lower:upper[:log] replaces the stored parameters. If you give no parameters, the command lists the candidates.
  • Target. --target is used for files without a # target: line. A project with a single kinetic operation needs neither.
  • Output. The command prints the estimates, the correlation matrix, the χ² test and a residual summary, or the full result with --json. It exits with code 3 if the fit does not converge.
  • Design and write-back. --design N adds N D-optimal sampling times. -o saves a copy of the project with the fitted values written back, together with the experiments, the parameters and the result.

Method notes

  • Covariance. The covariance of the estimates is (JᵀJ)⁻¹, where J holds the weighted sensitivities at the optimum. Estimated σ use the unbiased variance SSR/(n(1 − p/N)). The intervals are linearised (Wald) intervals. They are reliable when the model is nearly linear in the parameters over the interval, and log scaling helps with this. Treat wide or highly correlated intervals with care.
  • Validation. The test suite checks that the estimator recovers known parameters from noisy synthetic data: a first-order reaction; k_ref and Ea from three temperatures; Monod μmax, Ks and Yx/s from a batch fermentation; CSTR and PFR rate constants. It also checks that the 95 % intervals cover the true value in about 95 % of repeated data sets, and that the optimiser converges on Rosenbrock’s valley.

References: Y. Bard, Nonlinear Parameter Estimation, Academic Press, 1974. D. M. Bates and D. G. Watts, Nonlinear Regression Analysis and Its Applications, Wiley, 1988. K. Madsen, H. B. Nielsen and O. Tingleff, Methods for Non-linear Least Squares Problems, DTU, 2004. G. Franceschini and S. Macchietto, “Model-based design of experiments for parameter precision: state of the art”, Chem. Eng. Sci. 63 (2008) 4846–4872.