Emergency Shutdown (E-Stop) Logic — Control Design
Shared by TSIMEREZIVO Team · 4 Oct 2026 · 45 views
# Generic Module: Emergency Shutdown (E-Stop) Logic
**Version**: 1.0
**Complexity**: Medium-High
**Industries**: ALL (mandatory in every plant)
**Safety Standard**: IEC 61508 (Functional Safety) / ASME B11.19 (E-Stop Devices)
**Category**: Safety Interlock (SIL 2 / SIL 3 capable)
---
## 📋 Overview
Implement a hardwired emergency stop circuit that cuts power to all dangerous motors/actuators
**immediately** (not via PLC logic). E-stop must NEVER depend on PLC responsiveness.
**Use When:**
- ✅ ANY plant with rotating motors, hydraulic/pneumatic actuators, or chemicals
- ✅ Personnel safety critical (operator, maintenance, walkways)
- ✅ Regulatory requirement (OSHA, EU Machinery Directive, CSA)
- ✅ Multi-pump redundancy (need to stop all simultaneously)
- ✅ Cascade shutdown (stop main motor, then wait for auxiliaries)
**Do NOT Use When:**
- ❌ Non-critical systems only (even then, recommend E-stop for future expansion)
- ❌ Wireless E-stop (violates IEC 61508; hardwired only)
**Critical Principle:**
```
E-Stop = Category 3 or 4 Electrical Circuit (IEC 61508)
✅ Hardwired dual-channel monitoring (not single relay)
✅ No PLC logic in critical path
✅ Manual reset required (cannot auto-restart after E-stop)
✅ Status feedback to PLC/HMI for logging
✅ Solenoid dump valve (vents accumulated pressure)
```
---
## 🎯 Control Philosophy
```
E-STOP ARCHITECTURE (Hardwired Safety Relay / Safety PLC)
E-Stop Button / Limit Switch
↓
├─→ [Safety Relay Module] ← NC contacts (dual-channel monitored)
│ (Category 3: single fault detected but managed)
│ OR
│ [Safety PLC] (Category 4: dual-channel redundant with voting)
│
├─→ De-Energizes Main Motor Contactor
│ (Siemens 3TF motor starters have E-stop terminals)
│
├─→ Energizes Solenoid Dump Valves
│ (Hydraulic accumulators → Tank, Pneumatic stores → Atmosphere)
│
├─→ Triggers Audible Horn
│ (100 dB alarm — cannot miss)
│
├─→ Illuminates Status Beacon
│ (Red flashing — plant personnel recognize E-stop active)
│
└─→ Sends status pulse to PLC (for logging/diagnostics)
(PLC logs timestamp; does NOT control the stop process)
Key Difference from Soft-Stop:
- Soft-stop: Motor ramps down 0-100% over 5 seconds (controlled)
- E-stop: Motor contactors de-energize IMMEDIATELY (uncontrolled coast-down)
- Result: E-stop CREATES an emergency condition (sudden stop) to PREVENT a worse emergency
```
**Why Hardwired?**
```
Scenario: Operator reaches into running pump shaft to clear jam
→ Presses E-stop
→ Safety relay responds in <20 ms
→ Motor contactor de-energizes immediately
If same logic in PLC:
→ Operator presses button
→ Signal → PLC input
→ PLC scan cycle (10-100 ms)
→ PLC logic (2-5 ms)
→ PLC output (2-5 ms)
→ Output card lag (5-10 ms)
→ Contactor pickup (20-30 ms)
Total: 40-150 ms
Difference: 120 ms × spinning shaft = additional 0.5-1 full revolutions
→ Injury risk exponentially worse
HARDWIRED IS NON-NEGOTIABLE
```
---
## 🏗️ Control Logic (Pseudocode)
```pascal
PROGRAM Emergency_Shutdown_Logic
VAR
(* ─── WATCHDOG & HEARTBEAT ─── *)
Watchdog_Counter : INT := 0;
Watchdog_Max : INT := 10; (* PLC must toggle status bit every scan *)
Watchdog_Timeout : BOOL := FALSE;
(* ─── PLC FAULT DETECTION (E-stop can work without PLC!) ─── *)
PLC_Online : BOOL := TRUE;
Safety_Relay_Status : BOOL := TRUE; (* Feedback from hardwired safety relay *)
(* ─── INPUTS FROM HARDWIRED SAFETY RELAY ─── *)
(* These come from safety relay; PLC monitors ONLY (cannot change them) *)
E_Stop_Activated : BOOL; (* Safety relay output on hardwire *)
Accumulator_Pressure_Dump : BOOL; (* Safety relay activates dump solenoid *)
Solenoid_Dump_Energized : BOOL; (* Feedback: dump valve is open *)
Hydraulic_Accumulator_Bar : REAL; (* Transducer on accumulator *)
(* ─── CRITICAL MOTOR STATUSES ─── *)
Main_Motor_Running : BOOL;
Pump_1_Running : BOOL;
Pump_2_Running : BOOL;
Furnace_Heater_Running : BOOL;
(* ─── E-STOP STATUS FOR PLC MONITORING ─── *)
E_Stop_Status : BOOL := FALSE;
E_Stop_Duration_Sec : REAL := 0.0;
E_Stop_Count : INT := 0; (* How many times E-stop activated *)
(* ─── SHUTDOWN VERIFICATION (After hardwired stop completes) ─── *)
Motors_Stopped_Verified : BOOL := FALSE;
Motors_Stop_Timeout : REAL := 10.0; (* Expect motors to stop within 10 seconds *)
Motors_Stop_Timer : REAL := 0.0;
(* ─── SOLENOID DUMP VALVE MONITORING ─── *)
Dump_Valve_Stuck : BOOL := FALSE; (* Solenoid energized but valve not opening) *)
Dump_Valve_Pressure_Drop_Rate : REAL; (* bar/sec expected ~20 bar/sec *)
(* ─── HUMAN OVERRIDE (Emergency manual reset) ─── *)
Manual_Reset_Authorized : BOOL := FALSE;
Reset_Timeout_Sec : REAL := 0.0; (* 120-second mandatory delay before reset allowed) *)
(* ─── OUTPUTS TO HMI/LOGGING ─── *)
Status_Message : STRING;
Alarm_Priority : INT; (* 0=Info, 1=Warning, 2=Critical *)
END_VAR
(* ═════════════════════════════════════════════════════════════ *)
(* 1. WATCHDOG: PLC LIVENESS MONITORING *)
(* ═════════════════════════════════════════════════════════════ *)
(*
Safety relay has INDEPENDENT watchdog on PLC heartbeat.
If PLC stops responding (crash, freeze), safety relay stops PLC outputs.
*)
(* Toggle a bit every scan (hardwired relay monitors this) *)
Watchdog_Counter := (Watchdog_Counter + 1) MOD (Watchdog_Max + 1);
(* If hardwired relay detects watchdog stuck for >500 ms: force E-stop *)
(* We can detect THIS in PLC by monitoring safety relay feedback *)
IF NOT Safety_Relay_Status THEN
Watchdog_Timeout := TRUE;
E_Stop_Status := TRUE; (* PLC recognizes that safety relay took over *)
END_IF;
(* ═════════════════════════════════════════════════════════════ *)
(* 2. E-STOP ACTIVATION DETECTION *)
/* ═════════════════════════════════════════════════════════════ */
IF E_Stop_Activated THEN
E_Stop_Status := TRUE;
E_Stop_Duration_Sec := 0.0; (* Reset timer for fresh E-stop *)
E_Stop_Count := E_Stop_Count + 1;
Status_Message := CONCAT("E-STOP ACTIVATED - Count: ", E_Stop_Count);
Alarm_Priority := 2; (* CRITICAL *)
ELSE
(* Not currently in E-stop *)
IF E_Stop_Status THEN
(* Was in E-stop, now released *)
E_Stop_Duration_Sec := E_Stop_Duration_Sec + SCAN_TIME_SEC;
END_IF;
END_IF;
(* ═════════════════════════════════════════════════════════════ *)
(* 3. SHUTDOWN SEQUENCE VERIFICATION *)
/* ═════════════════════════════════════════════════════════════ */
IF E_Stop_Status THEN
(* Hardwired safety relay has already killed motor contactors *)
(* PLC now verifies that motors are actually stopped *)
IF NOT (Main_Motor_Running OR Pump_1_Running OR Pump_2_Running) THEN
Motors_Stopped_Verified := TRUE;
ELSE
(* Motor still running after E-stop — major problem! *)
Motors_Stop_Timer := Motors_Stop_Timer + SCAN_TIME_SEC;
IF Motors_Stop_Timer > Motors_Stop_Timeout THEN
Status_Message := "CRITICAL: Motor still running 10 sec after E-stop!";
Alarm_Priority := 2; (* CRITICAL *)
END_IF;
END_IF;
END_IF;
(* ═════════════════════════════════════════════════════════════ *)
(* 4. ACCUMULATOR DUMP VERIFICATION *)
/* ═════════════════════════════════════════════════════════════ *)
(* Safety relay energizes solenoid dump valve on E-stop *)
(* PLC monitors that accumulator pressure is dropping *)
IF E_Stop_Status AND Solenoid_Dump_Energized THEN
(* Accumulator should dump from ~3000 PSI → 100 PSI in ~5 seconds *)
VAR Target_Dump_Rate := (3000.0 - 100.0) / 5.0; (* ~580 bar/sec *)
Dump_Valve_Pressure_Drop_Rate :=
(Hydraulic_Accumulator_Bar / SCAN_TIME_SEC);
(* If dump rate too slow, solenoid might be stuck *)
IF Dump_Valve_Pressure_Drop_Rate < (Target_Dump_Rate * 0.5) AND
Hydraulic_Accumulator_Bar > 500.0 THEN
Dump_Valve_Stuck := TRUE;
Status_Message := "WARNING: Dump solenoid may be stuck/blocked";
Alarm_Priority := 2; (* CRITICAL - pressure not draining *)
END_IF;
END_IF;
(* ═════════════════════════════════════════════════════════════ *)
(* 5. MANDATORY RESET DELAY *)
/* ═════════════════════════════════════════════════════════════ *)
(* After E-stop, MANDATORY 120-second delay before reset allowed *)
(* This gives:
- Personnel time to check plant for damage
- Operators time to diagnose reason for E-stop
- Prevents accidental rapid restart-stop-restart *)
IF E_Stop_Status THEN
Reset_Timeout_Sec := Reset_Timeout_Sec + SCAN_TIME_SEC;
IF Reset_Timeout_Sec < 120.0 THEN
Manual_Reset_Authorized := FALSE;
STATUS := CONCAT("E-STOP: Reset locked. ", FLOOR(120 - Reset_Timeout_Sec), " seconds remaining");
ELSE
Manual_Reset_Authorized := TRUE;
STATUS := "E-STOP: Ready for operator reset (press RESET button)";
END_IF;
ELSE
Reset_Timeout_Sec := 0.0;
END_IF;
(* ═════════════════════════════════════════════════════════════ *)
(* 6. OUTPUTS: STATUS SIGNALLING TO HMI *)
/* ═════════════════════════════════════════════════════════════ *)
(* PLC CAN OUTPUT:
- Status messages to HMI
- Timestamps for logging
- Diagnostic data
PLC CANNOT:
- Control motor contactors (hardwired relay does)
- Control dump solenoid (hardwired relay does)
- Override E-stop button (illegal)
*)
IF E_Stop_Status THEN
WRITE_STATUS_LINE("🚨 EMERGENCY STOP ACTIVE");
WRITE_STATUS_LINE(Status_Message);
WRITE_LED(LED_RED_BEACON, ON);
WRITE_LED(LED_YELLOW_CAUTION, OFF);
WRITE_LED(LED_GREEN_RUN, OFF);
PLAY_AUDIO_ALARM(FREQUENCY: 600, DURATION: 100); (* 600 Hz tone, 100 ms *)
ELSE
WRITE_LED(LED_RED_BEACON, OFF);
WRITE_LED(LED_GREEN_RUN, ON);
END_IF;
END_PROGRAM
```
---
## 🏷️ Tag List
| Tag | Type | I/O | Range | Description |
|-----|------|-----|-------|-------------|
| `ESTOP_ACTIVATED` | BOOL | Input | - | E-stop button pressed (from safety relay) |
| `ESTOP_STATUS` | BOOL | Status | - | PLC recognizes E-stop latched (read-only) |
| `ESTOP_COUNT` | INT | Metric | 0-9999 | Total E-stop activations |
| `ESTOP_DURATION_SEC` | REAL | Metric | 0-99999 | How long current E-stop active |
| `ESTOP_TIMESTAMP` | STRING | Logging | - | Last E-stop timestamp (ISO 8601) |
| `ACCUM_PRESSURE_BAR` | REAL | Feedback | 0-3000 bar | Hydraulic accumulator pressure |
| `ACCUM_DUMP_SOLENOID` | BOOL | Feedback | - | Dump valve energized (from relay) |
| `ACCUM_DUMP_RATE_BAR_SEC` | REAL | Diagnostic | 0-1000 | Pressure drop rate during dump |
| `MOTOR_1_RUNNING` | BOOL | Status | - | Main motor status |
| `MOTOR_2_RUNNING` | BOOL | Status | - | Pump 2 status |
| `MOTOR_STOPPED_VERIFIED` | BOOL | Status | - | All motors confirmed stopped |
| `MOTOR_STOP_CHECK_TIMEOUT` | BOOL | Alarm | - | Motor still running 10 sec after E-stop |
| `DUMP_VALVE_STUCK` | BOOL | Alarm | - | Solenoid energized but not dumping |
| `RESET_AUTHORIZED` | BOOL | Status | - | 120-second delay expired, reset allowed |
| `RESET_TIMEOUT_REMAINING_SEC` | REAL | Diagnostic | 0-120 | Seconds until reset allowed |
| `WATCHDOG_FAULT` | BOOL | Alarm | - | PLC watchdog timeout (safety relay active) |
| `SAFETY_RELAY_OK` | BOOL | Status | - | Hardwired safety relay responding |
| `ESTOP_LOG_ENTRY` | STRING | Logging | - | Audit log entry with timestamp + reason |
---
## 🚨 Alarm & Trip Matrix
| Alarm | Condition | Severity | Action |
|-------|-----------|----------|--------|
| **E-STOP ACTIVE** | Button pressed or safety relay timeout | CRITICAL | All motors de-energized immediately (hardwired) |
| **Motor Still Running** | >10 sec after E-stop | CRITICAL | Operator must investigate; mechanical jam suspected |
| **Dump Valve Stuck** | Pressure not dropping; solenoid energized | CRITICAL | Replace dump solenoid; accumulator remains pressurized (danger!) |
| **Reset Locked** | <120 sec after E-stop | WARNING | Cannot restart until delay expires (operator must wait) |
| **PLC Watchdog Timeout** | No heartbeat toggle for 500+ ms | CRITICAL | Safety relay takes over; PLC output disabled |
| **Safety Relay Fault** | Relay not responding to tests | CRITICAL | Plant shutdown; maintenance required |
---
## 📺 HMI Layout (Safety-Critical Display)
```
╔══════════════════════════════════════════════════════════════╗
║ TSIMEREZIVO EMERGENCY STOP STATUS ║
╠══════════════════════════════════════════════════════════════╣
║ ║
║ 🚨 EMERGENCY STOP ACTIVE 🚨 ║
║ ║
║ Status: LATCHED (Manual reset required) ║
║ Duration: 3 min 45 sec ║
║ Count: 2 activations (previous: 2024-01-24 15:33:22) ║
║ ║
║ ┌────────────────────────────────────────────┐ ║
║ │ Motor Status: │ ║
║ │ Main Motor: ✓ STOPPED (verified) │ ║
║ │ Pump 1: ✓ STOPPED (verified) │ ║
║ │ Pump 2: ✓ STOPPED (verified) │ ║
║ │ Heater: ✓ STOPPED │ ║
║ └────────────────────────────────────────────┘ ║
║ ║
║ ┌────────────────────────────────────────────┐ ║
║ │ Hydraulic System: │ ║
║ │ Accumulator: 450 bar (dumping...) │ ║
║ │ Dump Valve: OPEN ✓ │ ║
║ │ Drop Rate: 520 bar/sec (target: 580) │ ║
║ └────────────────────────────────────────────┘ ║
║ ║
║ Reset Lockout: 116 seconds remaining ║
║ [RESET] button will appear in 116s ║
║ ║
║ ┌────────────────────────────────────────────┐ ║
║ │ Safety Relay Status: ✓ ONLINE │ ║
║ │ PLC Watchdog: ✓ RESPONDING │ ║
║ │ Hardwired Interlock: ✓ FUNCTIONAL │ ║
║ └────────────────────────────────────────────┘ ║
║ ║
║ Last E-Stop Reason: Operator pressed panel button ║
║ Next Recommended Check: Hydraulic system for leaks ║
║ ║
╚══════════════════════════════════════════════════════════════╝
```
---
## 🔧 Configuration Parameters
```json
{
"watchdog_timeout_ms": 500,
"motor_stop_verification_timeout_sec": 10.0,
"manual_reset_delay_mandatory_sec": 120.0,
"accumulator_dump_target_rate_bar_sec": 580.0,
"accumulator_dump_rate_min_threshold": 290.0,
"initial_accumulator_pressure_bar": 3000.0,
"final_accumulator_pressure_bar": 100.0,
"safety_relay_category": "Category 3 (single-fault monitored)",
"safety_integrity_level": "SIL 2",
"e_stop_response_time_ms": 20.0,
"audit_logging_enabled": true,
"alarm_horn_frequency_hz": 600,
"beacon_flash_frequency_hz": 1.0
}
```
---
## 📝 Implementation Checklist
### Hardwired Safety Relay (Non-PLC Elements)
- [ ] **Safety relay model selected** (e.g., Siemens 3SK, Eaton ESL, Schneider XPS)
- [ ] **E-stop button mounted** (red button, mushroom top, IP67 rated)
- [ ] **E-stop button properly latching** (cannot be reset by power cycle)
- [ ] **Dual-channel monitored E-stop** (two independent switches in series)
- [ ] **Motor contactors wired to safety relay** (NOT PLC outputs)
- [ ] **Solenoid dump valve wired to safety relay** (Normally Closed, de-energizes on E-stop)
- [ ] **Audible horn wired to safety relay** (independent siren, 100 dB minimum)
- [ ] **Red beacon light wired to safety relay** (flashing when E-stop active)
- [ ] **Safety relay tested** (IEC 61508 annual certification)
### PLC Integration
- [ ] **E-stop status input to PLC** (isolated, read-only, cannot influence relay)
- [ ] **Watchdog heartbeat output** (PLC toggles bit every scan; relay monitors)
- [ ] **Accumulator pressure feedback** (4-20 mA transducer)
- [ ] **Motor running feedback** (from motor starters, not PLC logic)
- [ ] **Dump solenoid status feedback** (isolated input, confirms valve opening)
- [ ] **Audit logging enabled** (every E-stop logged with timestamp)
### Commissioning (Mandatory 8-Step Procedure)
1. **Hardwired E-stop button test**:
- Press E-stop button → motor contactors de-energize immediately
- Audible horn sounds (100+ dB)
- Red beacon flashes
- No PLC intervention involved
2. **Safety relay watchdog test**:
- Kill PLC power (simulate crash)
- Safety relay should detect missing watchdog pulse within 500 ms
- Verify motor contactors remain de-energized (safe state)
- Power back PLC
3. **Dual-channel E-stop verification**:
- Short one E-stop switch contact → system should still be safe
- Short the other E-stop switch contact → system should still be safe
- (Single-fault tolerance)
4. **Accumulator dump test**:
- Charge accumulator to 3000 PSI
- Press E-stop
- Monitor accumulator pressure drop rate (should be >290 bar/sec)
- Verify reaches <100 bar within 5 seconds
5. **Dump solenoid stuck test**:
- Block solenoid dump port (intentional)
- Press E-stop
- Verify PLC detects slow pressure drop rate
- Issue DUMP_VALVE_STUCK alarm
- Unblock solenoid
6. **Motor stop verification test**:
- Run main motor
- Press E-stop
- Verify motor contactors de-energize immediately (NOT soft-stop)
- Wait <1 second for motor to coast down and confirm RUNNING bit drops to FALSE
- If still TRUE after 10 sec, trigger alarm
7. **Reset lock delay test**:
- Activate E-stop
- Verify RESET button disabled for exactly 120 seconds
- Verify countdown displayed on HMI
- After 120 sec, verify RESET button becomes active
8. **Audit log verification**:
- Activate E-stop 5 times with different reasons (manual entry)
- Verify all 5 logged with timestamp, duration, and manual notes
- Export log to CSV; verify formatting
---
## 📊 Expected Performance
| Metric | Standard | Achievable |
|--------|----------|-----------|
| **E-stop response time** | <20 ms | 15-20 ms (hardwired relay) |
| **Motor contactor de-energize** | <50 ms from button | 30-50 ms (contactor pickup) |
| **PLC detection of E-stop** | <100 ms | 50-100 ms (PLC scan) |
| **Accumulator dump rate** | >290 bar/sec | 400-600 bar/sec (typical) |
| **Full depressurization time** | <10 sec | 4-6 sec (normal) |
| **Watchdog timeout detection** | <500 ms loss | <500 ms (safety relay) |
| **Reset delay** | 120 sec ±0% | 120 sec (locked timer) |
---
## 🔄 Advanced Variations
### Cascade Shutdown (Multi-Stage)
Stage 1 (Immediate): Kill main motor (hardwired E-stop)
Stage 2 (1 sec delay): Stop auxiliary pumps (solenoid dump)
Stage 3 (5 sec delay): Close isolation valves (proportional valve commands)
Benefit: Prevents water hammer from sudden stop; controlled de-pressurization.
### PLC Soft-Stop Before Hardwired E-Stop
Allow operator to request normal shutdown (ramp down over 10 sec).
If 10 sec passes without reaching idle, safety relay then forces E-stop.
Benefit: Smoother shutdown in normal operation; E-stop is true emergency.
### Remote E-Stop (Radio)
NOT PERMITTED per IEC 61508 (wireless can fail).
If remote needed: use wired hardwire + wireless input (hardwire takes priority).
### E-Stop Suppressible on Non-Critical Channels
Main plant: full E-stop (all motors).
Testing rig: selective E-stop (each circuit separately).
Archive with documented risk assessment.
---
**SAFETY-CRITICAL EMERGENCY SHUTDOWN FOR ALL INDUSTRIAL PLANTS.**
> **MANDATORY**: This template is non-optional. Every TSIMEREZIVO deployment must include
> a hardwired E-stop circuit per this specification. Violation of this requirement
> is grounds for plant shutdown pending safety audit.