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

Day 87 of 365 · Beginner · Month 3: First systems

Testing in the simulator

Breakpoints, single step, values by hand and couplings: in the simulator of the IC10 coder you test every case before it happens in the game.

Lesson 15 min Week 13

What you learn today

  • Breakpoints and single step
  • Set values by hand
  • Couplings for trends

Testing a chip in the game is tedious. You cannot simply set a sensor to 5 °C, and if something goes wrong, the room is already cold. The simulator in the IC10 coder plays all of that through in the browser.

Step, tick and breakpoint

Buttondoes
Steprun exactly one instruction
Tickrun a whole tick, up to the next yield
Run / Pausekeep running, the speed is adjustable
Resetreload the chip, everything back to the start

A breakpoint stops the run at a line. You set it with a click on the line number. Then the register list shows exactly what is in every register before that line. With Step you continue from there instruction by instruction. The tick display tells you which line the chip is on and how many of the 128 instructions the tick has used.

Setting values by hand

Under Devices you create what your chip expects: “Add to network” for lbn and sbn, “Insert device” for a pin. Every device gets a name as in the game and values you can change at any time. That way you try every case: cold, warm, exactly on the limit. Remove takes a device away, that is your failure test.

Strict mode only allows LogicTypes that are listed on the device, as with real devices. That helps you find mistyped names.

A real pump fills a tank. In the simulator a coupling does that: every tick factor × source is added to the target.

SourceTargetFactorEffect
Pump.OnTank.Pressure5050 kPa more per tick while the pump runs

On top of that every value has a Δ/tick, a fixed change per tick. −10 on the pressure lets the tank slowly drain. Together you see whether your hysteresis swings the way it should. The chart button next to a register records the curve in the Trend.

sgt edge pumping last     # pump just started?
add starts starts edge    # count switching cycles
move last pumping

How often a pump starts is a good measure. If it switches every few ticks in the trend, your band is too narrow.

Warning

The simulator starts every run with zeros in all registers. In the game the chip keeps its old values. So check that your code also starts correctly without these zeros, thanks to the lines before the start label.

Tip

Always test three cases: the normal case, the limit and the failure. Whoever tests only the normal case tests what works anyway.

Diagram

Ticks and yield on a timeline tick 0 · 0.0 s tick 1 · 0.5 s tick 2 · 1.0 s tick 3 · 1.5 s 5 instr. yield 5 instr. yield 5 instr. yield 128 instr. no yield: limit hit Device values only change between two ticks.
Step runs one instruction, Tick a whole tick up to the yield. A breakpoint stops the run at a line.

Exercise

Task

A pipe analyzer “Tank” measures the tank pressure, the volume pump “Fuellpumpe” fills it.

  • pump on below 1500 kPa, off from 2000 kPa, keep the state in between
  • the LED display “Starts” counts how often the pump has started
  • if the analyzer fails: pump off

Try your solution in the IC10 coder first with a coupling Pump.On → Tank.Pressure (factor 50) and Δ/tick −10 on the pressure.

Hints

Hint 1

The hysteresis is the and/or pattern from week 7.

Hint 2

You count starts with an edge on pumping, not on the pressure.

Hint 3

In the simulator the trend shows whether the pump swings cleanly.

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