In the Simple Gas Model tutorial,
you created a simple open-loop gas model. This example shows how to
modify this model by changing the gas flow boundary conditions without
affecting temperature. To open the completed model, in the MATLAB® Command
To change the upstream boundary conditions from specified pressure and temperature to specified mass flow rate and temperature:
Change the Upstream Reservoir block back to
Atmospheric pressure, but keep the temperature of
Add a Mass Flow Rate Source (G) block upstream from the local
restriction. Set the Mass flow rate parameter
Simulate the model. The mass flow rate through the restriction is now 0.15 kg/s.
To measure the absolute pressure and temperature upstream of the local restriction, add a Pressure & Temperature Sensor (G) block and connect an Absolute Reference (G) block to the B node of the sensor. Duplicate the converter-scope block pair to add the Pressure and Temperature scopes to the model, as shown in the diagram.
Simulate the model. To drive 0.15 kg/s of gas through the restriction, the Mass Flow Rate Source (G) block increased the pressure from atmospheric (as specified by the Upstream Reservoir block) to almost 0.13 MPa.
The temperature upstream of the restriction is approximately 427 K, not 400 K (as specified by the Upstream Reservoir block).
The reason for the temperature increase is that the source needs to do work, to bring the
pressure up and drive the desired flow rate through the system, which adds
energy to the gas. This way, the source can be treated as an idealized
compressor or pump. However, our intent is just to specify an upstream boundary
condition of 400 K and 0.15 kg/s, regardless of whether there is actually a
compressor upstream or not. Therefore, in the Mass Flow Rate
Source (G) block dialog, switch the Power
added parameter to
Simulate the model. The temperature upstream of the restriction is now 400 K.