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

Day 290 of 365 · Expert · Month 10: Bits and data

Leader chip and follower chips

A leader chip distributes tasks: commands via sbn to all follower chips, collecting results from logic memories and deciding itself when to save.

Lesson 20 min Week 42

What you learn today

  • Distribute tasks
  • Send commands
  • Collect results

One chip for the whole base does not fit into 128 lines. So you split up: each area gets its own chip, the follower chip. A leader chip decides what the base should be doing right now and tells everybody.

Distributing tasks

A follower chip does exactly one thing well – heating in the living module, pumps in water treatment. It does not need to know why power is being saved. It only needs to know that it is. The leader makes the decision once instead of every follower working it out itself.

Sending commands

The simplest mailbox of a follower chip is its own housing: the leader writes into its Setting, the follower reads it with l cmd db Setting. If all followers have the same name, a single sbn reaches all of them:

sbn HOUSING HASH("Folger") Setting mode     # to all followers

The leader itself is not affected, as long as its housing has a different name.

CommandMeaning
0off
1normal operation
2saving mode

Collecting results

For the way back each follower gets its own logic memory that only it writes into – “Ergebnis1”, “Ergebnis2”. The leader reads them all and works with them:

lbn r1v MEMORY HASH("Ergebnis1") Setting Average
lbn r2v MEMORY HASH("Ergebnis2") Setting Average
add total r1v r2v

That way it can react to the overall picture: if the followers together need more than 3000 W, it switches them all to saving mode – something no single follower sees.

Warning

If a result is missing, the sum is NaN. A leader that derives commands from it needs a safe answer: here the selected mode stays, and a light reports the missing follower. If the dial is missing, the command goes to 0 – off is the safe state.

Tip

Write the command table into the header comment of every chip involved. Otherwise in three months you will no longer know whether 2 meant “save” or “emergency”.

Diagram

Devices on the data network with type and name IC housing IC10 StructureGasSensor „Lager“ StructureGasSensor „Werkstatt“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Lagerheizung“ StructureWallHeater „Werkstattheizung“ lbn SENSOR HASH("Lager") reads only this sensor sbn HEATER HASH("Lagerheizung") switches both at once
Commands go through the Setting of the follower housings, results come back through logic memories.

Exercise

Task

Write the leader chip:

  • display “Gesamt”: sum of “Ergebnis1” and “Ergebnis2”, −1 if one is missing; then light “Folger” on
  • command = value of the dial “Modus”, 0 without the dial
  • if the command is not 0 and the sum is above 3000, it becomes 2 (saving mode)
  • write the command into the Setting of all housings “Folger”

Hints

Hint 1

add total r1v r2v is NaN as soon as a result is missing – check that with snan.

Hint 2

Saving mode: sgt tmp total LIMIT, snez active mode, and, then select mode tmp SAVE mode.

Hint 3

One sbn HOUSING HASH("Folger") Setting mode reaches both followers.

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