# Generic Engine

Internal combustion engine with throttle and rotational inertia and time lag

• Library:
• Simscape / Driveline / Engines & Motors

## Description

The Generic Engine block represents a general internal combustion engine. This block is a suitable generic engine for spark-ignition and diesel. Speed-power and speed-torque parameterizations are provided. A throttle physical signal input specifies the normalized engine torque. Optional dynamic parameters include crankshaft inertia and response time lag. A physical signal port 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.

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

By default, the Generic Engine block uses a programmed relationship between torque and speed that is modulated by the throttle signal.

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 input signal T specifies the actual engine power. The power is delivered as a fraction of the maximum power possible in a steady state at a fixed engine speed. It modulates the actual power delivered, P, from the engine: P(Ω,T) = T·g(Ω). The engine torque is τ = P/Ω.

### Engine Power Demand

The engine power is nonzero when the speed is limited to the operating range, ΩminΩΩmax. The absolute maximum engine power Pmax defines Ω0 such that Pmax = g(Ω0). Define wΩ/Ω0 and g(Ω) ≡ Pmax·p(w). Then p(1) = 1 and dp(1)/dw = 0. The torque function is:

τ = (Pmax/Ω0)·[p(w)/w].

You can derive forms for p(w) from engine data and models. The Generic Engine block uses a third-order polynomial form

p(w) = p1·w + p2·w2p3·w3

that satisfies

p1 + p2p3 = 1, p1 + 2p2 – 3p3 = 0.

In typical engines, the pi are positive. This polynomial has three zeros, one at w = 0, and a conjugate pair. One of the pair is positive and physical; the other is negative and unphysical:

`${w}_{±}=\frac{1}{2}\left(-{p}_{2}±\sqrt{{p}_{2}^{2}+4{p}_{1}{p}_{3}}\right).$`

For the engine power polynomial, there are restrictions on the polynomial coefficients pi to achieve a valid power-speed curve. If you use tabulated power or torque data, the corresponding restrictions on P(Ω) apply.

Typical Engine Power Demand Curve

Determine the speed and power, w = Ω/Ω0 and p = P(Ω)/P0, and define the boundaries as wmin = Ωmin/Ω0 and wmax = Ωmax/Ω0. Then:

• The block restricts the engine speed to a positive range above the minimum speed and below the maximum speed: 0 ≤ wminwwmax.

• The engine power at minimum speed must be nonnegative: p(wmin) ≥ 0. If you use the polynomial form, this condition is a restriction on the pi:

p(wmin) = p1·wmin + p2·w2minp3·wmin3 ≥ 0.

• The engine power at maximum speed must be nonnegative: p(wmax) ≥ 0. If you use the polynomial form, this condition is a restriction on wmax: wmaxw+.

### Engine Power Forms for Different Engine Types

For the default parameterization, the block provides two choices of internal combustion engine types, each with different engine power demand parameters.

Power Demand
Coefficient
Engine Type
Spark-IgnitionDiesel
p 1 10.6526
p 2 11.6948
p 3 11.3474

### Idle Speed Controller Model

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

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

and

