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

Day 115 of 365 · Advanced · Month 4: Network in detail

Two chips talking

One chip puts a value into its housing or a logic memory, another one picks it up. Every channel has exactly one writer.

Lesson 14 min Week 17

What you learn today

  • Housing Setting as a mailbox
  • Logic memory in between
  • Who writes, who reads

One chip measures the weather outside, a second one controls the hangar door inside. The door chip has to know when a storm is coming. Two chips talk to each other by one putting a value down and the other picking it up.

The housing's Setting as a mailbox

Every IC housing has a Setting its chip writes with s db Setting x. Other chips on the same data network read it like any other device:

s db Setting storm                                    # weather chip
lbn storm HOUSING HASH("Wetterchip") Setting Average  # door chip

HOUSING is the hash of StructureCircuitHousing. So that the door chip hits the right housing, the weather chip's housing gets a name of its own.

Logic memory in between

Instead of the housing, a logic memory can hold the value as well. That has two advantages: the value stays even while the writing chip is taken out, and a player sees and changes it without code. The weather chip writes into it with sbn, the door chip reads with lbn.

Who writes, who reads

The most important rule: every value has exactly one writer. If two chips write into the same box in turns, whoever came last wins, and the value jumps back and forth.

Boxwritten byread by
housing “Wetterchip”, Settingonly the weather chipdoor chip, displays
housing “Torchip”, Settingonly the door chipweather chip, displays

If the weather chip needs feedback, such as “door is closed”, the door chip writes it into its own housing. That way every channel has one direction.

Warning

If the sender is missing, lbn … Average returns NaN. Decide beforehand what applies then. For a hangar door with a storm risk that means: better closed than open.

Tip

A code in the Setting can mean more than 0 and 1: 0 calm, 1 wind, 2 storm. Write the meaning as a define into both chips.

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
The Setting of every IC housing is a mailbox: its own chip writes with s db, everyone else reads with lbn.

Exercise

Task

You write the door chip. The housing “Wetterchip” reports in its Setting: 0 calm, 1 wind, 2 storm.

  • Door “Hangartor” follows the lever “Tor”, but only without danger. Danger means: code ≥ 2 or weather chip missing.
  • On danger: door closed and Lock 1, otherwise Lock 0.
  • Feedback: write a 1 into your own housing (db) when the door is closed, otherwise 0.

Hints

Hint 1

Danger: sge danger weather STORM, then or with snan.

Hint 2

Open only if there is no danger and the lever is on.

Hint 3

The feedback is written with s db Setting closed – never into the weather chip's housing.

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