Hi,
I am working with a neck model, and I want to add an external load as a point force. We have an experiment where our test subject is pushing their head back against a resistance, and I want to simulate that to see what happens in my model, although I have no data for the force yet. Preferably via Matlab, but in the GUI is good too.
I looked in the tutorials, and I found the files specifying the ground forces and how I can change the force over time, but I can not figure out how to add a new force to the model. How do I create the file from scratch, so that it applies to my model? How do I specify where the force is applied, and at what angle?
If it is shown in the tutorials, I don't understand it and if it is documented somewhere else, I have not found it. Can someone please help explain or point me towards the appropriate documentation?
Thank you in advance,
Karin
How do I make an external load point force on the neck?
- Karin Lundengard
- Posts: 4
- Joined: Sat Jul 25, 2020 9:47 pm
- Ibraheem Al-Dhamari
- Posts: 35
- Joined: Thu Mar 16, 2017 2:44 am
Re: How do I make an external load point force on the neck?
Hi
Maybe this code help! You can check the XML related components and the documentation related to PrescribedForce.
Maybe this code help! You can check the XML related components and the documentation related to PrescribedForce.
Code: Select all
//------------------------------------------------------------------
// Exteranal Force
//------------------------------------------------------------------
float extForceValY = 50 ; // 50 N external force
PrescribedForce *myExtForce = new PrescribedForce("myExtForce", *myBdy);
myExtForce->setName("myExtForce");
double extForceTime[2] = {0, finalTime}; // time nodes for linear function
double fXofT[2] = {extForce, extForce}; // force values at t1 and t2
// Create linear function for the force components
PiecewiseLinearFunction *extForceValY = new PiecewiseLinearFunction(2, extForceTime, fXofT);
// Set the force and point functions for the new prescribed force
myExtForce->setForceFunctions(new Constant(0.0),extForceValY, new Constant(0.0));
double fXofTPt[2] = {extForceMrkPtY, extForceMrkPtY}; // force values at marker point extForceMrkPtY
PiecewiseLinearFunction *extForcePtY = new PiecewiseLinearFunction(2, extForceTime, fXofTPt);
myExtForce->setPointFunctions(new Constant(0.0), extForcePtY, new Constant(0.0));
myExtForce->setTorqueFunctions(new Constant(0), new Constant(0), new Constant(0));
osimModel.addForce(myExtForce);
- Karin Lundengard
- Posts: 4
- Joined: Sat Jul 25, 2020 9:47 pm
Re: How do I make an external load point force on the neck?
Hi,
Thank you for your very fast answer! Would I use this script in MatLab then?
How do I find the coordinates in the frame that I want to use the force? I know where it is visually from a photo of our test subjects, but how do I know which coordinates it is and that I am in the correct frame?
Thank you for your very fast answer! Would I use this script in MatLab then?
How do I find the coordinates in the frame that I want to use the force? I know where it is visually from a photo of our test subjects, but how do I know which coordinates it is and that I am in the correct frame?
- Ibraheem Al-Dhamari
- Posts: 35
- Joined: Thu Mar 16, 2017 2:44 am
Re: How do I make an external load point force on the neck?
I don't use matlab but I think there should be equivalent way to do this.Would I use this script in MatLab then?
There other software where you cam load a mesh e.g. stl file and fins location of different points, personally I use 3D slicer but I think you can use blender or something similar. Another way is to create a marker in opensim then keep changing its location until it is in the correct location.How do I find the coordinates in the frame that I want to use the force?