Specifications
67
The three graphs (of which one is constant zero) is because the hand node position is a vector with three
coordinates. We want to extract the height, which is the y coordinate, and use it as the abscissa. But the
abscissa obviously cannot be a vector, so we must construct a scalar variable containing the y coordinate of
the hand node in the AnyScript model. The way to do so represents a very useful and slightly subtle trick,
and requires a bit of explanation.
At the beginning of this lesson you learned that the system automatically defines a group of variables
containing the output from the analysis. But you can also define your own output variables. The only
difference between an output variable and an ordinary AnyVar is that the values of output variables get
stored for each time step.
So how can we make the system perceive a given variable as an output variable? The answer is that any
variable defined inside an operation in a study is a user-defined output variable. Now we are getting to the
point of the case at hand: We can define the y coordinate of the HandNode as a variable in the
InverseDynamicAnalysis operation in the study and subsequently use it as the abscissa of the Chart View.
Here's what to do:
AnyBodyStudy ArmStudy = {
AnyFolder &Model = .ArmModel;
RecruitmentSolver = MinMaxSimplex;
Gravity = {0.0, -9.81, 0.0};
InverseDynamicAnalysis = {
AnyVar HandHeight = Main.ArmModel.Segs.LowerArm.HandNode.r[1];
};
};
As you can see, the new code is an addition to the existing (implicitly defined) InverseDynamicAnalysis
object. The result is that the model now contains a scalar output variable called HandHeight containing the y
coordinate of the handle. Try adding that piece of code to the model, reload, and run the
InverseDynamicAnalysis. You should now have the following section in the tree in the Chart View:










