Computer simulation of gas exchange 
The mathematical model of gas exchange should be rapid and
precise, because the calculation of gas exchange takes a considerable proportion of total
time.
In a program DIESEL2/4t, parameters of gas in manifolds and ducts of
the engine are specified by decision of systems of equations including the conservation equation of energy, gas weight, concentration, pulse, and also equation of state
written down for these elements of engine. The gas parameters in cylinders are
specified by decision of system of conservation equation of energy, weight,
concentration, and also equation of state written down for an open thermodynamic
system. In each element of engine, except for the pulse converter the heat interchange
with walls is taken into account.
Calculation of lengthy fragments of gasair part of engine
For calculation of lengthy
fragments of an engine with high gradients of pressure the equations of
onedimensional, nonsteady flow are used. The used simulation method was designed by the
Professor A.S. Orlin for calculation of a flow velocity in exhaust port of highspeed
engines.
Equation of motion for
onedimensional, nonsteady flow:
,
where: W is the gas velocity; P is the gas pressure; r is the gas density; õ is the length of the duct, t is the time.
By multiplication of both sides of this equation on dx, integration of it on a length of the duct from 0 up to lc at assumptions that dW/dt does not depend on x and W (0, t) = 0, and also taking into account the Bernoulli's equation:
we get differential equation:
where: W_{o}(t) is a velocity of a
steadystated stream in the duct depending only on relation between cylinder
pressures and manifold one in each instant:
where: P_{c}, T_{c}
are the pressure and temperature in cylinder;
P_{r} is the exhaust manifold pressure.
At the given calculation step of
time the assumption about the gas pressure and temperature in cylinder and manifolds are
constants is used. The value of velocity W_{o}(t) at the same
calculation step is a stationary value too.
Let W_{o} be the value of W_{o}(t);
t, the value of calculation step of time;
W_{1},
the value of velocity in the end of the duct at a start of a calculation step;
W_{L}, the value of velocity in the end of the duct at the end of a calculation
step.
A solution of the differential equation (1) in view of adopted labels is:
Critical velocity of the outflow is  . 
l=
W_{L }/ a_{kp} is
a reduced velocity at the end of the channel. The exhaust port has not a profile of a
Laval nozzle. The sudden expansions and rotational displacements take place in it. The
sharp increase of losses in the duct starts already at medial values of l_{lim }=
(0.65 ... 0.75). A reason of increase of losses is the
formation of local zones of flow with a sound velocity. The supersonic flows in elements
of a piston engine are impossible generally even at supercritical differences of pressure.
Therefore if l > l_{lim} then W_{L} = l_{lim }a_{kp}.
The mean velocity of the flow at a small calculation step is
W = (W_{L} + W_{1}) / 2.
There are temperature, pressure and density in the gas portion which has flowed out from the cylinder: 
Mass and enthalpy of a portion of gas flowed out from a duct with an effective flow section mf during a calculation step Dt are
DG = mf r W Dt, I^{*} = DG Cp T_{c}.
The calculation of gas exchange is carry out with a step of 1 crank angle deg.
Boundary conditions in front of turbine
At calculation of parameters of gas in an exhaust manifold the boundary conditions of the turbine are applied. Equations for mass and enthalpy of gas portion flowed out into a turbine are
I^{*}_{t} = DG_{t }C_{p } T^{*}_{r} ; (2) 
where: P^{*}_{r}, T^{*}_{r }are stagnation pressure and temperature in inlet of turbine;
P_{2} is turbine discharge
pressure;
F_{t} is flow section of turbine nozzles;
m
is coefficient (for the radial turbine m = 0.42, for axial one m =
0.346);
A is empirical factor.
To obtain required value of average pressure in front of the turbine P^{*}_{r }it is necessary to update value of a factor A by iterations. Previously, the average turbine inlet pressure must be set directly in a list of input data or must be calculated from an equation of balance of the turbine and compressor power .
Pulse converter simulation
For calculation of mixing of flows from two manifolds in the pulse converter the equations of an ejector are used. The pressure in zone of flows mixing P_{t} is specified by iterations on each calculation step. Pressure P_{r1}^{*}(j) and temperature T_{r1}^{*}(j) in the “first” inlet of the pulse converter are specified by step by step decision of system of conservation equations for exhaust manifold. This equations system is decided together with other equations systems for the cylinder and intake manifold. The parameters in the “second” inlet of the pulse converter P_{r2}^{*}(j) and T_{r2}^{*}(j) are not calculate. They are specified by shift of time of the computed results of the "first" inlet. The value of shift is Dj = 360 / i_{cyl}, where i_{cyl }is a number of cylinders connected with one exhaust manifold. The velocity of gas in the mixing zone can be specified by the Bernoulli's equation for an incompressible liquid :
where:  is mean gas density. 
The calculations
in view of a compressibility provide practically identical results, but require the much
greater the computer run time.
Resultant flow velocity and flow rate after mixing is
W_{t} = (W_{1} + W_{2}) / 2 ; G_{t} = r F_{t }W_{t} ;
where: F_{t} is flow section area of turbine inlet.
The way of calculation of stagnation pressure in mixing
zone depends on the pulse converter design. If the losses on sudden expansion take place
in the pulse converter before a turbine the pressure is
P_{t}^{*} = P_{t} + r (W_{1}^{2} + W_{2}^{2}  W_{t}^{2}) / 2 .
Fig.1  If the pulse
converter is designed in a scroll duct of a radial turbine (Fig.1) , the losses of sudden
expansion are absent. P_{t}^{*} = P_{t} + r W_{t}^{2} / 2 . 
Stagnation temperature in the mixing zone is
T_{t}^{*} = (T_{r1}^{*} W_{1} + T_{r2}^{*} W_{2 }) / (W_{1} + W_{2 }).
Mass of gas portion flowed out into a turbine are specified by boundary condition equation is
If çG_{t}^{' } G_{t }ç> 0.001 G_{t}^{'}, the calculation of the pulse converter should be repeated with other value of P_{t }down to installation of mass balance.
At calculation of an exhaust manifold connected with the pulse converter the boundary conditions (2) are substituted on (3).
DG_{t }= W_{1 }r Dt F_{t }/ 2 ; I_{t}^{*} = DG_{t} C_{p }T_{r1}^{*}. (3)
Peculiarities of gas exchange simulation in the cylinder of the twostroke engine.
The basic difficulty at the calculation of
working process of the twostroke engine is simulation of scavenging. In this period in
the cylinder there is a complex interaction of two gas flows: a cold fresh charge and hot
burnt gases. In mathematical model the parameters of gas during a scavenging are
determined separately for both zones. At simulation, a combination of hypotheses of zones
interaction is used:
 About "complete mixing ",
 About "layer replacement ",
 About "short closing".
