Pro
20 min

Tank Level Alarms with Hysteresis

analogscalinglevelalarmhysteresis

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

Tank Level Alarms with Hysteresis scenario preview

Briefing

A level transmitter returns raw ADC counts (0–10 000) proportional to tank fill. The formula: **Level % = LT_RAW / 10 000 × 100** gives 0 = empty, 5 000 = 50%, 10 000 = full. Simple threshold detection chatters: if the level sits at exactly 90% the alarm fires and clears every scan. **Hysteresis** solves this by using two setpoints — the alarm **sets** above 90% but only **clears** below 80%. The physics engine computes and publishes four BOOL signals: - **HIGH_SET** (level > 90%) — use this to S= HIGH_ALARM - **HIGH_CLEAR** (level < 80%) — use this to R= HIGH_ALARM - **LOW_SET** (level < 10%) — use this to S= LOW_ALARM - **LOW_CLEAR** (level > 20%) — use this to R= LOW_ALARM Your task is to implement the four-rung latch logic.

Objectives

  • HIGH_ALARM latches when level rises above 90% (HIGH_SET), clears below 80% (HIGH_CLEAR)
  • LOW_ALARM latches when level falls below 10% (LOW_SET), clears above 20% (LOW_CLEAR)

Hints

  • Use SET/RESET latch pairs: | HIGH_SET | S= HIGH_ALARM ; and | HIGH_CLEAR | R= HIGH_ALARM ;
  • The SET rung must come BEFORE the RESET rung for correct scan-order behaviour
  • For LOW_ALARM: | LOW_SET | S= LOW_ALARM ; and | LOW_CLEAR | R= LOW_ALARM ;

I/O Table

Inputs

LT_RAW

Level transmitter raw counts (0–10000)

INT · %IW0

HIGH_SET

Physics: level > 90% — set high alarm

BOOL · %I0.0

HIGH_CLEAR

Physics: level < 80% — clear high alarm

BOOL · %I0.1

LOW_SET

Physics: level < 10% — set low alarm

BOOL · %I0.2

LOW_CLEAR

Physics: level > 20% — clear low alarm

BOOL · %I0.3

Outputs

HIGH_ALARM

High-level alarm (latching with hysteresis)

BOOL · %Q0.0

LOW_ALARM

Low-level alarm (latching with hysteresis)

BOOL · %Q0.1

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Level rises above 90% → HIGH_ALARM latches

    LT_RAW = 9100 (91%) → HIGH_SET true → HIGH_ALARM latches on

  2. #2Level drops to 85% (inside hysteresis band) → HIGH_ALARM stays on

    After HIGH_ALARM latches, level drops to 85% (between 80 and 90) — alarm must remain on

  3. #3Level drops below 80% → HIGH_ALARM clears

    After HIGH_ALARM latches, level drops to 75% (below HIGH_CLEAR) — alarm clears

  4. #4Level drops below 10% → LOW_ALARM latches

    LT_RAW = 800 (8%) → LOW_SET true → LOW_ALARM latches on

  5. #5Level recovers above 20% → LOW_ALARM clears

    LOW_ALARM latched; level rises to 25% (above LOW_CLEAR) — alarm clears

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

Runnable simulator field guide

Tank-level alarm PLC scenario: test checklist

Direct answer

The learner can scale a declared range, distinguish normal movement from bad quality, apply stable alarm thresholds and prove acknowledgement and return-to-normal behavior.

Written for instrumentation and PLC learners converting a level signal into engineering units and dependable high, high-high, low and low-low alarms.

a water-based process instrumentation skid with tank, valve, transmitter and controller evidence used for safe calibration and sequence practice while studying analog tank-level scaling, alarm thresholds, hysteresis, delay and recovery
System map / 02

NODE 01observable

Scenario setup

Transmitter range, raw input limits, engineering units, valid quality, alarm thresholds, hysteresis, on-delay, latching, acknowledgement and trip boundary.

NODE 02observable

I/O and state map

Physical or simulated level through loop signal, input conversion, scaled value, quality, alarm evaluation, operator indication and protective response.

NODE 03observable

Normal run

Known low, mid and high input points scale correctly and each alarm enters and clears at its declared boundary without chatter.

NODE 04observable

Boundary run

Open loop, underrange, overrange, noisy level, threshold equality, rapid fill, delayed scan, acknowledgement while active, restart and stale data.

NODE 05observable

Injected fault

A transmitter, loop, input, range, scale, quality, threshold, timer, alarm-state or display mismatch.

NODE 06observable

Target check

The design validated against current instrument data, tank limits, alarm philosophy and independent protective layers.

Answer surface / 07

How do you stop a tank-level alarm from chattering?

Use justified hysteresis or delay after verifying signal quality and process behavior; never use delay to hide a failing transmitter or unsafe response time.

Should a high-high alarm latch?

That depends on the approved alarm and protection philosophy; if it latches, define acknowledgement, reset permissives and the independent trip relationship explicitly.