Engee documentation
Notebook

Investigation of compressible gas properties

In this example, we will use a piston model and plot a gas compression experiment.

Model description

The main element of the model is the piston assembly Translational Mechanical Converter. Negative movement of the piston rod means its compression and leads to an increase in temperature and pressure in the outlet channel.

image.png

Additional blocks are responsible for controlling and measuring the piston state:

  • the piston rod is moved by the action of a Translational Velocity Source
  • displacement sensor Absolute Translational Motion Sensor measures the piston rod position
  • pressure and temperature sensor Absolute Pressure & Temperature Sensor (G) measures the gas properties at the piston outlet.
  • block Gas Properties (G) sets the working body properties of our model.

The model can work with ideal gas, with semi-ideal and real gas models.

The piston has a limit position (equal to 0.0) and an initial position (Initial interface displacement), set equal to 0.5m.

When the zero position is reached, the pressure inside the piston will be equal to the value Dead volume set in its properties (in the model it is equal to 1e-5 m^3), the rod cannot move further.

Rod control

In this model, the stem movement is set by a constant speed unit. With this control, the rod movement will be uniform, progressive and will not take into account the counter effect from the compressed gas. *In reality, the approximate situation may arise when the gas response to compression is negligible compared to the force exerted on the rod and the piston itself is structurally indestructible.

In this case, connecting the force source to the piston rod results in an unsolvable system of equations.

If the initial position of the rod is zero, negative motion of the piston is impossible. When solving such a system, the integrator will decrease the step until an error occurs DtLessThanMin.

Passing a "positive value" of velocity to the Translational Velocity Source block causes the rod to be pulled and the pressure and temperature at its outlet to decrease. Change the value of block Constant to a positive value to verify this.

Starting the model

In [ ]:
# Загрузим модель, если она еще не открыта на холсте
if "gas_actuator_model"  getfield.(engee.get_all_models(), :name)
    engee.load( "$(@__DIR__)/gas_actuator_model.engee");
end

model_data = engee.run( "gas_actuator_model" );

Let's plot the state of the gas.

In [ ]:
gr()
pos = collect( model_data["Положение штока"] )
P_out = collect( model_data["P_out"] )
T_out = collect( model_data["T_out"] )
plot(
    layout=(2,1),
    plot( pos.time, pos.value, title="Перемещение штока", leg=false, c=1),
    plot( plot( P_out.time, P_out.value, title="Давление", leg=false, c=2 ),
          plot( T_out.time, T_out.value, title="Температура", leg=false, c=3 ) )
)
Out[0]:

The upper graph shows the displacement of the rod from its initial position (not the position relative to the zero point).

If you increase the simulation time beyond 10 seconds, the rod position will reach zero and the simulation will stop with an error. To avoid this, there are more complex models based on Translational Mechanical Converter, such as the block Single-Acting Actuator (G).

Conclusion

This small model provides an insight into the operation of one of the basic "building blocks" in gas dynamic models. This building block underpins many other more complex models of assemblies, such as linear gas actuators and compressors.