Custom variables with iStep

Hi,
I defined two variables and wanted to assign the value of one variable to the other at each ISTEP, the procedure is as follows:

*AnyVar MFdL1L3_CSA = -(S0+1-MFdL1L3_CSA_10)*exp(-14/(24*T0))+S0+1;*
  • };*

  •           };//muscle group*
    
  •         *
    
  • AnyOperationSetValue SetValue = {*

  • Target = { &Main.HumanModel.BodyModel.Trunk.MuscleParametersSpineRight.TransversusL5_var }; *

  • Source = { &Main.PostProcess_For_InverseDynamicStudy.muscle.Tra.TransversusL5.MFdL1L3_CSA[iStep] };*
    };

but,it went wrong:

ERROR(SCR.PRS9) : SpinePressureStanding.Main.any(6334) : 'iStep' : Unresolved object

Hi Civill,

If I understand correctly, you have defined MFdL1L3_CSA as an AnyVar. AnyVar holds a single dimensional value and you can't really index an AnyVar. You would need to use a multi-dimensional variable like an AnyFloat or AnyVector.

Then, to index the value, you would need to provide the proper path to the iStep: so something like:

&Main.PostProcess_For_InverseDynamicStudy.muscle.Tra.TransversusL5.MFdL1L3_CSA[Main.PATH_TO_YOUR_STUDY.iStep]

Best regards,
Dave

Hi dschander,

Thank you for your advice, I corrected my previous mistake according to the way you said. But as you can see, I want to modify my mannequin with the value of each iStep. But how do I have the program automatically rerun InverseDynamics after each iStep modification of the model to get new mechanical parameters?

Hi Civill,

Could you please briefly explain what exactly you want to do? I am sorry, i don't understand what variables you want to use and what variables you want to modify.

Best regards
Dave

Hi dschander,

Sorry, I probably didn't describe it very well before. I want to use two variables, one is the cross-sectional area of the muscle and the other is the maximum activation of the muscle. I defined two studies in my program, one to obtain the maximum activation of the muscles under the current posture and cross-sectional area, and one to obtain the new muscle cross-sectional area using the formula using the maximum activation input. I want to update the cross-sectional area of the muscle in each istep and get a new muscle maximum activation du based on the new muscle cross-sectional area.I wonder if there is any way this can be implemented.

Best regards
Civil

Hi Civil,

Sorry for my late reply.

I think what you would like to do is perhaps not possible.. Physiologically, the cross-sectional area is modelled using kinematic parameters. You could perhaps consider using AnyMuscleModelUsr1, which allows you to define the strength of a muscle as a function of time, position, and velocity variable. This would still exclude making strength a function of muscle activity of the previous step.

Best regards,
Dave

Hi Civil,

I didn't consider all the possibilities in my previous reply. There seems to be a way to do what you want to do through the Python hook. Please see here for more info on how to use an external Python function with AnyBody. There is also a small example at the end of the page that shows a differentiation example using the values from the previous time step. Hopefully, this helps you out.

Best regards,
Dave

Hi dschander,

Thank you for your reply. In fact, I've done this before using python. The reason why I want anybody to do this is that if I do this in python but I want to see the result, I need to define it in python myself, and whenever I want to see some new parameter I have to rewrite the python program and run it, which is laborious and time-consuming. So if using python, is there a more convenient way to see the results?

Best regards
Civil

Hi Civil,

At the moment, there isn't a more convenient way I think. If you want to see a specific parameter, you would need to program it in AnyScript or Python. So one way or the other, you would need to rewrite some code.

Best regards,
Dave

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.