Accessing states during a forward dynamic simulation

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Peter Bishop
Posts: 21
Joined: Thu Aug 28, 2014 10:47 pm

Accessing states during a forward dynamic simulation

Post by Peter Bishop » Sat Jul 07, 2018 3:24 am

Hello,
I have been running forward dynamic simulations via the API through MATLAB. I wish to access the states of a model during a forward dynamic simulation in real-time (i.e., at the end of each integration time-step), so that I can use this information to update the model (e.g., modify applied forces) or decide wether to stop a simulation or not (e.g., if the body COM has fallen below a certain height, the simulation should abort).

I am aware of the "TriggeredEventHandler", "PeriodicEventReporter" and "Controller" classes in C++, but am not sure how to access and use these via the MATLAB interface.

Many thanks in advance for any suggestions!

Peter Bishop.

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Accessing states during a forward dynamic simulation

Post by Dimitar Stanev » Mon Jul 09, 2018 12:50 am

The proper way to implement this is by a custom C++ controller. Alternatively, you can call the integrate function incrementally, however this approach will inherit a piecewise constant (discontinuity) response in the applied forces.

User avatar
Peter Bishop
Posts: 21
Joined: Thu Aug 28, 2014 10:47 pm

Re: Accessing states during a forward dynamic simulation

Post by Peter Bishop » Mon Jul 09, 2018 1:20 am

Thanks Dimitar. So just to clarify, there's no way that I can do this through just the MATLAB interface? I'm a novice when it comes to C++, and my ultimate intention is to make my models and simulations accessible to other MATLAB users.

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Accessing states during a forward dynamic simulation

Post by Dimitar Stanev » Mon Jul 09, 2018 11:35 pm

You can do it but the result will not be so good, because you will update the input force every dt keeping the value constant between the integration steps.

POST REPLY