FB_CXProfiler

FB_CXProfiler 1:

Please use this function block only under Windows CE. If your operating system is Windows XP or XPe. than please use the more accurate Profiler function block from the TcUtilities.Lib.

The Profiler function block can be used to allow the execution time of PLC code to be measured. Internally, an instance of the GETCPUCOUNTER function block is called. The measurement is started by a rising edge at the bStart input and is stopped by a falling edge. The measurements are evaluated internally and are then made available for further processing at the stData output in a structure of type ST_CX_ProfilerStruct. As well as the current, minimum, and maximum execution times, the function block calculates the mean execution time for the last 100 measurements. The times measured are given in microseconds. The output variable stData.dwMeasureCycle provides information about the number of measurements that have already been carried out. To measure the execution time for a specific segment of the PLC program the measurement must be started by a rising edge at the bStart input when the segment to be measured starts and stopped by a falling edge at the bStart input at the end of the segment. A rising edge at the RESET input and simultaneous rising edge at the START input will reset all the variables at the DATA output. The measurements in the stData structure that have already been determined then become invalid and are re-calculated when the function block is called again.

FB_CXProfiler 2:

The times measured can differ from the true values, since a certain amount of time is needed just for the call of the GETCPUCOUNTER function block. This time depends on the computer and is included in the times that are found. Task interruptions i.e. by the NC are not detected and lead to higher values.

VAR_INPUT

VAR_INPUT
    bStart        :BOOL;
    bReset        :BOOL;
END_VAR

bStart: A rising edge at this input starts the measurement of the execution time. A falling edge at this input stops the measurement, and causes the current, minimum, maximum and mean execution times to be recalculated. The variable stData.dwMeasureCycle is incremented at the same time.

bReset: A rising edge at this input will reset the variables at the stData output. A rising edge at this input and simultaneous rising edge at START input will reset the variables at the DATA output.

VAR_OUTPUT

VAR_OUTPUT
    bBusy        :BOOL;
    stData       :ST_CX_ProfilerStruct;
END_VAR

bBusy: This output is set at the start of the measuring procedure and remains set until the time measurement has been completed. Once the bBUSY output has been reset, the latest times are available at the stData output.

stData: Structure of type ST_CX_ProfilerStruct with the measured times [in µs].