Page 1 of 1

printing controls after integration:

Posted: Sat Oct 28, 2017 2:02 pm
by mlaudu
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

Re: printing controls after integration:

Posted: Sat Oct 28, 2017 7:30 pm
by chrisdembia
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.

Re: printing controls after integration:

Posted: Tue Oct 31, 2017 8:21 am
by mlaudu
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

Re: printing controls after integration:

Posted: Tue Oct 31, 2017 10:41 am
by chrisdembia
If you are using 4.0, you can use a StatesTrajectoryReporter with a report_time_interval of 0.01.