Proportional Valve — Level Error
Ready to build this?
Sign up free — no credit card required. This scenario requires the Pro plan.
Sign up to play this scenario →Already have an account? Log in
Briefing
This scenario introduces the concept behind PID control without requiring you to configure a PID block. A fill valve feeds a tank that is continuously drained by a downstream process. Your goal is to hold the tank level near the **50% setpoint** using a simple proportional strategy: **Valve output % = Kp × (Setpoint − Level %)** where Kp = 1.5. When the level is 30% (20% below setpoint), the valve opens to 30%. When the level reaches 47% (3% below setpoint), the valve is at only 4.5% — barely open. When the level exceeds 53% the valve output goes negative — meaning it should close. The physics engine computes this and publishes: - **VALVE_OPEN_ZONE** — proportional output > 10%: open the fill valve - **VALVE_CLOSE_ZONE** — proportional output < 5%: close the fill valve - **SENSOR_FAULT** — level sensor out of valid 4–20 mA range You are implementing a *bang-bang on a proportional zone*: FILL_VALVE open when proportional demand is high, closed when demand is low. This is the conceptual building block for understanding why a PID controller exists and why you need integral action to eliminate steady-state error.
Objectives
- Latch RUN_BIT on START, reset on STOP
- FILL_VALVE latches ON (S=) when RUN_BIT AND VALVE_OPEN_ZONE
- FILL_VALVE latches OFF (R=) when VALVE_CLOSE_ZONE or SENSOR_FAULT or STOP
- FAULT_LAMP mirrors SENSOR_FAULT
Hints
- Use S= / R= so the valve stays latched between VALVE_OPEN_ZONE and VALVE_CLOSE_ZONE transitions
- | RUN_BIT AND VALVE_OPEN_ZONE | S= FILL_VALVE ;
- | VALVE_CLOSE_ZONE OR SENSOR_FAULT OR STOP | R= FILL_VALVE ; — note: all three conditions can be ORed in one rung
I/O Table
Inputs
STARTStart push-button
BOOL · %I0.0
STOPStop push-button
BOOL · %I0.1
LT_RAWLevel transmitter raw counts (0–10000)
INT · %IW0
VALVE_OPEN_ZONEPhysics: proportional output > 10% — open valve
BOOL · %I0.2
VALVE_CLOSE_ZONEPhysics: proportional output < 5% — close valve
BOOL · %I0.3
SENSOR_FAULTPhysics: sensor out of valid range
BOOL · %I0.4
Outputs
FILL_VALVEFill valve solenoid (latching)
BOOL · %Q0.0
FAULT_LAMPSensor fault indicator lamp
BOOL · %Q0.1
Your program will be tested against:
All test cases run automatically when you submit. Assertions are hidden until you pass.
- #1Level below setpoint (30%) → FILL_VALVE opens on START
LT_RAW = 3000 (30%) → error = 20%, valve_pct = 30% → VALVE_OPEN_ZONE true → FILL_VALVE latches on
- #2Level near setpoint (50%) → FILL_VALVE closes (VALVE_CLOSE_ZONE)
LT_RAW = 5000 (50%) → error = 0%, valve_pct = 0% → VALVE_CLOSE_ZONE true → FILL_VALVE resets
- #3Sensor fault (LT_RAW < 500) → FILL_VALVE closes, FAULT_LAMP on
Out-of-range sensor reading trips SENSOR_FAULT, which resets the valve and lights the fault lamp
- #4STOP immediately closes FILL_VALVE
Valve is open; pressing STOP resets it within one scan
Related scenarios
Ready to build this?
Sign up free — no credit card required. This scenario requires the Pro plan.
Sign up to play this scenario →Already have an account? Log in