What you learn today
- Combine furnace, fabricators and counting
- Typical mistakes
Two weeks of production: furnace and alloys, fabricators, centrifuge, arc furnace, counting. Before the whole smelter takes shape tomorrow, a look back is worthwhile – and at the mistakes that happen again and again along the way.
What belongs together
| Building block | Core idea |
|---|---|
| Furnace | window of temperature and pressure, RecipeHash not 0 before opening the mould |
| Arc furnace | Activate 1 per stack, power per piece, switches itself off on shortage |
| Fabricators | RecipeHash chooses, Activate 1 triggers one piece |
| Counting | ExportCount with ClearMemory, piece counts in storage with lbns … Sum |
| Watching | counter trick for jams and standing chains |
Typical mistakes
1. Sum on ratios. Two batteries at 30 % each give 0.6 with Sum – “above 50 %” although both are almost empty. Ratio, Temperature and Pressure call for Average. Sum only for real sums: piece counts, power, energy.
2. A threshold without memory. sgt free level ON alone switches back and forth at 50 %. A hysteresis needs two thresholds and the old result.
3. Writing Activate every tick. sbn … Activate free writes a 0 as soon as the release drops – and cancels a half-finished piece. Trigger yes, cancel never.
More classics from the last days:
- Opening the mould without checking
RecipeHash– slag instead of ingots. And checkingModeinstead ofRecipeHash– on a dedicated server the mould never opens. lr … Requiredon a furnace – the chip stops.rmapwith a ReferenceId instead of a pin.- Counting loops over many slots and then expecting the result in the same tick.
- NaN in a sum: one missing device poisons everything after it.
Finding the mistakes
This is what the small smelter looks like with the first three mistakes:
lbn level BATT HASH("Akku") Ratio Sum
sgt free level ON
sbn LATHE HASH("Drehbank") Activate free
And this is without:
lbn level BATT HASH("Akku") Ratio Average
sgt tmp level OFF
and free free tmp
sgt tmp level ON
or free free tmp
When hunting mistakes, a simple test in your head helps: “What happens with two devices of the same name? What happens exactly at the threshold? What happens when the device is missing?” These three questions find most of this week's mistakes.
Exercise
Task
The starter code of the small smelter contains the three typical mistakes. Fix them: Average instead of Sum for the battery level, a hysteresis (free from above 50 %, locked at 20 % and below) and a lathe trigger that never writes a 0 – Activate 1 only when free and the lathe is not active right now. You only release the arc furnace with On here; in this exercise another chip starts its stacks.
Hints
Hint 1
Mistake 1 is a single word in the lbn.
Hint 2
Mistake 2: sgt/and with OFF, then sgt/or with ON.
Hint 3
Mistake 3: beqz free start, read Activate, bnez active start, only then Activate 1.
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