neqsim-continuous-improvement-toolkit
Skill4 starsChanged 5 months agoApache-2.0View on GitHub
Building blocks for NeqSim living tasks: a tagreader PI/IP.21 adapter for cycle_plan.yaml, Gaussian-process Bayesian optimisation with expected improvement, an ensemble Kalman parameter update, and an SVD identifiability check. USE WHEN: a living task needs historian data without enterprise adapters, a solve loop must pick the next trial and its expected gain, parameters must update each cycle from measurements, or a calibration must be checked for unidentifiable parameters.
In this repository90 other files it gives its agents.
- neqsim-document-intelligence-extractionSkill
- neqsim-co2-emissions-screeningSkill
- neqsim-energy-emissions-screeningSkill
- neqsim-weather-dataSkill
- neqsim-anp-open-dataSkill
- neqsim-artificial-lift-screeningSkill
- neqsim-asset-value-npv-screeningSkill
- neqsim-capex-opex-screeningSkill
- neqsim-design-basis-screeningSkill
- neqsim-economy-basis-screeningSkill
- neqsim-ncs-infrastructure-networkSkill
- neqsim-ncs-ownership-equitySkill
- neqsim-ncs-value-chain-optimizationSkill
- neqsim-norwegian-continental-shelf-dataSkill
- neqsim-psc-bid-economics-screeningSkill
- neqsim-reservoir-depletion-screeningSkill
- neqsim-reservoir-facility-value-chainSkill
- neqsim-reservoir-model-builderSkill
- neqsim-resource-classification-screeningSkill
- neqsim-hydrate-margin-checkSkill
- neqsim-hydrate-screeningSkill
- neqsim-multiphase-flow-slug-screeningSkill
- neqsim-olga-multiphase-simulatorSkill
- neqsim-produced-water-scale-screeningSkill
- neqsim-surf-cooldown-screeningSkill
- neqsim-two-phase-flow-regime-screeningSkill
- neqsim-wax-margin-checkSkill
- neqsim-acoustic-induced-vibration-screeningSkill
- neqsim-adsorbent-capillary-condensation-screeningSkill
- neqsim-ageing-life-extension-screeningSkill
- neqsim-cfd-couplingSkill
- neqsim-compressor-antisurge-recycleSkill
- neqsim-compressor-operating-window-checkSkill
- neqsim-compressor-power-screeningSkill
- neqsim-control-authority-screeningSkill
- neqsim-control-valve-cv-screeningSkill
- neqsim-dry-gas-seal-screeningSkill
- neqsim-dynamic-instrument-controller-setupSkill
- neqsim-dynamic-process-preparationSkill
- neqsim-fem-couplingSkill
- neqsim-fired-heater-duty-screeningSkill
- neqsim-flow-induced-vibration-screeningSkill
- neqsim-gas-scrubber-sizing-screeningSkill
- neqsim-gas-turbine-performance-screeningSkill
- neqsim-heat-exchanger-fouling-assessmentSkill
- neqsim-line-velocity-checkSkill
- neqsim-noise-screeningSkill
- neqsim-pipe-wall-thickness-screeningSkill
- neqsim-piping-flexibility-screeningSkill
- neqsim-pressure-drop-screeningSkill
- neqsim-pump-hydraulics-screeningSkill
- neqsim-reciprocating-compressor-screeningSkill
- neqsim-reliability-data-screeningSkill
- neqsim-sand-erosion-screeningSkill
- neqsim-separator-modellingSkill
- neqsim-teg-dehydration-modelingSkill
- neqsim-uncertainty-quantificationSkill
- neqsim-utility-balance-screeningSkill
- neqsim-water-dewpoint-dehydration-screeningSkill
- neqsim-benchmark-reference-dataSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Before trusting a calibration: identifiability(J) — a rank below the number of parameters means some combination is set by noise, not data.
- Very specific: line 124
Check the SourceResult status each cycle.
- Very specific: line 126
Run identifiability before accepting an EnKF or calibration result.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Continuous Improvement Toolkit
Public, plant-agnostic helpers for the NeqSim living-task runner
(neqsim task-living, task-cycle, task-solve, task-backtest; see the core
skill neqsim-continuous-task-improvement). Everything here runs without
enterprise access.
When to Use
- A living task must read a PI or IP.21 historian: use
TagreaderAdapter. - A solve stage tunes a few bounded setpoints and each trial is a NeqSim run:
use
propose_next(GP + expected improvement). Pass itsexpected_improvementas the candidate'spredicted_deltaso the stop rule can declare converged when no trial is worth its cost. - Model parameters drift (fouling factor, efficiency, meter bias): update them
every cycle with
enkf_update. - Before trusting a calibration:
identifiability(J)— a rank below the number of parameters means some combination is set by noise, not data.
Inputs
TagreaderAdapter: tagreadersource,imstype,step_secondsand atagsmap (logical name -> historian tag), plus the runner's watermark window.propose_next: previous trialsX(list of setpoint vectors), resultsy,boundsper variable,maximize, and an optionalseed.enkf_update: parameter ensemble (members x parameters), matching model predictions (members x observations), the measured vector andobs_std.identifiability: a sensitivity Jacobian (observations x parameters), optional parameternamesandparameter_scale.
Outputs
TagreaderAdapter.fetch(...)returns aSourceResult(ok,partial,stale,failed,not_installed) and writes a CSV part file to the task'scontinuous/data/folder.propose_nextreturns{"x", "expected_improvement", "predicted", "predicted_std", "best_so_far"}.enkf_updatereturns the updated ensemble array.identifiabilityreturnssingular_values,condition_number,rank,n_parameters, anidentifiableflag,unidentifiable_directionsand a per-parametersensitivity_norm.
Engineering Method
- Bayesian optimisation: Gaussian-process surrogate (RBF kernel on the unit cube) with the expected-improvement acquisition, maximised over random candidates inside the bounds.
- Parameter tracking: stochastic ensemble Kalman filter with perturbed observations, using ensemble cross-covariances between parameters and predictions.
- Identifiability: singular-value decomposition of the scaled Jacobian; a parameter combination whose singular value is below the noise level is not determined by the data.
Python Usage Pattern
The sections below show the historian source, a solve stage and a parameter update as used from a living task.
Historian source in cycle_plan.yaml
sources:
historian:
adapter: "continuous_improvement_toolkit.tagreader_adapter:TagreaderAdapter"
initial_lookback_days: 1
overlap_hours: 2
options:
source: "MY-PI-SERVER" # tagreader data source
imstype: "piwebapi" # or "aspenone"
step_seconds: 3600
tags: # logical name -> historian tag
suction_pressure_bara: "AREA.PT-0001"
discharge_pressure_bara: "AREA.PT-0002"The runner resolves the dotted path, so no entry point is needed. Without
tagreader installed the source reports not_installed and the cycle is
degraded, not failed. Authentication failures set interaction_required.
Solve stage with Bayesian optimisation
from continuous_improvement_toolkit import propose_next
def run(ctx):
trials = ... # [(x, y), ...] kept in ctx.state_dir
step = propose_next([t[0] for t in trials], [t[1] for t in trials],
bounds=[(40.0, 60.0), (20.0, 35.0)], maximize=True, seed=len(trials))
y = evaluate_with_neqsim(step["x"]) # ProcessAutomation.evaluate(...)
return {"kpis": {"uplift": y},
"solve": {"value": max(y, best), "validated": True, "confidence": "medium",
"candidates": [{"action": "next BO trial", "p_success": 1.0,
"predicted_delta": step["expected_improvement"]}]}}Parameter update and identifiability
from continuous_improvement_toolkit import enkf_update, identifiability
ensemble = enkf_update(ensemble, predictions, measured, obs_std=[0.2, 0.5])
report = identifiability(jacobian, names=["eta", "fouling"], parameter_scale=[0.01, 1e-4])
if not report["identifiable"]:
... # fix one parameter or add a measurement before calibratingValidation Checklist
- Backtest the living task (
neqsim task-backtest) before trusting the drift or solve loop on live data. - Check the
SourceResultstatus each cycle;staleorpartialdata must not drive a solve step. - Run
identifiabilitybefore accepting an EnKF or calibration result. - Confirm that a proposed setpoint is inside the bounds and was evaluated with
the NeqSim model (
validated: True) before reporting it.
Common Mistakes
- Mapping logical names to the wrong historian tags or units. Check the
tagsmap against the P&ID. - Reporting
expected_improvementas a realised gain. It is a prediction that feeds the stop rule. - Running the EnKF with too few members, which collapses the ensemble spread.
- Calibrating parameters that
identifiabilityreports as undetermined.
Limitations
- The GP uses a fixed RBF length scale on the unit cube; with fewer than ~5
trials the proposal is close to space-filling. It is a screening optimiser,
not a replacement for NeqSim's
AgenticProcessOptimizeron smooth problems. - EnKF assumes approximately Gaussian errors; use at least 20 members.
- Nothing here validates a result — validation stays with the NeqSim model and the backtest.
References
- Jones, D. R., Schonlau, M. and Welch, W. J. (1998). Efficient global optimization of expensive black-box functions. J. Global Optim. 13, 455-492.
- Evensen, G. (2009). Data Assimilation: The Ensemble Kalman Filter, 2nd ed. Springer.
- Page, E. S. (1954). Continuous inspection schemes. Biometrika 41, 100-115.
- tagreader-python: https://github.com/equinor/tagreader-python
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

