Group Assignment 5: Optimization for an On Board Fuel Processing Unit to Provide Hydrogen from Ammonia Michael Huang, Zubin John, Bill Binder, Joel Toussaint Task 1: Solving the Design Problem Deterministically In the first part of this exercise expected utility of the ammonia cracker fuel cell car is optimized (maximized). The design of experiments performed in the previous assignment showed that the design space had numerous local maxima making it difficult to find the somewhat steep and thin global maximum. Many different algorithms of different types were tested to see what could most efficiently and accurately calculate the global maximum. After many tests it was found that only a genetic algorithm could find the correct peak the global maximum was on. It was decided the most efficient way to accurately solve for the global maximum was to use the Darwin algorithm to get close to the maximum and then acquire a finer solution using Hooke-Jeeves algorithm. Once the Hooke-Jeeves algorithm had an appropriate starting value it could very quickly converge to a maximum. Hooke-Jeeves was selected instead of quicker more approximate gradient based algorithms because it consistently found values a few percent higher which indicated the other methods were less accurate. Figure 1.1 shows the design variables changing each run and eventually converging on the optimum. 1500 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200 100 0 200 400 600 800 1000 1200 1400 1600 1800 Run Number SystemVoltage StallTorque w _max Figure 1.1: Design variables at each run. Blue is system voltage, red is stall torque, and green is ωmax. 1 It can be seen that the Darwin algorithm starts with the design variables spanning randomly across their range. The voltage of the battery/PEMFC appears to converge to an optimum value fastest after about 300 runs, most likely due to its smaller range. After about 500 runs stall torque and ωmax start to converge to an optimum value although ωmax seems to slowly improve after another 1000 runs. Figure 1.2 shows the design variable values vs. the expected utility. 1500 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200 100 0 20,000,000 40,000,000 60,000,000 80,000,000 100,000,000 120,000,000 ExpectedUtility SystemVoltage StallTorque w _max Figure 1.2: Design variables vs. expected utility. Blue is system voltage, red is stall torque, and green is ωmax. Design variables at the same expected utility are from the same run. Expected utility increases as the design variables narrow to their optimum values together. It is interesting to see that the farther from optimum the larger the range of values that can be taken by the design variables. As the optimization begins to converge the design variables are generated over a smaller and smaller range as they approach an optimum. Once the Darwin algorithm nears a global maximum the run with design variable values that give the highest expected utility is used to start the Hooke-Jeeves algorithm. Figure 1.3 shows the design variables vs. the run number. 2 1500 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200 100 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 Run Number SystemVoltage StallTorque w _max Figure 1.3: Design variable values vs. run number. The colors represent the same variables as in previous figures. The figure shows that the starting values generated from the Darwin algorithm are very close to what the Hooke-Jeeves algorithm converges to. The Hooke-Jeeves algorithm only makes a very small improvement but runs much faster than the Darwin algorithm. Figure 1.4 shows the design variable values vs. expected utility. 1500 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200 100 20,000,000 30,000,000 40,000,000 50,000,000 60,000,000 70,000,000 80,000,000 90,000,000 100,000,000 110,000,000 120,000,000 ExpectedUtility SystemVoltage StallTorque w _max Figure 1.4: Design variable values vs. expected utility for Hooke-Jeeves algorithm. Design variables at the same expected utility are from the same run. 3 The expected utility nears the global maximum as the design variable values cluster near the optimum. If even one of the design variables strays from their optimum value the expected utility drops rapidly. The global maximum found in this exercise is in agreement with what was found in the previous assignment G4. It was found that the highest peak in the design of experiments from G4 was at a voltage of 185 V. Similarly using the optimizer the optimal voltage found is at 179 V. Also the stall torque is found to be 367.6 Nm and ωmax is 1314.6 rad/s. This means that only ωmax changed by a large amount from 900 Nm. This is not an issue since the space can have rapidly shifting maxima as the voltage changes a small amount. Task 2: Solving the Design Problem under Uncertainty Due to the fact that our model requires approximately thirty seconds to calculate, we decided that a surrogate model was necessary. In order to do this, a level 7 full factorial was performed as data. This was then used to create the surrogate model with R2 values of 99.999%, 99.9311%, and 99.7135% for mileage, acceleration, and top speed, respectively. Since these values were extremely close to one, it was concluded that the surrogate model would be sufficient for use in performing the optimization under uncertainty. The Hooke-Jeeves algorithm was used with five trials, starting at the optimized value that was achieved deterministically. Figure 2.1 shows the model with the optimizer wrap. Figure 2.1: Shows the model with the Optimizer 4 Using the new optimal value from the five trial optimization, we then performed a ten trial and consequently a twenty-five trial optimization. The change in the variables was less than one percent and thus it was concluded that we were sufficiently close to the optimized value and that additional iterations would be unnecessary due to the high cost of running the optimizer and low return on values that did not change significantly. The final values were 186.1 V, 389 N-m, and 1287 rad/s for the system voltage, stall torque, and maximum angular velocity respectively. Based on these numbers, the averages for the parameters were: zero to sixty acceleration time was 8.463 seconds, the mileage was 73.76 mpg, and the top speed was 123.86 mph. This provided an expected utility of 1.22*108. In order to further understand what the optimizer was doing, we then decided to make plots of the variables against the expected utility as well as a plot of the variables with respect to the run number, shown in Figure 2.2 and 2.3, respectively. Figures 2.2 and 2.3 only show the case of the twenty-five trial optimization. The plots for the five and ten trial optimization can be found in Appendix A and B. 25 Trial Parameters vs Uncertain E[U] 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 3e+007 4e+007 5e+007 6e+007 7e+007 8e+007 9e+007 1e+008 1.1e+008 1.2e+008 E[U] SystemVoltage StallTorque w _max Figure 1.2: Shows the design variables, i.e., the system voltage, stall torque, and maximum angular velocity vs the expected utility. It is clear from Figure 2.2 that the optimizer quickly located the general region of the maximum expected utility. As it approached the optimal value of the expected utility, the number of trials in that area increased. In addition, the closer to the maximum expected utility the 5 optimizer was, the smaller the change in the variables. This is reasonable as it is expected that the optimizer first finds the general area of the optimal value and then proceeds to refine its search as it gets closer to the true optimal. Since Hooke-Jeeves algorithm uses the slope of the solution it is also easy to understand that not many runs are necessary when it calculated a large slope, only when the slope was approaching zero. 25 Trial Parameters vs Run Number 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 Run Number SystemVoltage StallTorque w _max Figure 2.3: Shows the design variables, the system voltage, stall torque, and maximum angular velocity vs the run number. Figure 2.3 helps to reinforce the conclusions made from Figure 2.2. In Figure 3 it is clear that the optimizer changed the values of the variables considerably in the beginning of the optimization but then the changes became very small as the run number increased. This is simply the optimizer searching the space from the initial values. Of particular interest is that the optimizer appears to avoid changing more than one variable at a time. By looking closely at the very beginning of the optimization it is clear that the stall torque and maximum angular velocity do not change under the optimizer has explored an area around the system voltage. It performed a search in both directions from the initial value. Once this was done, the stall torque design space was then explored in a similar fashion, with the other two variables remaining unchanged. Lastly, the maximum angular velocity then did this in a similar fashion. This was then repeated, 6 starting once again at the system voltage and appears to repeat indefinitely until the optimizer has the optimal values. The deterministic optimizer was able to achieve a higher value of utility as compared to the expected utility from the uncertain optimizations. The utility from the deterministic optimizer is 1.245*108 while the expected utility from the uncertain optimizer was 1.221*108. Without an infinite number of trials it is not useful to compare the two values. This is due to the fact that the uncertain optimizer was using a set of random entries that the deterministic optimizer is unable to access and the uncertain optimizer only approaches this as the number of trials goes to infinite. Task 3: Lessons Learned The first issue that had to be addressed was our Dymola model's extremely long runtime of nearly 30 seconds depending on what machine is used. Two attempts were made at producing a surrogate model with the Krigging method. The first attempt, which used 1080 data points, was most likely quite sufficient although there was some concern that the true optimum would be outside of the range of points taken. A second attempt was made with nearly 2400 data points over a larger range despite warnings that it wouldn't be feasible (it was mentioned that over 1000 would most likely not work). Delightfully, the surrogate model did not take long to generate and gave an R2 value of no less than 99.7%. Figure 3.1 shows the RSM toolkit results that confirm the 2392 point surrogate model. 7 Figure 3.1: Surrogate model is successfully generated over 2392 data points with sufficient accuracy. A design of experiments was performed with the surrogate model to show that it matched with the Dymola model design of experiments. The next issue was selecting an appropriate optimization algorithm. Unfortunately the design space was very bumpy most likely due to the demand model. This made using a less efficient global optimization algorithm necessary. Fortunately since the surrogate model was generated the run time was not unreasonable. After several practice runs it was determined that the Darwin algorithm would work most efficiently with the data. After about an hour the Darwin algorithm was close to converging to an optimum. Once it seemed that it found very close to a global maximum and it wasn't going to go much higher it was decided that switching to a gradient based algorithm, Hooke-Jeeves would be more efficient to further explore the peak. In this assignment we were able to become familiar with many different optimization algorithms and methods to explore our design space. The use of a surrogate model turned out to be very helpful. The combination of a surrogate model and a genetic algorithm seem to be very effective in optimizing a problem with many local maxima. If presented with another design problem, we would like to do two things differently. Firstly, we would like to spend more time planning and implementing the prospective system in Dymola so that the model reflects 8 accurately the physical processes in the system. By making the Dymola model more modular and efficient, it would hopefully reduce the run time to something more easily handled than 30 seconds per run. One of the trade-offs, which in this case was well worth it, was the surrogate model. The creation and verification of the surrogate model required two designs of experiments, both of which took a considerable amount of time. This time was definitely less than the amount of time that would have been consumed had we tried running our optimizers with the Dymola model. Secondly, we would strive to get more results for the design surveys. This would help us develop a more accurate demand model that will reflect how desirable the design is to the target market. The system had a trade-off where it seemed to sacrifice acceleration time in order to increase the mileage to a certain level. This also had to be done with the top speed being a sufficient level. Appendices Appendix A, Five Trials 5 Trial Parameters vs Uncertain E[U] 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 3e+007 4e+007 5e+007 6e+007 7e+007 8e+007 9e+007 E[U] StallTorque SystemVoltage 9 w _max 1e+008 1.1e+008 1.2e+008 5 Trial Parameters vs Run Number 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 10 20 30 40 50 60 70 80 90 100 Run Number StallTorque Appendix B, Ten Trials 10 SystemVoltage w _max 110 120 130 140 10 Trial Parameters vs Uncertain E[U] 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 2e+007 4e+007 6e+007 8e+007 1e+008 E[U] SystemVoltage StallTorque w _max Parameters vs Run Number 1500 1450 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 800 750 700 650 600 550 500 450 400 350 300 250 200 150 100 0 20 40 60 80 100 120 140 Run Number StallTorque SystemVoltage 11 w _max 160 180