Problem with joint angular initial condition in SimMechanics.

1 view (last 30 days)
I have a simple pendulum system in SimMechanics, the pendulum body block is connected to a revolute block which is attached to a initial condition block. Everything is fine dynamics-wise.
However let's say I want to initialize the pendulum at an angle of 1.1*pi, all angles are positive measured anticlockwise from the bottom position, and negative in the clockwise direction. The problem arises when the simulation runs. When I print out the angle of the pendulum at each time step, I discover that the pendulum was initialized with an angle of MINUS 0.9*pi, i.e the model takes my initial condition angle and returns the angle between -pi and +pi which corresponds to the same point. I don't want this to happen! Is there a way to get the solver to treat my initial condition as exactly what it is?
NOTE: I am aware of the "Continuous Angle" block which I am using when I measure the angle, this works fine once the simulation is under way (i.e there are no discontinuities in angle measurement when my pendulum makes a loop) but it doesn't help the fact that the angle is initialized incorrectly...
Any help would be greatly appreciated!
  1 Comment
SAMAR
SAMAR on 25 Feb 2013
dude, try to take the modulus value of the angle and then integrate with respect to time., so after 360 degree of rotation, make ur initial value to zero by making any conditional subsystem.

Sign in to comment.

Answers (1)

Steve Miller
Steve Miller on 6 Mar 2018
You should add the proper offset to the measured value so that your measurements start with the value you expected.
--Steve

Community Treasure Hunt

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

Start Hunting!