# CalcPlant model and result reference for AI operators Revision: 2026-11-14. Read [the operation guide](ai-instructions.md) first. This is a focused reference for the supplied liquid-pump example, not a complete JSON Schema or a promise that every internal field is a stable public API. ## Drawing envelope and identity - `v: 2`: use model v2. Missing/v1 versions can invoke legacy migration with different units; never omit the version for a new candidate. - `fluid`: common settings. `fluid.atm` is atmospheric **absolute** pressure in kgf/cm². Do not put all line properties here; the example's line properties are on `pipes[]`. - `fluidMoved: 1`: retain this migration marker when cloning the example/current model. - `nodes[]`: unique nonempty string `id`, valid `type`, finite schematic `x`/`y` coordinates, human-readable `name`. - `pipes[]`: unique nonempty `id`, disjoint from node IDs, and existing node IDs in `from`/`to`. Direction matters. Keep all branch/tee connections instead of replacing them with an invented direct line. - `calc.src`/`calc.dst`: source/destination node IDs in the starter model. Empty selectors in other drawings may have automatic/multiple-path semantics; preserve them unless deliberately changing path selection. - `view`: drawing presentation. Node `x` and `y` are **schematic coordinates**, not physical EL or Plant View metres. - `grades[]` (optional): ground (GL) zones `{ id, name, el, surf? }`, `el` = **absolute EL in m** of that ground; `surf` = `concrete` | `gravel` | `asphalt` | `sea` (missing = soil), Plant View pad only (the drawing ground is always a plain hatch). Plant View keeps zone areas in `layout.grades` (layout only) and edits zone values through its apply step. `view.elRef: 'gl'` only changes how the inspector shows and accepts EL (above the zone GL); stored values stay absolute. Node `gz` = zone `id` (missing → first zone). Display/layout only: all EL inputs (`z`, `zb`, `el`, nozzle ELs) stay **absolute** and the hydraulic result does not change; the drawing ground steps per zone, Plant View sets a ground-standing linked item's base at its zone EL and Relief `E` is measured from it. Do not shift ELs when adding zones. In GL input mode (`view.elRef: 'gl'`, zones present) the app keeps an item's height above its ground when that ground moves: changing a zone's `el`, moving an item to another zone (`gz`) or removing its zone (its items then stand on the first zone) shifts the item's absolute ELs and its line nozzle ELs (`zn1`/`zn2`) by the ground difference — in the inspector and through Plant View apply alike. With absolute EL input nothing shifts. - Tank `cont` (optional, ordinary tanks only, not sphere/cooling tower): `single` | `double` | `full` LNG-style containment. Drawing outline and Plant View geometry only; no hydraulic effect. - Tank `ow` (optional, needs `cont`, cone / dome / IFR tanks only; otherwise dropped on load): `concrete` | `steel` outer tank of a cryogenic double-wall tank. Plant View then draws an open-top 9 % Ni inner tank, perlite annulus and suspended deck inside an outer tank of that material with a dome roof; `single` adds the bund, `double` the open-top concrete wall, `full` makes the outer tank the containment (`cont: 'full'` alone = concrete). Missing = the ordinary tank for `single` / `double`. The Hydraulic inspector offers it only for a cryogenic tank (tank fluid or a connected line at ≤ −40 °C). Display only; no hydraulic effect. - Cooling tower (`type: 'tank'`, `tstyle: 'ct'`) `cells` (optional integer 1–12, default 1): cells in line. Plant View geometry only (one fan stack per cell); no hydraulic effect. Plant View uses `D` (mm) as the cell size (one side) and HLL + 0.3 m as the basin curb. - Cooling tower `ctdist` (optional): `'spray'` = pressurised spray (nozzle) distribution; missing = gravity (open hot-water basin). With `'spray'`, `ctdp` (kgf/cm², > 0 … 10) is the required inlet pressure, vendor value at the inlet flange. It is added to the tower pressure `p` only for lines **arriving** at the tower (it raises the required pump head and the arrival pressure); the basin outlet / pump suction still uses `p`. Loading a `ctdp` without `ctdist` sets `ctdist: 'spray'`; any other `ctdist` removes both. The building cooling example uses spray with 0.5. - `notes[]` (optional): free text boxes `{ id, x, y, text, box? }` in schematic coordinates (`box: false` = no frame). Annotation only; never put inputs or results in a note. - Preserve optional/unknown sections. `relief`, `layout`, `sb`, `vdb`, `operatingCases`, `checkIgnore`, `grades` and `notes` are not disposable output caches. - `exampleDesignBasis: true` identifies teaching assumptions. Copying an example does not turn those assumptions into verified user requirements. Review and replace its equipment design pressures for a real design. ## Units: do not infer them from the current UI pressure selector All stored model pressure numbers and `FlowCanvasAPI.results()` numeric pressure outputs use **kgf/cm²**. Multiply by 0.980665 for bar or 98.0665 for kPa. Displaying bar does not change stored numbers. Starter equipment: - Tank `p`: operating gauge pressure, kgf/cm²g. `designP`: design gauge pressure; not an operating-pressure substitute. - Tank `zb`: bottom datum EL, m. `Ht`: tank shell height, m in this example. Tank `D`: diameter, **mm**; blank = a first guess from typical height / diameter (fixed roof 0.6, internal floating 0.5, external floating 0.35, onion 0.3, LNG containment 0.55) used for the drawing width and the Plant View tank until a real D is entered. Other tank styles have different geometry semantics; do not apply this shape to a sphere or cooling tower blindly. - Tank `LLL`/`NLL`/`HLL`: liquid levels, **mm above the tank bottom**, not absolute EL. Absolute liquid EL is `zb + level/1000`. - Tank `lb`: selected calculation-level basis. The example uses source `LLL` and destination `tangent-auto`; preserve the example's destination high-level semantics or explicitly compare specified level cases. Do not change all bases to NLL by default. - Vessel fluid `fl` (tank / drum / column, optional): `rho` kg/m³, `mu` cP, `T` °C (liquid outlets), `mw` kg/kmol, `rhog` kg/m³, `mug` cP (top-nozzle vapour outlet); blank line cells inherit them. `fl.pf` (UI only, properties panel **Properties / 물성 계산**) names a CoolProp fluid (64 ids listed in `FCProps.FLUIDS` of `fc-props.js`, e.g. `Water`, `Air`, `Nitrogen`, `Hydrogen`, `CarbonDioxide`, `Methane`, `Propane`, `n-Hexane`, `Toluene`, `Methanol`, `Ammonia`, `R134a`; glycol solutions `MEG` / `MPG` with `pfx` wt% 0–60), or `fl.pf: 'MIX'` with `fl.pr` `{ c: [{ id, v }], basis }` (same as the line mixture below): a Peng–Robinson flash at `T` and the vessel pressure fills the liquid `rho`/`mu` and vapour `mw`/`rhog`/`mug` (both when two-phase); `pfb` `tp` (default, the single phase at `T` and the vessel `p` + atmospheric) | `sat` (saturated liquid + vapour at `T`). While `pf` is set the page recomputes and overwrites `rho`/`mu`/`mw`/`rhog`/`mug` (the other phase's fields are cleared) before each on-page recalculation, except keys listed in `fl.pfPin` (typed over by the user), and stores the status and computed values in `fl.pfr` (`calc`); `calc()` does not compute properties, so give numeric fields when building a model through the API. - Line mixture `pr` (pipe, optional, UI only, line properties panel **Properties / 물성 계산 → Mixture (Peng–Robinson)**): `pr.c` `[{ id, v }]` (`id` = CAS of a component in `props-db.json`, `v` amount), `pr.basis` `mol` (default) | `wt`, `pr.P` flash pressure kgf/cm²g (blank = the pressure of the item the line leaves), temperature = the line `T` °C. While `pr` is set the page flashes before each on-page recalculation and overwrites `ph` (blank = liquid, `V`, `M`), `xv` (vapour wt%), `rho`, `rhog`, `mw`, `zf`, `mu`, `mug`, `st` (fields of an absent phase are cleared). Keys listed in `pr.pin` (fields the user typed over) keep their typed value. Status in `prr` `{ phase, beta, wv, P, calc{computed values}, warn[], est[] }` (`est` lists `mu` / `mug` / `st` that include correlation estimates) or `{ err }`. Peng–Robinson with kij = 0, COSTALD liquid density, liquid viscosity from CoolProp-fitted or Joback / Letsou–Stiel component values (ln-mole mixing), gas viscosity Herning–Zipperer × Lucas pressure factor, surface tension mole-fraction average; `calc()` does not flash, so give numeric line fields when building a model through the API. - Pump `z`: pump datum EL, m. `eff`: efficiency in **percent**, e.g. 70, not 0.70. `npshr` and `npshm`: NPSHr and configured allowance, m. - Pump `pvMode: 'input'`, `pv`: explicitly entered vapor **absolute** pressure, kgf/cm²a. Do not enter gauge pressure here. Starter pipes: - `l`: length, m. `d`: actual internal diameter, **mm**. `nps`: nominal size, inches. `sch`: schedule string such as `'40'`. Nominal size is not internal diameter. - `e`: absolute roughness, **mm**. `k`: additional dimensionless K. `fit` contains counts of fittings; do not count the same loss both as an explicit fitting and another K/length allowance without a stated basis. - `q`: the liquid example's actual volumetric flow, m³/h. `w`, when used, is mass flow, kg/h. A vapour line may instead give `qstd` (Nm³/h, or Sm³/h with `qstdB: 'S'`), converted with its `mw` — see Gas standard volume flow below. In the starter series circuit, flow is explicitly given on L1 and propagated to L2; do not force contradictory explicit flows on connected segments. - `rho`: kg/m³. `mu`: **cP**, not Pa·s. `T`: °C. The fixture sets `phase: 'liquid'`; preserve phase fields when cloning. Gas normal/standard volume flow is `qstd` (Gas standard volume flow below), never `q`; two-phase input semantics need their own verified basis; do not reuse liquid density/flow assumptions for them. - `fromPort`/`toPort`: drawing connection sides. `zn1`/`zn2`, when used, are per-pipe nozzle EL in **m**, not liquid level in mm. Preserve them unless intentionally changing nozzle elevations. - Example `fit` keys: `entrance`, `exit`, `gate`, `check`, `elbow90`; values are counts. There are other supported fitting keys; use the UI/reference for those instead of inventing spellings. Empty/missing fields are not automatically zero. Use actual JSON numbers for known values; JSON cannot represent NaN/Infinity. Do not fill unknown physical data with zero merely to satisfy structural validation. ## Existing browser API, version 1 - `getModel()`: JSON copy of the current serialized drawing; initial/legacy drawings can gain default fields when subsequently normalized on import. - `loadModel(model)`: replace, render, calculate and autosave; resets Undo and detaches the DB item. It does **not** preserve a sandbox automatically. - `calc(model)`: results of a candidate drawing in the same shape as `results()`, without changing the open drawing, its results, autosave, Undo or DB item (`meta.computedAt` is the evaluation time). Throws on an invalid model. Added 2026-11-04; check `typeof FlowCanvasAPI.calc === 'function'`. - `results()`: numerical snapshot `{meta, lines, equipment}` (+ `flare` when the drawing has a flare network, see below; + `relief` when `model.relief` has PSVs — Relief PSV sizing per case, governing case and missing inputs, see [the operation guide](ai-instructions.md) Relief; read-only, also in `calc()`). May calculate if no current result exists; normal model loading already calculates. - `diff(model)`: field-level changes of a candidate against the open drawing `{ base, candidate, changes[{key, op, path, target, from, to}], effects[{target, field, from, to}] }`; changes nothing. Added 2026-11-14. - `apply(model, { base, only })`: apply all or the listed change keys after checking `base` = the current fingerprint (else `code: 'stale'`); one Undo step, Undo history and DB item kept; returns `{ applied, fingerprint }`. Added 2026-11-14. - `review(model, { title })`: change review window for the user; Promise of `{ applied, fingerprint }` or `{ applied: [], cancelled: true }`. Added 2026-11-14. See [the operation guide](ai-instructions.md) for details. - `loadErrorText(error, model)`: readable import error detail. - `compareOperatingCases(cases)`: relative flow/level comparisons, restores original model/caches. Each case requires a unique `id`, nonempty `name`, `flowPercent` (>0, <=1000), `sourceLevel` and `destinationLevel` in `current|LLL|NLL|HLL`. Up to 12 conditions. - `reportSnapshot()`: formatted report basis; unlike `results()`, it includes selected display pressure units/labels/factor. Do not mix its display strings with canonical numerical result fields. - `schema()`: field guide for the drawing JSON — field names, stored units, allowed values (node types, tank/drum/pump styles, fitting keys, GL zone, containment, multiplier, Relief PSVs `model.relief`). Generated from this build's constants; contains no drawing or user data. Read it before building a `loadModel` candidate. - `lang()`: current UI language. `version` is a property, not a function. There is no documented `calculate()`, `validateModel()` or `saveProject()` method on `FlowCanvasAPI`. Access only methods actually present. Internal Relief/Plant View/debug helpers are not universal design APIs. ## Numerical results and acceptance - `meta.ok`: computation status, **not engineering acceptance**. - `meta.errs`, `meta.warns`, `meta.convergence`: errors/warnings/convergence information. An item or line that cannot be calculated is reported as `: check the inputs. Missing or invalid: