Home automation

This scenario example illustrates the configuration mode for building automation. Symbols are written to an MySQL database in three different AutoLog groups without additional programming, i.e. purely based on the configuration. Room temperatures are logged in the database at 5-minute intervals. Energy data are saved at 1-minute intervals. Events such as "lamp on", "lamp off" are stored.

Home automation 1:

Category

Configure Mode

Database used

MySQL

Compatible databases

Can be used for all supported database types

PLC function blocks used

None

PLC libraries used

Tc3_Database, Tc2_BABasic

Download

TF6420_Sample1_Homeautomation.zip

TwinCAT Database Server project was created.
1. Add and configure the database connection.
Home automation 2:
2. Since logging is to take place in three different tables, three AutoLog groups are appended to the database connection. First the temperature AutoLog group is configured. TheCycleTime is set to 300000 ms to match the 5-minute database logging interval.
Home automation 3:
3. Then the ADS device from which the ADS symbols are to be read is set up.
Home automation 4:
4. The symbols are created with the target browser.
Home automation 5:
5. Now you can select the table into which the temperature values are to be written. The AutoLog groups support two TableModes. The standard table structure is used for the temperature values. A tick indicates that the selected table has the correct structure.
Home automation 6:
6. Then the AutoLog group for the events is configured. The LogMode for the group is set to "onChange", the cycle time to 1000 ms. This means that the symbols are checked at 1-second intervals but a table entry is only created if a value changes.
Home automation 7:
7. Then the ADS device and the symbols are selected, as described in steps 3 and 4.
Home automation 8:
8. The events are also store in a standard table structure.
Home automation 9:
9. Finally the energy data are saved at 1-minute intervals.
Home automation 10:
10. For the energy data the ADS device and the symbols are also selected.
Home automation 11:
11. The energy data should be stored in a custom table structure, with the various symbols assigned to the columns.
Home automation 12:
Logging can now be started and monitored with the AutoLog Viewer.
Home automation 13: