# Devices and control logic

Fifth, some control logic and automation is introduced via PROP, DEVC, CTRL namelist groups.
Devices can be used to control various actions, like creating and removing obstructions, or activating and deactivating fans and vents.

## Devices, DEVC and PROP

From the point of view of FDS, sprinklers, smoke detectors, heat flux gauges, timers, thermocouples, etc., are devices that operate in specific ways depending on the properties assigned to them.
All devices are designated via the DEVC namelist group. The various parameters associated to devices can be grouped and entered in a PROP namelist group.
Each PROP line is identified by a unique ID, and it is invoked by the DEVC lines that share the same properties. For example, these lines:
define a group of heat detectors of the same model.
Every device has an associated QUANTITY. When the QUANTITY value passes above, or below, a prescribed threshold the device is activated or deactivated, and changes its state from .FALSE. to .TRUE. or the other way back.
The threshold can be as simple as a numeric SETPOINT or can be the result of an activation algorithm. For example, an activation algorithm is used for sprinklers, heat and smoke detectors...
The following table summarizes some DEVC parameters:
| Parameter | Type | Description | Unit | Default |
| ID | String | Identifier | | |
| QUANTITY | String | Name of quantity to output | | |
| XB(6) | Real | Volume, face or segment of measurement | m | |
| XYZ(3) | Real | Point of measurement | m | |
| IOR | Integer | Index of orientation | | |
| ORIENTATION(3) | Real | Direction vector | | 0,0,-1 |
| PROP_ID | String | Associated PROP line | | |
| SETPOINT | Real | Value at which device changes state | | |
| TRIP_DETECTION | Integer | Sign of derivative at first state change | | 1 |
| INITIAL_STATE | Logical | Initial state of device | | .FALSE. |
| LATCH | Logical | Device cannot change state multiple times | | .TRUE. |
See [FDS5 user's guide] for a detailed description of PROP parameters.

## Examples of devices

In the following paragraphs some sample devices are listed.

### Timer

The simplest example of device is just a timer:
It changes its state from .FALSE. to .TRUE. when the simulation time increases past 30 s.

### Thermometer

The following is a thermometer:
It changes its state when the temperature at point (1.2,3.4,5.6) increases past 60 °C.

### Smoke detector

A smoke detector is defined in the input file with an entry similar to:
The SD_29 smoke detector has the following properties:
* LENGTH is the characteristic length for the single parameter in Heskestad model and defaults to 1.8 m.
* ACTIVATION_OBSCURATION threshold can be set according to the value provided by the manufacturer. The default setting is 3.28%/m.
The smoke detector changes its state following the specific activation algorithm.

### Beam smoke detector

A beam detector is defined by:
The B_4 beam detector has the following properties:
* SETPOINT is the total % obscuration at which the detector activates.
* XB specifies the segment covered by the beam. The two endpoints must lie in the same mesh.
The beam detector changes its state following the specific activation algorithm.

### Sprinkler and heat detector

Here is a very simple example of a sprinkler:
A sprinkler, known as S_60, is located at a point in space given by XYZ. It is an acme spk type sprinkler, whose properties are given on the PROP line:
* RTI is the Response Time Index in units of m$^{1/2}$s$^{1/2}$.
* ACTIVATION_TEMPERATURE is the link activation temperature in °C.
* FLOW_RATE is the flow rate of released water expressed in units of l/min.
* PART_ID refers the properties of the droplets water drops, defined by a PART namelist group.
This example defines a heat detector, which uses essentially the same activation algorithm as a sprinkler, without the water spray:

## Basic control logic

In many fire scenarios, the opening or closing of a door or window can lead to dramatic changes in the course of the fire. Sometimes these actions are taken intentionally, sometimes as a result of the fire. Within the framework of an FDS calculation, these actions are represented by the creation or removal of solid obstacles, or the opening or closing of vents.
The change of state of a device can be used to trigger an action to occur, like activating and deactivating obstructions, boundary conditions and holes. For example, devices change of state can create or remove obstructions, switch on or off burners, ventilators and fans.
For example, in the lines:
the DEVC creates a timer named my timer. The OBST existence depends on the DEVC, thanks to the DEVC_ID='my timer' parameter. When the simulation starts the timer has a .FALSE. initial state, thus the OBST is not activated and does not obstacle the flow domain. Then at 30 seconds the timer changes its state to .TRUE., the OBST is activated and comes to life.
The following parameters dictate how a device will control something:
* SETPOINT is the value of the device at which its state changes. For a detection type of device (heat or smoke detectors) this value is calculated from the device’s activation algorithm and need not be specified on the DEVC line.
* TRIP_DIRECTION, a positive integer means the device will change state when its value increases past the SETPOINT and a negative integer means the device will change state when its value decreases past the SETPOINT.
* LATCH, if this logical value is set to .TRUE. the device will only change state once. Otherwise it can change its state several times.
* INITIAL_STATE, this logical value is the initial state of the device.
To remove and then re-create an obstruction in the same place, use two lines since the code simply sees this as two different obstructions:
A last example:
the hole is created when the activation algorithm of the heat detector gives the consensus. Note that a DEVC that is being used for a HOLE should not be used for anything else other than additional HOLE lines.
When a HOLE is deactivated, the obstruction to be cut out can have a different color and transparency than the original obstruction: just set the COLOR and a TRANSPARENCY value on the HOLE line. When the HOLE becomes activated, the void is created and the prescribed color disappears.
Also VENT activation can be controlled by DEVC state. For example, to control a burner with the device my timer, do the following:
Note that at 30 s, the VENT is activated and the burner boundary condition turns on. The prescribed t$^2$ ramp begins at 30 s and ends at 150 s, when HRRPUA reaches its maximum of 4000 kW m$^{−2}$.
Note that a MIRROR or OPEN VENT should not be activated or deactivated. The reason for this restriction is that abrupt changes in pressure can cause numerical instabilities.

## Advanced control logic

If you desire to control FDS objects using more complex logic than can be provided by the use of a single device and its SETPOINT, control functions can be specified using the CTRL namelist group.
A control function take as input the outputs of one or more devices and control functions. In this manner, complicated behaviors can be simulated by making functions of other functions. For most of the control function types, the logical value output of the devices and control functions and the time they last changed state are used as the inputs.
For any object that a DEVC_ID can be specified for (such as OBST or VENT), a CTRL_ID can be specified instead.
See [FDS5 user's guide] for broader discussion of the topic.