# Generic Engine

Generic internal combustion engine

**Libraries:**

Simscape /
Driveline /
Engines & Motors

## Description

The Generic Engine block represents a configurable internal
combustion engine that is suitable for spark-ignition and diesel applications. You can
control the block using either a torque or normalized throttle physical signal. You can
parameterize the block by using a third-order polynomial or by using tabulated torque or
power data. Optional dynamic parameters include crankshaft inertia and response time
lag. A physical signal port, **FC**, outputs the engine fuel
consumption rate based on the fuel consumption model that you choose. Optional speed and
redline controllers prevent engine stall and enable cruise control. The figure shows how
the ports relate to an engine configuration.

### Engine Speed, Throttle, Power, and Torque

By default, the Generic Engine block uses a programmed relationship between torque and speed that the throttle signal or the torque command signal modulates.

The block evaluates engine power demand as a function of engine speed,
*g(ɷ)*. The function provides the maximum power available for a
given engine speed, *ɷ*. The block parameters **Maximum
power**, **Speed at maximum power**, and
**Maximum speed** normalize this function to physical maximum
torque and speed values.

The normalized throttle signal, *Thr*, controls the engine power such that *P(**ɷ**,Thr)* =
*Thr*·*g(**ɷ**)*. When you set **Model parameterization** to
`Normalized throttle`

, the physical input signal
**Thr **controls the engine power. When you choose
`Torque command`

, the block computes the normalized
throttle internally. The block delivers power as a fraction of the maximum power
possible in a steady state at a fixed engine speed. The figure shows the torque and
power curves for the default settings.

### Polynomial Engine Control

When you set **Model parameterization** to
`Normalized 3rd-order polynomial`

, the block uses the
normalized engine speed, *ɷ _{N}*, to compute
the speed and torque. The block defines the normalized engine speed as

$${\omega}_{N}(\omega )\equiv \frac{\omega}{{\omega}_{PP}}$$

where:

*ɷ*is the current engine speed.*ɷ*is the engine speed at peak power._{PP}

The block treats the normalized, dimensionless engine power as a third-order polynomial such that

$$\begin{array}{l}P\left(\omega \left({\omega}_{N}\right)\right)={P}_{P}\cdot {p}_{N}\left({\omega}_{N}\right)\\ {p}_{N}({\omega}_{N})={s}_{1}{\omega}_{N}+{s}_{2}{\omega}_{N}^{2}+{s}_{3}{\omega}_{N}^{3}\end{array}$$

where *s _{1}*,

*s*, and

_{2}*s*are constant polynomial coefficients and

_{3}*P*is the peak power. In typical engines, the

_{p}*s*coefficients are positive.

_{i}The block calculates engine torque at the wide-open throttle condition using the polynomial coefficients such that

$$\begin{array}{l}T\left(\omega ({\omega}_{N})\right)={p}_{1}+{p}_{2}{\omega}_{N}^{}+{p}_{3}{\omega}_{N}^{2}\\ {p}_{1}\equiv {s}_{1}{P}_{p}/{\omega}_{pp}\\ {p}_{2}\equiv {s}_{2}{P}_{p}/{\omega}_{pp}\\ {p}_{3}\equiv {s}_{3}{P}_{p}/{\omega}_{pp}\end{array}$$

The block sets the normalized engine speed at peak power such that

$${\omega}_{NPP}={\omega}_{N}\left({\omega}_{NPP}\right)=1.$$

Substituting this equality into the formula for
*p _{N}* gives

$${s}_{1}+{s}_{2}+{s}_{3}=1.$$

This condition normalizes the power to the engine speed at peak
power. The block sets the slope of
*p _{N}(ɷ_{PP})* to
zero, such that

$${s}_{1}+2{s}_{2}+3{s}_{3}=0.$$

The block defines the normalized engine speed of peak torque as

$${\omega}_{NPT}={\omega}_{N}\left({\omega}_{PT}\right)=\frac{{\omega}_{PT}}{{\omega}_{PP}}<1$$

where the speed of peak power is greater than the speed of peak
torque. The block uses the polynomial formulation to find the dimensionless,
normalized torque, *τ _{N}*, and to sets the
slope to zero such that

$$\frac{d{\tau}_{N}\left({\omega}_{NPT}\right)}{d\omega}={s}_{2}+2{s}_{3}{\omega}_{NPT}=0.$$

Solving for *s _{i}* using
these equations yields

$$\begin{array}{l}{s}_{1}=\frac{3-4{\omega}_{NPT}}{2\left(1-{\omega}_{NPT}\right)}\\ {s}_{2}=-\frac{{\omega}_{NPT}}{{\omega}_{NPT}-1}\\ {s}_{3}=\frac{1}{2\left({\omega}_{NPT}-1\right)}\end{array}$$

The block calculates the engine torque as

$$T\left(\omega \left({\omega}_{N}\right)\right)=\frac{2{T}_{P}}{3-{\omega}_{NPT}}\left({s}_{1}+{s}_{2}{\omega}_{N}+{s}_{3}{\omega}_{N}^{2}\right),$$

