6.2 Heating a Liquid Mixture
241
The temperature matches the current temperature in the tank
T empF = liq.T
Knowing in each case the temperature of the liquid TempF, we can record its heat
capacity as a linear function of temperature:
C p = C p0 + C p1 · T empF
And the amount of heat, respectively, received or given away by the liquid
F h = F m · C p · T empF
Liquid Source Program Code:
model SourceLiq
parameter Integer nComp = 1;
Interfaces.Liquid liq(nComp=nComp)
Interfaces.Signal signal(nSignal=nComp+2)
// Signals from the regulator
Real sFracMass[nComp];
SI.MassFlowRate sTotalMassF;
SI.Temperature sTempF;
// Specific heat
parameter Real CpCoefs[nComp,2];
protected
SI.SpecificHeatCapacity Cp[nComp];
SI.Temperature TempF;
equation
signal.s[1:nComp] = sFracMass;
signal.s[nComp+1] = sTotalMassF;
signal.s[nComp+2] = sTempF;
if sTotalMassF > 0 then
// Fluid flow from reservoir to source
liq.Fm = if noEvent(liq.mode == MODE_Empty)
then zeros(nComp)
else sTotalMassF*liq.mass/sum(liq.mass);
TempF = liq.temp;
else
// Fluid flow from source to reservoir
liq.Fm = if noEvent(liq.mode == MODE_Full)
then zeros(nComp)
else sTotalMassF*sFracMass;
TempF = sTempF;
end if;
for i in 1:nComp loop
Cp[i] = CpCoefs[i,1] + CpCoefs[i,2]*TempF;
end for;
liq.Fh = Cp*TempF*liq.Fm;
end SourceLiq;
Précédent

- 252/274

Suivant