220
6 Hierarchical Component Models
The next step is to create the three components of the system. Let us start by
creating the Components subpackage inside the Hierarchical package. In the Components package, create a reservoir component called Tank. As mentioned above,
the “reservoir” contains four connectors, we define the variables that are transmitted
using them
• Connector LiquidFlowInput transmits a variable input stream qIn,
• Connector LiquidFlowOutput transmits a variable output flow qOut;
• Connector ReadSignalOutput transmits a fluid level variable y;
• Connector ActSignalInput transmits a signal from the PI controller u.
We write the equations that determine the behavior of the liquid in the tank. The
central equation is the differential equation we derived above:
der(h) = (qIn - qOut) / A
The flow at the outlet of the tank is related to the position of the valve through the
PI controller variable −u and the LimitValue function. When creating this model, we
used the function LimitValue that we created in the previous approach to solving this
problem. It is still stored in our Functions package.
A general text view of the reservoir component is shown in Fig. 6.19. For the
geometric dimensions of the tank and the restrictions for the flow, the same numerical
values were used as in the previous task.
Leave the text mode and go to Diagram View. We see only connectors—two input
and two output (Fig. 6.20).
Now, we will go into the icon creation mode and create a conditional image of the
tank in the same way as in the previous task. Connectors will automatically appear
on the icon (Fig. 6.21).
Create a component of the Flow fluid source that generates the fluid flow. We also
create it in the Components package:
model LiquidSource;
parameter Real flowLevel=0.15;
Fig. 6.19 Screen text view of the tank model (tank)
Précédent

- 231/274

Suivant