|
a |
|
b/Application/Examples/THA-KneeBendDemo/THA-KneeBendDemo.Main.any |
|
|
1 |
#include "../libdef.any" |
|
|
2 |
|
|
|
3 |
/** |
|
|
4 |
This is a demo model for the simulation of a knee bend for a body model |
|
|
5 |
with a total hip arthroplasty (THA)using: |
|
|
6 |
- either an ideal spherical joint with joint reaction forces |
|
|
7 |
- or force dependent kinematics and a contact model. |
|
|
8 |
|
|
|
9 |
In the body model, the hip joint is excluded from the AnyBodyStudy and a new force dependent |
|
|
10 |
hip joint is included. Therefore, a acetabular cup and a femoral component (1) are included into the model |
|
|
11 |
and a contact force between these implants is defined. For stabiliy reasons an artifical spring |
|
|
12 |
is implemented to avoid the joint to disconnect. |
|
|
13 |
|
|
|
14 |
Please notice that this simulation is only a demo example. |
|
|
15 |
The placement of hte implant is not based on any anatomical data. |
|
|
16 |
Further, the implant includes an artificial spring (in Model/ContactForces.any) |
|
|
17 |
element to make the simulation more robust. For each simulation, the force produced |
|
|
18 |
by this artifical spring should be checked to be aware of the influence |
|
|
19 |
of this spring on the results. |
|
|
20 |
|
|
|
21 |
--- |
|
|
22 |
(1) The geometry data of the femoral component was kindly provided by Edmundo Fuentes via GrabCAD.com |
|
|
23 |
http://edmundofuentes.com |
|
|
24 |
*/ |
|
|
25 |
Main = { |
|
|
26 |
|
|
|
27 |
// Switches to include AnyDrawWidgets to change the positions and orientation of the hip implants. |
|
|
28 |
|
|
|
29 |
// Widget to rotate the femoral component |
|
|
30 |
#define FEM_STEM_ROT 0 |
|
|
31 |
// Widget to move the femoral component |
|
|
32 |
#define FEM_STEM_LIN 0 |
|
|
33 |
// Widget to rotate the Acetabular cup |
|
|
34 |
#define PELVIS_CUP_ROT 0 |
|
|
35 |
|
|
|
36 |
// Switch to use an ideal spherical joint, or force dependent kinematics for the right hip joint. |
|
|
37 |
#ifndef USE_FDK |
|
|
38 |
#define USE_FDK 1 |
|
|
39 |
#endif |
|
|
40 |
|
|
|
41 |
// ---------------------------------------------------------- |
|
|
42 |
// Path to draw settings |
|
|
43 |
// ---------------------------------------------------------- |
|
|
44 |
#include "Model/DrawSettings.any" |
|
|
45 |
|
|
|
46 |
// ---------------------------------------------------------- |
|
|
47 |
// Body Model Configuration |
|
|
48 |
// ---------------------------------------------------------- |
|
|
49 |
#include "Model/BodyModelConfiguration.any" |
|
|
50 |
|
|
|
51 |
// The Mannequin file specifies load-time positions for all the segments |
|
|
52 |
// in the HumanModel. This is important for the model's ablity to resolve |
|
|
53 |
// all the kinematic constraints when the model is analyzed. |
|
|
54 |
// The mannequin file also drives those degrees of freedom of the human |
|
|
55 |
// model that are not governed by problem-specific drivers at run time. |
|
|
56 |
#include "Model/Mannequin.any" |
|
|
57 |
|
|
|
58 |
// Model of the human body to be used for the analysis |
|
|
59 |
#include "<ANYBODY_PATH_BODY>/HumanModel.any" |
|
|
60 |
|
|
|
61 |
/// The actual model where all components are assembled |
|
|
62 |
AnyFolder Model ={ |
|
|
63 |
/// Body model without default drivers |
|
|
64 |
AnyFolder &BodyModel=.HumanModel.BodyModel; |
|
|
65 |
/// Reference to the mannequin folder (used by drivers) |
|
|
66 |
AnyFolder &Mannequin =.HumanModel.Mannequin; |
|
|
67 |
|
|
|
68 |
#include "Model/Environment.any" |
|
|
69 |
|
|
|
70 |
// Implants defines and positions the stl surfaces of the hip implants. |
|
|
71 |
#include "Model/Implants.any" |
|
|
72 |
|
|
|
73 |
AnyFolder ModelEnvironmentConnection = { |
|
|
74 |
#include "Model/JointsAndDrivers.any" |
|
|
75 |
}; |
|
|
76 |
}; |
|
|
77 |
|
|
|
78 |
AnyBodyStudy Study = { |
|
|
79 |
AnyFolder &Model = .Model; |
|
|
80 |
|
|
|
81 |
// This file implements the implant contact forces. |
|
|
82 |
#if USE_FDK |
|
|
83 |
#include "Model/ContactForces.any" |
|
|
84 |
#endif |
|
|
85 |
|
|
|
86 |
// In this file, the bone of the femur is replaced. |
|
|
87 |
#include "Model/BoneExchange.any" |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
tEnd = 10.0; |
|
|
91 |
Gravity = {0.0, -9.81, 0.0}; |
|
|
92 |
nStep = 10; |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
AnyFolder HipComparison = |
|
|
96 |
{ |
|
|
97 |
|
|
|
98 |
#if USE_FDK |
|
|
99 |
AnyFloat RightHipReactionForceFDK = (Main.Study.FSurf.Fslave[0]^2 |
|
|
100 |
+ Main.Study.FSurf.Fslave[1]^2 |
|
|
101 |
+ Main.Study.FSurf.Fslave[2]^2)^0.5; |
|
|
102 |
#else |
|
|
103 |
AnyFloat RightHipReactionForce = (Main.HumanModel.BodyModel.Right.Leg.Jnt.Hip.Constraints.Reaction.Fout[0]^2 |
|
|
104 |
+ Main.HumanModel.BodyModel.Right.Leg.Jnt.Hip.Constraints.Reaction.Fout[1]^2 |
|
|
105 |
+ Main.HumanModel.BodyModel.Right.Leg.Jnt.Hip.Constraints.Reaction.Fout[2]^2)^0.5; |
|
|
106 |
#endif |
|
|
107 |
|
|
|
108 |
AnyFloat LeftHipReactionForce = (Main.HumanModel.BodyModel.Left.Leg.Jnt.Hip.Constraints.Reaction.Fout[0]^2 |
|
|
109 |
+ Main.HumanModel.BodyModel.Left.Leg.Jnt.Hip.Constraints.Reaction.Fout[1]^2 |
|
|
110 |
+ Main.HumanModel.BodyModel.Left.Leg.Jnt.Hip.Constraints.Reaction.Fout[2]^2)^0.5; |
|
|
111 |
}; |
|
|
112 |
|
|
|
113 |
#if USE_FDK |
|
|
114 |
// Here the hip joint from the body model is removed |
|
|
115 |
// and new FDK drivers for the contact hip joint are |
|
|
116 |
// defined. |
|
|
117 |
#include "Model/HipExchange.any" |
|
|
118 |
|
|
|
119 |
InverseDynamics.ForceDepKinOnOff=On; //Values gained by experience |
|
|
120 |
InverseDynamics.ForceDepKin.ForceTol=10; //Values gained by experience |
|
|
121 |
InverseDynamics.ForceDepKin.Perturbation=5e-5; //Values gained by experience |
|
|
122 |
InverseDynamics.ForceDepKin.LocalSearchOnOff = On; //Values gained by experience |
|
|
123 |
//InverseDynamics.ForceDepKin.MaxNewtonStep = 0.1; //Values gained by experience |
|
|
124 |
|
|
|
125 |
//InverseDynamics.ForceDepKin.UseAdaptiveForceTolOnOff = On; |
|
|
126 |
#endif |
|
|
127 |
|
|
|
128 |
}; // End of study |
|
|
129 |
|
|
|
130 |
// Include an operation sequence to run all required steps of your application (see Operations tab) |
|
|
131 |
#include "<ANYBODY_PATH_MODELUTILS>\Operations\RunAppSequence.any" |
|
|
132 |
|
|
|
133 |
}; //Main |
|
|
134 |
|