TC_CpuUsageEx

TC_CpuUsageEx 1:

The function block TC_CpuUsageEx can be used to determine the current CPU usage of a TwinCAT CPU core. The function corresponds to the display of the CPU usage in the TwinCAT system menu under the real-time settings for the corresponding CPU core.

TC_CpuUsageEx 2: Inputs

VAR_INPUT
    bExecute : BOOL;
    tTimeout : TIME;
    sNetId   : T_AmsNetId;
    nCpuId   : USINT;
END_VAR

Name

Type

Description

bExecute

BOOL

The function block is enabled by a positive edge at this input.

tTimeout

TIME

States the time-out period that may not be exceeded by execution of the ADS command.

sNetId 

T_AmsNetId

AmsNetId (AMS network ID) of the TwinCAT computer whose CPU usage is to be read. An empty string may be specified for the local computer.

nCpuId

USINT

CPU ID of the TwinCAT CPU core to be used, see Real-Time | Settings tab

TC_CpuUsageEx 3: Outputs

VAR_INPUT
    bBusy    : BOOL;
    bError   : BOOL;
    nErrorId : UDINT;
    nUsage   : UDINT;
END_VAR

Name

Type

Description

bBusy 

BOOL

When the function block is enabled, this output is set and remains set until a feedback is received.

bError 

BOOL

If an error occurs during the transmission of the command, this output is set after the bBusy output is reset.

nErrorId 

UDINT 

Returns the ADS error number when the bError output is set.

nUsage  

UDINT 

The current CPU usage of a TwinCAT CPU core in %.

Requirements

Development Environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.4022.14

PC or CX (x86, x64, Arm®)

Tc2_Utilities (System) >= 3.3.25.0