Field fix / guidePLC / HMI Code & LogicVendor-agnostic (IEC 61131-3)Safetyindustrial-automation

Gas Monitoring Alarm — PLC Control Template

Shared by TSIMEREZIVO Team · 4 Oct 2026 · 28 views

# Gas Monitoring Alarm — Usage Guide ## Overview Combustible gas monitoring template with warning, ventilation, and evacuation thresholds expressed as %LEL. Includes latched evacuation output with manual reset below a safe threshold. ## Safety Notes - Gas trip logic should be backed by site-certified detection and shutdown hardware - Set thresholds to site hazardous-area study and detector manufacturer guidance - Treat detector faults as potentially dangerous conditions during operation ## Commissioning 1. Verify detector calibration and 4-20mA scaling 2. Simulate warning and evacuation thresholds with certified test gas 3. Confirm ventilation and evacuation outputs drive the intended field devices --- ## Control Logic — Vendor-Agnostic Pseudocode # Gas Monitoring Alarm — Logic ## Standards: IEC 61131-3 | ISA-18.2 | IEC 61508 SIL1 ## Scan Rate: 250ms | Pattern: LEL alarm stages with ventilation and evacuation outputs ``` ROUTINE: GasMonitoringAlarm SCAN_RATE: 250ms // SECTION 1 — GAS INPUT VALIDATION GAS_MA := SCALE(GAS_RAW, 0, 27648, 4.0, 20.0) GAS_VALID := (GAS_MA >= 3.8) AND (GAS_MA <= 20.5) IF GAS_VALID THEN GAS_LEL_PV := SCALE(GAS_MA, 4.0, 20.0, 0.0, 100.0) GAS_LAST_GOOD := GAS_LEL_PV ELSE GAS_LEL_PV := GAS_LAST_GOOD GAS_FAULT := TRUE END_IF // SECTION 2 — ALARM ZONES IF GAS_LEL_PV >= EVAC_SP THEN EVAC_CMD := TRUE; VENT_CMD := TRUE; TRIP_LATCH := TRUE END_IF IF GAS_LEL_PV >= VENT_SP THEN VENT_CMD := TRUE END_IF IF GAS_LEL_PV < (VENT_SP - HYST_SP) THEN VENT_CMD := FALSE END_IF // SECTION 3 — SAFETY TRIP LATCH IF RESET_CMD AND GAS_LEL_PV < RESET_SAFE_SP AND NOT GAS_FAULT THEN TRIP_LATCH := FALSE EVAC_CMD := FALSE END_IF // SECTION 4 — ALARMS IF GAS_FAULT THEN SET_ALARM(ALM_GAS_SENSOR_FAULT, HIGH) END_IF IF GAS_LEL_PV >= WARN_SP THEN SET_ALARM(ALM_GAS_WARN, HIGH) END_IF IF GAS_LEL_PV >= EVAC_SP THEN SET_ALARM(ALM_GAS_EVAC, CRITICAL) END_IF // SECTION 5 — HMI HMI_GAS_LEL := GAS_LEL_PV HMI_VENT := VENT_CMD HMI_EVAC := EVAC_CMD END_ROUTINE ``` --- ## Tag List ```csv Tag Name,Description,Data Type,Direction,Engineering Unit,Range Min,Range Max,Default Value,Address GAS_RAW,Gas Detector Raw ADC,INT,input,,0,27648,,AI:0:0.0 GAS_MA,Gas Detector mA,REAL,calculated,mA,3.8,20.5,, GAS_VALID,Gas Detector Healthy,BOOL,calculated,,,,TRUE, GAS_LEL_PV,Gas Concentration,REAL,calculated,%LEL,0,100,0, GAS_LAST_GOOD,Last Good Gas Reading,REAL,internal,%LEL,0,100,0, GAS_FAULT,Gas Detector Fault,BOOL,internal,,,,FALSE, WARN_SP,Warning Gas Threshold,REAL,internal,%LEL,0,100,10, VENT_SP,Ventilation Start Threshold,REAL,internal,%LEL,0,100,20, EVAC_SP,Evacuation Threshold,REAL,internal,%LEL,0,100,40, RESET_SAFE_SP,Reset Safe Threshold,REAL,internal,%LEL,0,100,5, HYST_SP,Ventilation Reset Hysteresis,REAL,internal,%LEL,0,20,3, VENT_CMD,Ventilation Command,BOOL,output,,,,FALSE,DO:1:0.0 EVAC_CMD,Evacuation Alarm Command,BOOL,output,,,,FALSE,DO:1:0.1 RESET_CMD,Manual Reset Command,BOOL,input,,,,FALSE, TRIP_LATCH,Gas Trip Latched,BOOL,internal,,,,FALSE, ALM_GAS_SENSOR_FAULT,Gas Sensor Fault Alarm,BOOL,calculated,,,,FALSE, ALM_GAS_WARN,Gas Warning Alarm,BOOL,calculated,,,,FALSE, ALM_GAS_EVAC,Gas Evacuation Alarm,BOOL,calculated,,,,FALSE, HMI_GAS_LEL,HMI: Gas Concentration,REAL,output,%LEL,0,100,0, HMI_VENT,HMI: Ventilation Output,BOOL,output,,,,FALSE, HMI_EVAC,HMI: Evacuation Output,BOOL,output,,,,FALSE, ``` --- ## Alarm Matrix ```csv Alarm Tag,Condition,Setpoint,Priority,Type,Response,Delay,Auto Acknowledge ALM_GAS_SENSOR_FAULT,GAS_VALID = FALSE,wire-break,high,safety,Gas detector fault. Treat as dangerous until proven otherwise and inspect sensor loop.,2s,No ALM_GAS_WARN,GAS_LEL_PV >= WARN_SP,10%LEL,high,process,Combustible gas warning. Increase supervision and investigate source.,2s,No ALM_GAS_EVAC,GAS_LEL_PV >= EVAC_SP,40%LEL,critical,safety,Evacuation threshold exceeded. Ventilation and evacuation outputs active. Manual reset only below safe threshold.,0s,No ```

More like this

Rate, comment, and get full access

Members can download files, rate contributions, and discuss fixes with the engineers who posted them — free.

Join the library