212
6 Hierarchical Component Models
dI (t)
dt
= e(t)
u h (t) = K p ·
e(t) +
1
K p T I
· I (t)
We introduce the following convenient notation:
1
K p T I
· I (t) = x(t), K p T I = T, K p = K
Finally, the equations are rewritten as:
dx(t)
dt
=
1
T
e(t)
u h (t) = K · (e(t) + x(t))
Here, x(t) is the state variable of the PI controller, T is the time constant of the
PI controller, and K is the gain of the PI controller. The last two equations will be
used when writing code.
We will write the code in Modelica in the same way as we did in the previous
sections. The only difference is that we will create and use the LimitValue function,
which will limit the output stream. Its definition is done by creating a function in a
package called Functions. Since this is a package, when creating a class, we select
the class type Package (Fig. 6.5).
When creating a class inside a package, you must select the type of the Function
class (Fig. 6.6).
Fig. 6.5 Creating a special Functions package for helper functions
Précédent

- 223/274

Suivant