Memory Management

The power monitoring library uses parts of the Condition Monitoring library, which internally uses TcCOM objects. The TcCOM objects are provided by the installed drivers. The instances are created dynamically in the TwinCAT AMS router memory.

Necessity for dynamic memory management

All memory requirements and initializations are implemented or performed during the initialization phase. Since the number of elements of the input data and the internal structures depend on the configuration of the respective function blocks, the memory space for them is allocated dynamically as a matter of principle. This happens automatically when the Condition Monitoring library is used.

Since all memory allocations occur during initialization, and therefore the initialization of function blocks may require a relatively large amount of memory under certain circumstances, the initialization at this point may fail due to lack of memory, but not later.
The allocated memory is released again once the object is deleted.

TwinCAT router memory for dynamically generated objects

The buffers reserved by the Condition Monitoring library are created in the TwinCAT AMS router memory when function blocks are initialized, so that they are available for execution under real-time conditions. Certain functions, such as high-resolution histograms and quantiles as well as the calculation of spectra with very high resolutions, require considerably more router memory than conventional control programs. Therefore, the router memory may need to be increased.

Adapting the router memory

The standard size of the router memory is 32 MB. The current setting is shown in the AMS Router Information dialog.

To open the dialog, right-click on the TwinCAT System Service icon in the system tray and select the command Router > Info in the system menu that opens.

Memory Management 1:

To increase the router memory, open the real-time settings in TwinCAT Engineering and enter a value in MB in the TwinCAT configuration (TwinCAT project tree > SYSTEM > Real-Time > Settings tab > Router Memory). Then activate the configuration.

Memory Management 2:

The adjustment of the router memory necessitates a reboot of the target device.

Memory Management 3: