[770c98]: / Application / Examples / KneeSimulator / Model / AnyKneeSimulator.any

Download this file

63 lines (47 with data), 2.2 kB

// class templates for defining ligaments and tendons reside here
#include "ClassTemplates.any"


Main = {
  #include "DrawSettings.any"
  #include "DefaultSettings.any"
  
  AnyFolder Model = {
    #include "Environment.any"
    #include "Segs.any"
    #include "Ligaments.any"
    #include "Tendons.any"
    #include "Joints.any"
    #include "Contacts.any"
  };//Model

  #include "EvaluateLigamentLength.any"
  
  AnyBodyStudy KneeSimulatorStudy = {
    // A low kinematic tolerance will help FDK optimization to converge
    Kinematics.KinematicTol ??= 1e-8;
    
    AnyFolder& Parameters = .Parameters; 
    AnyFolder& Model = .Model;
    #include "Drivers_and_Loads.any"
    #include "Actuators.any"
    #include "Measures.any"
    
    //Include this to generate .txt output files
    #include "Outputs.any"
    

    Gravity = {0, 0, -9.81};
    tStart = (DEF_GAIT_PERIOD * DEF_GAIT_PERIOD_USE_RATIO * 0.0);
    tEnd = (DEF_GAIT_PERIOD * DEF_GAIT_PERIOD_USE_RATIO * 1.0);
    nStep = round((DEF_GAIT_NSTEP)) ;
    AnyVar Cycle = t / (tEnd - tStart) * 100;
    
    InverseDynamics.ForceDepKinOnOff=On;
    InverseDynamics.ForceDepKin.SolverType ??= FDK_SolverType ;
    InverseDynamics.ForceDepKin.ForceTol ??= FDK_ForceTol ;
    InverseDynamics.ForceDepKin.UseAdaptiveForceTolOnOff ??= FDK_UseAdaptiveForceTolOnOff ;
    InverseDynamics.ForceDepKin.Perturbation ??= FDK_Perturbation;
    InverseDynamics.ForceDepKin.MaxIteration ??= FDK_MaxIteration;
    InverseDynamics.ForceDepKin.LocalSearchMaxSteps ??= 15; // Reduced from default 25. Speeds up convergense.

    
    InverseDynamics.ForceDepKin.MaxNewtonStep ??= FDK_MaxNewtonStep;       
    InverseDynamics.ForceDepKin.LocalSearchOnOff ??= FDK_LocalSearchOnOff;  
    
    #ifdef TOOLS_MODELUTILITIES_VIDEO_CAMERACLASSTEMPLATE
    // Include functions to generate a video:
    // -> Run `Study.VideoTool.Preview` to preview the camera view.
    // -> Run `Study.VideoTool.Create_Video` to generate video from the analysis.
    #include "CreateVideo.any"
    #endif
     
  };
  
  #include "OperationSequences.any"    
};