stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 206

Day 206 of 365 · Pro · Month 7: Power and energy

Forecasting run time

Calculate the batteries' remaining run time from the measured loss of charge per minute, compare it with the night and warn in time.

Lesson 20 min Week 30

What you learn today

  • Remaining run time from charge and consumption
  • Bridge the night
  • Early warning

“Battery 40 %” sounds reassuring. Whether it is enough, however, depends on how fast it runs empty. The real question is: how many minutes left?

Charge and consumption

The station battery delivers Charge (stored energy in J) and Maximum (capacity in J). Over all batteries Sum is right – energy adds up.

You do not measure consumption via watt figures but directly at the battery: how much charge has vanished in the last minute?

sub loss old now
move old now
div minutes now loss

If 20,000 J are missing after one minute and 580,000 J are left, the battery lasts 29 minutes. That is a simple rule of three, and it is always right, whatever hangs on the network, because it measures the real loss.

Tip

Do not calculate with the devices' watt values. The game books the displayed power values per tick, not per second. The measured loss of charge avoids this trap.

When the battery is charging

If loss is zero or negative, the battery is charging or idle. Then there is no remaining run time, and the division would be meaningless. The chip then shows −1:

sgtz tmp loss
select minutes tmp minutes -1

The chip reads the starting value for old before the start label. Otherwise old would be 0 the first time, and the first minute would look like a huge charge.

Bridging the night

NIGHT is the time the battery has to hold out without sun. Set the value to your night, plus some reserve. If the remaining run time is below it, the warning light goes on – while there is still time to act: fire up the generator, switch off the furnace, dim the lights.

When the batteries are missing

Sum over no batteries gives 0, not NaN. 0 J of charge would look like an empty battery. That is why the chip checks the total capacity: if Maximum sums to 0, there is no battery – display −1 and warning on.

Exercise

Task

Once per minute the chip measures the total charge of the batteries “Akku” and calculates the remaining run time in whole minutes (rounded down). “Restzeit” shows it in mode DisplayMode.Minutes, −1 while charging or idle. The light “Reserve” is on when the remaining run time is below 30 minutes. If the batteries are missing (Maximum sums to 0): display −1, light on.

Hints

Hint 1

Loss: sub loss old now, then right away move old now.

Hint 2

Minutes: div, floor, then select … -1 twice – for loss ≤ 0 and for missing capacity.

Hint 3

Warning: below NIGHT and not negative, or capacity 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

Esc
↑ ↓ selectEnter open/ opens search anywhere