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

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

Project: power manager

A power manager starts the generator by charge level, sheds loads in two stages and shows the reserve in percent.

Project 35 min Week 28

What you learn today

  • Generator by charge level
  • Load shedding in stages
  • Show the battery reserve

This week revolved around batteries, generators and load shedding. The project turns it into the chip every bigger base needs at some point: a power manager.

The plant

DevicePrefabName
two station batteriesStructureBattery“Akku”
solid fuel generatorStructureSolidFuelGenerator“Notstrom”
wall lightsStructureWallLight“Komfort”
wall heaterStructureWallHeater“Werkstatt”
LED displayStructureConsoleLED5“Reserve”

The charge level comes as Ratio from 0 to 1, averaged over both batteries.

The rules

Whatoffback on
Generatorfrom 90 %below 30 %
Comfort (lights)below 25 %from 40 %
Workshop (heater)below 10 %from 25 %

The generator is wired the other way round from the loads: it runs when the battery runs low. The loads leave the grid by priority – comfort first, the workshop last of all. All three get a hysteresis, otherwise they flutter around the threshold.

You already know the generator pattern from the heater. For a load that switches off below a threshold, you flip the comparisons:

sge tmp level C_OFF   # still above the shedding limit?
and comfort comfort tmp
sge tmp level C_ON    # already above the reconnect limit?
or comfort comfort tmp

When the batteries disappear

Without batteries Average returns NaN. Then: generator on, all loads off, the display shows −1. snanz ok level gives a clean 1 for that as long as there is a reading.

Milestones

  1. Generator with hysteresis (on below 30 %, off from 90 %)
  2. Shed comfort below 25 %, back on from 40 %
  3. Workshop last: off below 10 %, back on from 25 %
  4. Reserve in percent on the display
  5. Batteries gone: generator on, loads off, display −1
Tip

Set comfort and work to 1 before the start label. Otherwise the base starts in the dark after every chip restart even though the batteries are full.

Diagram

Temperature curve with hysteresis 21 °C 19 °C band: state is kept Heater on on off off On at 19 °C, off only at 21 °C – nothing switches in between.
Every stage is a hysteresis of its own: off at the bottom, back on only clearly higher. That way nothing switches every second.

Project task

Task

Build the power manager following the rules above. The defines and the start are already there, the four sections are missing: generator, comfort, workshop and display.

Milestones

  1. Milestone 1: generator with hysteresis
  2. Milestone 2: shed comfort
  3. Milestone 3: workshop last
  4. Milestone 4: reserve in percent
  5. Milestone 5: batteries gone

Hints

Hint 1

Generator like the heater: slt/and with GEN_OFF, slt/or with GEN_ON – and also on when the battery is missing.

Hint 2

Loads with sge: first and with the shedding limit, then or with the reconnect limit, finally and with ok.

Hint 3

Display: mul, round, then select pct ok pct -1.

Quiz

3 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

Esc
↑ ↓ selectEnter open/ opens search anywhere