agentleFS
equinorequinor/neqsim/.github/skills/neqsim-hazid-fmea-eta-fta/SKILL.md

neqsim-hazid-fmea-eta-fta

Skill170 starsChanged 7 months agoApache-2.0View on GitHub

Structured hazard identification - IEC 61882 HAZOP worksheets with deviation-to-NeqSim-calculator mapping, FMEA with RPN scoring, event trees, fault trees with beta-factor common cause and minimal cut sets, escalation (domino) screening. USE WHEN: a task needs systematic hazard identification, quantified HAZOP/HAZID deviations, top-event decomposition or domino analysis. Anchors on neqsim.process.safety.hazid, .risk.eta, .risk.fta and .escalation.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 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.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use addDeviation(...) once per (guideWord, parameter) deviation per node, or generateGrid(...) to create empty rows for selected parameters.

    line 61
  2. Very specific:

    Run runHAZOP with selected failure modes, or enable all failure modes.

    line 283

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

NeqSim HAZID / FMEA / ETA / FTA Skill

The four canonical hazard-identification and scenario-development techniques in one place — used together they produce auditable HAZOP / SIL / QRA documentation per IEC 61882, IEC 61508/61511, ISO 17776 and the CCPS guideline series.

When to Use

  • HAZOP node walkdown — apply guidewords to design intent at every node
  • FMEA / FMECA — equipment-level failure-mode tabulation with RPN scoring
  • Event-tree analysis (ETA) — outcome-frequency development from initiating event
  • Fault-tree analysis (FTA) — top-event decomposition, minimal cut sets, β-factor CCF
  • Escalation / domino analysis — graph of adjacency between fire/explosion sources

Pairs with neqsim-process-safety (LOPA / SIL / risk matrix) and neqsim-consequence-analysis (probit / IRPA roll-up).

Standards

  • IEC 61882 — HAZOP studies — application guide
  • IEC 60812 — FMEA / FMECA procedure
  • IEC 61025 — fault tree analysis
  • IEC 61508 / 61511 — β-factor common-cause modelling
  • CCPS Guidelines for Hazard Evaluation Procedures (3rd ed.)
  • ISO 17776 — major-accident hazard management

Method 1 — HAZOP Worksheet

import neqsim.process.safety.hazid.HAZOPTemplate;

HAZOPTemplate ws = new HAZOPTemplate("V-100", "HP separator pressure control node");
ws.addDeviation(HAZOPTemplate.GuideWord.MORE, HAZOPTemplate.Parameter.PRESSURE,
    "PCV stuck open",
    "Vessel rupture, gas release",
  "PSV-101; Operator response",
  "Verify PSV sizing per API 521");
String report = ws.report();

The seven IEC 61882 guidewords are defined in HAZOPTemplate.GuideWord. Use addDeviation(...) once per (guideWord, parameter) deviation per node, or generateGrid(...) to create empty rows for selected parameters.

For STID/P&ID + plant-data + NeqSim simulation workflows, use MCP runHAZOP. It accepts a standard runProcess JSON definition plus extracted nodes, safeguards, evidence references, failure modes, and an optional barrier register. It returns HAZOP rows with scenario-simulation evidence and report markdown.

To quantify a single deviation from a P&ID Safety Analyser / AI-HAZOP front-end, use MCP runHazopScenario (neqsim.mcp.runners.HazopScenarioRunner). The deviation→calculation auto-population is driven by neqsim.process.safety.hazid.HazopConsequenceAutoPopulator.quantify(...), and each HazopConsequenceFinding records a verdict, a standardReference, and a limitBasis provenance string (default screening limit vs per-unit data-sheet override from HazopQuantificationLimits). See docs/safety/ai_hazop_input_format.md.

Method 2 — FMEA / FMECA

import neqsim.process.safety.hazid.FMEAWorksheet;

FMEAWorksheet f = new FMEAWorksheet("Compressor train");
f.addEntry("K-101", "Centrifugal compressor",
    "Surge", "Suction valve closed too fast",
    "Bearing damage, unplanned shutdown",
    8, 4, 5);   // Severity, Occurrence, Detection
double rpn = f.totalRPN();

