What you learn today
- Keep mixed gas within a tolerance band
- Report deviations
- Set a relative tolerance
For the base's breathing air you mix oxygen and nitrogen in a tank. The share should be 21 %. No pump hits it exactly, a band of a few percent is fine. That is exactly what you learned sap for this week.
The setup
| Device | Prefab | Name |
|---|---|---|
| pipe analyzer at the mixing tank | StructurePipeAnalysizer | Mischtank |
| volume pump for oxygen | StructureVolumePump | Sauerstoffpumpe |
| volume pump for nitrogen | StructureVolumePump | Stickstoffpumpe |
| wall light | StructureWallLight | Mischung ok |
| flashing light | StructureFlashingLight | Mischalarm |
| LED display | StructureConsoleLED5 | Abweichung |
The analyzer delivers the oxygen share as RatioOxygen, a number from 0 to 1.
Milestones
- Within the band: if the share lies within
TOL(relative) aroundTARGET, both pumps are off, “Mischung ok” lights up, the alarm is off. - Too little oxygen: the oxygen pump runs, the nitrogen pump does not, the alarm lights up.
- Too much oxygen: the nitrogen pump runs, the oxygen pump does not, the alarm lights up.
- Tolerance and display: with
TOL0.05, 22 % still counts as good, 22.5 % no longer. The display shows the deviation in percent of the target: (share − target) / target × 100. - Failure: if the analyzer is missing, no pump runs, the alarm lights up, the display shows −999.
Setting the relative tolerance
sap allows a distance of TOL times the larger of the two values. At 22 % oxygen and TOL 0.05 that is 0.05 × 0.22 = 0.011. The distance to 0.21 is 0.01, so still within the band.
sap ok o2 TARGET TOL # 1 within the band, 0 outside and on NaN
seqz tmp ok # 1 = action needed or failure
slt less o2 TARGET
and less less tmp
If you want a narrower band, you only make TOL smaller. For breathing air a few percent around 21 % are fine. For a fuel mixer you would regulate more tightly.
Do not build the pumps with sna. With NaN sna also returns 0 in the game, and the logic behind it behaves as if everything were within the band. Here that happens to be harmless. An explicit snan for alarm and display makes the failure visible.
The deviation in percent of the target is easier for people to read than the raw ratio: “+4.8 %” says more than “0.22”.
Diagram
Project task
Task
Build the tolerance guard with the devices and names from the table. TARGET 0.21, TOL 0.05. The milestones are listed above the editor.
Milestones
- Milestone 1: within the band
- Milestone 2: too little oxygen
- Milestone 3: too much oxygen
- Milestone 4: 5 % tolerance and display
- Milestone 5: analyzer missing
Hints
Hint 1
sap ok o2 TARGET TOL decides about the band – NaN gives 0.
Hint 2
seqz tmp ok is the need for action. The direction comes from slt and sgt, each with and tmp.
Hint 3
The alarm is simply tmp. The display: sub, div, mul 100, then select with missing.
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