Skip to content

SoftwarePartition

Overview

Partition that the device does not know. PQ arms and disarms it, keeps the arming across restarts and raises its alarm from the perimeter lines it covers. The partition covers lines through range children (see MODEL-017).

  • Namespace: Pq.Adapters.Framework
  • Construction: extended_construction: true (the hand-written partial provides the constructor)
  • Works with: Partition on the same Thing (shows the state and publishes the events), LineDetector on the covered lines

When to Use

  • Perimeter systems whose controller has no partitions: the operator arms groups of detectors in PQ
  • A detector must be guarded only while a partition that covers it is armed

Do not use it when the device has its own partitions; use Partition alone.

States and Actions

None generated. The Thing shows state and publishes events through its Partition function; SoftwarePartition calls the actions of Partition. A Thing with SoftwarePartition and without Partition fails at its first use.

Modeling

The partition device type lists both functions. Its children are an adapter device type with a device reference line (its type is the id of the line device type) and an addresses string property.

device_types:
  - type_id: "PerimeterPartition"
    name: "Perimeter partition"
    category: partition
    functions:
      Partition:
      SoftwarePartition:

  - type_id: "PerimeterRange"
    name: "Line range"
    category: line_range
    properties:
      line:
        type: PerimeterLine
        required: true
        description: "Line the range covers"
      addresses:
        type: string
        required: true
        description: "Covered detectors, e.g. 0-200,300-310"
    parents:
      PerimeterPartition:
        required: true

The hand-written partial of the range type implements ILineRange. A framework function cannot hold a device reference, so the adapter exposes it. The generated properties Line and Addresses carry the YAML names, so the interface is implemented explicitly:

public partial class PerimeterRange : ILineRange
{
    /// <inheritdoc/>
    Thing? ILineRange.Line => Line;

    /// <inheritdoc/>
    AddressSet ILineRange.Addresses => AddressSet.TryParse(Addresses, null, out var set) ? set : AddressSet.Empty;
}

Validate addresses with AddressSet.TryParse and AddressSet.OutsideOf against the line when the tree is built, so a typo is a configuration error, not a range that covers nothing.

Line and Addresses read the line and addresses properties of the range. Line is null while the reference is not set; such a range covers nothing. A partition has one range child per line; a detector can lie in the ranges of several partitions.

Methods

Method Effect
Arm(forced, timestamp, personId?) Arms the partition; returns an ArmingResult
Disarm(timestamp, personId?) Disarms the partition; returns true when it was armed
IsArmed Stored arming

Arm

  • Normal arm is refused while a detector in the ranges is active and not bypassed, or while a covered line has not reported its state since start. The partition publishes pq.event.intrusion.arming.failed and stays disarmed. ArmingResult.ActiveDetectors lists the blocking detectors as LineLocations (<line guid>#<detector>), ArmingResult.SilentLines the lines whose state is not known yet, and IsArmed is false.
  • A bypassed active detector does not block the arm.
  • A normal arm publishes pq.event.intrusion.armed.remote.
  • Forced arm arms regardless and publishes pq.event.intrusion.armed.forced.remote. Active detectors in the ranges alarm at once.
  • Rearm — an arm of an armed partition in alarm — ends the alarm and its memory, and the partition keeps guarding. It follows the arm rules: a detector that still stands refuses a normal rearm (arming.failed, the alarm stays), and after a forced rearm it raises pq.event.intrusion.alarm again.
  • Arm of an armed partition that is not in alarm changes nothing: it returns ArmingResult.AlreadyArmed (Unchanged is true) and publishes nothing.
  • After a successful arm, every covered line re-evaluates which detectors it guards.

Disarm

Disarm stores the disarming and publishes pq.event.intrusion.disarmed.remote. When the partition is in alarm, it publishes pq.event.intrusion.disarmed.alarm.remote instead and the alarm and its memory end. The covered lines stop guarding the detectors; an active detector becomes Open. Disarm on a disarmed partition is a no-op that returns false.

Alarm reset

ResetAlarm ends the alarm of an armed partition and its memory; the partition stays armed. It publishes pq.event.intrusion.cleared (with personId) and the partition shows intrusion.armed. A detector that still stands raises pq.event.intrusion.alarm again at once, as after a forced rearm. A partition that is not in alarm changes nothing and returns false.

Partition Alarm

A detector that enters alarm in an armed partition raises the partition alarm: the partition publishes pq.event.intrusion.alarm with location and detector. A detector in the ranges of several armed partitions alarms in each of them. The alarm lasts until a rearm, a disarm or an alarm reset. The alarm, tamper and cut events of the line itself come from LineDetector.

Alarm memory. The partition remembers each detector that raised its alarm. Its line shows a remembered detector in intrusion.alarm after the fence calms, until the alarm of the partition ends; then the line publishes intrusion.cleared for it. The memory is not stored, like the alarm: after a restart the partition shows its stored arming without alarm.

Commands

The framework handles the commands; the adapter writes no handler and lists no command in YAML.

Device type carries Commands (added implicitly) Handler
SoftwarePartition pq.command.security.arm, .arm.forced, .disarm, .alarm.reset LineCommandRunner.Arm, .Forced, .Disarm, .Reset
LineDetector pq.command.security.bypass, .bypass.cancel (parameter detector) LineCommandRunner.Bypass, .Cancel
  • A refused arm fails with a reason that names each line and its refusing detectors, e.g. Arming refused: active detectors Line A 105-106,150, or the lines without state.
  • A bypass without detector fails; it never bypasses the whole line.
  • Arm of an armed partition that is not in alarm, disarm of a disarmed one, an alarm reset without alarm, a repeated bypass and a cancel without bypass change nothing and fail with the stable reason AlreadyInTargetState (reason state pq.state.intrusion.armed, .disarmed, .bypassed; none for the reset and the cancel). The framework shows it to the operator and publishes no technical.command.failed for it.
  • A handler the adapter writes itself for the same command and device type takes precedence.

Start and Persistence

The function implements IStartable. Functions take part in start right after their Thing. On start the function shows the stored arming on the Partition function (armed or disarmed) before any line delivers its first picture. The first picture of a line then raises the alarm for every alarming detector of an armed partition.

The arming is stored on every change (SoftwarePartitionArming), so it survives restarts. Nothing runs on stop.

See Also