RPN = S × O × D (IEC 60812). Items above the company threshold (often RPN > 100 or S ≥ 9) trigger design changes. The criticalEntries(threshold) helper returns the subset above a cut-off.

Method 3 — Event Tree (ETA)

import neqsim.process.safety.risk.eta.EventTreeAnalyzer;

EventTreeAnalyzer eta = new EventTreeAnalyzer("Gas leak", 1.0e-4); // /yr
eta.addBranch("Immediate ignition?", 0.05);
eta.addBranch("Confined?", 0.30);
eta.addBranch("Delayed ignition?", 0.10);

double fJet  = eta.outcomeFrequency(new boolean[] {true,  false, false});
double fVCE  = eta.outcomeFrequency(new boolean[] {false, true,  true});
double fFlash = eta.outcomeFrequency(new boolean[] {false, false, true});
double fSafe = eta.outcomeFrequency(new boolean[] {false, false, false});
String tree = eta.toTextTree();

Branches multiply: f_outcome = f_init · Π p_branch (or 1-p) along the path. The text-tree output is suitable for embedding in HAZOP reports.

Method 4 — Fault Tree (FTA)

import neqsim.process.safety.risk.fta.FaultTreeAnalyzer;
import neqsim.process.safety.risk.fta.FaultTreeNode;

FaultTreeNode psvA = FaultTreeNode.basic("PSV-A fails", 0.005);
FaultTreeNode psvB = FaultTreeNode.basic("PSV-B fails", 0.005);
FaultTreeNode bothFail = FaultTreeNode.and("Both PSVs fail", psvA, psvB)
                                      .withCCF(0.10);  // β-factor 10 %

FaultTreeAnalyzer fta = new FaultTreeAnalyzer();
double pTop = fta.topEventProbability(bothFail);
java.util.Set<java.util.List<String>> cuts =
    fta.minimalCutSets(bothFail, /* maxCardinality */ 4);

Gate types: AND, OR, VOTING (k-of-n). Common-cause is applied via withCCF(β). Minimal cut sets are returned by brute-force enumeration up to a user-specified cardinality (sufficient for typical < 20-basic-event trees).

β-factor common-cause semantics

The implementation uses the IEC 61508 convex-combination form:

P(top with CCF) = (1 − β) · P_independent + β · max(P_basic_i)

For redundant (AND) configurations this increases the failure probability — the dominant safety effect. For series (OR) configurations it decreases the disjunction probability because the common-mode replaces independent co-occurrence.

Method 5 — Escalation / Domino Graph

import neqsim.process.safety.escalation.EscalationGraphAnalyzer;

EscalationGraphAnalyzer esc = new EscalationGraphAnalyzer();
esc.addEquipment("V-100", 1.0e-4);     // base release frequency
esc.addEquipment("V-101", 1.0e-4);
esc.addAdjacency("V-100", "V-101", 0.30); // 30 % escalation if V-100 ignites
double fEscalated = esc.escalatedFrequency("V-101");
java.util.List<String> chain =
    esc.criticalChain("V-100", "V-101"); // worst-case domino path

Used to screen plot-plan layouts before detailed CFD (KFX / FLACS) runs.

Method 6 — ISO 17776 Major-Accident-Hazard Bow-Tie

Generate a pre-populated bow-tie (threats → top event → consequences, with prevention/mitigation barriers) for each ISO 17776 major accident hazard from MahCatalogue / MahBowTieBuilder:

import neqsim.process.safety.hazid.MahType;
import neqsim.process.safety.hazid.MahCatalogue;
import neqsim.process.safety.hazid.MahBowTieBuilder;
import neqsim.process.safety.risk.bowtie.BowTieModel;

// One call builds a complete bow-tie with default threat freq + barrier PFD
BowTieModel bt = MahBowTieBuilder.build(MahType.TOPSIDE_HYDROCARBON_RELEASE);
bt.getThreats();        // ≥ 4 standard threats
bt.getConsequences();   // ≥ 3 standard consequences
bt.getBarriers();       // ≥ 5 prevention/mitigation barriers

// Or inspect the raw catalogue lists to tailor a custom bow-tie
MahCatalogue.threatsFor(MahType.WELL_BLOWOUT);
MahCatalogue.consequencesFor(MahType.FIRE_EXPLOSION);
MahCatalogue.barriersFor(MahType.TOXIC_RELEASE);

