In TwinCAT, is there a way to get the real time (isolated) CPU usage from outside of the PLC code?

742 views Asked by At

The CPU usage of non-RT cores is available in MDP (either over ADS or UA), but I'm unable to find any way to get the CPU usage of isolated cores from user land (i.e. Windows).

I feel like there should be an easy way to read this since TcXaeShell is able to display the RT core usage in a chart.

Does anyone know how to do this, or, as a last resort, how to sniff out the protocol that TcXaeShell is using to get this info?

Real time usage chart in TwinCAT XAE Shell

UPDATE: Thanks to the insight from the comments below that the TC_CpuUsage FB is just using ADS reads in the background, I was able to find the ADS parameters I needed inside the TC_CpuUsage FB:

enter image description here

At first I had missed the detail that the AMS port should be that of the TwinCAT Real Time Server (200), and not that of the runtime port (default 851), so I was getting an ADS error. Once I changed the port, I was able to get the CPU usage of RT cores over ADS in my .NET application.

1

There are 1 answers

8
Jacek Domański On BEST ANSWER

Isn't TC_CpuUsage function block what you are looking for? If you wish to get CPU usage of more than 1 core, you need to run an instance of this FB in each program that is assigned to task from each core.