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

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

Remote control

Commands via radio: why a logic transmitter without a link halts the chip, a running number as a heartbeat, feedback to the base and the safe state when the radio goes quiet.

Lesson 20 min Week 42

What you learn today

  • Commands via radio
  • Feedback
  • Safety on connection loss

The pump station at the ice field is two kilometres from the base. No data cable reaches that far. A pair of logic transmitters bridges the distance – and brings a new danger: what does the pump do when the connection breaks?

What the logic transmitter returns

A logic transmitter (StructureLogicTransmitter) in active mode has a Setting of its own. A transmitter in passive mode is linked to another one and passes reading and writing on to it. How to pair the two is covered in day 116.

One detail from the game code matters for safety: if the passive transmitter has no link or no power, it reports itself as not readable. An l or lbn on it halts with IncorrectLogicType – and while the chip stands still, the pump keeps its last command. Without a link it cannot be written either, without power it silently drops what you write. That is why both receivers hang on pins, and before every access you ask first:

move lost 1                   # to begin with: no connection
move radio 0
bdns cmdradio check           # device gone?
bdnvl cmdradio Setting check  # power, link?
l radio cmdradio Setting
move lost 0
check:
Warning

If the chip at the base stops, the transmitter stands still too: it simply keeps its last value. To the receiver that looks like a valid command that does not change. A radio command therefore needs a heartbeat.

Commands with a number

As with Monday's protocol, every command gets a running number. The base counts it up regularly, even if the command does not change:

BitsContent
0–7number
8pump on (1) or off (0)

The receiver remembers the last number. If it does not change for too long, the connection is gone – exactly as with the watchdog:

seq tmp seq old
add still still tmp
mul still still tmp
move old seq
sgt tmp still TIMEOUT      # quiet for too long
or lost lost tmp

Safety on connection loss

What “safe” means depends on the plant. For a pump station it usually means: pump off, valves closed, light on. The receiver enforces this state itself without waiting for a command:

seqz tmp lost
and cmd cmd tmp       # no connection: off
sbn PUMP HASH("Pumpe") On cmd

Feedback

The base does not only want to send but to know what is happening out there. A second transmitter pair carries the reply back: the number seen last and the state the pump really has. If the number matches, the command has arrived. If the state does not match the command, the safety outside is kicking in.

Tip

The reply needs its own transmitter pair. If the receiver writes back the same way, it overwrites the base's command.

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 command goes out with a number, the number comes back with the actual state.

Exercise

Task

Write the pump station's receiver. The logic transmitters hang on pins: “Befehl” on d0, “Antwort” on d1. “Befehl” delivers bits 0–7 number and bit 8 pump:

  • pump “Pumpe” follows bit 8
  • if the number does not change for more than TIMEOUT = 20 ticks, or d0 is empty or not readable: pump off, light “Funk” on
  • feedback into “Antwort”: number in bits 0–7, actual pump command in bit 8 – only if d1 is there and writable

Hints

Hint 1

Reading: first move lost 1 and move radio 0, then bdns and bdnvl on d0 before the l.

Hint 2

Unpack: ext seq radio 0 8 and ext cmd radio 8 1, loss as with the watchdog.

Hint 3

Reply: bdns and bdnvs on d1, then move reply seq, ins reply cmd 8 1 and s.

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