**Written by: Romain Gillot – Project Engineer**

The **inverseBlockConstraints** block can be found in **Modelica.Blocks.Math**. It allows to invert the input(s) and output(s) of a model whilst maintaining the plant model identical. This is possible because Dymola supports acausal modelling with extensive support of the Modelica language. The symbolic manipulation Dymola performs prior to running a model allows the model equations to be automatically rearranged into a form where a solution can be calculated in relation to the boundary conditions and model paramterisation imposed.

Let’s have a look at a few examples of applications of **inverseBlockConstraints**:

Example 1: As an alternative to a PID.

PID are frequently used control components but they require parameter tuning.

Figure 1: Model of an inertia controlled by a torque actuator.

Above is a simple model of a torque source rotating an inertia, a PID is used to reach our desired speed.

The results are as follows:

Figure 2: Required torque and speed profile.

An alternative to using a PID is to use the inverseBlockConstraints block.

Figure 3: Same model as in figure 1, without the PID.

The results:

Figure 4: Input torque and speed profile.

Example 2: To invert a table.

Let’s consider the example of a 2D table for the sake of simplicity (it would also work with 3D tables).

Figure 5: Simple 2D table where y=u1*u2.

The output of the table is the product of the two inputs.

With u1 = 0.3 and u2 = 3, we can check that the table output is 0.9:

Figure 6: Table output.

In the case when we know one input and we know what output we want, we can use the inverseBlockConstraints block to find what the value of the second input needs to be.

Figure 7: Let’s find the value of the missing input.

We can check that the value of the second input is calculated in the correct way:

Figure 8: The value is correct!

This can be useful in cases when the table of data received from the manufacturer is not in the same format as in the model (i.e. speed=f(torque) instead of torque=f(speed) for example).

This model has to be used with caution since it can generate non-linearities. However, it can be useful to get a sense of what the input of a model should be and can later be replaced by a more physical control model.

**Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion**