A study of studies

Studies are AnyBody's mechanism for specifying "things to do to the model" in the sense that a study executes the model and gives you results to investigate afterwards. The study or studies is what you see organized in a tree in the frame at the bottom of the screen when you have loaded a model.

AnyBody's family of study classes looks like this:

where the classes with blue icons are the ones you can actually define. In this tutorial we shall focus on AnyBodyStudy and AnyBodyCalibrationStudy, while a seperate tutorial is dedicated to AnyParamStudy and AnyOptStudy.

The AnyBodyStudy and Studies in general

A study is really just a folder. It is a pair of braces between which you can place some specifications. Whatever you put between the braces becomes part of the study. As every object, a study has some predefined properties that you either can set, must set, or cannot touch.

When you create a new model by means of the menus File -> New Main, the system automatically inserts an AnyBodyStudy for you (please do it and save the file under some relevant name). It looks like this:

// The study: Operations to be performed on the model
AnyBodyStudy MyStudy = {
  AnyFolder &Model = .MyModel;
  RecruitmentSolver = MinMaxSimplex;
  Gravity = {0.0, -9.81, 0.0};
};

It contains all the things you formally need. Let's start with the two last lines. They read

RecruitmentSolver = MinMaxSimplex;
Gravity = {0.0, -9.81, 0.0};

As you can see, they are simply assignments of values to variables. The two variables shown here have no type definitions in front of them. This is because they are predefined properties of the AnyBodyStudy object. The value of RecruitmentSolver tells the system which solution algorithm to use for muscle recruitment, and Gravity is a specification of the vector of gravitational acceleration affecting the model. The system assumes that you want to work with the y axis being vertical in space. If you prefer otherwise, simply change the direction of Gravity to reflect your choice. Please go ahead and load the model if you have not already done it by pressing F7 or the  icon.

An AnyBodyStudy has many more predefined properties that you can play with. You can get an overview of these using the Model Browser. The Model Browser is opened from the menu Windows -> Model Browser, whereafter you can find the study in the Model Tree. Alternatively, you can, as with all objects in the model, dump the contents of a study in the message window. This is done simply by finding the study in any Model Tree view, right-clicking it and selecting Dump. This produces a whole lot of output in the Output Window.

 

 

Most of the properties deal with solution methods, tolerances, and other stuff that is necessary or handy for advanced users. For a description of each property, please refer to the AnyScript Reference manual. A few of the properties, however, are necessary to know even for casual users:

tStart

This is the time at which the study begins. In almost every case, this would be zero. Using a non-zero value of tStart is sometimes used to restrict the study to a subset of the time is was originally developed for or if the model is driven by measured data which does not begin at t = 0.

tEnd

Ah, you guessed it already. This is the time at which the study ends. Contrary to tStart, this often has to be set by the user. The standard value is tEnd = 1.0, and if you want your study to span any more or less time, you have to set tEnd manually. A very common modeling mistake is to define data-based drivers such as the AnyKinEqInterPolDriver with a time span exceeding the interval from 0 to 1 and then wondering why only a small part of the movement interval gets simulated. In this case, the user must manually specify tEnd to correspond with the end of the driver time span.

nStep

AnyBody analyzes movement in discrete time steps, and nStep specifies how many steps the system should use to come from tStart to tEnd. The steps are equidistant, and since tStart is always the first analysis time, and tEnd the last, the interval gets divided into nStep-1 equal intervals. The default value is nStep=100, which for most purposes is a very fine resolution. If you have a large and time-consuming model, it might be a good idea to manually set nStep to a smaller number.

The first line of the study reads

AnyFolder &Model = .MyModel;

Notice that the first word of that line is a type definition: "AnyFolder". The predefined properties we have just discussed need no type definition because the study already knows them. They are already defined and merely get new values by the assignments we may specify. So the type definition at the beginning of this line indicates that this property is an addition to the study; something that was not known already. This is an important point to understand about studies: You can add almost anything to a study and the study does not need to know its type in advance.

