What you learn today
- Generation minus consumption
- Show the sign in colour
- Sum for power values
Are the batteries charging right now, or draining? One number answers that: generation minus consumption. If it is positive, something is left over for the batteries. If it is negative, the base lives off its reserve.
Generation: right at the producers
| Producer | LogicType | Batch mode |
|---|---|---|
| generators | PowerGeneration | Sum |
| solar panels | Charge | Sum |
Power values really do add up, so Sum is right here. Without a match Sum returns 0 – a field that currently produces nothing and a field that does not exist look the same.
Consumption: measured behind the battery
Consumption comes from the cable analyzer on the consumers' network, that is behind the battery or the area power control. There PowerRequired reports what lights, heaters and pumps demand together. Between producers and batteries the number would be useless, because the batteries register demand of their own there.
lbn gen GEN HASH("Generator") PowerGeneration Sum
lbn tmp PANEL HASH("Dach") Charge Sum
add generation gen tmp
lbn usage CABLE HASH("Verbraucher") PowerRequired Average
sub balance generation usage
The sign in colour
| Balance | Meaning | Colour |
|---|---|---|
| positive | batteries charging | green |
| zero | just about | yellow |
| negative | batteries draining | red |
sgn returns −1, 0 or 1. Two select turn that into the colour:
sgn tmp balance
select colour tmp Color.Green Color.Yellow # not 0: green first
sltz tmp balance
select colour tmp Color.Red colour # negative: red
The display
With Mode Power the display appends a W. It shows negative numbers with a minus – together with the red colour you see right away that the base is living off the battery.
If the cable analyzer is missing, consumption is NaN and so is the balance. sgn turns that into 0 – the display would show yellow instead of a fault. Catch the failure with snan and colour it red.
A balance just above zero is not enough for the night. The balance shows the moment, the batteries' range comes in the advanced part.
Exercise
Task
A power balance. On the network: solid fuel generator “Generator”, solar panels “Dach”, cable analyzer “Verbraucher”, LED display “Bilanz”.
- Generation = sum of
PowerGenerationof the generators + sum ofChargeof the panels. - Consumption = the analyzer's
PowerRequired. - “Bilanz” shows generation − consumption, Mode Power; colour green when positive, yellow at 0, red when negative.
- Analyzer missing: colour red, display 0.
Hints
Hint 1
Two lbn … Sum for generation, one lbn … Average for consumption.
Hint 2
Colour: sgn, select green/yellow, then sltz and select red.
Hint 3
NaN last: snan, red, display 0.
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