Inverting models in Dymola

Written by: Alessandro Picarelli – Chief Engineer

Modelica’s acausal nature makes model inversion within Dymola a fairly straightforward task.

An example is presented in which the objective is to achieve a desired speed profile of inertia_2 whilst calculating the torque necessary to do so. For this example, a model of 2 inertias connected via a gear ratio will be inverted in three different ways.

N.B. If the system is being driven using speed actuators it is usually necessary to substitute standard Modelica friction models for smooth (e.g. atan) type models as the computation around zero speed becomes problematic.

Method 1 is to apply a speed via an actuator to inertia_1 and drive the system along a particular speed profile which also takes into account the gearing between the inertias so as to achieve the correct speed of inertia_2. We account for the gearing by scaling the desired speed of inertia_2 using a gain block.

At compilation, Dymola automatically rearranges the system equations to calculate the torque required to drive the required speed profile.

figure1

Figure 1: System driven using a speed actuator where signal can be filtered or raw (exact = false/true)

figure2

Figure 2: 

Top – plots of desired (blue) and actual (red) inertia_1 angular velocity

Bottom – plot of calculated torque to drive the system (speed is filtered in actuator)

figure3

Figure 3:

Top – plots of desired (blue) and actual (red) inertia_1 angular velocity

Bottom – plot of calculated torque to drive the system (speed is not filtered in actuator)

Method 2 uses a PID to apply the required torque to inertia_1 in order to achieve the desired speed profile for inertia_2. The model can now be driven using a torque actuator but the user will have to optimise the PID tuner parameters to achieve a good match between the desired angular velocity of inertia_2 and the actual velocity of inertia_2 (see top plot in figure 5).

figure4

Figure 4: System driven using a torque actuator

figure5

Figure 5:

Top – plots of desired (blue) and actual (red) inertia_1 angular velocity

Bottom – plot of calculated torque to drive the system

Method 3 also allows us to use a torque actuator to drive the system. The Modelica.Blocks.Math.InverseBlockConstraints inversion block takes into consideration the desired angular velocity coming from the table and also the actual speed of the inertia_2. The input of the torque actuator now becomes an unknown of the system which Dymola calculates during the simulation. Note that no calculation or accounting for the gear ratio is required using this method.

figure6

Figure 6: System driven using a torque actuator via a model inversion block

figure7

Figure 7:

Top – plots of desired (blue) and actual (red) inertia_1 angular velocity

Bottom – plot of calculated torque to drive the system

These same methods can be applied to the control of other domains and is not limited to 1D rotational mechanics models.

CONTACT US

Got a question? Just fill in this form and send it to us and we'll get back to you shortly.

Sending

© Copyright 2010-2023 Claytex Services Ltd All Rights Reserved

Log in with your credentials

Forgot your details?