Scale a 4–20 mA Pressure Transmitter
Ready to build this?
Sign up free — no credit card required. This scenario is included in the free tier.
Sign up to play this scenario →Already have an account? Log in
Briefing
A pressure transmitter wired on the 4–20 mA loop returns raw ADC counts in the range 4 000–20 000. The PLC scales this to engineering units using the formula: **PSI = (PT_RAW − 4 000) ÷ 16 000 × 150** So 4 000 counts = 0 PSI, 12 000 counts = 75 PSI, 20 000 counts = 150 PSI. The physics engine performs this calculation and publishes a ready-to-use BOOL signal — **PUMP_OK_PRESSURE** (true when PSI < 120 and the transmitter is healthy). Your job is to write the supervisory logic: 1. Latch a **RUN_BIT** on START, drop on STOP. 2. Gate **PUMP_PERMIT** on RUN_BIT AND PUMP_OK_PRESSURE — the pump may only run when pressure is safe. 3. Latch **PRESSURE_ALARM** when running and PUMP_OK_PRESSURE drops (pressure too high). 4. Drive **FAULT_LAMP** from the **TRANSMITTER_FAULT** signal (open-circuit 4–20 mA loop: counts below 3 600). The 4–20 mA standard means a broken wire reads near 0 mA, not 0 PSI — the fault band below 3.6 mA (3 600 counts) is how you distinguish "zero pressure" from "broken transmitter".
Objectives
- Latch RUN_BIT: SET on START, RESET on STOP
- PUMP_PERMIT: ON when RUN_BIT AND PUMP_OK_PRESSURE (PSI < 120, no fault)
- PRESSURE_ALARM latches when running and PUMP_OK_PRESSURE is false
- FAULT_LAMP mirrors TRANSMITTER_FAULT (open-circuit detection)
Hints
- Use SET/RESET coils for the latches: | START AND /PRESSURE_ALARM | S= RUN_BIT ;
- PUMP_OK_PRESSURE is already a BOOL input — just use it as a contact in the permit rung
- Pressure alarm: | RUN_BIT AND /PUMP_OK_PRESSURE | S= PRESSURE_ALARM ; and | STOP | R= PRESSURE_ALARM ;
I/O Table
Inputs
STARTStart push-button (momentary NO)
BOOL · %I0.0
STOPStop push-button (momentary NO)
BOOL · %I0.1
PT_RAWPressure transmitter raw counts (4000–20000)
INT · %IW0
PUMP_OK_PRESSUREPhysics-published: PSI < 120 AND no fault
BOOL · %I0.2
TRANSMITTER_FAULTPhysics-published: open-circuit (< 3600 counts)
BOOL · %I0.3
Outputs
PUMP_PERMITPump run permissive
BOOL · %Q0.0
PRESSURE_ALARMHigh-pressure alarm (latching)
BOOL · %Q0.1
FAULT_LAMPTransmitter fault indicator lamp
BOOL · %Q0.2
Your program will be tested against:
All test cases run automatically when you submit. Assertions are hidden until you pass.
- #1START with normal pressure → PUMP_PERMIT on
PT_RAW = 12000 (75 PSI, PUMP_OK_PRESSURE = true) + START → PUMP_PERMIT on within one scan
- #2High pressure (PT_RAW = 19200 ≥ 120 PSI) blocks PUMP_PERMIT
PT_RAW = 19200 (≈ 143 PSI) → PUMP_OK_PRESSURE = false → PUMP_PERMIT must not energise on START
- #3Pressure rises above 120 PSI while running → PRESSURE_ALARM latches
Start with normal pressure, then raise PT_RAW above threshold → PRESSURE_ALARM latches and PUMP_PERMIT drops
- #4Open-circuit (PT_RAW < 3600) → FAULT_LAMP on
Simulating a broken 4–20 mA wire: counts drop below 3600 → TRANSMITTER_FAULT → FAULT_LAMP on
Related scenarios
Ready to build this?
Sign up free — no credit card required. This scenario is included in the free tier.
Sign up to play this scenario →Already have an account? Log in