printing controls after integration:

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Musa Audu
Posts: 47
Joined: Mon Nov 24, 2008 11:30 am

printing controls after integration:

Post by Musa Audu » Sat Oct 28, 2017 2:02 pm

I have a C++ model that has m muscles and n user-actuators. Each muscle has one control variable and each actuator has 3 control variables - for a total model control vector of length m+3n. The length and content of my model controls does contain the controls for all muscles and actuators in the model - m+3n. However, when I integrate the model and called _model.printControlStorage() to print the controls vector to a file, I see that only the first control variable is printed for each of the actuators - the output file has m+n+1 columns. Can someone advise on how to make sure for each actuator all the control variables are printed?
Thanks.
Musa

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: printing controls after integration:

Post by Christopher Dembia » Sat Oct 28, 2017 7:30 pm

Non-scalar actuators are not as well supported throughout the API. You can try calling model.getControls() during the integration to access all control variables.

User avatar
Musa Audu
Posts: 47
Joined: Mon Nov 24, 2008 11:30 am

Re: printing controls after integration:

Post by Musa Audu » Tue Oct 31, 2017 8:21 am

Thanks Chris. This is helpful to know. I guess I can run my integration in smaller time steps (say 0.01) and call getControls() at the end of each time step and record the control values. The only thing is I will then lose the ability to use printControlStorage( ) and getStateStorage().print which are called at the end of the whole integration run. Is there a way to extract the state vector at the end of every small but selected integration time step? - say at 0.01s intervals and repeated until final time = 1.0?
Thanks.
Musa

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: printing controls after integration:

Post by Christopher Dembia » Tue Oct 31, 2017 10:41 am

If you are using 4.0, you can use a StatesTrajectoryReporter with a report_time_interval of 0.01.

POST REPLY