Clear Filters
Clear Filters

Best practice for infinitely integrating component

16 views (last 30 days)
Lars
Lars on 30 Aug 2024 at 20:59
Answered: Shivam Gothi on 31 Aug 2024 at 5:44
I am working on an inverter system using a C2000 F280049C launchpad and it recently occurred to me that using a discrete time integration of my base frequency, ω, to generate the phase angle of the output, ωt, could lead to problems if the system runs for long enough for the value of ωt to exceed the maximum value for its datatype.
The F280049C uses a 32-bit system and if the value gets stored as a float, I realize it probably won’t saturate any time within the next millennium, but if I use an int (which might be more efficient?) it seems like a more realistic problem.
Regardless, I do not like the thought of including an infinitely integrating component in my design.
I have temporarily resolved the issue above by using a counter which resets to 0 after reaching 2pi, but this is not a viable solution for other applications such as the phase output from a PLL.
So, I am wondering if there are any best practices for dealing with potentially infinite integration.

Answers (1)

Shivam Gothi
Shivam Gothi on 31 Aug 2024 at 5:44
Hello @Lars,
The angular frequency (ω) is almost constant. Therefore its integration will yield the output that will be a ramp, evantually causing the the output to be keep on rising. This is indeed true!
However, since the output represents an "angle" value, multiples of (2π) (such as (0, 2π, 4π...) correspond to the same angle. Therefore, resetting the integrator to 0 after reaching (2\pi) is not a "temporary" solution, but rather the correct approach. It is known as the "Integrator Wrap-up State."
Simulink provides an "Integrator with Wrapped State" block that offers this feature.
For further clarification, please refer to the MATLAB documentation here:
The documentation also recommends "wrapping the state" to obtain the angle.
I hope this clarifies any doubts you may have

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!