`$\frac{d\left({\Pi }_{c}\right)}{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.

• Πi is the input throttle (port T).

• Πc is the controller throttle.

• ω is the engine speed or crankshaft angular velocity.

• ωr is the idle speed reference.

• ωt is the controller speed threshold.

• τ is the controller time constant.

The controlled throttle increases with a first-order lag from zero to one 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 function limits the controlled throttle to the range [0,1]. The engine uses the larger of the input and controlled throttle values. If engine time lag is included, the controller changes the input before it computes the lag.

### Redline Controller Model

While 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:

• ωr is the redline speed reference.

• ωt is the redline speed threshold.

• τ is the redline time constant.

### Performance

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

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.

When the parameter is set to `No fuel consumption`, the block does not calculate fuel consumption, even if the FC port is connected to another block.

### Assumptions and Limitations

This block contains an engine time lag limitation.

Engines lag in their response to changing speed and throttle. The block optionally supports lag due to a changing throttle only. Time lag simulation increases model fidelity but reduces simulation performance.

### Hardware-in-the-Loop Simulation

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

## Ports

### Input

expand all

Engine torque demand as a fraction of maximum possible torque.

### Output

expand all

Power produced by the engine, in W.

Fuel consumed by the engine, in kg/s.

### Conserving

expand all

Mechanical rotational conserving port associated with the engine block. This is the base port. The engine block is the physical body that contains the piston cylinders.

Mechanical rotational conserving port associated with the engine crankshaft. This is the follower port of engine. The crankshaft transmits the power generated from the combustion process. Typically, you attach a clutch and transmission at this port.

## Parameters

expand all

### Engine Torque

Engine modeling selection. Choose between these options based on the available data:

• ```Normalized 3rd-order polynomial matched to peak power``` — Parametrize the engine with a power curve lookup table defined by power and speed characteristics.

• `Tabulated torque data` — Engine is parametrized by a speed–torque table that you specify.

• `Tabulated power data` — Engine is parametrized by a speed–power table that you specify.

Internal combustion modeling choice. Either option will cause the block to use the coefficients for that option in the third-order polynomial.

#### Dependencies

To enable this parameter, set Model parameterization to ```Normalized 3rd-order polynomial matched to peak power```.

Maximum power Pmax that the engine can output. This value sets the peak of the speed-power curve.

#### Dependencies

To enable this parameter, set Model parameterization to ```Normalized 3rd-order polynomial matched to peak power```.

Engine speed Ω0 at which the engine is running at maximum power. This value sets the location along the power curve where the peak occurs.

#### Dependencies

To enable this parameter, set Model parameterization to ```Normalized 3rd-order polynomial matched to peak power```.

Maximum speed Ωmax at which the engine can generate torque. This value sets the upper bound of the power curve.

During simulation, if Ω exceeds this value, the simulation stops with an error. The engine maximum speed Ωmax cannot exceed the engine speed at which the engine power becomes negative.

#### Dependencies

To enable this parameter, set Model parameterization to ```Normalized 3rd-order polynomial matched to peak power```.

Minimum speed Ωmin at which the engine can generate torque. This value sets the lower bound of the power curve.

During simulation, if Ω falls below this value, the engine torque is blended to zero.

#### Dependencies

To enable this parameter, set Model parameterization to ```Normalized 3rd-order polynomial matched to peak power```.

Vector of engine speeds that informs the model parameterization lookup table.

#### Dependencies

To enable this parameter, set Model parameterization to `Tabulated torque data` or `Tabulated power data`.

Vector of engine torques for lookup table parameterizations. The size of this vector must match the Speed vector parameter.

#### Dependencies

To enable this parameter, set Model parameterization to ```Tabulated torque data```.

Vector of values of the engine function's dependent variable, the power P. The size of this vector must match the Speed vector parameter.

#### Dependencies

To enable this parameter, set Model parameterization to ```Tabulated power data```.

Method to calculate the fuel consumption at intermediate speed-torque values. Beyond the data range, fuel consumption remains constant at the final lookup table value.

#### Dependencies

To enable this parameter, set Model parameterization to `Tabulated torque data` or `Tabulated power data`.

### Dynamics

Option to parameterize the inertia and initial velocity. You can choose to model inertia for increased fidelity or numerical stability.

Initial rotational inertia. This parameter initializes the engine inertia computation.

#### Dependencies

To enable this parameter, set Inertia to ```Specify inertia and initial velocity```.

Initial angular velocity, Ω(0). This parameter initializes the engine inertia computation.

Option to parameterize the time constant and initial normalized engine throttle.

Engine response time delay value. This parameter specifies the lag between the throttle signal and the engine response.

#### Dependencies

To enable this parameter, set Time constant to ```Specify time constant and initial value```.

Initial normalized engine throttle, T(0). This value must be in the range [0,1]. You specify this value when you want to model lag.

#### Dependencies

To enable this parameter, set Time constant to ```Specify time constant and initial value```.

### Limits

Torque drop off range before stalling. This parameter specifies where the engine starts to experience rapid torque drop off as the crankshaft approaches the Stall speed. The torque is blended to 0 between this point and the point of stalling.

### Speed Control

Option to enable speed control. Speed control idles the engine at a given setpoint. The purpose of engine idle is to prevent stalling when the applied throttle is not enough to turn . When you enable speed control, the block asserts enough throttle to maintain at least the Idle speed reference parameter value. For more information, see Idle Speed Controller Model.

Reference crankshaft angular velocity for speed control modeling. The idle speed controller will work to maintain at least this speed.

#### Dependencies

To enable this parameter, set Idle speed control to `On`.

Time to respond to deviations from the value of the Idle speed reference parameter.

#### Dependencies

To enable this parameter, set Idle speed control to `On`.

Controller smoothing parameter. The Controller threshold speed smooths the controlled throttle value when the rotational speed of the engine crosses the idle speed reference. For more information, see Idle Speed Controller Model. Large values decrease controller responsiveness. Small values increase computational cost. This parameter must be positive.

#### Dependencies

To enable this parameter, set Idle speed control to `On`.

Option to enable the engine crankshaft maximum angular velocity limiter. When you set Redline control to `On`, the block works to prevent the engine speed from exceeding a maximum setpoint.

Redline control engine speed setpoint. Enter the value of the speed reference above which the redline control activates.

#### Dependencies

To enable this parameter, set Redline control to `On`.

Time to respond to engine speeds exceeding the value of the Redline speed parameter. Enter the value of the time constant associated with an increase or decrease of the controlled throttle.

#### Dependencies

To enable this parameter, set Redline control to `On`.

Redline controller smoothing parameter. Specify the width of the region around the redline speed where the controller goes from fully enabled to not enabled. The block uses this parameter for smoothing the controlled throttle value when the rotational speed of the engine crosses the redline speed reference. Large values decrease controller responsiveness. Small values increase computational cost.

#### Dependencies

To enable this parameter, set Redline control to `On`.

### Fuel Consumption

The table shows how the specified options for the Fuel consumption model parameter affects the availability of dependent parameters. To learn how to read the dependencies tables, see Parameter Dependencies.

Fuel Consumption Parameter Dependencies

Fuel Consumption
Fuel consumption model
```No fuel consumption````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```
Fuel consumption per revolutionDisplaced volume
Revolutions per cycle
Speed vector
Torque vectorBrake mean effective pressure vector
Fuel consumption tableBrake specific fuel consumption table
Interpolation method

Fuel consumption method based on available data. Select a model for calculating fuel consumption. The methods enable parameters that are consistent with typical industrial data. Choose from the following options:

• `No fuel consumption`

• `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```

If you set Fuel consumption model to `No fuel consumption`, the block does not calculate fuel consumption even when the FC port is connected to another block. Selecting this option increases simulation speed.

Constant rate of fuel consumption as a function of crankshaft revolutions. Enter the volume of fuel consumed in one crankshaft revolution.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Constant per revolution```.

