how the moco objectives are claculated

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
barak ostraich
Posts: 42
Joined: Thu Apr 12, 2018 12:17 am

how the moco objectives are claculated

Post by barak ostraich » Wed Sep 07, 2022 10:40 am

I succeed in calculating with MocoOutputGoal of metabolic probe by:

Code: Select all

    auto* metGoal = problem.addGoal<MocoOutputGoal>("met", 0.1);
    metGoal->setOutputPath("/metabolics|total_metabolic_rate");
    metGoal->setDivideByDisplacement(true);
    metGoal->setDivideByMass(true);
and I see the summary result at the solution printout. "objective_met=0.39"
Than i calculate the same output by:

Code: Select all

    TimeSeriesTable outputTable =
            analyzeMocoTrajectory<double>(model, solution,
            {  "/metabolics\\|total_metabolic_rate"});

When I try to integrate the storage result I get totally different value 184.64.
I didn't use divide by mass or divide by displacement.

Am I wrong in something here?

Tags:

User avatar
Carmichael Ong
Posts: 378
Joined: Fri Feb 24, 2012 11:50 am

Re: how the moco objectives are claculated

Post by Carmichael Ong » Thu Sep 08, 2022 10:36 am

It looks like you used divide by mass and displacement in the first code block, which could account for the difference when you integrated and didn't divide by mass or displacement. Further, you have a weight of 0.1 in the first code block that changes the objective value by 1/10.

User avatar
barak ostraich
Posts: 42
Joined: Thu Apr 12, 2018 12:17 am

Re: how the moco objectives are claculated

Post by barak ostraich » Sat Sep 10, 2022 6:29 am

I found the reason but I dont understand.
Where I read the model from file and compute analyzeMocoTrajectory I get one result
but when I use the model in the same procedure immediately after the solution I get anther solution
I had output for many other variables and there are all identical, all but the metabolics.

Code: Select all

...
 Model model = modelprocessor.process();
...
study.solve
...
//ONE OPTION 
      TimeSeriesTable outputTable01 =
            analyzeMocoTrajectory<double>(model, solution,
            { "/metabolics\\|total_metabolic_rate" });
    STOFileAdapter_<double>::write(outputTable01, "outputs01.sto");
//SECOND  OPTION
  model.print(modelfilename);
   Model model00(modelfilename);
    TimeSeriesTable outputTable00 =
            analyzeMocoTrajectory<double>(model00, solution00,
            { "/metabolics\\|total_metabolic_rate" });
    STOFileAdapter_<double>::write(outputTable00, "outputs02.sto");
What did I miss?

POST REPLY