# How to design a Wankel or any other rotary engine This tutorial describes the mathematical background of the rotary mechanism. It is not a software specific tutorial, a model can be realized with any program that can read coordinates from a file. (There are other tutorials for importing such as: https://grabcad.com/tutorials/tutorial-how-to-import-points-to-solidworks-from-a-text-file or How to import points from MS Excel in NX?)

1. ### Step 1: The rotary engine

The three main parts of the rotary engine is the rotor, eccentric shaft and housing. The rotor is connected to the housing via a pair of gears. The apex of the rotor divides the housing into different chambers, where the strokes of the cycle occurs. The sealing between the housing and the rotor is a critical part and it will always be the main drawback of the invention. However it is still an interesting concept. I recommend these videos to familiarize yourself with it if you have not seen them yet:

Same, but in real life:

The Wankel engine is a valveless construction so it allows unusually high rpms:

2. ### Step 2: Epitrochoid

The housing of the rotor is an epitrochoid. Wikipedia describes the curve pretty straightforward: The epitrochoid with R = 3, r = 1 and d = 1/2

It uses the parameters R, r, and d. In my calculations I prefer to use d as a fraction of r as it is more intuitive (at d = 1, the epitrochoid touches the inner circle).

The number of apexes, referred as N defines the basic shape of the rotary mechanism (R = (N-1)*r). If N = 3 then it is called the Wankel engine after its inventor Felix Wankel. However it is possible to make different designs (d = 0.5, N: 2 – 7): 3. ### Step 3: Eccentricity

The parameter d is eccentricity. This animation shows the effect of eccentricity from d = 0 to 0.8 in the case of the Wankel engine: At d = 0 both the housing and the rotor is a circle, and at max the triangle of the rotor is a hypotrochoid.

In practice the eccentricity of the mechanism increases torque (by increasing the lever arm), but at the same time the available maximal pressure ratio in the chamber is reduced. Also the outer gear must fit inside the rotor.

The gear ratio is equal to N, and the radii of the base circles are the product of R_out = N*r*d and R_in = (N-1)*r*d for the outer and inner gear respectively. The distance between the two axis is Dist = d*r. This is equal to the eccentricity of the shaft.

4. ### Step 4: Envelope

While the epitrochoid of the housing can be described with parametric equations, the rotor is a different geometry. It is an envelope which is "a family of curves in the plane is a curve that is tangent to each member of the family at some point, and these points of tangency together form the whole envelope". It is a curve which follows the eccentric rotary motion of the epitrochoid. Deriving equations for me is not an intuitive approach, although it can be done (at least for the Wankel): This is from the book Rotary Engine by Kenichi Yamamoto.

My approach was to write a short script to generate the points of the envelope for different N values. It failed, but meanwhile I discovered a much simpler solution for the problem, which is the main reason I am writing this tutorial, since I found no other sources to use this method. On the left is the plot of the curves as the epitrochoid (N = 2) rotates around the rotor, drawing the envelope. On the right the same but with points and it shows circular patterns. My next approach was to describe these circles instead of moving the envelope. These circles are formed along a greater circle, with the radius of R+r and the center (0, cos(π/N)*(R+r)). The radii of the circles along the greater circle are N*d/2 times the distance of the points of the greater circle from the x axis: The yellow line is the greater circle, the dark blue and the orange is the inner and outer envelope of the circles. (There are engines that utilize the outer envelope.) The coordinates of the circle centers are on the greater circle. The distance in the x and y directions give the angle a, and the distance between the centers and the difference between radii gives the angle b. Then the coordinates of the envelope (x1,y1) can be calculated relative to the greater circle (x,y).

5. ### Step 5: Using the spreadsheet

To keep it simple the spreadsheet consists of one sheet. Fields for editing are colored with yellow. The three main parameters are R, N and d. Every further value is calculated from these. On the top, the gear diameters and distances are shown. The epitrochoid is transformed in the x and y directions, to match the envelope. The distance of the gears and the eccentricity of the shaft is the distance of epitrochoid center from the origin. With the gray background are the results for the inner envelope and the epitrochoid.

If you paste the values to the yellow area, it can be copied further to a text editor, from which it can be saved as a .dat or .txt or other format that can be imported to CAD. The reason for this is that there are CAD systems that require all three coordinates (x,y,z) for imported points. The curve for the envelope needs to be made into a circular pattern around the origin with N steps.

Note: The columns from "B" and "C" are for the coordinates of the greater circle. From "D" to "F" are the calculations for the circles along this. These are using inverse trigonometric functions, which can produce an error message, if the values are out of the domain, however there should be a solution for every input value. I could not find a workaround yet. 