FB_BA_Weatherstation_Thies
![FB_BA_Weatherstation_Thies 1:](Images/png/11733454859__Web.png)
This template prepares the data which are read from a Thies weather station via the function block FB_BA_ThiesWSC11 and makes them available in a globally declared variable structure stWeatherstation (see global variable list Site).
In addition, the hardware connection is established in this template via the variables stRawDataIn and stRawDataOut.
A detailed description of the integration of the weather station can be found here.
![]() | The initialization of the template takes place within the method FB_Init. |
Syntax
FUNCTION_BLOCK FB_BA_WeatherStation_Thies EXTENDS FB_BA_View
VAR_INPUT CONSTANT
SerialCommRst : FB_BA_Bv_OP;
WthStRst : FB_BA_Bv_OP;
SerialCommErr : FB_BA_BV;
Dstb : FB_BA_BV;
Rain : FB_BA_BI;
WthT : FB_BA_AI;
DewPtT : FB_BA_AI;
PrssAbs : FB_BA_AI;
PrssRel : FB_BA_AI;
HumAbs : FB_BA_AI;
HumRel : FB_BA_AI;
Brightness_N : FB_BA_AI;
Brightness_S : FB_BA_AI;
Brightness_E : FB_BA_AI;
Brightness_W : FB_BA_AI;
Dawn : FB_BA_AI;
GlobRadn : FB_BA_AI;
WndDir : FB_BA_AI;
WndSpd : FB_BA_AI;
Latd : FB_BA_AI;
Lngt : FB_BA_AI;
SunAzm : FB_BA_AI;
SunElv : FB_BA_AI;
END_VAR
VAR
ThiesWSC11 : FB_BA_ThiesWSC11;
bResetWeatherStation : BOOL;
bResetSerialCommunication : BOOL;
DataConversion : FB_BA_ThiesData;
tonSerialCommErr : TON;
tonDstb : TON;
stRawDataIn AT %I* : KL6InData22B;
stRawDataOut AT %Q* : KL6OutData22B;
fbSerialCtrl : SerialLineControl;
fbKL6Configuration : KL6configuration;
stTxBuff : ComBuffer;
stRxBuff : ComBuffer;
bSerialConfigError : BOOL;
nSerialConfigErrorID : UDINT;
bSerialCommError : BOOL;
nSerialCommErrorID : UDINT;
END_VAR
VAR_INPUT CONSTANT PERSISTENT
{attribute 'parameterUnit':= 's'}
nSerialCommErrDelay : UDINT := 10;
{attribute 'parameterUnit':= 's'}
nDstbDelay : UDINT := 10;
END_VAR
Inputs CONSTANT
Name | Type | Description |
---|---|---|
SerialCommRst | Restart the serial communication if it is permanently faulty due to a configuration error or during operation. | |
WthStRst | Restarting the weather station itself if it is permanently faulty. Here the PLC routine is restarted starting with the configuration and subsequent cyclic query. A hardware reset is not performed. | |
SerialCommErr | Message requiring acknowledgement: Serial communication or configuration permanently faulty. | |
Dstb | The weather station reports a malfunction. | |
Rain | Rain sensor. | |
WthT | Outside temperature [°C]. | |
DewPtT | Dew point temperature [°C]. | |
PrssAbs | Absolute air pressure [hPa]. | |
PrssRel | Relative air pressure [hPa]. | |
HumAbs | Absolute humidity [g/m3]. | |
HumRel | Relative Absolute Humidity [g/m3]. | |
Brightness_N | Directional light sensor north [Lux]. | |
Brightness_S | Directional light sensor south [Lux]. | |
Brightness_E | Directional light sensor east [Lux]. | |
Brightness_W | Directional light sensor west [Lux]. | |
Dawn | Dawn [Lux]. | |
GlobRadn | Global radiation [W/m²]. | |
WndDir | Wind direction [°]. | |
WndSpd | Wind speed [m/s] | |
Latd | Latitude of the installation site [°]. | |
Lngt | Longitude of the installation site [°]. | |
SunAzm | Current position of the sun [°]. | |
SunElv | Current sun elevation [°]. |
Variables
Name | Type | Description |
---|---|---|
ThiesWSC11 | Function block for unloading the data from the Thies WSC11 | |
bResetWeatherStation | BOOL | Reset weather station. |
bResetSerialCommunication | BOOL | Reset serial communication. |
DataConversion | Converts the Thies weather station data into project-specific data. Example brightness: conversion from kLux to Lux, because only this unit is supported by BACnet. | |
tonSerialCommErr | Error delay communication error. | |
tonDstb | Error delay weather station error | |
stRawDataIn | Input raw values from the serial terminal. | |
stRawDataOut | Output raw values to the serial terminal. | |
fbSerialCtrl | Communication block to the serial terminal. Runs in the fast task under the FastCycle method. | |
fbKL6Configuration | Configuration block to the serial terminal. Runs in the fast task under the FastCycle method. This is used to set the serial parameters (baud rate, etc), but not the process image (see Thies weather station). | |
stTxBuff | Communication variable between the fbSerialCtrl of the fast task and the ThiesWSC11 of the normal PLC task. | |
stRxBuff | Communication variable between the fbSerialCtrl of the fast task and the ThiesWSC11 of the normal PLC task. | |
bSerialConfigError | BOOL | Configuration error of the serial communication. |
nSerialConfigErrorID | UDINT | |
bSerialCommError | BOOL | Communication error of the serial communication. |
nSerialCommErrorID | UDINT |
Inputs CONSTANT PERSISTENT
Name | Type | Description |
---|---|---|
nSerialCommErrDelay | UDINT | Error delay communication error [s]. |
nDstbDelay | UDINT | Error delay weather station error [s]. |
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.35 | TF8040 | TwinCAT Building Automation from V5.0.0.0 |