Optimizations
In case of trouble with OPC-Server performance please check following steps :
1. Minimize OPC-Namespace in TwinCAT-OPC-Server :
- OPC-Server should provide required variables in his namespace which are requested by an opc-client. It makes no sense to provide 700.000 PLC variables in the OPC-namespace but the opc-client just exchange values from 10.000 variables. The size of OPC-namespace will cause a longer opc-server-startup-time and will cause a high memory consumption .
Option 1 :
Export just part of PLC variables required for OPC. - In the TwinCAT PLC programming environment, select "Project"->"Option"->"Symbolconfiguration". Activate "Create Symbol", and use the mouse to select under "Configure Symbolfile..." the areas that you want to export (e.g. POUs and global variables). After compiling the PLC-project the new symbolfile "<yourProjectName>.sym" will be in the same folder as your plc-project.
- Each compiling of the PLC-project will automatically update the symbolfile.
- The OPC-Server imports structure and array-elements out of *.SYM files.
- Option 2 :
Mark PLC-variables in the PLC-code to be relevant for OPC. This way is based on the TwinCAT export file *.tpy.
Detailed info
2. OPC-Server : Running as EXE or DLL ?
- Arguments for working with EXE :
- One single OPC-client will access data from TwinCAT-OPC-Server
- The OPC-Client is installed on a different PC , the network has to be crossed via DCOM. - Arguments for working with DLL :
- More than one OPC-Client will communicate with the OPC-Server : Instead one single OPC-Server shares his CPU time to multiple opc-clients, the OPC-Server should work as a DLL : As a result each OPC-Client will have "his personal" instance of the OPC-Server with each opc-server having a separate ADS-communication channel into the ADS-device like the PLC.