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

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

Plants in a slot

The hydroponics device reports in slot 0 how far the plant has grown. With Maximum across all trays the harvest lamp lights up as soon as something is ripe.

Lesson 12 min Week 11

What you learn today

  • Read a hydroponics tray
  • Growth and Mature
  • Report ripeness

Tomatoes take their time. Instead of walking through the greenhouse every few minutes, a lamp should light up as soon as something is ripe.

The right tray

There are two hydroponics trays, and only one of them talks to the chip:

PrefabName in gameData port
StructureHydroponicsTrayHydroponics Trayno
StructureHydroponicsTrayDataHydroponics Deviceyes

The simple tray is a pure pipe piece without logic. For the chip you need the Hydroponics Device. According to the Stationpedia these devices cannot be placed right next to each other like the simple trays, so plan a little more space.

Warning

With the simple tray lbs finds no device. Depending on the batch mode you get NaN, 0 or −infinity, and you look for the bug in the code instead of in the tray.

Slot 0: the plant

Slot 0 is the plant, slot 1 the fertiliser. Among other things the plant reports:

LogicSlotTypeValue
Growthgrowth stage, a whole number (0, 1, 2 …)
Mature1 = ripe, 0 = not yet
MaturityRatioway to ripeness from 0 to 1
Healthhealth from 0 to 1

Without a plant all four report −1. That becomes important in a moment.

lbs ripe TRAY 0 Mature Maximum            # 1 as soon as a plant is ripe
lbs progress TRAY 0 MaturityRatio Maximum

Growth is not a percentage but the number of the stage. How many stages a plant has depends on the variety. For a “how far?” display MaturityRatio is the better choice.

Maximum for “any”

With Maximum you ask: is any plant ripe? A ripe plant returns 1, so the maximum is 1 as well. Empty trays return −1 and do no harm.

Warning

Sum over Mature does not count the ripe plants. An empty tray subtracts a ripe plant again with its −1: 1 + 0 + (−1) = 0.

For a clean lamp you turn the result into 0 or 1 with sgtz. That also covers the case “no tray on the network at all”: Maximum returns −infinity there, and sgtz turns it into 0.

sgtz ripe ripe
sbn LAMP HASH("Ernte") On ripe
Tip

For the percentage display multiply MaturityRatio by 100 and add max progress progress 0. That way the display shows 0 instead of −100 or −infinity when all trays are empty.

Diagram

A locker with numbered slots Locker (d0) Slot 0 Iron ore Occ 1 Qty 5 Slot 1 Copper ore Occ 1 Qty 12 Slot 2 empty Occ 0 Qty 0 Slot 3 empty Occ 0 Qty 0 ls r0 d0 0 Occupied r0 = 1 ls r1 d0 1 Quantity r1 = 12 Slots count from 0. Values in a slot are called LogicSlotTypes.
Slot 0 is the plant, slot 1 the fertiliser. Without a plant Growth, Mature, MaturityRatio and Health report −1.

Exercise

Task

Three hydroponics devices stand on the data network of the greenhouse.

  • The wall light “Ernte” lights up as soon as one plant is ripe.
  • The LED display “Reife” shows the MaturityRatio of the most advanced plant in percent (0 to 100).
  • If all trays are empty or removed: lamp off, display 0.

Hints

Hint 1

lbs ripe TRAY 0 Mature Maximum – slot 0 is the plant.

Hint 2

sgtz turns 1 / 0 / −1 / −infinity into a clean 0 or 1.

Hint 3

For the display read MaturityRatio with Maximum, times 100, then max … 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