244
6 Hierarchical Component Models
Pump Program Code:
model PumpLiq
parameter Integer nComp = 1;
parameter SI.Mass epsMass = 1;
Interfaces.Signal signal(nSignal=1)
Interfaces.Liquid liqIn(nComp=nComp)
Interfaces.Liquid liqOut(nComp=nComp)
// Perfect heat capacity
parameter Real CpCoefs[nComp,2];
// Control action
SI.MassFlowRate sTotalMassF;
protected
SI.SpecificHeatCapacity Cp[nComp];
SI.Temperature TempF;
equation
signal.s = {sTotalMassF};
if sTotalMassF > 0 then
// Fluid flow from liqIn to liqOut
liqIn.Fm = if noEvent( liqIn.mode == MODE_Empty or
liqOut.mode == MODE_Full )
then zeros(nComp)
else sTotalMassF*liqIn.mass/sum(liqIn.mass);
TempF = liqIn.temp;
else
// Fluid flow from liqIn to liqOut
liqIn.Fm = if noEvent( liqOut.mode == MODE_Empty or
liqIn.mode == MODE_Full )
then zeros(nComp)
else sTotalMassF*liqOut.mass/sum(liqOut.mass);
TempF = liqOut.temp;
end if;
liqOut.Fm = -liqIn.Fm;
for i in 1:nComp loop
Cp[i] = CpCoefs[i,1] + CpCoefs[i,2]*TempF;
end for;
liqIn.Fh = Cp*TempF*liqIn.Fm;
liqOut.Fh = -liqIn.Fh;
end PumpLiq;
Component: Tank
Create a Tank (Fig. 6.49).
This component is a reservoir for storing liquid and is connected by a blue connector
to a source or pump (liq variable), and a red connector, if necessary, with a heater (heat
variable). To describe the processes in the tank, it is necessary to set as parameters
the specific heat and density of the substances in the mixture, the volume of the tank,
the maximum mass of the liquid to which ε m flows from the tank. The temperature
variable temp initially assumes a value of 300 K.
First of all, we describe the limiting cases. Let mass be the mass, and V the current
volume of fluid in the tank. Then three tank conditions are possible
Précédent

- 255/274

Suivant