Integration on a circular set in simulink

4 views (last 30 days)
Hello, I would like to know if this is possible to obtain the same output as in the image below without having a diverging signal.
For instance, given a frequency of rotation (in rad/s), how to obtain the angle (in rad) in [-pi; pi[ without having a diverging signal?
Regards,
Pascal COMBES

Accepted Answer

Pascal
Pascal on 7 Oct 2015
Hi,
I was glad to discover by chance that this problem is solved by integrator wrapping in MATLAB Simulink 2015b (maybe in 2015a, but almost certainly not in 2014b). See for details: http://fr.mathworks.com/help/simulink/slref/integrator.html, paragraph "wrapping cyclic states".
I did not know if this question caused the development of this function but this is exactly the feature I desired (the exemple of trigonometric computations is even proposed). My thanks to MathWorks!
Regards,
Pascal COMBES

More Answers (1)

Drew Davis
Drew Davis on 8 Jun 2015
If you have a signal that is > 0 for all time entering in the inport of the model, as time approaches infinity the signal downstream of the integrator will approach infinity. The way to work around this for oscillatory signals is to create a sort of "wrap from -pi to pi" set of blocks or subsystem that performs this function as you have in your example.
You can add a saturation to the output signal of the integrator but it does not sound like that is what you are trying to do.
  1 Comment
Pascal
Pascal on 9 Jun 2015
Hello,
Your first proposition is exactly what I use. This improves the solution of the system (there is no "solver error" any more, in the range I use). This is due to the fact that sin(k*2*pi) is not 0 and increases as k increases, whereas sin(mod(k*2*pi), 2*pi) seems to be 0 for all the range of values I use.
Your second proposition however is not what I want to do.
I would like to have a block which has the output of the above sub system but without the possibly diverging system.
I tried resetting the integrator to its output +/-2*pi when it reached -pi/+pi, but this creates an algebraic loop which is difficult to solve.
Regards,
Pascal COMBES

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!