Samples | PLC POU types with declaration and implementation areas Not every type of POU has both areas. The following table shows which types have a declaration area and which have an implementation area. The process of creating POUs and other PLC objects is described in Creating PLC objects [ } 229] . 6.5.7 Running static code analysis | Running static code analysis Starting with TwinCAT Build 4023.103, static code analysis can be launched via the Automation Interface. This allows for integration into CI/CD pipelines regardless of whether the analysis is enabled in the project. The analysis is called using ITcPlcIECProject3.RunStaticAnalysis .
The boolean parameter bCompile controls whether the project is recompiled before the analysis. Errors and warnings appear in the error list and in the output window in Visual Studio. ITcPlcIECProject2.CheckAllObjects is also available; it performs a complete compile-and-check routine and is independent of the project's static analysis configuration. Requirements TwinCAT XAE is installed and started. A DTE connection to the target instance is active. ITcSysManager is initialized in an STA thread. A PLC project is included in the solution. TwinCAT Build 4023.103 or later. C# sample The PLC project Tree Item is cast to ITcPlcIECProject3 . RunStaticAnalysis(true) compiles the code first.
RunStaticAnalysis(false) skips the build and performs only the analysis. ITcSmTreeItem plcProject = sysManager.LookupTreeItem(@"TIPC^PLC1^PLC1 Project"); // Cast to ITcPlcIECProject3 for RunStaticAnalysis ITcPlcIECProject3 plcProject3 = (ITcPlcIECProject3)plcProject; // true = compile first; false = analysis only, no build plcProject3.RunStaticAnalysis(true); // Check all objects (compile + check, available via ITcPlcIECProject2) TE1000 233 Version:
1.7.0 Tree Item Type Declaration area Implementation area Program POU Yes Yes Function POU Yes Yes Function block POU Yes Yes Action POU No Yes Method POU Yes Yes Property (Get/Set) POU Yes Yes Transition POU No Yes Enum DUT Yes No Struct DUT Yes No Union DUT Yes No Alias DUT Yes No Interface Interface Yes No Property (Get/Set) Interface Yes Yes Global variables GVL Yes No