Hello.
I would like to know how to measure the time period between 2 point in the update code in the block C-Script. The command CurrentTime() just gives the time at the start of the period.
I need this to compare 2 different codes and tell which one is faster. Thanks.
The answer to this question does not really have anything to do with PLECS. The correct measurement of execution time in a multitasking system is quite complex and highly operating system dependent. The most reliable method is to use performance counters in the CPU, making sure that the measured thread is only executed on a single CPU core. Google “measure code performance in C” to get some hints. Whether these algorithms can be implemented in a C script is another matter.
The attached model measures the wall clock time between the start and end of a simulation. It can serve as an estimate of performance.
tictoc.plecs (6.35 KB)