I'm fairly new to Modelica, just started a few months ago due to a project I've been working on. Mostly doing work with multibody mechanical systems using the MultiBody library included in the standard Modelica distribution.
I need to change a body position according to the coordinates calculated dynamically during the simulation, but I can't find a way to do so.
This is the vector variable that calculates the position of the center of mass of the given system:
Modelica.SIunits.Length CMG[2];
CMG[1] = ... + cos(part3rotation.angles[3]) ... + part3origin[1] ...;
CMG[2] = ...;
I would like to position a massless body (FixedShape) at the coordinates (CMG[1], CMG[2]) as a way to display the center of mass and its movement during the simulation.
Is there any way to do this?
I've tried to attach the body to a fixed translation component but it expects a parameter (PARAM) instead of a variable (VAR) and this causes an error.
Software used: Modelica 3.2.2 and Wolfram SystemModeler 5.0.
The solution was to modify the FixedTranslation class to include a new input:
input Modelica.SIunits.Position xyz[3];
and modify the equations:
frame_b.r_0 = frame_a.r_0 + xyz;
Connecting the CMG vector to the xyz vector of the class did the trick.