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

Day 344 of 365 · Expert · Month 12: Masterpieces

Big project: planning

Planning a big project: collect requirements as a numbered specification, create a device list and decide on a naming scheme before the first line of code is written.

Lesson 20 min Week 50

What you learn today

  • Collect requirements
  • Device list
  • Naming scheme

The last weeks of the year belong to a big project: a base automation with life support, power, production, logistics and a central unit. Whoever simply starts building something like that has five chips after three evenings that get in each other's way. That is why the work starts on paper.

Collecting requirements

Write down what the system has to do – short, testable and numbered:

No.Requirement
A1alarm if the pressure of a room is below 90 or above 110 kPa
A2alarm if the oxygen ratio drops below 19 %
A3alarm if the sensor of a room is missing
A4a display shows how many rooms are in alarm

“Testable” means: there is a test case for every line. “The air should be good” is no requirement, “oxygen at least 19 %” is. The numbers later appear in the code as comments – that way you can see which line fulfils which requirement.

Separate three kinds while doing it: what the system must do, what would be nice and what must never happen. The third list is the most important one. The safe states come from it.

The device list

Every device gets a line: room, job, prefab, name in the game. The list is the building plan for the base and the header comment for the chips. What is not on the list does not get built – and what is built is on the list.

The naming scheme

With five devices “Heizung” is enough. With fifty it is not. A scheme makes names predictable: Room_Function for devices in rooms, System_Value for interfaces.

NameMeaning
“Wohn_Luft”gas sensor in the living room
“Labor_Alarm”flashing light in the lab
“LS_Status”status of life support
“EN_Puls”heartbeat of power

With the scheme a single subroutine can check every room: the main part only hands over the names, the logic stays the same.

sge alarm p P_MIN          # A1: pressure not too low
sle tmp p P_MAX            # A1: pressure not too high
and alarm alarm tmp
sge tmp o2 O2_MIN          # A2: enough oxygen
and alarm alarm tmp
seqz alarm alarm           # A3: NaN makes every check false, so alarm
Tip

Keep the names short and without special characters. They appear dozens of times in HASH("…"), and every character counts against the 4096.

Exercise

Task

Implement the specification A1 to A4. Two rooms by the scheme: sensors “Wohn_Luft” and “Labor_Luft”, flashing lights “Wohn_Alarm” and “Labor_Alarm”, display “Alarme”. A subroutine raum checks one room, the main part calls it for both.

Hints

Hint 1

Main part: count to 0, then per room two move with HASH("…") and jal raum.

Hint 2

In the subroutine check “everything fine” (sge, sle, and) and flip it with seqz at the end. NaN then falls into the alarm on its own.

Hint 3

add count count alarm counts the rooms, j ra jumps back.

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