MahType covers the standard offshore MAHs: TOPSIDE_HYDROCARBON_RELEASE, RISER_LEAK, WELL_BLOWOUT, STRUCTURAL_COLLAPSE, DROPPED_OBJECT, HELICOPTER_LOSS, SHIP_COLLISION, FIRE_EXPLOSION, TOXIC_RELEASE, LOSS_OF_BUOYANCY, EXTREME_WEATHER. Defaults exposed as MahBowTieBuilder.DEFAULT_THREAT_FREQUENCY and DEFAULT_BARRIER_PFD. Quantify the assembled BowTieModel with the bow-tie analyzer (see neqsim-process-safety). Verified by MahBowTieBuilderTest.

Method 7 — EI AVIFF Flow-Induced-Vibration Screening

Screen piping for flow-induced vibration (FIV) likelihood-of-failure per the Energy Institute AVIFF guidelines with PipingFivScreening (static helpers):

import neqsim.process.safety.vibration.PipingFivScreening;
import neqsim.process.safety.vibration.PipingFivLikelihood;
import neqsim.process.safety.vibration.FivLikelihoodResult;

// screenGas(tag, rho[kg/m3], v[m/s], D[m], t[m], nBranches, pulsationFactor, supportFactor)
FivLikelihoodResult gas =
    PipingFivScreening.screenGas("Compressor discharge", 80.0, 30.0, 0.3, 0.006, 2, 4.0, 2.0);
gas.getLofScore();        // dimensionless LOF
gas.getLikelihood();      // VERY_HIGH

// screenLiquid(tag, v[m/s], D[m], t[m], nBranches, supportFactor)
FivLikelihoodResult liq =
    PipingFivScreening.screenLiquid("Pump discharge", 3.5, 0.15, 0.005, 1, 1.5);

PipingFivLikelihood band = PipingFivScreening.bandFor(0.7);  // HIGH
String json = gas.toJson();   // contains "lofScore", "likelihood"

Likelihood bands: LOW (< 0.3), MEDIUM (0.3–0.5), HIGH (0.5–1.0), VERY_HIGH (≥ 1.0). High/very-high lines feed detailed AVIFF assessment or CFD. Verified by PipingFivScreeningTest.

Method 8 — Deviation → Calculation Auto-Population

Turn an empty HAZOP grid into a simulation-backed worksheet: each guideword × parameter deviation is mapped to the NeqSim calculator that quantifies its consequence, the governing standard, and a typical safeguard. This replaces the "TBD" placeholders produced by generateGrid(...) or fromProcessSystem(...) with engineered consequence and safeguard text.

import neqsim.process.safety.hazid.HAZOPTemplate;
import neqsim.process.safety.hazid.HazopConsequenceAutoPopulator;
import neqsim.process.safety.hazid.HazopConsequenceMapping;

// 1. Build a first-pass grid (or use HAZOPTemplate.fromProcessSystem(process))
HAZOPTemplate node = new HAZOPTemplate("Node-1: V-100", "HP separator");
node.generateGrid(HAZOPTemplate.Parameter.PRESSURE,
    HAZOPTemplate.Parameter.FLOW, HAZOPTemplate.Parameter.TEMPERATURE);

// 2. Auto-populate consequence / safeguard / recommendation columns
HazopConsequenceAutoPopulator populator = new HazopConsequenceAutoPopulator();
HAZOPTemplate populated = populator.populate(node);  // returns a NEW node
String report = populated.report();

// 3. Inspect a single mapping (e.g. for routing to the right calculator)
HazopConsequenceMapping m = populator.mappingFor(
    HAZOPTemplate.GuideWord.OTHER_THAN, HAZOPTemplate.Parameter.REACTION);
m.getRecommendedCalculator();   // "RunawayReactionAnalyzer"
m.getStandardReference();       // "DIERS / API 521"
String catalogueJson = populator.catalogueToJson();

The populate(...) method preserves any already-filled (non-"TBD") cells and builds a new template (HAZOP deviation rows are immutable). The catalogue maps:

