You can use a “Trace” to follow the value curve of variables on the controller in a similar way as a digital sampling oscilloscope. At application runtime with trace, all statements are executed first within the task cycle. Then, data sampling starts with value storage including time stamps. These time stamps are relative and refer to the start time of the data sampling. The data yields a discrete time signal and CODESYS displays its course in the trace editor.
A "sample" (data record) is composed of the value and the time stamp. The runtime system writes the samples to a buffer with a definable size. CODESYS requests the data, saves it in the trace editor buffer, and displays it in the trace diagram as a function of time. You can monitor the value curve of the configured variables continually because CODESYS displays the latest data.
You can provide a trigger to the data sampling. When the trigger is released, the data sampling is halted and the data is displayed around the trigger time.
The configuration and the display of a trace are possible in the CODESYS project by means of trace objects in the trace editor. There are the following two object types:
-
“Trace”: Inserted below the IEC application in the device tree. This kind of object always contains strictly an application-specific trace configuration. You can download this trace configuration to the controller and run it with the application.
-
“DeviceTrace”: Inserted below the device object in the device tree. If the PLC supports a "Trace Manager", then you can use one or more “DeviceTrace” objects to access one or more traces that are running on the controller. These can be both application-specific or controller-specific traces. For example, a controller can support traces for recording the processor load. Menu commands allow for access from the CODESYS project to the Trace Manager in the device.
Access to the Trace Manager from IEC code is possible by means of the functions from
the library CmpTraceMgr.library
. For more information, see the library documentation.




NOTICE

A running data sampling with trace can lead to a significant increase in the cycle time of the IEC task.




NOTICE

Data sampling with trace also continues running after logging out of the device.
-
See also: ⮫ Trace Configuration
-
Runtime system component CmpTraceMgr, Trace Manager
-
Data sampling after triggering
-
Saving samples to a file