1 Algorithm Comparisons for Ignition Timing Optimization Christian Peterson and Joshua Bianco December 2, 2015 University of North Carolina Wilmington Abstract Ignition timing is the process of setting the angle at which a spark will occur in the compression cycle of a four-stroke internal combustion engine with respect to piston position and crankshaft angular velocity. This paper discusses the algorithms used to find an optimal position before top dead center (BTDC) to maximize toque output of a Honda S2000 F20c stock engine. The first algorithm is based on a static approach where torque output is calculated based on a specified engine revolutions-per-minute (RPM) for varying degrees alpha and theta before and after top dead center (TDC)[1]. Alpha is a measure of degrees from the connecting rod to the line of motion of the piston, and theta is the angular position of the crank [5]. The second algorithm takes a dynamic approach for determining the optimal crankshaft position given a specific RPM and producing an angle for optimal ignition timing. The results of our algorithms produced similar ignition advance timing for varying RPM in the range 1000-9000. The optimal timing advance is between two and eighteen degrees with a maximum torque output at seventeen degrees BTDC. Key Words: ignition timing, static timing, dynamic timing, ignition optimization up in the cylinder and will be wasted trying to push the piston back down before it has reached the end of its cycle. If the timing is set too late (too retarded) the pressure from the ignited fuel air mixture will be lost and will not contribute the maximum force on the piston moving down in the power stroke, which will result in a major loss of torque output [5]. Ignition timing varies greatly based on the travelling speed of the piston, which is measured by engine RPM. The higher the RPM the more ignition advance needed, since the engine requires more fuel to run at higher speeds the total combustion process will require more time to complete. In order to account for the longer burn time of the fuel mixture the spark must be advanced in the stroke so that maximum pressure is achieved just before the pistons travels down in the cylinder, maximizing the output of the engine and reducing friction placed on the crankshaft. 2. Methods For the static and dynamic algorithms we are testing on a stock Honda S2000 F20c engine. The bore of this four-stroke engine measures 87mm or 3.4252in, the rod length measures 153mm or 6.02362in, and the stroke is 84mm or 3.30709in. The F20c engine has an output of ~237Hp and 153 ft. lb. torque and redlines at 9200RPM [2]. 1. Introduction 2.1 Static Algorithm Ignition timing is an important factor in tuning an internal combustion engine. The proper timing and spark advance optimize engine performance by producing more torque output per cylinder and reducing emissions. Proper ignition timing results in a cooler engine by working to improve rotational-momentum of the crankshaft. If timing is set too early (too advanced) and the piston is not near TDC the force will be applied against the piston travelling The static algorithm is designed to calculate the maximum torque output at a specified RPM for a range of degrees represented by alpha before and after TDC. This algorithm takes an input lambda, which is calculated based upon the velocity of the piston in the engine, the distance travelled by one piston in the cylinder, and the distance to cylinder TDC at a specific RPM. The algorithm 2 then calculates the force applied to one piston during its movement along the rotation of the crankshaft radius from top where the crankshaft angle is at 0 degrees and the connecting rod angle is 180 degrees, or 0 to pi radians, to bottom where the crankshaft angle is at 180 degrees and connecting rod is at 0 degrees, or pi to 0 radians. The algorithm only calculates the force applied in the first half of the crank radius since the rest of the stroke is used for moving the piston back to TDC in the cylinder and does not contribute to the total torque output of the engines stoke. The torque output is produced by calculating the summation of the force applied to the piston over the ranging theta, or the angular position of the crankshaft, from 0 to pi radians in the crank radius where the piston is travelling down the cylinder [1]. For each iteration or radian along the crank radius, alpha, the measure in degrees from the connecting rod to the pistons line of motion, is calculated by taking the sine of the sum of the theta value and lambda value at a given position along the crank radius [5]. The force is then calculated with each alpha, lambda and theta value, the force has been decayed since maximum force should occur at the top of the stroke pushing the piston downward and decrease throughout one half the piston cycle before reaching bottom dead center (BDC) in the cylinder. angle and the sine of the sum of the theta and alpha angles. F=(F/cos(alpha)*sin(theta + alpha)[1] The force is decayed by taking the cosine of half the given theta angle multiplied by nominal cylinder pressure (238PSI) and then multiplied by an ignition pressure multiplier of 4.0 [2]. DF=cos(theta/2)*(238)*(4.0) These calculations are performed for each iteration along half the crank radius resulting in the total torque output of the engine. The complexity of this algorithm in its worst case is represented by O(n) where n is the range of degrees before and after TDC tested. For testing we tried values from -180 to 180 degrees, for each degree tested the torque function had a function call to calculate a lambda value O(n+3) with three separate function calls O(1)*3 to convert from degrees to radians, calculate piston speed, and calculate distance moved. For each call to the torque function we calculated at RPM’s from 10009000 O(9). For the 361 degrees tested there was a function call to decay force O(1). The final results were added to a list and iterated through printing the results O(n). O(361) + O(9) + O(n+1) +O(n+1) + O(n+1) + O(1) + O(n) 374+O(3n) = O(n) 2.2 Dynamic Algorithm The dynamic algorithm is designed to calculate the angle at which the piston should be located before TDC when the spark occurs in the piston for varying engine RPM. Based on a constant burn rate of .34 milliseconds the combustion should begin alpha degrees before TDC and complete as the piston moves downward with maximum force being exerted at TDC. [1] The total force of a single piston is calculated by taking the product of the force at a given radian divided by the cosine of the alpha The dynamic algorithm takes an input of engine RPM ranging from (1000-9000) and the previously calculated angle BTDC to calculate the degrees BTDC for fuel ignition for the next RPM in the sequence. For each degree along half the crank radius the velocity of the piston is calculated by taking the sine of the product of 3 the radians alpha and the product of the given RPM and .9859. PV=sin(alpha)*(RPM*.8959)[3] Along with each radian around half the crank radius a range of velocities was tested to calculate the optimal ignition advance. After calculating the velocity of the piston at a given RPM the algorithm calculates the distance to TDC in the cylinder at that piston velocity. The distance to TDC is calculated by taking the result of the product pi minus the angle theta divided by pi and the engine rod length (6.02in). dis_TDC=(pi-theta)/pi*6.02 After calculating the distance to TDC the algorithm calculates the distance moved at that velocity and returns the result. The proper timing angle is represented by (180 degrees – result). The result from the first iteration is returned to determine the optimal angle for the next RPM in the range. The initial angle passed in for the starting value is 0 degrees or TDC. The complexity of this algorithm at its worst case is O(n^n) where n is represented by the range of degrees before and after TDC tested. For each varying degree tested there was a method call to convert degrees to radians, calculate piston speed and calculate distance moved O(1). For each degree tested there was a range of velocities tested O(180^180). For each RPM 1000-9000 an optimal degree was determined O(9). the two algorithms took different strategies to produce optimal ignition timing advance the results were very comparable. Below is the resulting torque output generated by the static timing algorithm giving a peak torque at 17 degrees BTDC. The results from the dynamic algorithm show optimal ignition advance with ranging RPM from 1000-9000 to be between two and eighteen degrees BTDC. Which matches the seventeen degrees advance specified by the static algorithm for maximum torque output. O(180^180) = O(9(n^n)) O(n^n) 3. Results The static algorithm produced the highest torque output at approximately seventeen degrees BTDC, the torque recorded at this timing advance was around 157 ft. lbs. just over the recorded 153 ft. lbs. stated by the specification sheet [2]. The dynamic algorithm produced ignition advance times ranging from 2 to 18 degrees BTDC for RPM’s ranging from 1000-9000. These results are very similar to the projected timing advance and torque output found for the Honda S2000 F20c engine. While 4. Future Work Future improvements to our work will include making the algorithms customizable for any four-stroke engine not just the Honda S2000 F20c. Other factors that will be accounted for will include varying fuel quality (octane), and stroke lengths along with differing burn rates. Tuned engines are also a possibility for improvement including supercharged engines. 5. Questions 4 1. How does proper ignition timing affect torque output of a four-stroke internal combustion engine? Answer: If the spark occurs too early it will cause “engine knock” (when the combustion process occurs too early and pushes against an ascending piston); if it occurs too late power will be wasted. 2. What is the complexity for finding ignitiontiming advance using the Static Optimization algorithm? Answer: O(361) + O(9) + O(n+1) +O(n+1) + O(n+1) + O(1) + O(n) 374+O(3n) = O(n) 3. Why is a static ignition schedule no longer implemented in modern engines? Answer: As a piston accelerates, ignition needs to accelerate as well. 6. References [1] Gupta, B., Rehman, A., & Mittal, N. (2014). Validating experimentally the gain in torque due to crankshaft offset of an internal combustion engine. International Journal of Engineering, Science, and Technology, 6(2), 76-88. Retrieved October 14, 2015. [2] Honda F20C Engine. (n.d.). Retrieved November 1, 2015, from http://www.jdmspecengines.com/hondaengines/f-series/f20c.html [3] L&M Engines, Inc. - Piston Velocity Calculator. (n.d.). Retrieved September 3, 2015, from https://www.lmengines.com/piston-speedcalculator/ [4] Derivation of Slider-Crank Model. (n.d.). Retrieved September 18, 2015, from http://www.engr.colostate.edu/~allan/thermo/pa ge2/page2.html [5] Shiffer, M. (n.d.). Ignition Timing Explained/Timing an Unknown Engine. Retrieved October 17, 2015, from http://www.type2.com/library/electrip/timex.htm [6] Piston Motion Basics -. (2014, August 8). Retrieved September 14, 2015, from http://www.epieng.com/piston_engine_technology/piston_moti on_basics.htm