Deviation (guideword + parameter)NeqSim calculatorStandardTypical safeguard
MORE PRESSURE (overpressure)ReliefValveSizing, SettleOutPressureAnalyzer, GasBlowbyAnalyzerAPI 520 / 521PSV / HIPPS
LESS PRESSURE (vacuum collapse)VacuumCollapseAnalyzerAPI 521 / ASMEVacuum breaker
LESS TEMPERATURE (autorefrig./brittle)MDMTCalculator, DepressurizationSimulatorASME UCS-66 / API 521Low-temp trip, MDMT material
MORE TEMPERATURE (fire case)TrappedLiquidFireRuptureStudy, PipeFireRuptureStudy, PfpDemandCalculatorAPI 521TSV, PFP, blowdown
NO / LESS FLOW (deadhead)PumpDeadheadAnalyzerAPI 610Min-flow recycle, low-flow trip
MORE FLOW (surge / erosion)getUtilizationSnapshot surge/velocityAPI 14E / 617Anti-surge controller
REVERSE FLOW (backflow / slam)WaterHammerStudyAPI 521Check valve, slow actuator
AS_WELL_AS / PART_OF COMPOSITIONphase / hydrate / separator screening (TPflash)API 521Composition monitoring, inhibitor
OTHER_THAN REACTION (runaway)RunawayReactionAnalyzerDIERS / API 521Quench, two-phase relief, inhibitor

These closed the previously-flagged 🟡 partial gaps in HAZOP coverage: vacuum collapse (VacuumCollapseAnalyzer), pump deadhead / min-flow (PumpDeadheadAnalyzer), settle-out and gas blow-by (SettleOutPressureAnalyzer, GasBlowbyAnalyzer), and runaway reaction (RunawayReactionAnalyzer). Verified by HazopConsequenceAutoPopulatorTest.

Workflow — From STID to Simulation-backed HAZOP

  1. Retrieve STID/P&ID, C&E, SRS, line-list, and operating-data documents into the task references folder.
  2. Extract nodes with nodeId, designIntent, equipment, safeguards, and evidenceRefs using the technical-document-reading and STID-retriever skills.
  3. Build a NeqSim process JSON definition from extracted topology or existing models.
  4. Run runHAZOP with selected failure modes, or enable all failure modes.
  5. Review generated rows, scenario results, failed simulations, and evidence references with the chaired HAZOP team.
  6. Pass accepted safeguards to runBarrierRegister, LOPA, SIL, bow-tie, and QRA workflows.

Detailed user documentation: docs/safety/automated_hazop_from_stid.md.

Workflow — From HAZOP to LOPA in One Notebook

  1. HAZOP the node → identify deviation, cause, consequence
  2. FTA the cause → quantify cause frequency from basic events
  3. ETA the consequence → split into outcome branches
  4. Probit + IRPA — see neqsim-consequence-analysis
  5. LOPA + SIL — see neqsim-process-safety

A reference end-to-end workflow lives in the test class HAZOPFMEATest + EscalationGraphAnalyzerTest.

Common Pitfalls

  • Guideword ≠ cause — HAZOP guidewords describe the deviation, not the cause. Every deviation can have multiple causes; document each separately.
  • RPN inflation — companies vary on detection scales. Document the scale used (CCPS 1–10 vs IEC 60812 1–10) at the top of every FMEA.
  • β-factor for OR gates — does not represent "more failure" the way it does for AND gates. See semantics box above.
  • Cut-set explosion — limit maxCardinality to 4–6 for trees with > 15 basics; the enumeration is O(2^n) in basic-event count.

Verification Tests

./mvnw test -Dtest=HAZOPFMEATest,EventTreeAnalyzerTest,FaultTreeAnalyzerTest,EscalationGraphAnalyzerTest,MahBowTieBuilderTest,PipingFivScreeningTest,HazopConsequenceAutoPopulatorTest,VacuumCollapseAnalyzerTest,SettleOutPressureAnalyzerTest,GasBlowbyAnalyzerTest,PumpDeadheadAnalyzerTest,RunawayReactionAnalyzerTest

See Also

  • neqsim-process-safety — LOPA, SIL, bow-tie, risk matrix
  • neqsim-consequence-analysis — fire, dispersion, probit, IRPA
  • neqsim-depressurization-mdmt — emergency blowdown, MDMT

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.