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

Day 65 of 365 · Beginner · Month 3: First systems

Monitoring batteries

Charge, Maximum and Ratio of a station battery, the charge in percent and why with several batteries you divide the sums instead of averaging the shares.

Lesson 11 min Week 10

What you learn today

  • Charge, Maximum and Ratio
  • Charge in percent
  • Average several batteries

At night the whole base hangs on the batteries. How much longer will that last? The first question for that is: how full are they?

What a battery reports

LogicTypeMeaningUnit
Chargestored energyJ
MaximumcapacityJ
RatioCharge / Maximum0 to 1

A station battery (StructureBattery) holds 3.6 MJ, the large one (StructureBatteryLarge) a good 9 MJ. One MJ is a million joules.

Charge in percent

Ratio already is the share. On a display in Percent mode it turns straight into a percentage:

lbn share BATTERY HASH("Akku") Ratio Average
sbn DISPLAY HASH("Ladestand") Setting share    # Mode Percent

Several batteries: divide the sums

If batteries of the same size are connected, the average of the shares works. With different sizes it does not: a half-full small one (1.8 of 3.6 MJ) and a full large one (9 of 9 MJ) average out at 75 %. In fact 10.8 of 12.6 MJ are stored – almost 86 %.

The right way: sum all charges, sum all capacities, then divide. Here Sum is the right batch mode, because energy really does add up.

lbn charge BATTERY HASH("Akku") Charge Sum
lbn full BATTERY HASH("Akku") Maximum Sum
div share charge full
Warning

Sum returns 0 without a match, not NaN. Then the chip computes 0 / 0 – and that gives NaN. So the error only appears at the division. With snan on the share you still catch it.

Showing energy

The display has no mode of its own for joules. Divide by a million and show MJ as a bare number in Default mode – “12.6” reads better than “12600000”.

Batteries lose charge by themselves

According to the game code a station battery discharges even without a load: 10 J per tick (20 W) as long as the air around it has more than 6.3 kPa and is warmer than 0 °C. In vacuum it is 50 J per tick, in cold below 0 °C up to 50 J depending on the temperature. The energy goes into the air as heat. So a full battery without consumers slowly gets emptier – least of all in a heated room with air.

Tip

Batteries with different jobs get different names: “Akku” for the base, “Reserve” for emergencies. Then lbn only sums what belongs together.

Exercise

Task

A battery display. The network holds two station batteries and one large station battery, all named “Akku”, plus LED displays “Ladestand” and “Energie” and a flashing light “Akku leer”.

  • “Ladestand”: sum of Charge / sum of Maximum, Mode Percent.
  • “Energie”: sum of Charge in MJ (divided by 1000000).
  • “Akku leer” on below 20 % or without batteries; then “Ladestand” shows 0.

Prefabs: StructureBattery, StructureBatteryLarge.

Hints

Hint 1

Two prefabs, so one lbn with Sum per type and then add.

Hint 2

Sum charge and capacity first, then one div.

Hint 3

Without batteries 0 / 0 turns into NaN – snan on the share.

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