Guy on Simulink

Simulink & Model-Based Design

Internal Combustion Engine Ignition Control Example – Part 1

This post introduces an example project I recently submitted to MATLAB Central: Four-Cylinder Engine Ignition Control Simulation

This project was made in collaboration with Isaac Hisahiro Ito at Toyota Motor North America R&D. Inside this project, you will find:

This project is for educational purposes, with the objective of demonstrating how the listed products can be used together.

In today's post, I am describing the modeling of the engine and drivetrain. I will follow up next week with a post describing the controller implementation.

Overview

This image illustrates the succession of events in this project.

Project overview

  • The engine crankshaft is equipped with a toothed wheel. In this case, the teeth are equally spaced every 10 degrees, with one missing tooth.
  • When the crankshaft rotates, the teeth pass in front of a sensor that triggers an interrupt, executing code on the ECU.
  • The code computes the position and speed of the engine and determines when the next cylinder should fire.
  • The code sets a hardware timer that will fire the appropriate spark plug at the appropriate time.

The next plot shows when the spark plugs are fired for each cylinder during one combustion cycle.

Cylinder Spark signals

Getting Started

For convenience, all the files involved in the project are included in a Simulink Project. When you open the project, a shortcut to the main model appears:

Simulink Project Shortcut

Here is what the main model looks like.

Main Model
Click image to enlarge

To document what each Subsystem is doing, I use Notes. Notes are a convenient way to add rich text, equations, and images to a model. You can open and close the Notes from the View menu or by hitting Ctrl+Shift+N. In case you had not noticed, you can click and drag the title bar of the Notes to move it to the top, bottom, left or right. You can even undock it from the canvas.

Engine Design using the Symbolic Math Toolbox

Inside the Subsystem containing the engine model, you will see that the Notes provide hyperlinks to a series of MATLAB LiveScripts that my collaborator Isaac created to design the engine model:

Notes to MLX

In those files, Isaac generated MATLAB functions and Simscape equations directly from the Symbolic Math Toolbox. Here is an example computing the cylinder volume as a function of the crank angle.

Symbolic Math toolbox

Four-Cylinder Engine Implemented using Simscape Language

To incorporate his design in Simulink, Isaac used the Simscape language. Using Mode Chart Modeling, he implemented equations for each phase of the combustion cycle: intake, compression, expansion and exhaust.

Simscape Modechart

In addition to a cylinder component, Isaac also implemented an intake component, allowing to control the airflow going in the engine using a throttle valve, and an exhaust component.

Here is what the pressure in the cylinders looks like over the course of a single combustion cycle..

Cylinders Pressure

To assemble the engine, we connected the intake, the four cylinders and the exhaust components together using physical connections inside a Subsystem. I then used the new R2018b function subsystem2ssc to convert this Subsystem into a Simscape composite component, which we could then include in the model using the Simscape Component block. This enables us to have all the engine parameters in one convenient dialog.

Simscape subsystm2ssc

Drivetrain Modeling using Simscape Driveline

To add a load for the engine, I used Simscape Driveline blocks like Torque Converter, Clutch and Planetary Gear to model the drivetrain. I recommend looking at the Complete Vehicle Model example for a well documented similar implementation.

Simscape Driveline

Vehicle Body

For the Vehicle body, I decided to implement two versions using Variant Subsystems

Because Isaac implemented the engine model using Simscape, I made the first implementation using Simscape Driveline:

Powertrain Blockset Vehicle

For the second implementation, I thought it would be a good opportunity to showcase the existence of the new product released in R2016b, Powertrain Blockset. This product does not (yet!) have an engine model suitable for this application, but it includes a library of components for simulating engine subsystems, transmission assemblies, traction motors, battery packs, and so on.

Here is how I interfaced the Vehicle Body 1DOF Longitudinal to the rest of the Simscape network:

Powertrain Blockset Vehicle

I recommend that you take a look at the library of fully assembled reference application models of automotive powertrains, including gasoline, diesel, hybrid, and electric systems included with the Powertrain Blockset.

Now it's your turn

In my next blog post, I will describe the remaining model architecture.

In the meantime, I would love to hear from you. Post your comments or questions below.

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.