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.

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 |
- TwinCAT Database Server project was created.
- 1. Add and configure the database connection.
- 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.
- 3. Then the ADS device from which the ADS symbols are to be read is set up.
- 4. The symbols are created with the target browser.
- 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.
- 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.
- 7. Then the ADS device and the symbols are selected, as described in steps 3 and 4.
- 8. The events are also store in a standard table structure.
- 9. Finally the energy data are saved at 1-minute intervals.
- 10. For the energy data the ADS device and the symbols are also selected.
- 11. The energy data should be stored in a custom table structure, with the various symbols assigned to the columns.
- Logging can now be started and monitored with the AutoLog Viewer.