Piston stroke fuel displacement. This is equivalent to the area of the circular piston cylinder cross-section multiplied by the piston travel distance.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Brake specific fuel consumption by speed and brake mean effective pressure```.

Number of crankshaft revolutions in a combustion cycle. Enter `2` for a four-stroke engine or `1` for a two-stroke engine.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Brake specific fuel consumption by speed and brake mean effective pressure```.

Vector of engine torques that corresponds to the M rows of the fuel consumption lookup table.

#### Dependencies

To enable this parameter, set Fuel consumption to one of these settings:

• ```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```

Vector of engine torques that corresponds to the N columns of the fuel consumption lookup table.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Fuel consumption by speed and torque``` or ```Brake specific fuel consumption by speed and torque```.

Matrix of fuel consumption values that correspond. Enter matrix with fuel consumption rates corresponding to engine speed and torque vectors. The number of rows must equal the number of elements in the Speed vector parameter. The number of columns must equal the number of elements in the Torque vector parameter. The default is ```[.5, .9, 1.4, 1.6, 1.9, 2.7, 3.4, 4.4; 1, 1.7, 2.7, 3.1, 3.6, 5, 6, 7.4; 1.4, 2.7, 4, 4.8, 5.6, 7.5, 8.5, 10.5; 2, 3.6, 5.8, 6.7, 8, 10.4, 11.7, 13.3; 2.5, 4.8, 7.9, 9.4, 10.8, 14, 16.2, 18.6; 3.1, 6, 10.3, 11.9, 13.8, 18.4, 22, 26.5]``` `g/s`.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Fuel consumption by speed and torque```.

Vector of brake mean effective pressure (BMEP) values. The BMEP satisfies the expression:

`$BMEP=T\cdot \left(\frac{2\pi \cdot {n}_{c}}{{V}_{d}}\right),$`

where:

• T is the output torque.

• nc is the number of cycles per revolution.

• Vd is the cylinder displaced volume.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Brake specific fuel consumption by speed and brake mean effective pressure```.

For the ```Brake specific fuel consumption by speed and torque``` fuel model, enter the matrix with brake specific fuel consumption (BSFC) rates corresponding to engine speed and torque vectors. BSFC is the ratio of the fuel consumption rate to the output power.

For the ```Brake specific fuel consumption by speed and brake mean effective pressure``` fuel model, enter the matrix with brake specific fuel consumption (BSFC) rates corresponding to engine speed and brake mean effective pressure (BMEP) vectors. BSFC is the ratio of the fuel consumption rate to the output power.

For both fuel-consumption models, the number of rows must equal the number of elements in the Speed vector parameter. The number of columns must equal the number of elements in the Torque vector parameter or Brake mean effective pressure vector parameter. The default is ```[410, 380, 300, 280, 270, 290, 320, 380; 410, 370, 290, 270, 260, 270, 285, 320; 415, 380, 290, 275, 265, 270, 270, 300; 420, 390, 310, 290, 285, 280, 280, 285; 430, 410, 340, 320, 310, 300, 310, 320; 450, 430, 370, 340, 330, 330, 350, 380]``` `g/hr/kW`.

#### Dependencies

To enable this parameter, set Fuel consumption to ```Brake specific fuel consumption by speed and torque``` or ```Brake specific fuel consumption by speed and brake mean effective pressure```.

Interpolation method to calculate fuel consumption at intermediate speed and torque values. Fuel consumption remains constant beyond the range of the lookup table.

#### Dependencies

To enable this parameter, set Fuel consumption to one of these settings:

• ```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```