![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1763734/image.png)
Best practice for infinitely integrating component
16 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1763594/image.png)
0 个评论
回答(1 个)
Shivam Gothi
2024-8-31,5:44
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1763734/image.png)
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!