Interfacing to Non-Mechanical Model Components


When a multidomain model in Modelica is designed, the mechanical part of the model physically interacts with some other parts of the model. The mechanical part should usually be connected with the part describing the drive train, which is in turn connected to the part describing the energy source, e.g. electrical circuit. There are standard Modelica libraries for all these components.

However, sometimes the attention is focused on an isolated mechanical part of the model. In this case the reference positions as well as forces and torques acting on the model can be specified directly.

There exist three major ways to set up an interface between the mechanical part of Modelica model and other parts. These ways correspond to three connector types:
Multiboby.Interfaces.Frame, Rotational.Interfaces.Flange and Translational.Interfaces.Flange.


1 Using Multibody.Interfaces.Frame

Any object with connector of type Frame_a or Frame_b can be connected to a model of external force or torque. This external force (or torque) will be applied to the corresponding point on the relevant body. The example below includes a force acting on the end of the pendulum in direction of the local Y-axis (perpendicular to the pendulum bar). When force is attached to the pendulum it does not oscillate; it rotates instead.






Sometimes it is necessary to specify external force in global coordinates. One connect statement should be replaced by equation (see below). The input signal
ExtForce object is adjusted according to the orientation matrix S of the ExtForce frame. When such constant force (in direction of vector {1,1,0} in the global coordinate system) is applied to the pendulum, it oscillates near the equilibrium point.


2 Using Rotational.Interfaces.Flange

The Rotational library describes varius elements for one-dimensional rotational motion. These elements can be attached to the Revolute joint from MultiBody library. A torque, spring, damper or any other component can be attached to the flanges of the revolute joint. The example below illustrates a one-dimensional spring and damper (from Rotational library) attached to the revolute joint of a simple pendulum.





3 Pendulum with Rotational Angle Steering

Sometimes there is a need to rotate the body connected to the joint to a certain desired angular position.This can be done by the use of an instance of the class Rotational.Position. In the example pendulum with rotation angle steering, the specified value of the angle is given by the step1 instance of the Step signal source from the Modelica.Block.Sources sublibrary. This value is converted to an angular position by the position1 component. In class Position the reference angle is filtered and the second derivative of the filtered curve is used to compute the reference acceleration of the flange. Angular position of the joint is computed from this acceleration. For filtering, a second order Bessel filter is used. The critical frequency (also called cut-off frequency) of the filter is defined via parameter f_crit in [Hz]. This value should be selected in such a way that it is higher as the essential low frequencies in the signal.







4 Computational Steering of a Pendulum through a PD controller

Another way to steer a joint is to set up a Proportional Derivative (PD) controller. Instead of computing angular position, the PD controller creates an active torque, which acts on the joint. It behaves like a motor; parameters k and d can be tuned in order to adjust the reaction speed and power.