|
|
It can happen that you want to simulate something in OpenSimRoot using a function that is not part of the list of registered functions. You have two options:
|
|
|
|
|
|
1) For simple functions, you can use the function interpreter
|
|
|
2) For more complicated algorithms, and especially when you need to computational speed write a c++ class.
|
|
|
|
|
|
|
|
|
### The function interpreter
|
|
|
The function interpreter can be used in the XML. It looks for a child named "formula" that contains a string that represents the function. The variables in that string are assumed to be declared in the XML at the same hierarchical level as the function. The variable t is reserved for time. If you want to use variables that are somewhere else in the hierarchy, you have to declare their path. As a child, declare a container named "variablePath" and declare inside the variable as a constant of type string and set the string to the path where the variable is declared.
|
|
|
|
|
|
Examples for using the function interpreter you can find in the test folder. In:
|
|
|
|
|
|
- /home/jouke/git/OpenSimRoot/OpenSimRoot/tests/modules/lotkaVolterra.xml you will find an implementation of the lotka volterra model, using purely the function interpreter.
|
|
|
|
|
|
- /home/jouke/git/OpenSimRoot/OpenSimRoot/tests/modules/nonLinearODE.xml you will find the standard double string problem. In this xml you will see the use of variablePath demonstrated.
|
|
|
|
|
|
### Write a new c++ class
|
|
|
##TODO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|