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

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

Project: chip network

A leader chip runs two follower chips: distribute setpoints, average results, watch both with a watchdog and hand the zone to the other follower on a failure.

Project 50 min Week 42

What you learn today

  • Leader chip with two followers
  • Watchdog
  • Shared memory

Two living zones, two follower chips each heating its zone, and a leader chip in the control room. If one follower fails, the other should take over its zone as well – the heaters of both zones are on both networks. This is the chip network from this week in one plant.

The setup

DevicePrefabNamePurpose
DialStructureLogicDial“Soll”target temperature in °C
IC housingStructureCircuitHousing“Folger1”, “Folger2”command in Setting
Logic memoryStructureLogicMemory“Puls1”, “Puls2”heartbeats of the followers
Logic memoryStructureLogicMemory“Wert1”, “Wert2”measured temperature of the zone
LED displayStructureConsoleLED5“Mittel”average of the living zones
Wall lightStructureWallLight“Ausfall”a follower has failed

The protocol

The command to a follower is packed: bits 0–7 the setpoint in °C, bit 8 means “take over the other zone as well”. Follower 1 gets bit 8 when follower 2 is dead, and vice versa.

Milestones

  1. Both followers get the setpoint from the dial, 20 °C without the dial.
  2. The display shows the average of the reported temperatures.
  3. If a pulse stands still for more than 10 ticks, the light comes on and the other follower gets bit 8.
  4. The average only counts living followers. When a pulse comes back, everything is normal again.
  5. If a pulse memory is missing, the follower counts as failed at once.
Tip

The two watchdogs are the same code with different registers. If you want to save lines, make a subroutine of it – then old, still and dead have to be copied before and after the call. With two followers the duplicated block is clearer.

Warning

select tmp alive tmp 0 instead of mul tmp tmp alive: a dead follower can return NaN, and NaN times 0 stays NaN. select, on the other hand, throws the value away cleanly.

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
Pulse and value come through logic memories, the command goes into the follower's housing.

Project task

Task

Build the leader chip following the milestones above. The defines and aliases are already there.

Milestones

  1. Milestone 1: setpoint to both
  2. Milestone 2: averaging results
  3. Milestone 3: watchdog and handover
  4. Milestone 4: follower returns
  5. Milestone 5: failures

Hints

Hint 1

Two watchdog blocks as on Thursday, one per pulse memory.

Hint 2

Command: move cmd target, then ins cmd dead2 8 1 for follower 1 – and the other way round.

Hint 3

Average: per follower seqz alive dead, read the value, select tmp alive tmp 0, add up, divide at the end.

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

Esc
↑ ↓ selectEnter open/ opens search anywhere