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

Day 270 of 365 · Pro · Month 9: Logistics and greenhouse

Debugging large plants

Debugging large plants: narrow down faults, add a display as a probe and test subsystems separately – on a greenhouse chip with four hidden bugs.

Lesson 22 min Week 39

What you learn today

  • Narrow down faults
  • Displays as probes
  • Test subsystems separately

The greenhouse is too warm, the heater keeps running anyway, and now and then the Harvie moves over an empty tray. The chip has 30 lines and no error message. Where do you start?

Narrowing down instead of guessing

Large plants have many sources of faults: device, name, cable, code. Proceed in this order:

  1. Which subsystem? Climate, harvest, light – only one shows the wrong behaviour. Leave the rest alone.
  2. Is the input right? Does the chip read what you think it reads? A probe helps here.
  3. Is the logic right? Only when the input is right is it worth looking at comparisons and jumps.
  4. Is the output right? Does the value arrive at the right device – right name, right LogicType?

Displays as probes

An LED display costs one line of code and shows you any intermediate value. Simply write the suspicious value onto it:

lbn temp SENSOR HASH("Gewaechshaus") Temperature Average
sbn DISP HASH("Sonde") Setting temp     # probe: what does the chip read?

If the probe shows 0 although the room is at 22 °C, the chip is not reading any device: wrong name or wrong prefab. If it shows 590 K, Sum is adding two sensors. If it shows NaN, the device is missing and you are using Average.

Tip

Feel free to leave the probe in after the repair. It costs almost nothing and saves the search next time. For states you can also use the housing itself: s db Setting state.

Testing subsystems separately

Instead of checking the whole plant at once, you test one section after the other – in the simulator with values set by hand, in the game with a lever as a stand-in sensor. Do not comment out other sections, give them values at which they stay quiet.

The usual suspects

SymptomCause
value is 0 instead of NaNname misspelt and Sum used
value is twice as largeSum instead of Average with two devices
switches in the middle of the bandhysteresis limits swapped
reacts to an empty traybnez on a value that can be −1
Warning

A typo in the device name is the most common mistake of all – and with Sum the most treacherous, because 0 looks like a real reading. One more reason for Average: there the typo becomes NaN, and NaN stands out.

Exercise

Task

The starter code has four bugs: wrong name, wrong batch mode, swapped hysteresis and bnez on Mature. Repair it:

  • heater “Gewaechshaus” on below 20 °C, off above 24 °C, off without a sensor
  • the Harvie “Ernter” only gets Harvest at Mature = 1
  • build a probe: display “Sonde” shows the temperature that was read

Hints

Hint 1

The sensor is called “Gewaechshaus” with “ae”. Average averages two sensors, Sum adds them.

Hint 2

Hysteresis: first slt with HEAT_OFF and and, then slt with HEAT_ON and or.

Hint 3

Harvest without a jump: seq ripe ripe 1 and sbn … Harvest ripe.

Quiz

3 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