The dispatch mechanism
The data point mapping among the drivers is defined in the file dispatch.txt. Before a data point can be processed in the dispatch.txt it must be declared in driver specific *.txt file.
The most simple way to bind two data point is the 1:1 binding.
This entry is declared as follows:
[<Routing address of source driver> <source driver name> <data point address>] target = <Routing address of target driver> <target driver name> <data point address>
Example Modbus→BACnet:
[80 mod 1 holding 2386] target = 940 bac 96099.AI 32001
Naming the type of data point is optional. It must correspond with the type defined in the driver .txt file.
For type of data point the following definition is valid:
Type | Description |
---|---|
M | Integer value (binary data points, counters) which can/shall only be read by the gateway |
S | Integer value which can be either read or written by the gateway. (to M-BUS writing is not possible) |
X | Floating point value (with decimal place) which can/shall only be read by the gateway |
Y | Floating point value (with decimal place) which can be either read or written by the gateway. (to M-BUS writing is not possible) |
A | String, is used e.g. with BACnet Trends and ESPA4.4.4 data points |
Each entry can be extended with two optional features in order to control data point transmission.
threshold = value =
The function of the option threshold varies according to the type of data point.
With integer data points threshold = 1 means that the dispatch will be released only if source value is „1“.
For analog values threshold = 1 is used to stabilize a value. The source value is only dispatched in case it differs more than 1 from the current target value.
The option value is used to dispatch a fixed value to the target data point. It can also be a calculated value based upon the current source data point or any other data point.
Some examples:
# If source value = 1 (integer(M)) -> Target value 15 [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 threshold=1 value=15 # If source value = 2 -> Target value 27 [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 threshold=2 value=27 # all other source values -> Target value 99 [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 threshold=default value=99 # Source (analog value (X)) -> Target (only at change grater than 0,5) [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 threshold=0.5
# Source value + 1 -> Target value [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 value=increment # Source value - 1 -> Target value [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 value=decrement
Formulars can be used to calculate or to manipulate target data points. Following syntax is valid:
„X“ Within the section formula() this represents the source data point value
„$(<Routing address> <driver name> <address of data point>)“ represents the target data point
# Source value / 2.55 -> Target value [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 value = formula(X/2.55)
# Source value + value of an other data point-> Target value # The formula is only calculated if the source value (holding 2386) changes. [80 mod 1 holding 2386] target = 940 bac 96099.AI 32001 value = formula(X+$(80.X mod 1 holding 1000)) # The formula is calculated when holding 1000 is changed. [80 mod 1 holding 1000] target = 940 bac 96099.AI 32001 value = formula($(80.X mod 1 holding 2386)+X)
Via the dispatch mechanism, the individual status flags of the data points can also be queried and assigned to a data point. In the example the flag „valid“ and the flag „fault“ of a LON data point are mapped to a binary BACnet data point.
[10 lon object 2] value = formula(if($(10 lon object 2).valid;1;0)) target = 940 bac local.BI 2
[10 lon object 2] value = formula(if($(X).fault;1;0)) target = 940 bac local.BI 3
Within the section formula() following operators can be used:
Operator | Description | Example |
---|---|---|
one-digit operators | ||
+ | Sign remains | +X (+1 → 2) |
- | Change of sign | -X (-1 → 0) |
~ | Invert | ~X (~21 → 10 / ~10101 → 01010) |
! | Not | !X (!1 → 0) |
2-digit operators | ||
^ | Bit Xor | |
| | Bit Or | |
& | Bit And | |
|| | Or | |
&& | And | |
== | Indentity | |
!= | Imparity | |
> | Larger | |
>= | Larger or equal | |
< | Smaller | |
< = | Smaller or equal | |
+ | Add | X+5 (9+5 → 14) |
- | Subtract | X-5 (9-5 → 4) |
* | Multiply | X*5 (9*5 → 45) |
/ | Divide | X/5 (9/2 → 4) |
% | Modulo | X%5 (9%2 → 1) |
Functions | ||
systime | GetSysTime | |
time | GetTime | |
date | GetDate | |
hour | GetHour | |
minute | GetMinute | |
second | GetSecond | |
year | GetYear | |
month | GetMonth | |
day | GetDayOfMonth | |
yday | GetDayOfYear | |
mday | GetDayOfMonth | |
wday | GetDayOfWeek | |
curtime | GetSysTime | |
One-digit functions | ||
sin | Sinus | sin(X) angle X radian (sin((45°*PI)/180) → 0.707107) |
cos | Cosinus | cos(X) angle X radian (cos((45°*PI)/180) → 0.707107) |
tan | Tangens | tan(X) angle X radian (tan((45°*PI)/180) → 1) |
asin | Arcus Sinus | asin(X) |
acos | Arc Cosinus | acos(X) |
atan | Arcus Tangens | atan(X) |
exp | Exp | exp(X) (eX) |
fabs | Fabs | fabs(X) (value of X) |
floor | Floor | floor(X) (round to next smaller natural) |
ceil | Ceil | ceil(X) (round to next higher natural) |
log | Log | log(X) (ln(X), nat. logarithm) |
log10 | Log10 | log10(X) (log10(X), logarithm base 10) |
sqrt | Square root | sqrt(X) (sqrt(9) → 3) |
2-digit functions | ||
atan2 | BinaerAtan2 | |
fmod | BinaerFmod | |
pow | BinaerPow | |
max | BinaerMax | |
min | BinaerMin | |
round | BinaerRound | |
counter_init | CounterInit | |
3-digit functions | ||
if | if(a;b;c) represents „if a then b else c“ | if ( $(1 ugwc freemem)<1000; 1; 0 ) |
max3 | TertiaerMax | max3(5;6;7) → 7 |
min3 | TertiaerMin | min3(5;6;7) → 5 |