# Configure rule chain

## Overview

<div data-full-width="true"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/vFN1Y1OCxVzsmvIglVTT/Rule%20chain%20konfig.png" alt=""><figcaption></figcaption></figure></div>

<table data-full-width="true"><thead><tr><th width="95"></th><th width="223"></th><th></th></tr></thead><tbody><tr><td><strong>[A]</strong></td><td>Start/Stop Chain</td><td><strong>Starts or stops</strong> the current rule chain.</td></tr><tr><td><strong>[B]</strong></td><td>Trigger</td><td>Select whether the trigger <strong>event-based</strong> or <strong>cycle-based</strong> should be. <a href="#trigger">-> Trigger</a></td></tr><tr><td><strong>[C]</strong></td><td>Trigger settings</td><td>Here the <strong>trigger can be configured</strong> in the app. <a href="#trigger">-> Trigger</a></td></tr><tr><td><strong>[D]</strong></td><td>Code view</td><td>Shows the <strong>Code view</strong> entered in "Asset Modeling".</td></tr><tr><td><strong>[E]</strong></td><td>errors</td><td>Shows how many <strong>errors</strong> are present. Clicking on it opens a window that shows the errors in detail.</td></tr><tr><td><strong>[F]</strong></td><td>Set sequence</td><td>After clicking on <strong>Set sequence</strong> you can determine the order of the blocks by clicking the elements in sequence <strong>[L]</strong> the <strong>Sequence of blocks</strong> in which they should be executed.</td></tr><tr><td><strong>[G]</strong></td><td>Delete</td><td>Here the <strong>rule chain can be deleted</strong> in the app.</td></tr><tr><td><strong>[H]</strong></td><td>Save</td><td><strong>Save your changes</strong>.</td></tr><tr><td><strong>[I]</strong></td><td>Nodes</td><td><strong>Nodes</strong> are the <strong>interfaces to the Eliona system</strong>that represent various actions or data links.</td></tr><tr><td><strong>[J]</strong></td><td>Conditions</td><td>These can be used to create <strong>Conditions</strong> between the nodes, including <strong>time-based conditions</strong>.</td></tr><tr><td><strong>[K]</strong></td><td>Operations</td><td>Performs <strong>logical operations</strong> (e.g. AND, OR) within the rule chain.</td></tr><tr><td><strong>[L]</strong></td><td>Linking area</td><td>Area in which the <strong>Nodes</strong> and <strong>Connections</strong> are placed and linked with each other.</td></tr></tbody></table>

## Create a rule chain step by step

