Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
-
Marc Zamora
- Posts: 3
- Joined: Sat Mar 18, 2023 9:44 am
Post
by Marc Zamora » Tue Aug 15, 2023 1:04 am
Hello,
First of all, I would like to thank you for developing and making this incredible simulation library available.
I am trying to analyze the stability of some systems. Until now, the models were quite simple and I could find the EOM manually, but I am using Simbody for more complex models. I read the SimTK::LocalEnergyMinimizer finds local equilibria by minimizing the potential energy locally, and therefore I assume it can only find stable equilibria?
In this case, I should define a function qdotdot(qdot,q), from which later I can find q*->qdotdot(0,q*)=0 and differentiate at q* to obtain the linearized system matrix. How can I do it? I guess I should be able to using functions from SimTK::SimbodyMatterSubsystem. Or is there an alternative?
Thank you!
Marc
-
Michael Sherman
- Posts: 806
- Joined: Fri Apr 01, 2005 6:05 pm
Post
by Michael Sherman » Tue Aug 15, 2023 8:37 am
Thanks for your kind remarks -- I'm glad you're finding Simbody useful.
Yes, minimizing PE only finds stable equilibria.
You should be able to find everything you need in
SimbodyMatterSubsystem. For example you can calculate accelerations udot directly with
calcAccelerations() and you can convert those to qdotdots (if they differ) using
calcQDotDot(). If you need to differentiate those you would have to do it numerically; you might find Simbody's
Differentiator class helpful or you could just do it manually.
In general you might find it worthwhile to scroll through the
SimbodyMatterSubsystem documentation to look at the large set of operators available there.
Regards,
Sherm
-
Marc Zamora
- Posts: 3
- Joined: Sat Mar 18, 2023 9:44 am
Post
by Marc Zamora » Wed Aug 16, 2023 2:17 pm
Hi,
Thank you for the prompt response.
I am devising a solution that simply consists in specifying the system configuration, realizing the state to the acceleration stage and reading (a subset of) UDot or QDotDot from the state, followed by the equilibrium search and the system linearization. I will post a working example once I test this more in depth.
Best regards,
Marc
-
Marc Zamora
- Posts: 3
- Joined: Sat Mar 18, 2023 9:44 am
Post
by Marc Zamora » Sun Aug 20, 2023 10:57 am
Hi,
The end solution is quite simple. After realizing the topology, I just get the evolution of the state vector by means of the following function:
Code: Select all
std::vector<double> get_dynsys_evolution(std::vector<double>& state_vector)
{
// Set mobilizer Qs and Us
// ...
// Advance state
sys.realize(state, Stage::Acceleration);
// Get dynamical system evolution (QDots and UDots)
std::vector<double> dynsys_evolution(state_vector.size(), 0.0);
// ...
return dynsys_evolution;
}
I am interfacing this with an external solver to find the equilibrium point and the linearized system matrix. Unfortunately, the system is too complex for this type of analysis, so at the end I will be performing a time response analysis.
Best regards,
Marc