Applet to carry out calculations relating to four stroke internal combustion engine mechanics and thermodynamics. Version 4.
To complement the book "Mechanical Engineering Design: Theme - Automotive Engines" [Ref. 1] by David J Grieve

NB This applet requires the Java Run Time Environment (JRE) to enable the applet to run in a browser. This can be down loaded from You can either download just the JRE or the complete Java Development Kit (JDK). The JDK seems to install itself so that the browser can find it OK. The applet has so far been tested with Netscape 7.2, Flock and Microsoft IE.

This version (4) differs from version 3 in that it additionally has the facility to plot a P - V diagram for the finite heat release cycle. Currently the plot is at 5 or 10 degree intervals which means the curve is not as smooth as I would have liked. (The listing is at 1 degree intervals).

Version 3 differs from version 2 in that in starts by running an induction stroke, assuming the inlet valve opening follows simple harmonic motion with a total open duration of 180o. The calculation assumes a coefficient of discharge of 0.7, checks for choked flow and uses the appropriate formula, see reference 2, below.

The absolute pressure, P1 and the temperature, T1, of the air taken in during the induction stroke (normally ambient, but not necessarily) are used for the calculations which give the absolute pressure, temperature, density during and at the end of the induction stroke. The mass of air taken in during the induction stroke is used to calculate the volumetric efficiency.

The calculated value of the volumetric efficiency (which is a mass ratio) is shown as a decimal value (not %) in the second of the results boxes adjacent to the pink labels.

After the 'Calculate' button has been clicked the first listing is inlet valve lift (in mm) the open area around the periphery of the valve (in mm 2) and the enclosed volume in the cylinder (in m3) at 1 degree intervals in the grey text area at the bottom of the screen.
The next listing shows the total mass of gas in the cylinder, the absolute pressure and temperature of the gas at 1 degree intervals during the induction stroke, together with an indication of whether the flow is choked or not:
a - , a * or a + sign.
A * sign indicates that the flow is choked, a + sign indicates that the flow is not choked and a - sign indicates that no calculation is possible for this position, usually because it is the first or last.
The next listing is the exhaust valve lift (and open area to bdc when the calculation ceases) with degrees measured from zero to whatever duration was specified.
The next listing shows, for crank angles measured from bdc at the start of the compression stroke, but only listed from 5 degrees before the exhaust valve opens, the the mass of gas in the cylinder and from the exhaust opening the density of the gas.

For engines with 2 or 3 inlet and exhaust valves per cylinder, put a value of twice or three times the valve head diameter in the appropriate valve dia.' input box(es).

This applet can be run in four different ways:
.i) With the exhaust valve shut until bdc at the end of the combustion stroke. Set the flag opposite the second orange label to 0.
.ii) With early opening of the exhaust valve. Set the flag opposite the second orange label to 1. The valve motion is assumed to be SHM hence the valve open duration (in o) must be entered as well as the angular crankshaft position after tdc of the start of the opening and also the maximum valve lift and the head diameter. A discharge coefficient of 0.7 is used [Ref. 2] for the flow of the exhaust gas out of the opening valve. The conditions are checked at 1o intervals to establish if the flow is choked or not and the appropriate formula used.

Both (i) and (ii), above, can be run either with a specified energy input per combustion stroke [enter the value (which must be greater than 1) in the 'Energy input, J' input field].
Alternatively (enter 0 in the 'Energy input, J' field) and the energy input will be computed form the air:fuel ratio and the energy value entered for the fuel.

The angular measurements in the listings and for the plots are degrees after bdc from the start of the compression stroke. However the start of the early exhaust valve opening is after tdc from the start of the combustion stroke and the listing in the grey text area starts from 5 degrees prior to the position of the exhaust opening, the exhaust valve open area listing stops (is shown as zero) at bdc, but the listing exhaust valve lift continues for the full duration
Velocities and accelerations of the piston away from bdc position are positive.

In the "Reciprocating mass" input field enter the mass of the piston, rings, gudgeon pin and a portion of the connecting rod mass (about one quarter is probably reasonable). The "Plot indicated torque" plot assumes the reciprocating mass is zero, neither torque plot makes any allowance for friction. Clicking the "Plot torque *2" button lists and plots the torque after allowance has been made for the force needed to accelerate and decelerate the piston.

NB Only integer values for "Ignition" (in degrees after bdc) can be entered, "Combustion duration" will accept integer and non integer values, as will most other input fields.

A value for the polytropic index must always be entered in the appropriate input field. 1.4 is commonly used. (The calculations of the early exhaust valve opening assume gamma = 1.35).

If Early opening of the exhaust valve is not to be considered, the "flag" input (opposite the second orange label) should be 0 and no entries are needed in the next four input fields.

If Early opening of the exhaust valve is to be considered, the "flag" input should be 1 and entries are needed in all input fields.

For the Otto cycle (4th and 5th grey plot buttons) the heat release is assumed to be almost instantaneous (between 180o and 181o after bdc).
For the finite combustion process the heat release rate is assumed to follow a Wiebe function with values of 'a'=5 and 'n'=3, (see Ref 1 chapter 8 and Ref 2 chapter 2) and the results are listed and plotted with the 3rd, 6th, 7th, 8th and 9th grey plot buttons.

N.B: The calculations of torque, indicated work done and indicated power are based on the finite heat release model rather than the (much less realistic) Otto cycle.
As neither the Otto cycle nor the finite heat release model computations make any allowance for heat transfer out of the combustion chamber, cylinder walls or piston crown, the actual temperatures and pressures will be lower than those shown and consequently the calculations using these will be overestimates. This and friction are the two main causes of the computed results for torque, work and power being greater than those actually achieved.

The blank boxes adjacent to the pink labels do not need any entry, these will contain results after the yellow 'Calculate' button has been clicked.
Click the other buttons to plot curves only after the calculate button has been clicked. Plot piston velocity first or else press the calculate button again.
Plot values are at 10o intervals except for 181 degrees after bdc, but the listings in the grey text area are at 1 degree intervals.

Each time a grey plot button is clicked, the title and values of the variable at one degree intervals are added into the results listing area.
Values on the plots are rounded down to the lower integer and given in SI units unless stated (volumes on the P - V diagram are in cc). Temperatures are in oK, pressures are in Pascals absolute.

As noted above, there are two options for specifying the total energy input per cycle:

1) Where an input energy is to be specified, enter the value into the input field by the 'Energy input, J' label (the value must be greater than 1.0).

2) If the energy input is to be calculated from volumetric efficiency, the air density, the fuel energy and the air:fuel ratio, enter a value of 0 in the 'Energy input, J' field and the energy input will be calculated.

1. 'Mechanical Engineering Design Notes - Theme: Automotive Engines', by David Grieve, 2008, 305 pages. ISBN: 978-0-9560037-0-6. Available 12.50 (including P+P) from the author, contact:
2. "Internal Combustion Engines", by C R Ferguson and A T Kirkpatrick, John Wiley and Sons. Inc., 2nd Ed., 2001.

Please send comments and suggestions to

Dr David J Grieve, Updated: 21st April 2013. Original: 27th February 2011.