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

Day 37 of 365 · Beginner · Month 2: Order and data network

lb and sb: all devices of a type

lb and sb address every device of a type on the network, whatever its name. Handy for “all lights off” – and dangerous if you do not know what is on the network.

Lesson 10 min Week 6

What you learn today

  • Read and write all devices of a type
  • Difference to lbn/sbn
  • “all lights off”

Closing time in the base: all wall lights should go off. You could switch each one by its name. Without names it is quicker.

lb and sb

InstructionFormhits
lbnlbn r? type name LogicType batchmodeall devices of the type with this name
lblb r? type LogicType batchmodeall devices of the type
sbnsbn type name LogicType valueall devices of the type with this name
sbsb type LogicType valueall devices of the type

The name is simply missing. Everything else stays the same, including the batch modes.

define LIGHT HASH("StructureWallLight")  # Wall Light
alias count r0
sb LIGHT On 0                 # all wall lights off
lb count LIGHT On Sum         # how many are still on?

What lb is good at asking

  • lb count LIGHT On Sum: how many lights are on? On is 0 or 1, so the sum counts.
  • lb count SENSOR Temperature Count: how many gas sensors does the chip see at all?
  • lb temp SENSOR Temperature Average: mean temperature over all sensors of the base.

One type only

sb hits exactly one prefab. Wall light, long wall light and round light are different types – “all lights off” needs a line of its own for every light type.

Warning

sb does not ask. A sb VENT On 0 switches off every active vent on the network, including the one in the airlock you were not thinking about. Only use sb for things where “all” may really mean all: lights, display colours, signs. Anything to do with air, pressure or power needs names.

When to use what

TaskInstruction
all lights offsb
light in the storagesbn with a name
mean temperature of the whole baselb
temperature in the lablbn with a name

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
lbn and sbn filter by type and name. lb and sb leave out the name and hit every device of that type.

Exercise

Task

A main switch for the lights: the network holds three wall lights with different names, a lever “Hauptschalter” and an LED display “Licht an”.

  • Lever flipped: all wall lights on, otherwise all off – with sb.
  • The display shows how many wall lights are on right now – with lb.

Hints

Hint 1

Read the lever with lbn by its name.

Hint 2

sb LIGHT On switch switches all wall lights at once.

Hint 3

lb count LIGHT On Sum counts the lights that are on.

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