error with the clock block while using the C2000 package support

Hi, I want to drive an electrical motor with an inverter that I made on PLECS. To drive the three different legs I introduced three modulation waves that I make with the C-Script block. Since the modulation waves depend on the time, I introduce the clock block. When I build the program it pops up an error window saying: The following components use the value of absolute time. This may cause overflow problems when a program runs for an indefinite time.

What can I do to solve this problem?

You can turn this error into a warning or completely ignore it by changing the parameter Usage of absolute time in the General tab of the Coder Options window. However, you should think twice before doing so.

Every floating point variable (such as time) has a resolution that decreases when the value increases. The relative spacing between two adjacent number in the machine’s floating point system is called eps. The absolute spacing to the next adjacent number of a floating point value x is x*eps.

For floats (single precision floating point), eps is around 1.1921e-7. For doubles (double precision floating point), eps is around 2.2204e-6. Whether the time is represented as a float or double is dependent on the Floating point format setting in the Coder Options.

This means that, for example, after running a simulation for one hour, the resolution of time is limited to 0.43 milliseconds when using floats. If you used the absolute time to generate a signal, it would only change at this rate after one hour.

This is why you really should not depend on the absolute time when generating signals - your signals will degenerate sooner rather than later. (The only exceptions to this rule are signals that only change a finite number of times, such as a step function).

In general, an integer tick counter is the preferred solution. For periodic signals, the tick counter should be reset to 0 after one period. In any case you should consider whether an integer overflow can occur and how to cope with this situation.