What you learn today
- Energy as a subsystem
- Load shedding on request
- Messages
The second subsystem keeps the lights on. You know power from the power manager on day 195: generator by charge, load shedding in stages. What is new is that it is now part of a network – it reports, and it accepts requests.
Generator and shedding stages
| Rule | Value |
|---|---|
| generator “EN_Generator” on | below 30 % battery, always without a battery value |
| generator off | from 90 % |
| stage 1: comfort light “EN_Komfort” off | below 25 %, over from 35 % |
| stage 2: workshop “EN_Werkstatt” off as well | below 10 %, over from 20 % |
What is measured is the mean of all batteries “EN_Akku”. Without a battery value stage 2 applies – whoever does not know how much power there is, saves.
Load shedding on request
Sometimes the central unit knows more than power does: a storm is coming, production starts a big order, the player wants power for the drill. Then it writes a shedding stage into “EN_Auftrag”. Power takes the higher of the two stages – its own or the requested one:
lbn order SPEICHER HASH("EN_Auftrag") Setting Average
snan tmp order
select order tmp 0 order # no order: stage 0
clamp order order 0 2
trunc order order
max order order stage # the higher stage wins
That way the central unit can demand more saving, but never less. If the battery is almost empty, no order “stage 0” helps – its own stage 2 wins.
Reports
| Memory | Content |
|---|---|
| “EN_Status” | 0 normal, 1 own shedding stage active, 2 no battery value |
| “EN_Ladung” | battery level in percent, −1 without battery |
| “EN_Puls” | heartbeat |
A shedding stage the central unit requested itself is no warning. Warning means: power had to shed on its own.
clamp and trunc on the order are no gimmick. If an older central unit accidentally writes 2.5 or 7 into it, power still stays at one of the three stages it knows.
Exercise
Task
Build the power subsystem according to the tables above: heartbeat “EN_Puls”, generator, two shedding stages with hysteresis, order “EN_Auftrag” (the higher stage wins), status “EN_Status” and charge “EN_Ladung”.
Hints
Hint 1
Every stage is a hysteresis: slt … AN with and, slt … AUS with or.
Hint 2
Own stage = s1 + s2, 2 without a battery value. Clean the order and combine it with max.
Hint 3
Comfort on at a stage below 1, workshop on at a stage below 2.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in