Integration Thies weather station
This manual shows the integration of a Thies weather station Compact WSC11, 4.9056.10.000, using the "FB_BA_Weatherstation_Thies" template.
Version Templates:
- From 6.1.0.0
Required hardware:
- Thies Weather Station Compact WSC11, 4.9056.10.000 (ASCII format)
- KL6041, preconfigured to 22 bytes process image
Required additional library:
- Tc2_SerialCom
Adding the template:
- 1. Since version 6.1.0.0 of Templates_Tc3_BA2, you can call the template of the Thies weather station in the "Building Controller" project template.

- The calling template is FB_BA_BuildingAutomationServer. This is a template at the "Trade" level and is instantiated directly in MAIN:

- If the template is to be moved or reloaded into the project via the template repository, care must be taken to call it up below the Trade level as described in order to maintain the correct DPAD hierarchy.
Adding a fast task for serial communication
The serial terminal (KL6041) is configured to the following communication parameters during a PLC restart:
- Baud rate: 9600
- Data bits: 8
- Parity: none
- Stop bits: 1
- Handshake: RS485 HALFDUPLEX
The process image must be set to 22 bytes beforehand.
After that the actual communication between terminal and weather station starts.
The function blocks required for this are available in the Tc2_SerialCom library and are called in the "FastCycle" method of the "FB_BA_Weatherstation_Thies" template. This call must be assigned to a faster task than the existing PLC cycle task.
- 1. Right-click on POU in the PLC folder structure to open the context menu, select Add (1) and POU (2). Enter a name in the window that opens (example MAIN_fast) (3).
The POU type is a program in Structured Text (ST):
- In this program, the method FastCycle is now called:

- 2. Right-click on Tasks (1) to add a new item (2) and give it a meaningful name, for example FastTask (3):

- 3. Set this new task to a small cycle time. The 5 ms shown here are a recommendation.

- 4. A task reference must be created so that this task is available to the program part: Right-click on the project (1), select Add (2) and then Referenced Task (3).
- 5. A window will then open. There, select the task to which the reference should refer (4):

- The task reference now appears in the PLC part below. The function block that is to be called in this task can now be assigned to it.
- 6. Right-click on the task (1), select Add (2) and then Existing item (3).

- A window opens in which the call program can be selected.
- 7. Confirm your selection with OK

Adding the serial communication library
Dragging in the "FB_BA_WeatherStation_Thies" template does not automatically add the required serial communication library. This must be inserted manually:
Right-click on "References" (1) and select "Add library" (2). In the window that opens, select the "Tc2_SerialCom" library (3) and confirm with "OK" (4).

Creating program links
The link variables for the process image of the serial terminal are located in the "FB_BA_WeatherStation_Thies" template. However, just because of the implementation of the template, they are not automatically available for linking. To do this, the solution must be rebuilt once.
- It is important at this point that no other compilation errors occur in the program.
- 1. Right-click on PlcTaskInputs and select Rebuild Solution from the Build menu.
At this point, only the existing PLC task has a process image.
- After an error-free build, the link variables of the template are available and the FastTask also has a process image area.

- 2. First, select all input variables of the terminal process image (click on State and then press the down arrow key while holding down the Shift key) (1), then right-click and select Change Multi Link (2). Link to stRawDataIn (3) of the template.

- 3. Link the output data in the same way:
