Configuration Configuration of the TwinCAT OPC server https://infosys.beckhoff.com/content/1033/tcopcserver/Resources/12162179979/.htm: Configuration by variable import from TwinCAT PLC control Receiving Data from the TwinCAT I/O task [ } 22] : Configuration by variable upload from the TwinCAT I/O task Configuration of the TwinCAT OPC Server CE In general, the configuration of the TwinCAT OPC Server CE is like the configuration of the TwinCAT OPC Server. The most important information is given here: Set the active OPC XML configuration: PC: The TcOpcStartup.exe tool saves the current OPC XML configuration file in the registry CE:
By default, the file "\hard disk\TwinCAT\OPC\CurrentConfigOpc.xml" is entered in the registry as the current OPC XML configuration file The OPC XML file for CE works with the same XML scheme The OPC XML file must allow for the fact that paths are written using a different notation under CE: PC example: C:\Project123\Test.tpy Example CE: \hard disk\project\Test.tpy 6.1.2.1 Receiving data from the TwinCAT PLC 2.8 and higher 1st Step TwinCAT PLC TwinCAT 2.8 (or higher): With TwinCAT 2.8 or higher an TwinCAT OPC-Server 4.1.0.79 (or higher) the OPC-configuration has become very easy and has to be done just once.
After the PLC project has been compiled, there is always a file in the PLC project directory with the name structured as " .tpy". The *.tpy file is automatically replaced each time the PLC project is compiled. In the PLC Control navigate to "Projects.. Options... TwinCAT" and select "Download symbol description". With each compile the .typ file is now transported to target system and stored as e.g. "\TwinCAT\Boot\CurrentPLC_1.tpy" for first PLC-runtime system, or "\TwinCAT\Boot\CurrentPLC_2.tpy" for second PLC-runtime system etc. Which PLC variable is available via OPC ?
With adding simple information done by the declaration of the PLC-variable you can mark a PLC variable to be known by the OPC-Server. This helps to reduce the OPC-namespace. The OPC-DA Server will automatically connect to PLC runtime and provide PLC-variables which are marked for OPC-DA within the PLC-Control. Mark the PLC-variables with a comment to enable them beeing accessed by OPC-DA Server. Extra comments in PLC-IEC1131 Editor will modify the configuration of opc-server: Sample1: PLC variable "bMemAlarm"1 will not be available via OPC-DA-Server Sample2: Two instances fbTest and fbTest2 of FB_BLOCK1.
Due to fbTest is marked with (OPC:1), all members of FB_BLOCK1 are available via OPC-DA TS6120 19 Version: 1.2.0