What you learn today
- Drive speaker and warning light
- Use Sound. names
- Acknowledge an alarm
A display is only seen by whoever stands in front of it. If the pressure drops in the storage while you are out mining ice, you need something louder: the klaxon speaker.
The klaxon
| LogicType | Meaning |
|---|---|
On | 1 = sound playing |
SoundAlert | which sound – read and write |
Mode | the same as SoundAlert |
Volume | loudness, default 50 – by hand 1 to 100, by chip 1 to 200 |
You pick the sound with names from the Sound. namespace:
| Name | Number | Name | Number | |
|---|---|---|---|---|
Sound.Danger | 15 | Sound.PressureLow | 40 | |
Sound.Warning | 16 | Sound.TemperatureHigh | 41 | |
Sound.Alert | 17 | Sound.HighCarbonDioxide | 44 | |
Sound.PowerLow | 23 | Sound.FireFireFire | 28 |
Set the sound once before the main loop, inside the loop you only switch On. There is a reason for that in the game code: every write of SoundAlert triggers the sound again, even with the same value.
sbn HORN HASH("Hupe") SoundAlert Sound.PressureLow
Warning light
You switch the flashing light (StructureFlashingLight) through On like any light. It stays on as long as the fault persists – even when the horn has gone quiet.
Acknowledging
An alarm that keeps honking for minutes while you are already on your way to the repair is annoying. With a button you acknowledge it: the horn goes quiet, the light stays on. When the fault disappears, the acknowledgement is forgotten. If it comes back, the horn sounds again.
For that a register remembers whether it was acknowledged:
slt alarm press LIMIT # fault right now?
lbn button BUTTON HASH("Quittieren") Activate Average
or ack ack button # remember the press
and ack ack alarm # forget it once all is well
seqz tmp ack
and horn alarm tmp # honk only when not acknowledged
sbn HORN HASH("Hupe") On horn
sbn LIGHT HASH("Warnlicht") On alarm
Activate is only 1 for about one tick. Because the or holds on to the press in ack, that one tick is enough.
A missing sensor is an alarm too. Hook the failure into the alarm condition with snan: snan tmp press and or alarm alarm tmp. Otherwise a removed sensor looks like “all fine”.
Less is more: a sound for every trifle, and soon nobody listens. Horn for real danger, light for warnings.
Exercise
Task
A pressure alarm with acknowledgement. On the network: gas sensor “Lager”, klaxon “Hupe”, flashing light “Warnlicht”, button “Quittieren”.
- Before the loop: sound
Sound.PressureLowthroughSoundAlert. - Alarm on pressure below 70 kPa or a missing sensor.
- On alarm: warning light on, horn on – until someone presses the button. Then the horn goes quiet, the light stays.
- Once the alarm is over, the acknowledgement is forgotten.
Hints
Hint 1
Before start:: sbn HORN HASH("Hupe") SoundAlert Sound.PressureLow.
Hint 2
Alarm: slt against LIMIT, plus snan and or.
Hint 3
Acknowledge: or ack ack button, and ack ack alarm, then seqz and and for the horn.
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