Creating A Neuromechanic Model
A Neuromechanic model is defined in a plain text Extensible Markup Language (XML) document. The XML files used by Neuromechanic have the file extension (*.nmcb), and are called body files. Each body file contains or references all information about the model and how it should interact with the environment. The file also contains instructions for equilibrating the model and running forward dynamic simulations.
Individual body files can be manipulated:
- Directly from any text editor
- Through the Neuromechanic graphical user interface or source editor
- In matlab using read (xml2matlab.m) and write (matlab2xml.m) matlab functions.
- In Python using a special class (Tree) defined in an included module (nmapiext).
The outermost tag of the body file is <NeuromechanicFile> which usually contains 2 reserved tags <Internal> and <Dynamic> and usually 7 children tags: <Functions>, <View>, <Parameters>, <Bodies>, <Resources>, <Environment>, <Muscles>, and <Neurons>. An eighth tag <FeasibleForces> is included to do a feasible force analysis.
Please pay attention to these characteristics of the body file:
- No units are specified for any of the parameters. This means that the user is responsible for ensuring that all values are consistent. For example if any length in the body file is in units of meters, then ALL units of length must be in meters. In addition, if all the quantities of time are given in seconds, all units of length are given in meters, and all units of mass are given in kilograms, then all units of force MUST be given in Newtons (MKS system).
- Characters specified in Neuromechanic are case insensitive. Therefore care must be taken in naming variables (such as rigid bodies). “Bodya” and “BodyA” will be interpreted as the same name. All tag names in the file are also case insensitive when parsed by the Neuromechanic engine. However when using other tools in tandem with Neuromechanic(such as Matlab) one should maintain case consistency.
Elements of a Body file
- Rigid Body Dynamics
- Constraints and External Forces
- Muscles and Motors
- Neurons and Control
- Math Functions
- Model Resources
- Viewing Parameters
- Simulation and Miscellaneous Parameters