Kepware Drivers > B-C Drivers > Beckhoff TwinCAT > Appendix — SYSTEMINFO Global Variables in a TwinCAT PLC Project
Appendix — SYSTEMINFO Global Variables in a TwinCAT PLC Project
Appendix — SYSTEMINFO Global Variables in a TwinCAT PLC Project
Because the PLC system global variable "onlineChangeCount" is disabled by default, the PLC project must be changed to include it. The variable is added through the correct PLC library, which depends on both the version of TwinCAT PLC Control and the target PLC system type (such as PC controller, BC controller, BX controller, and so forth) being used.
 
Including the "onlineChangeCount" variable in a PLC will allow the server project to access PLC variables using tag handles. Without it, the server must use fully qualified Symbolic information strings in each tag read. The number of bytes in a Symbolic information string can be several times larger than the number of bytes in a tag handle. For more information on adding the "onlineChangeCount" variable, refer to the instructions below.
 
Note: The following example applies to TwinCAT development environment version 2.11, and describes how to include the SYSTEMINFO variables in a TwinCAT PLC project where the target system is a PC controller. It assumes there is a pre-existing PLC project. The Tc2_System library is now part of the standard TwinCAT 3 PLC template; however, the library must be added if it is not already listed in the TwinCAT 3 PLC project's Library Manager to prevent using fully qualified symbolic information strings each time tag data is accessed.
1. In TwinCAT PLC Control, load the PLC project. Do not login.
2. Next, locate and open the Resources tab at the bottom of the Object Organizer. Then, expand the Resources tree and double-click on Library Manager.Note: The Library Manager should be displayed in the TwinCAT PLC Control's work area. All libraries that are attached to a PLC project will be listed in the top left of the Library Manager. New projects should only have the "STANDARD.LIB" library attached.
3. To add another library, right-click in the open area beneath "STANDARD.LIB" and select Additional Library. Then, locate and double-click on PlcSystem.lib. Note: The top left of the Library Manager should now display "PlcSystem.lib".
4. Return to the Library Manager. Then, select PlcSystem.lib and open the Data Types tab.
5. Next, open the SystemDataTypes folder and select the SYSTEMINFOTYPE structure. The variable "onlineChangeCount" should be included within the Library Manager.
6. Login to the PLC project.
7. In the Resources tree, open the Global Variables folder. Then, double-click on the Global_Variables icon. At this point, the variable "onlineChangeCount" should appear as an element of structure "SystemInfo" in the work area. Important: The "SystemInfo" structure will only be displayed within "Global_Variables" after the user has logged in to the TwinCAT PLC Control.
 
Was this helpful?