PresenceAlarm
Macro component that raises an alarm when a person is still present while monitoring is on (left-behind alarm), from the target state decoded by Hi_Link_LD2410C.
Processing
- Condition_count (RTMaps Condition) counts the samples with the condition (a != 0) * ((s >= 1 && s <= 3) * result + 1): 0 while monitoring_switch is 0, 1 while monitoring and nobody is present, n + 1 after a person has been present for n consecutive samples (target_state 1 to 3).
- Condition_alarm latches the alarm with the condition c != 0 && (result != 0 || c > 200): the alarm turns on when the count exceeds 200 samples (about 20 seconds at the report rate of the sensor, about 10 Hz) and stays on until monitoring_switch returns to 0.
- Both Condition components are evaluated whenever an input arrives (Synchro tolerance = -1) and output the value of the condition every time.
Usage
- Connect Hi_Link_LD2410C.target_state → target_state, and a 0/1 switch signal that means that nobody should be here from now on (door lock, door-closed switch, ignition off, end of a task; a Bi-state button for tests) → monitoring_switch. Connect alarm to an LED, a buzzer or a recorder.
- A person who leaves the detection range after monitoring starts becomes absent after the no-one duration of the sensor (default 5 s) and the count returns to 1, so no alarm is raised when leaving plus the no-one duration takes less than about 20 seconds. A person who stays (even motionless, detected by breathing) raises the alarm.
- Defined in SMSL_BasicToolkit_Macros.rtmc.
Data format
- Inputs and outputs: Integer32 scalars, one output sample per evaluation.
Notes
- Time is counted in samples, so the alarm delay changes with the report rate of the sensor. The threshold (200 samples) is in the condition of Condition_alarm; the macro has no properties, so edit the macro (.rtmc) to change it.
- target_state 4 to 6 (background noise detection) counts as absent.
- When the sensor stops reporting, the outputs stop and keep their last values.
- Not a safety device (not certified for functional safety); to protect people, use it only as an aid to a certified sensor.
Outputs
| Name | Description |
|---|---|
alarm | Alarm: 1 when a person has been present for more than 200 samples while monitoring, latched until monitoring_switch returns to 0; otherwise 0. Type: Integer32 |
monitor_count | Count: 0 = not monitoring, 1 = monitoring and nobody present, n + 1 = a person has been present for n consecutive samples. Type: Integer32 |
Inputs
| Name | Description |
|---|---|
monitoring_switch | Monitoring switch: non-zero (1) = on, 0 = off. Turning it off resets the count and the alarm. Type: Integer32 |
target_state | Target state from Hi_Link_LD2410C: 0 none, 1 moving, 2 stationary, 3 both (4 to 6: background noise detection, counted as absent). Type: Integer32 |
RTMaps Toolkits Documentation