Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

error with the clock block while using the C2000 package support

0 votes
35 views
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?
asked Sep 13 by Luca Mincato (32 points)

1 Answer

0 votes

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.

answered Sep 13 by Oliver Schwartz (495 points)
...