Simscape animation of Mass-spring-damper system
41 views (last 30 days)
Show older comments
Hi.
Following this tutorial I've succesfully learned how to build a working mass-sping-damper mode in Simscape:
Anyway, I'd like to simulate the real beahaviour creating anything like this:
The question is:
Is it possible in Simscape, and if yes, how?
Any idea ?
Thanks in advance.
0 Comments
Answers (1)
Nathan Hardenberg
on 5 May 2023
Yes this can be done, but there are multiple ways of doing this.
For once you can use the Block "Spring and Damper Force". There you can set the inital length, Spring siffness and Damping Coefficient. Just connect two not ridgidly connected frames. With this setting the initial position to be not in the relaxed state seems to be a bit tricky.
The in my opinion smarter way is to use a "Prismatic Joint" Block only. In the block settings you can directly define Equilibrium Position, Spring Stiffness and Damping Coefficient. By Setting Equilibrium Position to a Value other than 0 you set up the spring-damper-system in a non relaxed state (which is in your case desired).
The attachment is simulink-file with two prismatic joints set up in a way like your example.
3 Comments
Nathan Hardenberg
on 6 May 2023
No this is not possible in Simscape! If you want to create a pretty animation you have to do this with a matlab skript and not in simulink. Doing this is probably not as easy as you like.
But I found the following, which might already be the solution you are looking for, or at least something you can look into:
When you really want to use the Simscape simulation, you could send the displacement values of the simulation to the matlab workspace and then animate those. This has the disatvantage of having to always run the simulate first
See Also
Categories
Find more on Multibody Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!