One of the main purposes of this course is to develop a computer simulation of a Stirling engine. Before any simulation can take place we need to define a specific configuration. Thus we need to specify the type and geometry of the engine, the three heat exchangers, the working gas and the operating conditions. Once these have been specified then we can go to three levels of simulation: an Isothermal Schmidt analysis, an Ideal Adiabatic analysis, and a Simple analysis to evaluate the effect of non ideal heat exchangers.
In this section we consider the function set define, which includes the system definition and the Schmidt analysis. The program system is written in the MATLAB language and the eight m-files can be copied as convenient from this website, and used on any machine which has MATLAB installed.
Consider first the functional block diagram of the function set define, which has three main purposes:

The nineteen functions comprizing the set are included in the eight m-files: define.m, engine.m, heatex.m, regen.m, gas.m, and operat.m, and the two plotting routines plotpv.m and plotmass.m. All the global variables required for the simulation are declared in the header m-file define.m, and the main purpose of invoking define is to assign values to these global variables. These will subsequently be used in the 'adiabatic' and 'simple' simulations following. Notice that there are only two engine configurations specified: sinedr for a basic sinusoidal drive and yokedr for a Ross yoke-drive machine. Similarly the heat exchangers and regenerator have a limited set of options. This is a tutorial system and user is expected to augment it as required for any specific requirements. To this end the program system has been written in a universal and uniform style with strict rules regarding structure, variable names, and commenting, thus making it a self documenting system. All of the eight m-files shown above can be downloaded and copied onto any system which has MATLAB installed.
A typical execution output of the program is shown in the output file define.out for the Ross yoke drive engine, as well as the pV and the p-theta diagrams. Not very exciting, however recall that this set of routines was not designed to be executed independently, but as a precursor to the Ideal Adiabatic simulation or the Simple simulation routines, which will be discussed in detail later.The particle mass plot is shown below:
This plot shows particles of equal mass flowing through the engine over a cycle. In this design it appears as though the cooler volume can be reduced, since some mass particles never leave the cooler. This information is not intuitively obvious, and can direct the design of the machine for increased performance.
One of your tasks will be to augment the various modules to simulate and design the specific engine assigned to you. Currently the engine modules are for Alpha machines, including a Sinusoidal drive and a Ross Yoke-drive machine. The heat exchanger types include tubular, annular gap, and slot heat exchangers, and the regenerator matrix types include screen mesh and rolled foil matrices. Working gas types include air, helium, and hydrogen.
__________________________________________________________________________