My good friend Doug, formerly of Pick of the Week fame, sent me an
e-mail last week with the subject “Model this.” The message contained nothing
more than a link to a
video. Doug started a new video
blog, and for this reason, I have decided to incorporate some video into
this post.
What is happening?
The video shows five metronomes sitting on a board, and when
they start, the timing is initially out of phase. The board is placed on top
of empty soda cans on their side, allowing the board to slide back and forth
with very little friction. The board couples the dynamics of the metronomes
and, in time, their phases synchronize. The synchronization of periodic
systems is a fascinating concept, and fun to watch. This effect was first
observed by Huygens
in the 17th century. You can find many related videos on YouTube, like this presentation of metronomes
with different frequencies and this experiment with five
metronomes.
The Challenge
In honor of Doug’s latest venture, here is a challenge: Can you model this in Simulink?
You can take many different approaches in modeling
this system. I hope to see implementations using base blocks as well as
SimMechanics.
Hints
To get you started, I have built a simple pendulum and cart model.
Download:
The solution I have explored only shows synchronization when
the pendulum angle of deflection is small. I recommend initial deflections of
around pi/8 or smaller for the angle of the pendulum.
I have even built a “metronome scope” which will display a
crude pendulum given the angle of deflection in radians.
How to submit a solution
Post your solution by October 15th to the File
Exchange with the keyword metronome. I will give out some prizes like
T-shirts and other stuff I find in the MATLAB Central prize closet. Please
post a comment if you have submitted a model to the file exchange, or if you
have questions about the challenge. Good luck!
At first I thought this challenge was going to be easy, I assembled a SimMechanics model, clicked play… but the pendulums are not synchronizing, as mentioned by Parasar in his post.
Then I thought, let’s try with Simulink. I implemented in a vector form the equations provided and then face two choices:
- By default, the coupling of the equations results in an algebraic loop. I never like to have an algebraic loop in a model, but tried to let the solver resolving the algebraic loop. The results are similar to the ones from Simemchanics. It looks like the Simulink algebraic loop solver is doing a job similar to the SimMechanics solver. I cannot explain the exact reason, but my guess is that the algebraic loop solver removes the non-linearity that makes the pendulums synchronize in real life.
- My standard way to remove algebraic loops is to introduce a delay in the feedback path. In that case, the pendulums synchronize but the model becomes instable. The maximum sample time of the Simulink solver must be adjusted to an appropriate value to obtain an acceptable tradeoff between synchronization and stability.
I implemented the model using a vector approach. It allows easily changing the number of pendulums and modifying the algorithm.
I hope you will provide explanations on why no one has been able to obtain the synchronization using SimMechanics or with an algebraic loop.
> I hope you will provide explanations on why no one has been able to obtain the synchronization using SimMechanics or with an algebraic loop.
Synchronisation cannot happen in a linear framework, that is a long known fact from electrical oscillators. Coupling them leads to several modes with slightly different resonance frequencies (”off tune”), and increasing the coupling separates the frequencies further.
So the key is nonlinearity. My guess is that it is the driving force, but I did not study other options.
How you model it should have no influence: SimMechanics, SimScape or plain Simulink, they all show the same behaviour.
Leave a Reply
About
Seth Popinchalk is an Application Engineer for The MathWorks. He writes here about Simulink and other MathWorks tools used in Model-Based Design.
Hello Seth,
That was a good challenge.
At first I thought this challenge was going to be easy, I assembled a SimMechanics model, clicked play… but the pendulums are not synchronizing, as mentioned by Parasar in his post.
Then I thought, let’s try with Simulink. I implemented in a vector form the equations provided and then face two choices:
- By default, the coupling of the equations results in an algebraic loop. I never like to have an algebraic loop in a model, but tried to let the solver resolving the algebraic loop. The results are similar to the ones from Simemchanics. It looks like the Simulink algebraic loop solver is doing a job similar to the SimMechanics solver. I cannot explain the exact reason, but my guess is that the algebraic loop solver removes the non-linearity that makes the pendulums synchronize in real life.
- My standard way to remove algebraic loops is to introduce a delay in the feedback path. In that case, the pendulums synchronize but the model becomes instable. The maximum sample time of the Simulink solver must be adjusted to an appropriate value to obtain an acceptable tradeoff between synchronization and stability.
I implemented the model using a vector approach. It allows easily changing the number of pendulums and modifying the algorithm.
I hope you will provide explanations on why no one has been able to obtain the synchronization using SimMechanics or with an algebraic loop.
Guy
Guy:
> I hope you will provide explanations on why no one has been able to obtain the synchronization using SimMechanics or with an algebraic loop.
Synchronisation cannot happen in a linear framework, that is a long known fact from electrical oscillators. Coupling them leads to several modes with slightly different resonance frequencies (”off tune”), and increasing the coupling separates the frequencies further.
So the key is nonlinearity. My guess is that it is the driving force, but I did not study other options.
How you model it should have no influence: SimMechanics, SimScape or plain Simulink, they all show the same behaviour.