Hello,
We're doing some work for which we want to run small CMC simulations using the gait1018 model as quickly as possible. I was wondering if anyone could share some insight as to the best parameters to modify to speed up the CMC computation speed? (Of course at the cost of accuracy I assume).
I have modified the CMC time window but wonder which of the optimisation or integrator settings might be best to modify?
Kind regards,
Daniel
Speeding up CMC
- Daniel Gordon
- Posts: 34
- Joined: Fri May 06, 2016 7:57 am
Re: Speeding up CMC
Have you considered using Static Optimization rather than CMC? It will offer significant speed improvements.
- Daniel Gordon
- Posts: 34
- Joined: Fri May 06, 2016 7:57 am
Re: Speeding up CMC
Hi James,
I hadn't but on reading up that seems like a good idea, I'll try that. Thanks for the suggestion!
I hadn't but on reading up that seems like a good idea, I'll try that. Thanks for the suggestion!
- Daniel Gordon
- Posts: 34
- Joined: Fri May 06, 2016 7:57 am
Re: Speeding up CMC
Hi again,
I've noticed quite a disparity in the results of a metabolics probe between SO and CMC (I knew there would be differences but it seems vast).
CMC is reporting values from ~500 - 2000 whereas for SO it is around 74 - 77 only. This is for the same set of input data. I have noticed that in the force files the SO .sto file somehow has the ground reaction forces in there whereas in the CMC force .sto file they are not.
My implementation of SO in Matlab is as follows:
I couldn't get the SO to work properly without printing and reloading the settings file.
Can anyone see where I might be going wrong?
Cheers.
I've noticed quite a disparity in the results of a metabolics probe between SO and CMC (I knew there would be differences but it seems vast).
CMC is reporting values from ~500 - 2000 whereas for SO it is around 74 - 77 only. This is for the same set of input data. I have noticed that in the force files the SO .sto file somehow has the ground reaction forces in there whereas in the CMC force .sto file they are not.
My implementation of SO in Matlab is as follows:
Code: Select all
% Import OpenSim Analyze Tool.
import org.opensim.modeling.AnalyzeTool;
import org.opensim.modeling.Model;
% Temporarily copy SO settings folder to new location.
[folder, name, ext] = fileparts(settings);
temp_settings = [results filesep 'temp'];
copyfile(folder, temp_settings);
settings = [temp_settings filesep name ext];
% Modify pelvis COM in actuators file.
obj.modifyPelvisCOM(settings);
% Load tool.
soTool = AnalyzeTool(settings);
% Setup external loads.
external_loads = xmlread(load);
external_loads.getElementsByTagName('datafile').item(0). ...
getFirstChild.setNodeValue(obj.grfs_path);
temp = [results filesep 'temp.xml'];
xmlwrite(temp, external_loads);
soTool.setExternalLoadsFileName(temp);
% Load and assign model.
soTool.setModelFilename(obj.model_path);
% Assign parameters.
soTool.setCoordinatesFileName(obj.best_kinematics);
soTool.setInitialTime(timerange(1));
soTool.setFinalTime(timerange(2));
soTool.setResultsDir(results);
% Print new temp settings file.
soTool.print(settings);
% Reload tool from these settings.
soTool = AnalyzeTool(settings);
% Run tool.
soTool.run();
Can anyone see where I might be going wrong?
Cheers.
- Daniel Gordon
- Posts: 34
- Joined: Fri May 06, 2016 7:57 am
Re: Speeding up CMC
Just as an update I switched from running the AnalyzeTool with a SO and metabolics probe concurrently to running an analysis with the first SO first and a second analysis with only metabolics probe reporter afterwards. After this the metabolics look more reasonable. Not sure why the first attempt didn't work though!