Simscape multibody model is not following simulink output

7 visualizzazioni (ultimi 30 giorni)
Dear community,
I'm facing an unexpected behavior in my Simscape Multibody model (File attached).
I'm trying to build a model in Simscape Multibody that can represent the motion of two pendulums at the same time, one using linear equation of motion and the other using non-linear equation of motion, both starting at the same angle. Both equations are modeled in Simulink by block diagrams just as in the Matlab example called "Single Pendulum in Simulink and Simscape Multibody" (I took this example as a reference).
The Simulink model is passing the values of θ through variables defined in the second inetgrator (see Figure 1, highligthed in yellow) to the revolute joints of the pendulums modeled in Simscape Multimody.
Figure 1: Pendulum Linear tranfer function (top) and pendulum non-linear transfer function (bottom).
I was expecting to see a difference in the angular position θ according to the Simulink output (Figure 2), but the motion is the same for both cases linear and non-linear in the Simscape Multibody model (Figure 3).
Simulink output
Figure 1: Simulink output - Output 1 is linear equation, output 2 is non-linear equation.
Simscape Multibody output
Figure 2: Simscape multibody output - The output in the model is the same for linear and non-linear.
I would like to know why the Simscape Multibody is having the same output when the linear motion should be different
Any ideas?
Hope you can help.
Omar

Risposta accettata

Vasco Lenzi
Vasco Lenzi il 3 Mag 2021
Modificato: Vasco Lenzi il 3 Mag 2021
Dear Omar,
Simscape Multibody is an add on to Simscape and Simulink, and it works within the Simulink blank canvas, but his simulations are not "controlled" by Simulink signals in your case. Since in that model they are not connected by any signal, the two circuit (Simulink and Simscape Multibody) are completely independent.
One uses signals as an approach and solves differential equation (Simulink). Simscape Multibody instead uses phyiscal connection where you connect components together. Every component has an equation, and when you click "play" the system level equation is derived and implemented. The shipping example comparing Simulink and Simscape Multibody is there to showcase how two completely indipendent modeling approaches but with the same components/parameters will still give the same simulation results.
Try as well to completely cancel the Simulink part: the Simscape Multibody model will run just fine on his own.
Understanding how the Simscape simulation works is key to understand all your difficulties. Please follow-up on this links:
Simscape OnRamp:
Basic Principles of Modeling Physical Networks
Analyze a Simple Pendulum
  1 Commento
Omar Valladolid
Omar Valladolid il 3 Mag 2021
Dear Vasco,
Thank for you time and explanation.
I got the wrong idea, and it makes sense now why I got the same output in both revolute joints.
I really appreciate the information you shared with me.
Best regards,
Omar

Accedi per commentare.

Più risposte (1)

Vasco Lenzi
Vasco Lenzi il 3 Mag 2021
Hi Omar
Your file doesn't work out of the box because the variable declaration or the data dictionary are missing. Can you add the parameter declaration? In the meantime I used the parameters from the shipping example you shared "Single Pendulum in Simulink and Simscape Multibody"
I noticed that your two revolute joints in Multibody are configured eactly the same. How are you expecting something different? Where do you plan to implement the non-inearity? I see that in Simulink you added a sinus to the angle feedback for the non-linear system. Right now that would be more convoluted to implement in Multibody, because off-the-shelf you can only parametrize linear mechanics element such as spring and damping:
If you want to implement a non-linear loss function, you have to program it by hand
hope this helps!
Vasco
  1 Commento
Omar Valladolid
Omar Valladolid il 3 Mag 2021
Modificato: Omar Valladolid il 3 Mag 2021
Dear Vasco,
I have updated the zip file, hope this time it contains the correct information, I added a .m file with the variables initialization, just in case.
Answering your questions:
I noticed that your two revolute joints in Multibody are configured exactly the same. How are you expecting something different?
The only difference between them is the variable they are reading in the Position Target value.
  • Revolute Joint is reading theta_out_linear.
  • Revolute Joint 1 is reading theta_out_nonlinear.
So that's why I was expecting to see a slightly different output from the Simscape Multibody.
Where do you plan to implement the non-linearity? I see that in Simulink you added a sinus to the angle feedback for the non-linear system. Right now that would be more convoluted to implement in Multibody, because off-the-shelf you can only parametrize linear mechanics element such as spring and damping.
My understanding is that you can set the angular position of the Multibody model using variables, in this case the values of those variables are set in the Simulink model. That is exactly why I'm doing it in Simulink instead of Multibody. Am I right?
For some reason, the linear output in Multibody doesn't match the linear output in Simulink, but the non-linear output matches in both cases..
Since each Revolute Joint is taken the angular position (Position Target) from Simulink through the variables, I was expecting to see the same angular position output (q) in Simscape Multibody.
The model has a section where you can see the output and the comparison between Simulink and Simscape. Here is the diagram.
Simulink output:
This is the Simulink output, linear output in blue, non-linear output in red.
Simscape Multibody - Mechanics output:
This is the Simscape Multibody output. Despite both revolute joints are receiving different values from Simulink, their output is the same. Any ideas?
Linear output, Simulink vs Simscape Multibody - Mechanics:
This is the linear output comparison between Simulink (blue) and Simscape (red). You can see that they do not match, but they should.
Non-linear output, Simulink vs Simscape Multibody - Mechanics:
This is the non-linear output comparison between Simulink (blue) and Simscape (red). In this case it seems that they match as expected.
As you can see in the different outputs, the Simscape linear output is not matching the Simulink linear output. But not sure why this is happening.
  1. I run the example as it is, with the sine function, and it works well (similar to my non-linear case). See diagram an output below.
2. Next, I removed the sine function and connected theta directly to th gain. Even though the sine function is not there, I am still having the same output as the non-linear case.
Am I wrong expecting to see a different output from the Simscape model by only modifying the Simulink model? or Do I have to modify the Simscape model as well?
Hope this helps to clarify my question, if not, please do not hesitate to ask.
Best regards,
Omar

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by