{"id":6057,"date":"2021-08-13T13:46:10","date_gmt":"2021-08-13T17:46:10","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=6057"},"modified":"2023-09-13T14:01:40","modified_gmt":"2023-09-13T18:01:40","slug":"improve-a-cars-engine-performance","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2021\/08\/13\/improve-a-cars-engine-performance\/","title":{"rendered":"Improve a Car\u2019s Engine Performance"},"content":{"rendered":"<p><em>For today\u2019s post Roberto Valenti will provide details about the project implemented\u00a0by MathWorks\u2019 new Excellence in Innovation Program team.\u00a0<\/em><\/p>\n<p><span class=\"TextRun SCXW57032725 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW57032725 BCX0\">In th<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">e <strong><a href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2021\/08\/06\/matlab-and-simulink-design-projects-for-students-everywhere\/\">MATLAB and Simulink Design Projects for Students Everywhere<\/a><\/strong><\/span><span class=\"NormalTextRun SCXW57032725 BCX0\"><strong>\u00a0<\/strong>blog\u00a0we introduced the MathWorks\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">Excellence in Innovation program\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">and how we collaborated with<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">Professor Shayne McConomy\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">from\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">the Mechanical Engineering Department of the Florida Agricultural and Mechanical University \u2013 Florida State University (FAMU-FSU) College of Engineering<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">to pilot the program. A<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">s<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">\u00a0a result<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">,<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">a team of students from\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">Professor McConomy\u2019s senior design class\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">selected\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">and worked on\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">an automotive project from the\u00a0<\/span><\/span><strong><a class=\"Hyperlink SCXW57032725 BCX0\" href=\"https:\/\/github.com\/mathworks\/MathWorks-Excellence-in-Innovation\" target=\"_blank\" rel=\"noreferrer noopener\"><span class=\"TextRun Underlined SCXW57032725 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57032725 BCX0\" data-ccp-charstyle=\"Hyperlink\">GitHub list<\/span><\/span><\/a><\/strong><span class=\"TextRun Underlined SCXW57032725 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW57032725 BCX0\" data-ccp-charstyle=\"Hyperlink\">.<\/span><\/span><span class=\"TextRun SCXW57032725 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW57032725 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">In this blog we provide details on the project\u00a0<\/span><span class=\"NormalTextRun SCXW57032725 BCX0\">and the solution the team has implemented.\u00a0<\/span><\/span><span class=\"EOP SCXW57032725 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259,&quot;469777462&quot;:[9720],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-6066 size-large\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/team-1-1024x256.png\" alt=\"\" width=\"1024\" height=\"256\" \/><\/p>\n<p><em>The team,\u00a0composed of four\u00a0senior students:\u00a0Austin\u00a0LaFever,\u00a0Patrick\u00a0H.\u00a0Marlatt,\u00a0Frederick Peterson,\u00a0and\u00a0Jonathan Wozny,\u00a0(pictures of the students in\u00a0Figure\u00a01<\/em><span data-contrast=\"auto\"><em>)\u00a0<\/em>worked\u00a0on\u00a0an automotive project,\u00a0named\u00a0<\/span><strong><a href=\"https:\/\/github.com\/mathworks\/MathWorks-Excellence-in-Innovation\/tree\/main\/projects\/MIMO%20Engine%20Airpath%20Control\">MIMO Engine Airpath Control<\/a><\/strong><span data-contrast=\"auto\"><strong>,<\/strong>\u00a0with\u00a0the\u00a0objective\u00a0to design\u00a0and\u00a0implement\u00a0a\u00a0torque control\u00a0to improve\u00a0a\u00a0car\u2019s engine performance using a\u00a0Multi Input Multi Output (MIMO)\u00a0approach.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259,&quot;469777462&quot;:[9720],&quot;469777927&quot;:[0],&quot;469777928&quot;:[1]}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The challenging project\u00a0gave the students the opportunity to gain knowledge on\u00a0a\u00a0car\u2019s powertrain system,\u00a0modeling and simulation, system identification,\u00a0and\u00a0an\u00a0advanced control\u00a0approach\u00a0such as\u00a0the increasingly popular\u00a0model predictive control.\u00a0Moreover, throughout the project they had the\u00a0chance\u00a0to\u00a0apply\u00a0industry relevant tools for real\u00a0world\u00a0applications\u00a0building the base of their career in the automotive industry!\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"1\"><span data-contrast=\"none\">Motivation<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">Internal combustion engines will continue to be used in the automotive marketplace well into the future. However, engine performance, fuel economy, and emissions must continually be improved to keep them viable relative to more expensive full electric power sources. For example, modern gasoline and diesel engines use direct fuel injection which can result in particulate matter emissions at low engine loads with particles small enough to enter the human bloodstream directly through the lungs, so control of particulates is a major area of focus in diesel and gasoline engine control design today. Transient air-fuel ratio control is critical to the particulate matter problem.\u00a0The ability to both estimate and control the airflow into the engine is at least half of the Air-Fuel Ratio (AFR) control problem that is\u00a0critical\u00a0to\u00a0obtain\u00a0good engine performance, fuel economy, and emissions. Since multiple actuators,\u00a0e.g.,\u00a0throttle, wastegate, cam-phasers, Gas Re-circulation (EGR), affect the airflow into the engine, multi-input\/multi-output\u00a0(MIMO)\u00a0control of engine airflow is a\u00a0desirable\u00a0way to improve engine airflow control and estimation performance that has yet to be implemented fully in the marketplace.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"1\"><span data-contrast=\"none\">Introduction<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">Internal combustion engines rely on airflow through the engine from the outside environment in order to complete the combustion process and power the engine. Until now, internal combustion engines have relied on a single-input single-output (SISO)\u00a0proportional-integral (PI)\u00a0control approach developed decades ago. This approach manipulates the main components that control airflow into the\u00a0engine using scheduled steady-state positions. During transient response, the output is not coordinated or optimal compared to steady-state operation, resulting in inefficient control of torque and emissions. Although effective steady state control is achievable, effective transient control with this method is not and therefore needs to be improved\u00a0to\u00a0keep up with increasingly competitive standards of engine performance and emissions.\u00a0With the standard technique,\u00a0throttle and wastegate are not coordinated to provide a boost or intake manifold pressure (MAP) trajectory that\u00a0would\u00a0result in good emissions and torque transient response.\u00a0Our project goal\u00a0was to\u00a0design and implement a\u00a0MIMO controller\u00a0of the air system to produce coordinated\u00a0and optimal\u00a0control of the output values\u00a0in both transient and steady-state conditions. This control approach will control the boost by controlling the throttle and wastegate. Boost will then be related to torque to create a desired torque response.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">We decided to follow the\u00a0work described by GM in [1]\u00a0and\u00a0implementing\u00a0a model predictive control\u00a0(MPC)\u00a0system for the air flow components, specifically the throttle and wastegate, to control transient and steady state torque and emissions effectively.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"1\"><span data-contrast=\"none\">Methodology<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">In this project, the engine system\u00a0has been\u00a0simulated using the\u00a0spark-ignition (SI)\u00a0Engine Dynamometer in the MathWorks\u00a0Powertrain\u00a0Blockset\u2122, shown in\u00a0<\/span><span data-contrast=\"auto\">Figure\u00a02<\/span><span data-contrast=\"auto\">\u00a0below.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"576\" height=\"379\" class=\"aligncenter size-full wp-image-6081\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/EngineDynamometer.png\" alt=\"\" \/><\/p>\n<p><em>Figure 2 Engine Dynamometer Model<\/em><\/p>\n<p><span data-contrast=\"auto\">To model the system, the System Identification Toolbox in MATLAB was used to develop second order state-space models relating the throttle and wastegate to MAP separately using data acquired from the virtual engine\u00a0simulation. Because the system is nonlinear, it can be linearized by creating models over a range of operating points (engine speeds and torque commands).<\/span><\/p>\n<h1><span data-contrast=\"none\">Data collection<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">To\u00a0create the MPC controllers, each controller will need a model at specific operating points to reference while making control calculations. To do this, simulations were run to collect input\/output data for a range of engine speeds; the data for engine speed, throttle position, waste gate position, and MAP needed to be collected for each simulation. The data was simulated and collected in Simulink, and then processed in\u00a0MATLAB. Two sets of data were collected at each operating point\/engine speed, one set for system identification and the other for system validation.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">Modeling<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">The modeling was performed by overriding the engine speed to hold the engine in steady\u00a0state at a constant speed. The throttle and wastegate values in the controller were then overridden with a pseudo-random binary sequence (PRBS) sent into the throttle and wastegate values, essentially \u2019wiggling\u2019 each actuator and then seeing how the intake manifold pressure (MAP) responded. When a PRBS signal was sent into the throttle, the wastegate position was held constant to see only the effect of the throttle and vice versa. In order to improve accuracy, we utilized a system called differential modeling, which detrended the data (\u2019detrend\u2019 command used for input\/output data), then reduced the magnitude of the data to improve the system modeling. MPC works best in\u00a0\u2018differential control mode\u2019.\u00a0Differential modeling gets its name because it creates a model from the differences of the inputs\/outputs; essentially the mean values of the inputs\/outputs are subtracted from the measured input\/output data to see the direct changes in the output made by changes in the input. The process reduced the value of the manifold pressure so that the midpoint of the values was zero.<\/span><\/p>\n<h2><span class=\"TextRun SCXW159429782 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW159429782 BCX0\" data-ccp-parastyle=\"heading 3\">Modeling Throttle<\/span><\/span><\/h2>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><img decoding=\"async\" loading=\"lazy\" width=\"552\" height=\"434\" class=\"aligncenter size-full wp-image-6075\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/IntakeManifoldPressure1.png\" alt=\"\" \/><\/span><\/p>\n<p><em>Figure 3: Throttle PRBS Signal and MAP Response at Engine Speed 5000 rpm<\/em><\/p>\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><span class=\"TextRun SCXW18230816 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW18230816 BCX0\">At small throttle angles the boost is sensitive, since a small change in its position would correlate to a large percent difference in air pressure in the manifold. MAP is also much easier to model and control at small throttle angles; as the\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW18230816 BCX0\">percent<\/span><span class=\"NormalTextRun SCXW18230816 BCX0\">\u00a0position of the throttle increased, the system became much more difficult to model. To model the relationship between throttle and MAP, the wastegate was held completely open at 100% (no effect) and the throttle was \u2019wiggled\u2019 at low values. Throttle values that provided suitable models were very low, less than ten percent.\u00a0<\/span><\/span><span class=\"FieldRange SCXW18230816 BCX0\"><span class=\"TextRun SCXW18230816 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW18230816 BCX0\">Figure\u00a0<\/span><span class=\"NormalTextRun SCXW18230816 BCX0\">3<\/span><\/span><\/span><span class=\"TextRun SCXW18230816 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW18230816 BCX0\">\u00a0shows\u00a0<\/span><span class=\"NormalTextRun SCXW18230816 BCX0\">the data collected for the variables MAP, throttle position, wastegate position, and engine speed at one operating point.<\/span><\/span><\/span><\/p>\n<h2><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\"><span class=\"TextRun SCXW159060441 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW159060441 BCX0\" data-ccp-parastyle=\"heading 3\">Modeling Wastegate<\/span><\/span><span class=\"EOP SCXW159060441 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/span><\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"544\" height=\"392\" class=\"aligncenter size-full wp-image-6072\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/IntakMeanifoldPressure2.png\" alt=\"\" \/><\/p>\n<p><em>Figure 4: Wastegate PRBS Signal MAP Response at Engine Speed 5000 rpm<\/em><\/p>\n<p><span data-contrast=\"auto\">The modeling of the wastegate was done in a similar manner to the throttle. Wastegate is much more sensitive when closer to closed (more air to spin turbocharger and thus, more air entering the cylinders), for the same reason throttle is sensitive at small angles. To model the wastegate, a PRBS signal was sent to override the wastegate, and the throttle was held completely open at 100%. This was done to ensure only the wastegate would have an impact on the MAP response and create a wastegate-MAP model.\u00a0<\/span><span data-contrast=\"auto\">Figure\u00a04<\/span><span data-contrast=\"auto\">\u00a0shows the\u00a0data collected for the variables MAP, throttle position, wastegate position, and engine speed.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">System Identification<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">A black box modeling approach was used, putting the identification input and output data into MATLAB\u2019s System Identification Toolbox. This was automated with scripts and the use of the n4sid command. To relate each input variable to the intake manifold pressure, only 2nd order models were required to produce accurate models.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">Model\u00a0Validation\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">To validate the states-spaces created with the identification data set, and a second validation set of data was then collected at the same parameters (different PRBS signal). The inputs of the second data set were input into the state-space, creating a \u2019best guess\u2019 output from our system. This is referred to as the model or fitted output. The system output and the model output were then compared by plotting them against one another. The MATLAB compare function was used to return a number fit by returning a normalized root mean square error (NRMSE) value, shown in Equation 1, that returned fits. The aim was to have fits above 90%.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"173\" height=\"78\" class=\"aligncenter size-full wp-image-6084\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/Capture.png\" alt=\"\" \/><\/p>\n<p><em>\u00a0<span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW202679245 BCX0\">Where<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">\u00a0<\/span><\/span><span id=\"MathJax-Element-2-Frame\" class=\"MathJax SCXW202679245 BCX0\" style=\"margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; white-space: nowrap; display: inline-table; font-weight: normal; line-height: normal; font-size: 14.6667px; text-indent: 0px; text-align: center; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;\" tabindex=\"0\" role=\"presentation\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mo&gt;&amp;#xA0;&lt;\/mo&gt;&lt;mi&gt;y&lt;\/mi&gt;&lt;\/math&gt;\"><span id=\"MathJax-Span-6\" class=\"math SCXW202679245 BCX0\"><span class=\"SCXW202679245 BCX0\"><span id=\"MathJax-Span-7\" class=\"mrow SCXW202679245 BCX0\"><span id=\"MathJax-Span-9\" class=\"mi SCXW202679245 BCX0\">y\u00a0\u00a0<\/span><\/span><\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">is the validation data output,<\/span><\/span>\u00a0<span id=\"MathJax-Element-4-Frame\" class=\"MathJax SCXW202679245 BCX0\" style=\"margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; white-space: nowrap; display: inline-table; font-weight: normal; line-height: normal; font-size: 14.6667px; text-indent: 0px; text-align: center; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;\" tabindex=\"0\" role=\"presentation\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mi&gt;y&lt;\/mi&gt;&lt;mo&gt;^&lt;\/mo&gt;&lt;\/mover&gt;&lt;\/math&gt;\"><span id=\"MathJax-Span-14\" class=\"math SCXW202679245 BCX0\"><span class=\"SCXW202679245 BCX0\"><span id=\"MathJax-Span-15\" class=\"mrow SCXW202679245 BCX0\"><span id=\"MathJax-Span-16\" class=\"mover SCXW202679245 BCX0\"><span id=\"MathJax-Span-17\" class=\"mi SCXW202679245 BCX0\">y<\/span><span id=\"MathJax-Span-18\" class=\"mo SCXW202679245 BCX0\">\u02c6\u00a0<\/span><\/span><\/span><\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">is the system output,\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW202679245 BCX0\">and<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">\u00a0<\/span><\/span>\u00a0<span id=\"MathJax-Element-1-Frame\" class=\"MathJax SCXW202679245 BCX0\" style=\"margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; white-space: nowrap; display: inline-table; font-weight: normal; line-height: normal; font-size: 14.6667px; text-indent: 0px; text-align: center; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;\" tabindex=\"0\" role=\"presentation\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mi&gt;y&lt;\/mi&gt;&lt;mo&gt;-&lt;\/mo&gt;&lt;\/mover&gt;&lt;\/math&gt;\"><span id=\"MathJax-Span-1\" class=\"math SCXW202679245 BCX0\"><span class=\"SCXW202679245 BCX0\"><span id=\"MathJax-Span-2\" class=\"mrow SCXW202679245 BCX0\"><span id=\"MathJax-Span-3\" class=\"mover SCXW202679245 BCX0\"><span id=\"MathJax-Span-4\" class=\"mi SCXW202679245 BCX0\">y<\/span><span id=\"MathJax-Span-5\" class=\"mo SCXW202679245 BCX0\">\u2212\u00a0<\/span><\/span><\/span><\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">is the\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW202679245 BCX0\">mean<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">\u00a0of<\/span><\/span>\u00a0<span id=\"MathJax-Element-3-Frame\" class=\"MathJax SCXW202679245 BCX0\" style=\"margin: 0px; padding: 0px; user-select: text; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; white-space: nowrap; display: inline-table; font-weight: normal; line-height: normal; font-size: 14.6667px; text-indent: 0px; text-align: center; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;\" tabindex=\"0\" role=\"presentation\" data-mathml=\"&lt;math xmlns=&quot;http:\/\/www.w3.org\/1998\/Math\/MathML&quot; display=&quot;block&quot;&gt;&lt;mo&gt;&amp;#xA0;&lt;\/mo&gt;&lt;mi&gt;y&lt;\/mi&gt;&lt;\/math&gt;\"><span id=\"MathJax-Span-10\" class=\"math SCXW202679245 BCX0\"><span class=\"SCXW202679245 BCX0\"><span id=\"MathJax-Span-11\" class=\"mrow SCXW202679245 BCX0\"><span id=\"MathJax-Span-13\" class=\"mi SCXW202679245 BCX0\">y.\u00a0<\/span><\/span><\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">Below are the fits for the throttle (<\/span><\/span><span class=\"FieldRange SCXW202679245 BCX0\"><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">Figure\u00a0<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">5<\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">)\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW202679245 BCX0\">and<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">\u00a0the wastegate (<\/span><\/span><span class=\"FieldRange SCXW202679245 BCX0\"><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">Figure\u00a0<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">6<\/span><\/span><\/span><span class=\"TextRun SCXW202679245 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW202679245 BCX0\">)\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 GrammarErrorHighlight SCXW202679245 BCX0\">at<\/span><span class=\"NormalTextRun SCXW202679245 BCX0\">\u00a0one operating point.<\/span><\/span><\/em><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"488\" height=\"350\" class=\"aligncenter size-full wp-image-6063\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/ThrottleVsBoost5000rpm.png\" alt=\"\" \/><\/p>\n<p><em>Figure 5: Fitted Model for Throttle over Measured Boost Data at Engine Speed 5000rpm<\/em><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"508\" height=\"316\" class=\"aligncenter size-full wp-image-6060\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/WastegateVsBoost5000rpm.png\" alt=\"\" \/><\/p>\n<p><em>Figure 6: Fitted Model for Wastegate over Measured Boost Data at Engine 5000 rpm<\/em><\/p>\n<h1><span class=\"TextRun SCXW71723121 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW71723121 BCX0\" data-ccp-parastyle=\"heading 1\">Results and Validation<\/span><\/span><span class=\"EOP SCXW71723121 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-6069 size-large\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/MAP-1024x324.png\" alt=\"\" width=\"1024\" height=\"324\" \/><\/p>\n<p><em>Figure 7: Throttle Control at Four Different Engine Speeds<\/em><\/p>\n<p><span class=\"FieldRange SCXW194189052 BCX0\"><span class=\"TextRun SCXW194189052 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW194189052 BCX0\">Figure\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">7<\/span><\/span><\/span><span class=\"TextRun SCXW194189052 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0shows\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">the engine\u2019s absolute manifold pressure (MAP) output (blue) that results from the throttle values controlled by the MPC, compared to the desired output (orange), which for this example was a sine wave. The state-space models used for these MPCS related throttle to MAP (note that it was not differential MAP). The operating points tested worked around four different engine speeds. From left to right on the plot, they are<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">:<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0750 RPM, 1000 RPM, 2500 RPM and 5000 RPM. Even with the noise in the output of the 750 RPM section, the error across the system is only 1%, far lower than our goal of 1.75%. As the output follows the desired MAP, there is lag error present, but it is minimal. In\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">between operating<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">points 1000 RPM, 2500 RPM, and 5000 RPM, a spike in<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">MAP can be observed. This is due to the RPM suddenly<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0spiking and creating confusion for the MAP controller response. The MPCs controlling the throttle are<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">n<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">o<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">t<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0able to respond instantly, causing a very brief error as the throttle is adjusted. The error has little impact on the accuracy of our\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">controller and<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0can effectively be ignored. To implement differential boost control models into an MPC controller for testing, the mean boost value\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">was subtracted<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0from the boost command before entering the MPC, and the nominal actuator values were added to the resulting control\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">commands<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0for differential boost leaving the MPC to return the actual actuator positions required.<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">A s<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">imilar\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">control\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">approach\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">was used for the\u00a0<\/span><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2 SCXW194189052 BCX0\">wastegate<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">\u00a0and similar\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">results\u00a0<\/span><span class=\"NormalTextRun SCXW194189052 BCX0\">were obtained.<\/span><\/span><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">HARDWARE-IN-THE-LOOP<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">To ensure this controller can be run on a real-world electronic control unit (ECU),\u00a0we created a hardware-in-the-loop (HIL) system to run\u00a0alongside the simulation. Figure 8 shows a picture of\u00a0our final HIL system.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The HIL system receives the simulated throttle and wastegate positions created by the MPC, using an Arduino Uno as the data acquisition and motor driver. The Arduino then commands a servo motor to move to the simulated angle, and an encoder measures that angle digitally. The protractor shown on the right of the image above will be used to visually check the throttle\/wastegate angle. After the encoder measures the angle, the digital signal is sent back to MATLAB to override the simulated throttle\/wastegate valve angle. If the MAP output is as expected, the HIL system has verified the control method can be applied to a real-world ECU.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-6078 size-medium\" src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/HIL-300x252.png\" alt=\"\" width=\"300\" height=\"252\" \/><\/p>\n<p><em>Figure 8: Hardware in the Loop system: The system is composed of an Arduino Uno served as motor drive and data acquisition, a servo motor as the planet, and encoder to measure the motor&#8217;s rotation angles.\u00a0<\/em><\/p>\n<h1 aria-level=\"1\"><span data-contrast=\"none\">Conclusion<\/span><\/h1>\n<p><span data-contrast=\"auto\">The final control system was able to accurately switch between MPCs\u00a0under different operating ranges\u00a0to control throttle position to produce a desired MAP command. Moreover,\u00a0the system\u2019s state-space\u00a0utilizes differential MAP, throttle, and wastegate\u00a0to return actuator values to achieve the desired MAP command in steady state\u00a0with errors &lt; 0.5%.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The implemented controller can control throttle and wastegate individually, but not together to output a single matrix of improved throttle and wastegate positions. While we did not achieve a MIMO system, we established an excellent framework to continue expanding on the MPC control of this system, and are confident our work can be used as\u00a0stepping stones\u00a0for the continuation of this research\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">A quote from the students:<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u201cWe were intrigued to expand our knowledge\u00a0of MathWorks tools and\u00a0learn\u00a0practical applications of\u00a0coding software.\u00a0Our\u00a0team\u00a0is very\u00a0interested in cars and\u00a0how\u00a0to optimize their\u00a0engine\u00a0performance, specifically as it\u00a0relates to emissions\u00a0and this project was very much aligned with our interests and\u00a0our studies.\u00a0\u200bThis project had a large learning\u00a0curve but\u00a0was a very fun\u00a0and\u00a0a\u00a0super useful\u00a0learning experience!\u201d<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">So, what do you think?\u00a0 Does this\u00a0<\/span><strong><a href=\"https:\/\/github.com\/mathworks\/MathWorks-Excellence-in-Innovation\">list<\/a><\/strong><span data-contrast=\"auto\">\u00a0inspire you?\u00a0 Are you looking for different types of projects?\u00a0 Tell us what you think in the comments below. We\u2019d love to hear from you.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h2>References:<\/h2>\n<p>[1] Bemporad, A., Bernardini, D., Long, R., and Verdejo, J., \u201cModel Predictive Control of Turbocharged Gasoline Engines for Mass Production,\u201d SAE Technical Paper 2018- 01-0875, 2018, doi:10.4271\/2018-01-0875.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/08\/EngineDynamometer.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>For today\u2019s post Roberto Valenti will provide details about the project implemented\u00a0by MathWorks\u2019 new Excellence in Innovation Program team.\u00a0<br \/>\nIn the MATLAB and Simulink Design Projects for Students&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2021\/08\/13\/improve-a-cars-engine-performance\/\">read more >><\/a><\/p>\n","protected":false},"author":174,"featured_media":6081,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[680],"tags":[70,537,549,552,534,540],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/6057"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/comments?post=6057"}],"version-history":[{"count":6,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/6057\/revisions"}],"predecessor-version":[{"id":6108,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/6057\/revisions\/6108"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/6081"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=6057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=6057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=6057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}