yau-plant-assistant/db/seed/alarm_bits.csv
Claude 3d19b186da Key the whole seed on the CI Server item name
45 of the 65 rows in db/seed/tags.csv had a PS_* name as their PRIMARY
KEY, and historian_items.csv, alarm_bits.csv, the fixtures, two Cube
models and the exam all referenced them. They are gone. The tag seed is
now keyed on the CI Server item for everything the historian carries -
AID.WRPS.STN.LEVEL - and on the instrument tag for the 20 field devices
that never reach SCADA.

gen_historian_items.py reads db/seed/scada-source/ by default, so it runs
for anyone with a clone: --wrps is now --source. The tag match is the item
name itself, an identity lookup, and the TAG_FOR_ITEM special case is
deleted - all 49 item names are unique, which the old point names were
not. scada_point in the output is replaced by ci_station, ci_point and
poll_group; 001_schema.sql and deploy.sh's upsert follow.

Regenerated, and it comes out the same shape it went in: 49 items, 45
answerable, 4 deliberately excluded, three groups at 5 s, 30 s and on
change. Every historian_items.tag_id and alarm_bits.tag_id resolves to a
tags.csv row. No duplicate keys.

THE ONE NAME THAT WAS AMBIGUOUS, AND NEARLY COST US

PS_STN_HIGH_LEVEL_ALARM named two different things in the old delivery:
the high level alarm STATUS BIT on coil 10, and the alarm SETPOINT on
holding register 1032. Building the rename map from that file kept
whichever came last, so the status bit was silently renamed onto the
setpoint. check_mapping() refused to write and named the item that no
longer resolved - which is the only reason this is a paragraph in a commit
message rather than a defect.

Had it gone through, alarm bit 0 - wet well high level - would have
pointed at the setpoint. "How many high level alarms last week" would have
counted setpoint changes and returned a small, plausible, confident,
wrong number. That check exists because the same ambiguity caused the
first Phase 5 finding in August. It has now bitten twice.

NOT YET VERIFIED: pytest api/tests could not be run here - this machine
has neither fastapi nor psycopg. The tests are unchanged and reference no
PS_ name, but they have not been run. pg-ai on lin001 still holds the old
keys and must be reloaded, Cube pre-aggregations rebuilt, and the Phase 1
gate re-run. eval/testset.jsonl changed, so the 78-case exam - never yet
run - should be run after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-01 19:00:38 +10:00

3.1 KiB

1bitalarm_typeprioritytag_idalarm_textdescription
20HIGH_LEVEL2AID.WRPS.STN.HIGH_LEVELWet well high levelWet well level above the high level alarm setpoint (%MW8, default 5200 mm = 86.7%). The discrete item AID.WRPS.STN.HIGH_LEVEL mirrors this bit; the two are cross-checked at fixture load.
31HIGH_HIGH_LEVEL1LSHH-102Wet well high high levelLSHH-102 wet at 5500 mm (91.7%). Forces all available pumps to 50 Hz and bypasses min-off timers. The switch itself is a field input and is not historised - this bit is the only record of it.
42LOW_LOW_LEVEL1LSLL-103Dry run lockoutLSLL-103 dry. Stops all pumps and latches the dry-run lockout, which needs a manual reset. Field input, not historised - this bit is the only record.
53SPILL1AID.WRPS.STN.SPILL_ACTIVESpill over the weirLevel over the 6000 mm weir crest. An environmental reportable event - report the count plainly and never round it. The discrete item AID.WRPS.STN.SPILL_ACTIVE mirrors this bit.
64PUMP_TRIP1AID.WRPS.PU301.TRIPPEDPU-301 trippedPU-301 tripped on thermal TE-312, vibration above 11.0 mm/s, or no-flow on PIT-311. Trips LATCH and clear only on the reset command.
75PUMP_TRIP1AID.WRPS.PU302.TRIPPEDPU-302 trippedPU-302 tripped on thermal TE-322, vibration above 11.0 mm/s, or no-flow on PIT-321. Trips LATCH and clear only on the reset command.
86PUMP_TRIP1AID.WRPS.PU303.TRIPPEDPU-303 trippedPU-303 tripped on thermal TE-332, vibration above 11.0 mm/s, or no-flow on PIT-331. Trips LATCH and clear only on the reset command.
97SEAL_LEAK3MSE-313PU-301 seal leakMSE-313 moisture detected. Alarm only - a seal leak does NOT remove availability (WRPS-PRO-001 section 5.5) and the pump keeps running.
108SEAL_LEAK3MSE-323PU-302 seal leakMSE-323 moisture detected. Alarm only; availability is unaffected.
119SEAL_LEAK3MSE-333PU-303 seal leakMSE-333 moisture detected. Alarm only; availability is unaffected.
1210HIGH_VIBRATION2VE-314PU-301 high vibrationVE-314 above the 7.1 mm/s alarm threshold. Above 11.0 mm/s the unit trips and bit4 sets as well. There is no vibration trend in the historian - the instrument is a field input.
1311HIGH_VIBRATION2VE-324PU-302 high vibrationVE-324 above the 7.1 mm/s alarm threshold. Above 11.0 mm/s the unit trips and bit5 sets as well.
1412HIGH_VIBRATION2VE-334PU-303 high vibrationVE-334 above the 7.1 mm/s alarm threshold. Above 11.0 mm/s the unit trips and bit6 sets as well.
1513LEVEL_SIGNAL_FAULT1LIT-101Wet well level signal faultLIT-101 frozen or out of range - no change greater than 1 mm for 10 minutes with a pump running. Priority 1: losing the level signal on a well that can spill is a priority 1 condition. While this is active, AID.WRPS.STN.LEVEL is not trustworthy and any level answer over the window must say so.
1614MAINS_FAILURE1XA-502Mains supply failureXA-502 unhealthy. Station is on loss of supply.
1715SETPOINT_REJECTED3AID.WRPS.STN.ALARM_WORDSetpoint write rejectedA SCADA setpoint write was rejected by the PLC as out of range and the previous value was retained. There is no dedicated instrument for this condition - the bitmask is the only record of it, so the tag is the bitmask itself.