At calculation, thermal interaction between the zones is taken into account, and also
assumption about instant distribution of pressure inside the cylinder is used.
At the beginning and up to the middle of a scavenging,  a
hypothesis about " layer replacement " is used, i.e. the cylinder is considered
to be divided into two zones by a membrane which is opaque for gas. There are zones of a
fresh charge and burnt gases. In both zones the values of temperature and concentration of
gases are calculated and all the parameters of gases are specified by decision of systems
of equations of weight balance, energy balance and state, written down for each zone. The
pressures in both zones are equal. The heat exchange between the zones is taken into
account. Naturally, it is supposed, that the gas from inlet ports gets into the zone of
fresh charge, and the burnt gases stream into exhaust ports (as indicated by the arrows in
Fig. 2 ). At the end of the scavenging the calculation is switched over, either to a
hypothesis about "complete mixing" of zones (mainly for uniflow scavenging), or
to a hypothesis about "short closing" (for the loopback scavenging).
Uniflow scavenging  Loopback scavenging 



At "complete mixing", the parameters of gas in the cylinder are again accepted homogeneous, and they are calculated from summation.  At "short closing"  assumption is introduced that the gas from a zone of fresh charge is directed at once to the exhaust port and the remaining burnt gases remain in the cylinder up to the end of gas exchange. This gas will get mixed up with a fresh charge already after closing of inlet and exhaust ports. 
Peculiarities of gas exchange simulation in the cylinder of the fourstroke engine.
During a scavenging of the cylinder of the fourstroke engine an assumptions about "complete mixing" and instant distribution of pressure are used. The whole volume of the cylinder is a uniform thermodynamic system in which parameters of gas are determined.
Peculiarities of gas exchange simulation in petrol engines.
At calculation of gas exchange in the petrol engine, design features
of its fuel supply system are taken into account:
 Carburetor system;
 System of injection into an inlet manifold;
 System of injection into the inlet port (on the valve).
Examples of gas exchange simulation
Gas exchange phenomena in the fourstroke 6
cylinder diesel D6
(D/S=150/180 mm, rpm=1500, BMEP=9 bar)
Notations: a  Pressure in the cylinder; b  Pressure in the exhaust manifold; c  Pressure in the inlet manifold; d  Flow section of exhaust port; e  Flow section of the inlet port; Gas velocity in the ports: fexhaust; g  inlet 
Gas exchange phenomena in the twostroke 3 cylinder
diesel 3TDF with uniflow scavenging
(D/S=120 / 2x120 mm, rpm=2600, BMEP=14 bar)
Diagram of diesel 
Notations: a  cylinder pressure; b  exhaust manifold pressure; c  inlet manifold pressure; 
d  flow section
area of inlet ports; e  gas flow rate through inlet ports; f  gas flow rate through exhaust ports;; g  flow section area of exhaust ports.. 
Calculation of parameters of the truck diesel KamAZ 7405 at the several operating regimes. Verification of the calculated data compared to experimental ones: integral parameters, curves of heat release, curves of pressure during combustion and during gas exchange. 