What you learn today
- Dashboard, history and forecast together
- Load shedding
- Alarm
This week you built single building blocks: dashboard, history, forecast, grid coupling, faults. The energy centre puts the most important ones together into one chip.
The plant
| Device | Prefab | Name |
|---|---|---|
| cable analyzer | StructureCableAnalysizer | “Hauptnetz” |
| two station batteries | StructureBattery | “Akku” |
| three LED displays | StructureConsoleLED5 | “Erzeugung”, “Spitze”, “Restzeit” |
| wall lights | StructureWallLight | “Komfort” |
| klaxon | StructureKlaxon | “Alarm” |
Two rhythms in one chip
Some things have to happen every tick: dashboard, load shedding, alarm. Others only once per minute: history and forecast. The trick: the minute work sits at the end of the loop behind the counter. In 119 out of 120 ticks blt tick TICKS start jumps back before it.
add tick tick 1
blt tick TICKS start
move tick 0
What the history stores
Every minute the chip stores the loss of charge of that minute in the stack (ten slots). “Spitze” shows the worst minute in kJ. That way you see in the morning whether something unusual drew power during the night.
The rules
- Dashboard: “Erzeugung” shows
PowerPotential, rounded, in modeDisplayMode.Power. - Remaining time: charge divided by the loss of the last minute, rounded down, in mode
DisplayMode.Minutes. −1 while charging or idle. - Load shedding: “Komfort” goes off below 30 % and only comes back from 50 %.
- Alarm: the klaxon plays
Sound.PowerLowwhen the remaining time is between 0 and 30 minutes or no batteries are there.
Milestones
- Dashboard with unit
- History: the peak of the last ten minutes in kJ
- Forecast of the remaining time
- Load shedding with hysteresis
- Alarm on a tight reserve and on missing batteries
minutes starts at −1. Otherwise the alarm would go off in the first minute with minutes 0 before anything has been measured.
If the batteries are missing, Ratio Average returns NaN: comfort goes off because sge with NaN gives 0. The capacity Maximum Sum is 0, so alarm. Both follow from the rules, without a special case.
Diagram
Project task
Task
Build the energy centre following the rules above. defines, aliases and start values are already there, the four sections are missing.
Milestones
- Milestone 1: dashboard with unit
- Milestone 2: peak of the last minutes
- Milestone 3: forecast the remaining time
- Milestone 4: load shedding with hysteresis
- Milestone 5: alarm
Hints
Hint 1
Every tick: dashboard, load shedding (sge/and, sge/or) and alarm.
Hint 2
Then the minute counter with blt tick TICKS start; behind it loss, poke, search loop with get … db.
Hint 3
Peak in kJ: divide by 1000 and round. Remaining time as yesterday with two select … -1.
Quiz
2 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- 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