Compare 02 — Dead band
Ready to build this?
Sign up free — no credit card required. This scenario requires the Basic plan.
Sign up to play this scenario →Already have an account? Log in
Not ready for Basic? Try a free scenario like this →
Briefing
With one limit, a reading hovering around 80 makes the lamp flicker. A dead band fixes that: the lamp switches ON above 80, OFF below 70, and keeps whatever it was doing between 70 and 80. That "keeps what it was doing" needs memory. Exactly 70 and exactly 80 are inside the band. As in Compare 01, comparisons are written in the Code tab.
Objectives
- Above 80: HIGH_TEMP_LAMP on
- Below 70: HIGH_TEMP_LAMP off
- Between 70 and 80 (inclusive): the lamp keeps its state, on the way up and on the way down
Hints
- With one limit the lamp flickers near it. Which readings should leave the lamp exactly as it already is?
- Holding a state needs memory. Think about what switches the lamp on, and what separately switches it off.
- Each switch condition is one comparison. They must not overlap, and the stretch between them must do nothing.
- Test the walk up and the walk down: 50, 75, 85, 75, 69, 75. The lamp should read off, off, on, on, off, off.
I/O Table
Inputs
TANK_TEMP_CTank temperature, whole degrees C
INT · %IW0
Outputs
HIGH_TEMP_LAMPHigh temperature lamp
BOOL · %Q0.0
Your program will be tested against:
All test cases run automatically when you submit. Assertions are hidden until you pass.
- #1Temperature 50 → lamp off
Below the band the lamp is off
- #2Temperature 85 → lamp on
Above 80 the lamp switches on
- #385 then 75 → lamp stays on
Falling into the band keeps the lamp on
- #485, 75, then 69 → lamp off
Below 70 the lamp switches off, and stays off back inside the band
- #550 then 75 → lamp still off
Rising into the band does not switch the lamp on
- #6Exactly 80 and exactly 70 keep the state
The edges of the band are inside the band
Related scenarios
Ready to build this?
Sign up free — no credit card required. This scenario requires the Basic plan.
Sign up to play this scenario →Already have an account? Log in
Not ready for Basic? Try a free scenario like this →