1. Make sure that you are in the configuration of the desired rule chain.[ -> Open the configuration of an existing rule chain.](https://docs.buildings.ability.abb/collection/english-v14/documentation/alarms-rules-and-escalations/rule-chains/open-the-configuration-of-an-existing-rule-chain)
2. **Select trigger**\
   Decide whether the rule is triggered by events or cycles and configure the *asset* or the time interval. [-> Trigger](#trigger)
3. **Add blocks**\
   Drag the required blocks by *drag and drop* onto the workspace \[L]. [-> Add blocks](#bausteine-hinzufugen)
4. **Configure blocks**\
   Click the gear icon in the block to make specific settings such as *asset*attribute or conditions. [-> Configure blocks](#baustein-konfigurieren)
5. **Connect blocks**\
   Connect the blocks by drawing a line from an **Output pin** to an **Input pin** (pay attention to matching colors). [-> Connect blocks](#bausteine-verbinden)
6. **Check errors**\
   Use the error window to locate and fix errors. [-> Errors](#fehler)
7. **Set sequence**\
   Determine the execution order of the blocks in the “Set order” mode. [-> Set sequence](#reihenfolge-festlegen)
8. **Save changes**

   Don't forget to save your changes **\[H]**

***

## Trigger

When **Trigger \[B]** you can choose whether the rule chain should be **event-based** or **cycle-based** triggered:

* **Event-based**: In this case, in **\[C]** a **Asset and its attribute** must be selected. Every time new data is written to this attribute, the rule chain is triggered automatically.

  <div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/CZr8xUaxy595zdND1epm/image.png" alt="" width="324"><figcaption></figcaption></figure></div>
* **Cycle-based**: If the rule chain should be triggered cyclically, you can specify in **\[C]** the number of **seconds** after which the rule chain is executed at regular intervals.

  <div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/tAMMMk7tkVmuqRa1ckdH/image.png" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="info" %}
Output nodes are only triggered when the incoming value changes.
{% endhint %}

***

## Code view

In the **Code view** you can view the created **JSON code** of your rule chain and edit it. To activate the **Code view** it, click on **\[D]**. Once this is activated, the JSON code of the rule chain is displayed, containing the configuration and sequence of the nodes and conditions. You have the option to change the code directly to make specific adjustments instead of using the visual interface.

<figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/9NU1aTc5CB3qKV4yuNRl/image.png" alt="" width="563"><figcaption></figcaption></figure>

***

## errors

If you click on **Errors \[E]** a window opens that shows all existing errors in detail.

<figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/yQL9oqZscuFXxcesQHp8/image.png" alt=""><figcaption></figcaption></figure>

By clicking the **localization icon** <img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/UrWtInFESlG11Hanr1Rh/image.png" alt="" data-size="line"> you can jump directly in the **linking area \[L]** to the element that caused the error.

***

## **Set sequence**

Click on **Set sequence \[F]**, to display the **execution order** of the nodes in the rule chain.

* Once this mode is activated, you can click the nodes in the **linking area \[L]** one after another to determine their execution order.
* The **Order number** is automatically incremented and appears at the top right of each node. This lets you see directly in which order the nodes are executed.

***

## Add blocks

To create a rule, the desired blocks can be dragged by *drag and drop* from the right sidebar to the field **\[L]** and dropped there. Each block represents a specific function that can be used in the rule chain.

<figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/nfZFLUC1rgannOsB5rJh/GIF%2014.10.2024%2007-47-15.gif" alt=""><figcaption></figcaption></figure>

## Configure block

To configure a block, click the gear icon at the top right of the block. This opens a window in which the individual settings of the block can be adjusted, e.g. the number of input and output pins, the *asset*to be used, the attributes or the conditions.

<figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/gMsBxn1p40JKw1MAOoqx/Rule%20chain%20konfig%20(3).png" alt="" width="375"><figcaption></figcaption></figure>

## Connect blocks&#x20;

Blocks are connected to each other by drawing a line by *drag and drop* from an output pin to an input pin of another block. Make sure that the output and input pins have the same color:

* **Red** stands for numerical values.
* **Blue** stands for boolean values (true/false).

Only pins with the same color can be connected to each other to ensure correct data transfer.

**Dynamic pin expansion**

If all existing pins of a block are already occupied, a new pin appears when hovering over an occupied pin. This can be used to create a connection to another input. As soon as the connection has been created, the new pin is automatically activated and added permanently.

<figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/brnoTMoklW7Sp3QHYEWj/DynamischePin-Erweiterung.gif" alt=""><figcaption></figcaption></figure>

### Visualization of values after execution

After a rule chain has been saved and executed at least once, the current values at the input and output pins of the blocks are displayed in purple. These values show which data is flowing through the rule chain and allow direct verification of the logic.

{% hint style="info" %}
The displayed values are updated each time it is executed again and help with troubleshooting and optimizing the rule chain.
{% endhint %}

***

## The blocks

Blocks are the basic elements of a rule chain. Each block performs a specific function, e.g. retrieving data, setting conditions, or executing actions such as sending alarms or emails.

Blocks can be connected to each other to control complex processes. The data flow is managed via input and output pins, and only compatible pins can be connected to each other.

In the configuration of a block, a **Note** can also be stored. This is used to document important information or explanations directly in the block and makes the rule chain easier to understand.

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/kEpIsrYnxtSuO5beW4Ld/image.png" alt="" width="211"><figcaption></figcaption></figure></div>

### **Nodes**

#### **Retrieve data**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/kWyIwxpqZP3DgrWkh07y/image.png" alt=""><figcaption></figcaption></figure></div>

**Function**: This block reads heap data from a specific *asset* and its attribute.

**Configurable settings**:

* ***Output pins*****:** You can configure multiple output pins to send the data to various other blocks.
* ***Asset and attribute*****:** The specific *asset* and the associated attribute whose data is to be queried.

#### **Write data**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/FCuL25bHSRlKcpp1o6Z0/image.png" alt="" width="330"><figcaption></figcaption></figure></div>

**Function**: Sends data to a defined *asset* and writes the specified value to a particular attribute.

**Configurable settings**:

* **Input pins:**
  * **Trigger pin:** Triggers writing the value.
  * **Value pin (optional):** If this pin is used, the value is taken from the connected source. Otherwise, the value can be entered manually.
* **Asset, attribute:** Selection of the asset and associated attribute into which the data is to be written.
* **Value:** If no value pin is used, a fixed value can be defined here.

#### **Alarm**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/94K7fknRyjxZruZEHAvC/image.png" alt="" width="331"><figcaption></figcaption></figure></div>

**Function**: Triggers an alarm for a specific *asset* when certain conditions are met.

**Configurable settings**:

* ***asset*****:** The *asset*, for which the alarm is triggered.
* ***Priority*****:** The urgency of the alarm (e.g. high, medium, low).
* ***Acknowledgement*****:** It can be specified whether the alarm must be acknowledged manually.

### **Ticket**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/t39QUsouitl7m1HXIYUd/image.png" alt="" width="328"><figcaption></figcaption></figure></div>

**Function**: Creates a ticket for tracking issues or tasks associated with a *asset* associated with a

**Configurable settings**:

* **Asset:** Selection of the asset to which the ticket refers.
* **Priority:** Definition of the urgency of the ticket (e.g. low, medium, high).
* **Assigned person:** Selection of the recipient responsible for handling the ticket.
* **Reason:** Selection of the reason for the ticket from predefined categories.
* **Title:** Enter a meaningful title for the ticket.
* **Description:** Detailed description of the problem or task.

#### **Send email**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/dNU9HyxJCPCUxuTD5Ola/image.png" alt=""><figcaption></figcaption></figure></div>

**Function**: Sends an email notification to a specific person or group.

**Configurable settings**:

* ***Subject*****:** The subject of the email.
* ***To*****:** The email address(es) of the recipient.
* ***Text*****:** The actual content of the email.

#### Script

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/ewSQjzl8gRRU7YtCbxO2/image.png" alt=""><figcaption></figcaption></figure></div>

**Function:** The **Script block** enables the execution of a script from the [-> *Script Engine* ](https://docs.buildings.ability.abb/collection/english-v14/documentation/engineering/script-engine)within the rule chain. Execution is controlled by a boolean input value.

**Configurable settings:**

* **Script:** Selection of the script to be executed from the *Script Engine*.

{% hint style="warning" %}
IMPORTANT: Script must be set to "Event triggered" in the grid
{% endhint %}

***

### **Conditions**

### **Condition**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/logpFQk6zVAaH8S4QHxn/image.png" alt="" width="329"><figcaption></figcaption></figure></div>

**Function**: Represents a condition that is checked before the rule chain is executed further and outputs the boolean result of the check. This can perform numerical comparisons between inputs.

**Configurable settings**:

* ***Number of input and output pins*****:** You can configure the number of pins to link multiple conditions.
* ***Comparison operations*****:** Choose from “equal”, “greater than”, “less than”, “greater than or equal”, “less than or equal”.
* ***Value*****:** If only one input pin is used, a fixed value can be entered for comparison. If multiple input pins are used, the inputs are compared with each other.

#### **Time**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/JOWXGuPMZPNcfo0TeANn/image.png" alt="" width="327"><figcaption></figcaption></figure></div>

**Function**: Inserts delays into the rule chain in order to execute events with a delay or cancel them.

**Configurable settings**:

* ***Number of input and output pins*****:** Determine how many delays can be set up.
* ***Condition*****:** TON (on-delay) and TOFF (off-delay).
* ***Delay time*****:** The delay in seconds to be applied.

#### Schedule

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/7q3bPbwIdWqFRL1pPz1d/image.png" alt="" width="328"><figcaption></figcaption></figure></div>

**Function:** The **Schedule block** enables a rule chain to be triggered based on a defined schedule. Within the specified time window, the block outputs a **"true"** signal, outside this period the output remains **"false"**.

**Configurable settings:**

* **Schedule type:** Selection of the schedule, e.g.
  * **Time Schedule** – control based on a defined time.
  * **Days Schedule** – control based on specific days of the week.
* **Begin time:** Start time of the active period (hh:mm) (*only for Time Schedule*).
* **End time:** End time of the active period (hh:mm) (*only for Time Schedule*).
* **Active days:** Selection of the days of the week on which the rule should be active (*only for Days Schedule*).

***

### **Operation**

#### **Or**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/hhCCZ1IBrYxxi9k4D4kH/image.png" alt="" width="329"><figcaption></figcaption></figure></div>

**Function**: Checks whether one of the input conditions is true or false and outputs the boolean value of this check.

**Configurable settings**:

* ***Number of input and output pins*****:** Determine the number of conditions to be checked.

#### **And**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/Zqi4IxdbsijNSfgOz5E1/image.png" alt="" width="329"><figcaption></figcaption></figure></div>

**Function**: Checks whether all input conditions are true and outputs the boolean value of this check.

**Configurable settings**:

* ***Number of input and output pins*****:** Determine the number of conditions that must be true at the same time.

#### **Arithmetic**

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/nMGrYtN2Tr65MydEF9d7/image.png" alt=""><figcaption></figcaption></figure></div>

**Function**: Performs mathematical calculations with the input parameters to generate a new value.

**Configurable settings**:

* ***Number of input pins*****:** Determine how many values go into the calculation.
* ***Operation*****:** Choose between addition, subtraction, multiplication, and division.
* ***Value*****:** An optional fixed value included in the calculation.

### Other

#### Note

<div align="left"><figure><img src="https://content.gitbook.com/content/Nyvwhz1kEMXcHf4HLuZ8/blobs/1BsacWC1fhtcIvUs1OZC/image.png" alt=""><figcaption></figcaption></figure></div>

**Function:** The **Note block** serves as a purely informational element within the rule chain. It allows notes or comments to be added to improve the clarity of the rule chain.

**Configurable settings:**

* **Text field:** Enter any note or description.
