Hi everyone,
I am looking for a GUI or C++ tool that will enable me to update a force parameter in the middle of a simulation. Specifically, is it possible to run a simulation from 0-1s, then from 1-2s update the rotational stiffness for a Bushing Force object? https://simtk.org/api_docs/opensim/api_ ... Force.html
Thank you!
-Jon
Changing a force parameter during a simulation
- Jonathan Perdomo
- Posts: 6
- Joined: Fri May 28, 2021 7:00 am
- Thomas Uchida
- Posts: 1794
- Joined: Wed May 16, 2012 11:40 am
Re: Changing a force parameter during a simulation
If computation time isn't a big issue, you could use the following algorithm:
- load model and call initSystem()
- run 1-second simulation
- edit bushing parameter and call initSystem()
- for each state variable, copy value from final time point of first simulation into new state
- run 1-second simulation
- load model and call initSystem()
- bushing1.setAppliesForce(state, True)
- bushing2.setAppliesForce(state, False)
- run 1-second simulation
- bushing1.setAppliesForce(state, False)
- bushing2.setAppliesForce(state, True)
- run 1-second simulation
- Jonathan Perdomo
- Posts: 6
- Joined: Fri May 28, 2021 7:00 am
Re: Changing a force parameter during a simulation
Hi Thomas,
The second solution sounds like it will work great, I will try it. Thank you!
-Jon
The second solution sounds like it will work great, I will try it. Thank you!
-Jon