Neqsim hazid fmea eta fta

From equinor/neqsim · View interactive version

Neqsim hazid fmea eta fta is an AI agent skill from the GitHub repository equinor/neqsim. 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, quant

How to use this skill

Skill file

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

Pairs with neqsim-process-safety (LOPA / SIL / risk matrix) and

neqsim-consequence-analysis (probit / IRPA roll-up).

Standards

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 calculator | Standard | Typical safeguard |

|-----------------------------------|-------------------|----------|-------------------|

| MORE PRESSURE (overpressure) | ReliefValveSizing, SettleOutPressureAnalyzer, GasBlowbyAnalyzer | API 520 / 521 | PSV / HIPPS |

| LESS PRESSURE (vacuum collapse) | VacuumCollapseAnalyzer | API 521 / ASME | Vacuum breaker |

| LESS TEMPERATURE (autorefrig./brittle) | MDMTCalculator, DepressurizationSimulator | ASME UCS-66 / API 521 | Low-temp trip, MDMT material |

| MORE TEMPERATURE (fire case) | TrappedLiquidFireRuptureStudy, PipeFireRuptureStudy, PfpDemandCalculator | API 521 | TSV, PFP, blowdown |

| NO / LESS FLOW (deadhead) | PumpDeadheadAnalyzer | API 610 | Min-flow recycle, low-flow trip |

| MORE FLOW (surge / erosion) | getUtilizationSnapshot surge/velocity | API 14E / 617 | Anti-surge controller |

| REVERSE FLOW (backflow / slam) | WaterHammerStudy | API 521 | Check valve, slow actuator |

| AS_WELL_AS / PART_OF COMPOSITION | phase / hydrate / separator screening (TPflash) | API 521 | Composition monitoring, inhibitor |

| OTHER_THAN REACTION (runaway) | RunawayReactionAnalyzer | DIERS / API 521 | Quench, 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.

  1. Extract nodes with nodeId, designIntent, equipment, safeguards, and

evidenceRefs using the technical-document-reading and STID-retriever skills.

  1. Build a NeqSim process JSON definition from extracted topology or existing

models.

  1. Run runHAZOP with selected failure modes, or enable all failure modes.
  2. Review generated rows, scenario results, failed simulations, and evidence

references with the chaired HAZOP team.

  1. 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

cause. Every deviation can have multiple causes; document each separately.

used (CCPS 1–10 vs IEC 60812 1–10) at the top of every FMEA.

for AND gates. See semantics box above.

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.