What you learn today
- Energy, greenhouse and storage of an outpost
- Collective alarm
An outpost far away from the main base: a few batteries with a backup generator, a small greenhouse and a fridge with supplies. Nobody is there all the time. A chip keeps everything running and tells you at a glance whether you need to fly out.
The setup
| Device | Prefab | Name |
|---|---|---|
| Station batteries | StructureBattery | “Akku” |
| Solid fuel generator | StructureSolidFuelGenerator | “Notstrom” |
| Gas sensor | StructureGasSensor | “Gewaechshaus” |
| Wall heater | StructureWallHeater | “Gewaechshaus” |
| Hydroponics device | StructureHydroponicsTrayData | “Beet” |
| Harvie | StructureHarvie | “Ernter” |
| Fridge | StructureFridgeBig | “Vorrat” |
| Wall light | StructureWallLight | “Sammel” |
| LED displays | StructureConsoleLED5 | “Vorrat”, “Alarm” |
The rules
- Energy: generator on below 30 %, off from 90 %. Without a battery value it runs.
- Greenhouse: heater on below 20 °C, off above 24 °C. The Harvie harvests with a free arm when
Mature= 1. - Store: the display “Vorrat” shows the quantity in all 15 slots.
- Collective alarm: the display “Alarm” shows the most important code, the light “Sammel” is on for any alarm:
| Code | Condition |
|---|---|
| 1 | batteries below 10 % or missing |
| 2 | greenhouse below 15 °C or sensor missing |
| 3 | stock below 10 pieces |
Milestones
- The generator keeps the batteries up with hysteresis.
- Heater and Harvie work in the greenhouse.
- The stock display counts all slots.
- The collective alarm shows the most important code.
- If batteries or sensor fail, the plant goes into the safe state and reports it.
This is the biggest chip of the level. Plan the registers first, then the sections. Each section is a building block you have already written this week.
The collective alarm needs values from all other sections. So put it at the end and do not read anything anew there: level, temp and stock are still in their registers.
The loop over the fridge uses tmp. If you need a value across the loop, it belongs in a register of its own.
Project task
Task
Build the outpost following the four rules above. The defines and aliases are already there.
Milestones
- Milestone 1: generator with hysteresis
- Milestone 2: heater and Harvie
- Milestone 3: counting the stock
- Milestone 4: collective alarm with priority
- Milestone 5: failures
Hints
Hint 1
Generator: hysteresis as usual, then snan tmp level and or gen gen tmp.
Hint 2
Stock: loop over SLOTS with lbns … Quantity Sum.
Hint 3
Alarm: set code 3, then 2, then 1 with select – the most important comes last.
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