The significance of adding something to a study is that whatever you add becomes a part of what the study executes. This particular line defines a variable called "Model" and sets it equal to .MyModel. If you look at the beginning of the AnyScript file, you will see that MyModel is really the folder containing the entire model the system has generated for you (we refer to it as .MyModel with a leading dot because it is one brace up compared to where it is referenced from). This means that the entire model comes under influence of the study. Instead of this line, we could simply have pasted the entire contents of the braces defining the MyModel in at this place, and in some sense, this is precisely what we have done. The ampersand '&' in front of "Model" means that Model does not get replicated inside the study. Instead, the '&' means that the study merely contains a pointer to MyModel. The concept of pointers should be very familiar to you if you have any experience in C, C++, or Java programming. If not, simply think of a pointer as a handle to something that's defined elsewhere. Whenever you access it, you are actually handling what it is pointing to.

Instead of including the entire model, we could have chosen to point to some of the sub folders of MyModel. This would mean that the study would work on just a subset of the model, and it can be very relevant in some cases. One of the more important is examples is for calibration of muscles as we shall see in the forthcoming lesson on Calibration Studies.

The elements of a study

When you define an AnyBodyStudy, regardless of what you include between the braces of the study, the result is four standard operations that appear in the study tree. They each represent something you can do to the model elements the study is pointing at:

  • ModelInformation dumps statistics of the mechanical system and is mainly a model debugging tool.
  • SetInitialConditions reads the values of whatever drivers you have included in the study and puts the model in the position of these drivers at time tStart. This is done in a multi-step process: The model is initialized into the initial positions from load time, and the kinematics is subsequently solved in a few steps (more details can be found in the reference manual). This is particularly useful for inspection of the specified initial positions when having problems with the initial configuration of the mechanism.
  • KinematicAnalysis. A kinematic analysis is a simulation of the movement of the model without calculation of any sort of forces. This means that you can run KinematicAnalysis as soon as you have the movement defined uniquely. You don't need any muscles in the model for this one.
  • InverseDynamicAnalysis. This is a simulation of the forces involved in the given movement or posture and whatever can be derived from them. The InverseDynamicAnalysis uses the KinematicAnalysis as a subroutine, so this requires a correctly defined movement or posture as well as the muscles or motors necessary to drive the model.

Each of these studies, when executed, assembles the output they generate in the Output section under the study's tree.

Running operations

You execute operations through the wide, narrow control pane that's usually located at the bottom of the screen. This is usually referred to as the Operation Window.

 

The lower portion of this pane is just the message window where the system writes various messages and dumps object properties when you double-click them as we did before with the entire study. The left of the upper fields is a filtered version of the tree you can find on the left side of just about any window in the AnyBody Modeling System. Rather than presenting all the objects of the model, this tree only comprises the studies. If you expand a study, you will find its operations, which typically are: SetInitialConditions, KinematicAnalysis, InverseDynamicAnalysis, and MuscleCalibrationAnalysis.

You pick an operation by clicking it once. This highlights its name, and you can now execute it with the Run or Step buttons in the right hand field. The "Run" button starts the study and it will run until it comes to its end or encounters an error. Once you press the run button, it changes its name to "Break", and pressing it in that state breaks the current analysis process.

The "Step" button takes one step at a time, What a step is exactly depends a little on the type of operation. For KinematicAnalysis, InverseDynamicAnalysis, and MuscleCalibrationAnalysis, a step is one time step of the movement. For SetInitialConditions, a step is one of the several distinct operations necessary to put the model into its initial state. We shall return to that subject in the next lesson.

The "Reset" button returns the model to its initial state after it has gone through a sequence of time steps. You must press "Reset" before you can rerun the model.

In the following lessons we shall look in more detail at the different operations in an AnyBodyStudy and finally also at the AnyBodyCalibrationStudy.

We need a model with a bit more substance than the template we created above. If you do not already have our trusted arm model stored somewhere, please download it here, save it to your disk, and load it into AnyBody. We are then ready to proceed to Lesson1: ModelInformation.

 

AnyBody Technology A/S · Niels Jernes Vej 10 · DK-9220 Aalborg Ø · Denmark · Tel. +45 9635 4286 · Fax. +45 9635 4599
Copyright (c) AnyBody Technology A/S · 2006 · All rights reserved · Email webmaster@anybodytech.com