where *T _{P}* is the peak
torque. Substituting the equation for

*ɷ*yields the constraint

_{NPT}$$2{T}_{P}{\omega}_{PP}^{2}-3{P}_{P}{\omega}_{PP}^{}+{P}_{P}{\omega}_{PT}^{}=0.$$

The block uses *T _{P}*,

*P*, and

_{P}*ɷ*to calculate the engine speed at peak power such that

_{PT}$${\omega}_{PP}^{}=\frac{3{P}_{P}+\sqrt{{P}_{P}\left(9{P}_{P}-8{T}_{P}{\omega}_{PT}^{}\right)}}{4{T}_{P}}>{\omega}_{PT}^{}.$$

where
*T _{P}ɷ_{PT}* is
equivalent to the power at peak torque,

*P*, which is always less than the peak power,

_{PT}*P*.

_{P}**Engine Power Forms for Different Engine Types**

The block calculates the polynomial using the corresponding coefficients for the setting
of the **Engine type** parameter. When you set **Engine
type** to `Spark-ignition`

or
`Diesel`

, the block selects the appropriate
coefficients from the table. When you select `Generic`

,
the block computes these coefficients internally.

Power Demand Coefficient | Engine Type | |
---|---|---|

Spark-Ignition | Diesel | |

s
_{1} | 1 | 0.6526 |

s
_{2} | 1 | 1.6948 |

s
_{3} | -1 | -1.3474 |

### Fuel Consumption

The block can optionally model fuel consumption and output the results as a
physical signal at port **FC**. To include fuel consumption in your
simulation, set **Fuel consumption model** to one of these settings:

`Constant per revolution`

`Fuel consumption by speed and torque`

`Brake specific fuel consumption by speed and torque`

`Brake specific fuel consumption by speed and brake mean effective pressure`

You can create a visual representation of the fuel consumption. When
you set **Fuel consumption model** to ```
Fuel consumption
by speed and torque
```

and click the **engine
properties** hyperlink in the block description, a live script
generates a heat map plot of fuel consumption for a given torque and speed.

This plot is in addition to the engine speed, throttle, power and
torque plot. When you set **Fuel consumption model** to
`Brake specific fuel consumption by speed and torque`

or ```
Brake specific fuel consumption by speed and brake mean effective
pressure
```

, the live script generates the heat map plot of fuel
consumption and a separate plot for brake-specific fuel consumption.

### Idle Speed Controller Model

The idle speed controller adjusts the throttle signal to increase engine rotation below a reference speed according to:

$$\Pi =\mathrm{max}({\Pi}_{i},{\Pi}_{c})$$

and

$$\frac{d({\Pi}_{c})}{dt}=\frac{0.5\cdot \left(1-\mathrm{tanh}\left(4\cdot \frac{\omega -{\omega}_{r}}{{\omega}_{t}}\right)\right)-{\Pi}_{c}}{\tau}$$

where:

*Π*is the engine throttle.*Π*is the input throttle port_{i}**Thr**.*Π*is the controller throttle._{c}*ω*is the engine speed or crankshaft angular velocity.*ω*is the idle speed reference._{r}*ω*is the controller speed threshold._{t}*τ*is the controller time constant.

The controlled throttle increases with a first-order lag from 0 to 1 when engine speed falls
below the reference speed. When the engine speed rises above the reference speed,
the controlled throttle decreases from one to zero. When the difference between
engine velocity and reference speed is smaller than the controller speed threshold,
the *tanh* part of the equation smooths the time derivative of
the controlled throttle. The smoothing function limits the controlled throttle to
the range [0,1]. The engine uses the larger of the input and controlled throttle
values. If you include engine time lag, the controller changes the input before it
computes the lag.

### Redline Controller Model

The idle speed controller determines the minimum throttle value for maintaining engine speed, the redline controller prevents excessive speed based on a maximum throttle input. To determine the maximum throttle value, the redline controller uses the idle speed controller model equation. However, for the redline controller:

*ω*is the redline speed reference._{r}*ω*is the redline speed threshold._{t}*τ*is the redline time constant.

### Performance

To increase simulation speed, set **Fuel consumption model** to
`No fuel consumption`

. When you use this setting, the
block does not calculate fuel consumption regardless of port
**FC**.

If you select any other option for **Fuel consumption model**, the block
must perform a nonlinear computation. The block solves the equation even if the
**FC** port, which reports the fuel consumption rate, is not
connected to another block.

### Assumptions and Limitations

Engines lag in their response to changing speed and throttle. The block supports lag due to a changing throttle only.

### Hardware-in-the-Loop Simulation

To improve performance for HIL simulation, set the **Dynamics** > **Time Constant** parameter to ```
No time constant - Suitable for HIL
simulation
```

.

## Examples

## Ports

### Input

### Output

### Conserving

## Parameters

## Extended Capabilities

## Version History

**Introduced in R2011a**