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

Day 97 of 365 · Advanced · Month 4: Network in detail

Project: battery bank

Project of the week: average, minimum and count of a battery bank, a warning on weakness or failure and the number of the weakest battery.

Project 35 min Week 14

What you learn today

  • Average, minimum and count of batteries
  • Report the weakest battery
  • Detect failure

The battery bank in the basement carries the base through the night. If a battery fails or one lags clearly behind, you want to know before it gets dark. This week you learned everything a monitor needs for that.

The setup

Three station batteries (StructureBattery) named “Akku 1”, “Akku 2” and “Akku 3”. There are no other station batteries on this network. In addition:

DevicePrefabName
LED displayStructureConsoleLED5Mittel
LED displayStructureConsoleLED5Minimum
LED displayStructureConsoleLED5Anzahl
LED displayStructureConsoleLED5Schwach
flashing lightStructureFlashingLightAkkuwarnung

Every battery reports its charge in Ratio, from 0 to 1.

Milestones

  1. Average: “Mittel” shows the average charge of all batteries in percent.
  2. Minimum and warning: “Minimum” shows the lowest charge in percent. Below 20 % “Akkuwarnung” lights up.
  3. Count: “Anzahl” shows how many batteries are on the network. If there are fewer than 3, the warning lights up as well.
  4. Weakest battery: “Schwach” shows the number (1, 2 or 3) of the battery with the lowest charge.
  5. Failure: if all batteries are gone, “Mittel” and “Minimum” show 0 instead of NaN, and the warning lights up.

Finding the weakest

The minimum tells you how weak the weakest battery is, but not which one. For that you go through the batteries one by one and remember the smallest value so far:

lbn value BATTERY HASH("Akku 1") Ratio Average
move lowest value
move number 1
lbn value BATTERY HASH("Akku 2") Ratio Average
slt tmp value lowest          # smaller than the smallest so far?
select number tmp 2 number
min lowest lowest value

For battery 3 you repeat the three lines from slt onwards.

Warning

If “Akku 1” is missing, lowest becomes NaN and every comparison after it is false. The number then stays at 1. That is not a false report, because a missing battery is the weakest of all.

Tip

Here you may use Count, because only these three station batteries hang on the network. Write this assumption as a comment into the settings block, so nobody overlooks it at the next rebuild.

Diagram

Three readings, five batch modes Sensor “Raum” 300 K Sensor “Raum” 310 K Sensor “Raum” 250 K lbn Average 286.67 Sum 860 Minimum 250 Maximum 310 Count 3 Sum on temperatures: 860 K – the heater thinks there is a fire.
Average, Minimum and Count summarise the bank. Which battery is the weakest only shows when you compare the individual names.

Project task

Task

Build the battery bank monitor with the devices and names from the table. The milestones are listed above the editor.

Milestones

  1. Milestone 1: average 60 %
  2. Milestone 2: minimum and warning
  3. Milestone 3: count
  4. Milestone 4: weakest battery
  5. Milestone 5: all batteries gone

Hints

Hint 1

Average with lb … Ratio Average, turn NaN into 0 with snan and select, then times 100.

Hint 2

Minimum with lb … Ratio Minimum, the count with lb … PrefabHash Count, warning from both with or.

Hint 3

Weakest battery: take battery 1 as the start, then compare batteries 2 and 3 with slt and select.

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

Esc
↑ ↓ selectEnter open/ opens search anywhere