In engineering, **simulations** play a critical part in the design phase of any system. Through simulation we can understand how a system works, how it behaves under predefined conditions and how the performance is affected by different parameters.

In this article we are going to use a simplified mathematical model of the longitudinal dynamics of a vehicle, in order to evaluate the **acceleration performance** of the vehicle (0-100 kph time) and determine the **maximum speed**.

To validate the accuracy of our mathematical model, we are going to compare the simulation result with the advertised parameters of the vehicle.

### Input data

The vehicle parameters are taken from a rear-wheel drive (RWD) 16MY Jaguar F-Type:

Engine | 3-litre V6 DOHC V6, aluminium-alloy cylinder block and heads | |

Maximum torque [Nm] | 450 | |

Engine speed @ maximum torque [rpm] | 3500 | |

Maximum power [HP] | 340 | |

Engine speed @ maximum power [rpm] | 6500 | |

Transmission type | automatic, ZF8HP, RWD | |

Gear ratio | 1^{st} | 4.71 |

2^{nd} | 3.14 | |

3^{rd} | 2.11 | |

4^{th} | 1.67 | |

5^{th} | 1.29 | |

6^{th} | 1.00 | |

7^{th} | 0.84 | |

8^{th} | 0.67 | |

Final drive (i_{0}) | 3.31 | |

Tire symbol | 295/30ZR-20 | |

Vehicle mass (curb) [kg] | 1741 | |

Aerodynamic drag, C_{d} [-] | 0.36 | |

Frontal area, A [m^{2}] | 2.42 | |

Maximum speed [kph] | 260 | |

Acceleration time 0-100 kph [s] | 5.3 |

From data available on the internet, we can also extract the static engine torque values at full load, function of engine speed:

Engine speed points (full load) [rpm] | 1000 | 2020 | 2990 | 3500 | 5000 | 6500 |

Engine static torque points (full load) [Nm] | 306 | 385 | 439 | 450 | 450 | 367 |

### Vehicle layout

The powertrain and drivetrain of a RWD vehicle consists of:

- engine
- torque converter (clutch)
- automatic (manual) transmission
- propeller shaft
- differential
- drive shafts
- wheels

For simplicity, for our simulation example we are going to make the following assumptions:

- the engine is only a source of torque, without any thermodynamics or inertia modeling
- the engine is running at full load all the time
- the effect of the torque converter is not considered
- the gear shifting is performed instantaneous disregarding any related slip or dynamics
- the effects of the propeller shaft and drive shafts are not considered
- the tires have constant radius and the effect of slip is not considered

The mathematical model is going to be implemented as a **block diagram in Xcos (Scilab)**, based on the following equations.

### Mathematical equations

The **vehicle movement** is described by the **longitudinal forces equation**:

where:

F_{t} [N] – traction force

F_{i} [N] – inertial force

F_{s} [N] – road slope force

F_{r} [N] – road load force

F_{a} [N] – aerodynamic drag force

The traction force can be regarded a a “positive” force, trying to move the vehicle forward. All the other forces, are resistant, “negative” forces which are opposing motion, trying to slow down the vehicle.

As long as the traction force will be higher than the resistances, the vehicle will **accelerate**. When the traction force is smaller compared with the sum of resistant forces, the vehicle will **decelerate** (slow down). When the traction force is equal with the sum of resistant forces, the vehicle will maintain a **constant speed**.

The **traction force** [N] depends on the engine torque, engaged transmission gear ratio, final drive ratio (differential) and wheel radius:

where:

T_{e} [Nm] – engine torque

i_{x} [-] – transmission gear ratio

i_{0} [-] – final drive ratio

η_{d} [-] – driveline efficiency

r_{wd} [m] – dynamic wheel radius

The **dynamic wheel radius** [m] is the radius of the wheel when the vehicle is in motion. It is smaller than the static wheel radius r_{ws} because the tire is slightly compressed during vehicle motion.

The **static wheel radius** [m] is calculated based on the tire symbol (295/30ZR-20). For a better understanding of the calculation method read the article How to calculate the wheel radius.

The **inertial (resistant) force** [N] is given by the equation:

where:

m_{v} [kg] – total vehicle mass

a_{v} [m/s^{2}] – vehicle acceleration

The **total vehicle mass** [kg] consists of the curb vehicle mass, the driver’s mass and an additional mass factor. The mass factor takes into account the effect of the rotating components (crankshaft, gearbox shafts, propeller shaft, drive shafts, etc.) on the overall vehicle inertia.

where:

f_{m} [-] – mass factor

m_{cv} [kg] – curb vehicle mass

m_{d} [m] – driver mass

The **road slope (resistant) force** [N] is given by the equation:

where:

g [m/s^{2}] – gravitational acceleration

α_{s} [rad] – road slope angle

The **road load (resistant) force** [N] is given by the equation:

where:

c_{r} [-] – road load coefficient

The **aerodynamic drag (resistant) force** [N] is given by the equation:

where:

ρ [kg/m^{3}] – air density at 20 °C

c_{d} [-] – air drag coefficient

A [m^{2}] – vehicle frontal area

v [m/s] – vehicle speed

The traction force is limited by the wheel friction coefficient in the contact patch. The maximum **friction force** [N] that allows traction is:

where:

μ [-] – friction coefficient

c_{l} [-] – rear axle load coefficient

Replacing (4) in (1) and rearranging the terms, gives:

\[a_v = \frac{1}{m_v} \left [ F_t – \left (F_s + F_r + F_a \right ) \right ] \tag{10}\]By integrating equation (10) we obtain the vehicle speed [m/s]:

\[v = \frac{1}{m_v} \int \left [ F_t – \left (F_s + F_r + F_a \right ) \right ] dt \tag{11}\]The equations above will be used in the Xcos block diagrams. Before diving in the Xcos model, we need to prepare the input parameters for our simulation.

### Input parameters

The input parameters are mainly based on the advertised vehicle data and engineering assumptions. The most efficient way of defining them is using a Scilab script file (`*.sce`

).

// Engine eng.NmaxTq = 3500; // engine speed for maximum torque [rpm] eng.NmaxPwr = 6500; // engine speed for maximum power [rpm] eng.tqFullLoad = [306 385 439 450 450 367]; // engine torque curve at full load [Nm] eng.NtqFullLoad = [1000 2020 2990 3500 5000 6500]; // engine speed axis [rpm] eng.Nmax = 6500; // maximum engine speed [rpm] eng.Nmin = 1000; // minimum engine speed [rpm] // Transmission gbx.gearMin = 1; // lowest gear [-] gbx.gearMax = 8; // highest gear [-] gbx.gearRat = [4.71 3.14 2.11 1.67 1.29 1.00 0.84 0.67]; // gearbox gear ratios [-] gbx.i0 = 3.31; // final drive ratio (differential) [-] gbx.eff = 0.85; // driveline efficiency [-] // Tires: 295/30ZR-20 tire.W = 0.295; // tire width [m] tire.D = 20 * 0.0254; // rim diameter [m] tire.miua = 1.1; // wheel (tire) friction coefficient [-] tire.load = 0.65; // rear axle load coeeficient [-] // Vehicle veh.mass_curb = 1741; // [kg] veh.mass_driver = 80; // [kg] veh.mass_fm = 1.05; // mass factor [-] veh.g = 9.81; // gravitational acceleration [m/s2] veh.cd = 0.36; // drag coefficient [-] veh.fa = 2.42; // frontal area [m2] veh.ro = 1.202; // air density [kg/m3] road.slope = 0; // road slope angle [rad] road.cr = 0.011; // road load coefficient [-]

By running the script file, the input parameters are going to be loaded in the Scilab workspace. This step must be performed before the Xcos block diagram modeling, because the parameters are going to be loaded in some of the Xcos blocks.

### Parameters pre-processing

With the input parameters defined, we can calculate the remaining parameters used in the mathematical equations. The pre-processing instructions can be included in the same Scilab script file, after the input parameters definition.

// engine power curve at full load eng.pwrFullLoad = (1.36/1000)* eng.tqFullLoad .* (eng.NtqFullLoad * (%pi/30)); // [HP] // wheel dynamic radius tire.H = 30*tire.W/100; // tire height [m] tire.rws = tire.D/2 + tire.H; // wheel static radius [m] tire.rwd = 0.98 * tire.rws; // wheel dynamic radius [m] // vehicle total mass veh.mass = veh.mass_curb*veh.mass_fm + veh.mass_driver; // [kg] // simulation dT = 0.01; // sample (plot) time [s]

The **static engine power** at full load is calculated from the **static engine torque** at full load and **engine speed**:

where:

P_{e} [HP] – static engine power at full load

N_{e} [rpm] – engine speed

T_{e} [Nm] – static engine torque at full load

We can plot the static engine torque and power at full load, function of engine speed, using the Scilab instructions below.

// Engine static torque and power at full load subplot(1,2,1) plot(eng.NtqFullLoad,eng.tqFullLoad,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;7000 500] xgrid() xlabel("Engine Speed [rpm]","FontSize",2) ylabel("Engine Torque [Nm]","FontSize",2) title("x-engineer.org") subplot(1,2,2) plot(eng.NtqFullLoad,eng.pwrFullLoad,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;7000 400] xgrid() xlabel("Engine Speed [rpm]","FontSize",2) ylabel("Engine Power [HP]","FontSize",2) title("x-engineer.org")

which will output the following graphical window:

For simulation purposes, in the parameters file, a plot time constant is also defined `dT`

. This time constant is going to be used as sample time for the delay blocks and also for the plot interval.

### Xcos block diagram modeling

With all the parameters defined we can proceed with the Xcos block diagram modeling.

For an easier understanding and for a better readability, the Xcos model is split into 3 major subsystems (models): `Engine`

, `Transmission`

and `Vehicle`

.

**Top level model**

A `Clock`

block is used to define a global sampling time (`dT`

) for all the saved variables.

The `Engine`

model has the engine torque as output which is provided to the `Transmission`

model. Further, the transmission model is generating the wheel torque which is fed to the `Vehicle`

model.

The engine speed is calculates in the `Transmission`

model and the transmission speed in the `Vehicle`

model.

**Engine model**

The `Engine`

model is quite simplistic. The input (**current engine speed**) is filtered and saturated to a minimum and maximum values. The role of the filter is to simulated the mechanical inertia of the engine. The saturation block makes sure that the engine speed doesn’t go below idle speed (1000 rpm) and does not exceed the maximum value (6500 rpm).

The **current engine torque** is interpolated in the `Interp`

block, which has, as parameters, two vectors: the engine speed vector and the static engine torque at full load vector. Both vectors are defined in the Scilab parameter script file.

The **current engine power** is calculated using equation (12).

Using the sample time `dT`

, the current engine speed, torque and power are saved in the Scilab workspace.

**Transmission model**

The `Transmission`

model receives **two inputs**:

- the engine torque (coming from the
`Engine`

model) - the transmission speed (coming from the
`Vehicle`

model)

and calculates **two outputs**:

- the transmission torque (going to the
`Vehicle`

model) - the engine speed (going back to the
`Engine`

model)

The final drive gear ratio (of the differential) is included in the transmission model. Therefore the transmission torque is equal with the wheel torque and the transmission speed is equal with the wheel speed.

The **transmission (wheel) torque** [Nm] is calculated after the equation:

where:

T_{e} [Nm] – engine torque

i_{x} [-] – transmission gear ratio

i_{0} [-] – final drive ratio

η_{d} [-] – driveline efficiency

The final drive ratio and driveline efficiency are constant and defined in the parameter file. The transmission gear ratio depends on the engaged gear, which is determined by the `Shift Scheduler`

.

The gear index signal goes into an `Interp`

block which has as X axis the number of gears `[1:8]`

and as output Y, the gear ratio vector (define din the parameter file).

The **engine speed** [rpm] is calculated based on the equation:

where:

ω_{t} [rad/s] – is the transmission speed (equal with the wheel speed)

The **engaged gear** and **transmission (wheel) torque** are saved in the Scilab workspace.

**Shift Scheduler**

The shift scheduler is designed to keep the engine speed in the power band, between maximum torque and maximum power. This way the best acceleration performance is going to be obtained.

The shift scheduler is designed as IF ELSEIF conditions. The **(gear) upshift** is performed when the engine speed reached the engine speed value for maximum power and the maximum (8^{th}) gear is not engaged. The **(gear) downshift** is performed when the engine speed reached the engine speed value for maximum torque and the minimum (1^{st}) gear is not engaged. If none of the up/down shift conditions are true, the shift scheduler keeps the current gear engaged.

For this example, since we are interested in the acceleration of the vehicle, only the gear upshift condition will be active.

**Vehicle model**

The vehicle model receives the **wheel (transmission) torque** input from the `Transmission`

subsystem.

The friction force limit is calculated based on the equation (9).

The **wheel (traction) force** [N] is calculated based on the equation:

where:

T_{w} [Nm] – wheel torque (equal with transmission torque)

The resistant (rolling) forces are implemented based on the equations (6), (7) and (8).

The `Integrator`

block integrates equation (11) and outputs the vehicle speed v [m/s]. The integrator output (vehicle speed) is saturated to 0 m/s (minimum value).

The **wheel speed** [rad/s] is calculated based on the equation:

where:

v [m/s] – vehicle speed

The friction (force) limit, vehicle acceleration, vehicle speed, wheel (traction) force and the sum of the resistant forces are saved in the Scilab workspace.

### Simulation results post-processing

The simulation is run for `60 s`

. Several Scilab instructions are used to plot the saved simulation variable and analyze the behavior of the vehicle.

**Engine speed**

// Engine speed in time plot(sEngSpd_rpm.time,sEngSpd_rpm.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 7000] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Engine Speed [rpm]","FontSize",2) title("x-engineer.org")

The engine starts to accelerate from idle speed (1000 rpm) up to the engine speed value for maximum power (6500 rpm). Notice that there are 6 gear shift performed, the last engaged gear being 7^{th}.

In the lower gears, because the gear ratio is higher, the wheel torque is higher thus the vehicle (engine) accelerates more rapidly. As we approach the top gear (8th), which means smaller gear ratios, the acceleration of the vehicle (engine) is slower.

**Engine torque**

// Engine torque in time plot(sEngTq_Nm.time,sEngTq_Nm.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 500] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Engine Torque [Nm]","FontSize",2) title("x-engineer.org")

The minimum engine torque starts at 306 Nm, which is the full load torque at idle speed. It ramps up, towards the maximum value (450 Nm) and ramps down since the engine speed keeps increasing. At every gear shift, the engine torque goes up, to maximum value and then starts decreasing.

**Engine power**

// Engine power in time plot(sEngPwr_HP.time,sEngPwr_HP.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 400] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Engine Power [HP]","FontSize",2) title("x-engineer.org")

The engine power has the same behavior as the engine torque. Notice that it never exceeds the maximum engine power value (340 HP).

**Engaged gear**

// Engaged gear in time plot(sGear.time,sGear.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 9] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Engaged Gear [-]","FontSize",2) title("x-engineer.org")

This plot shows how the timing of the gear shift during vehicle acceleration. As expected, lower gears are active for a shorter duration. The reason is the higher torque wheel given by the higher gear ratio allows the engine to accelerate faster.

Notice that 1^{st} gear is engaged for a longer time than 2^{nd} gear. This happens because in first gear the engine has to accelerate from idle speed (1000 rpm) to maximum power engine speed (6500 rpm).

**Wheel torque**

// Wheel torque in time plot(sTrnTq_Nm.time,sTrnTq_Nm.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 7000] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Wheel Torque [Nm]","FontSize",2) title("x-engineer.org")

The wheel torque is actually the sum between the left and right wheel torques. Notice that the value of the torque which can be applied to the wheels is much higher than the engine torque. The torque amplification is done in the transmission with the current gear ratio and final drive ratio.

**Wheel traction force**

// Wheel traction force in time plot(sWhlTotTrc_N.time,sWhlTotTrc_N.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 20000] plot(sWhlFricLim_N.time,sWhlFricLim_N.values,"g","LineWidth", 1) plot(sWhlRolRes_N.time,sWhlRolRes_N.values,"r","LineWidth", 1) xgrid() xlabel("Time [s]","FontSize",2) ylabel("Wheel Force [N]","FontSize",2) title("x-engineer.org") legend("Total Traction","Friction Limit","Rolling losses")

This plot is very interesting because it highlights some critical aspects of the vehicle dynamics.

Notice that the **total force available at the wheels for traction** is obtained in 1^{st} gear and it’s 17766 N. Even if the engine and transmission are capable to deliver this high amount of force, the wheel can not deploy it on the road. The maximum traction force which can be deployed by the wheels is limited by the **friction force**, which is 13383 N.

If the traction force generated by the engine and transmission exceeds the friction limit, the wheels will start to slip. This is how a tire “**burnout**” happens. In the vehicles equipped with Electronic Stability Program (ESP) systems, the wheel slip is detected and the engine torque (wheel force) is decreased below the friction limit.

The difference between the traction force and the road (rolling) resistant forces (also called rolling losses) is called **reserve force**. The higher the value of this force, the higher the vehicle acceleration.

As the vehicle speeds up, the resistant forces increase (mainly due to aerodynamic drag) and the traction force decrease. The point where these **forces are equal** (lines overlap or cross each other) is equivalent with the **maximum speed of the vehicle**. At this point the reserve force is zero, therefore the vehicle can not accelerate anymore and has a constant maximum speed.

**Vehicle acceleration**

// Vehicle acceleration in time plot(sVehAcc_mps2.time,sVehAcc_mps2.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 7] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Vehicle acceleration [m/s2]","FontSize",2) title("x-engineer.org")

The maximum vehicle acceleration (6.9 m/s^{2}) is obtained in 1st gear. This is happening because the reserve force is at its maximum. Notice that the vehicle acceleration in first gear is kept nearly constant for a short time. This happens due to the friction force limitation (`MIN`

block in the Xcos diagram).

We can also calculate the maximum G-force obtained during acceleration, by dividing the maximum acceleration of the vehicle with the gravitational acceleration.

`-->maxGforce_G = max(sVehAcc_mps2.values)/veh.g`

`maxGforce_G =`

` 0.7035715`

The vehicle (in simulation) is capable of reaching 0.7 G in 1^{st} gear, during full load acceleration.

**Vehicle speed**

// Vehicle speed in time plot(sVehSpd_kph.time,sVehSpd_kph.values,"LineWidth", 3) ha=gca(); ha.data_bounds = [0 0;60 300] xgrid() xlabel("Time [s]","FontSize",2) ylabel("Vehicle speed [kph]","FontSize",2) title("x-engineer.org")

From the vehicle speed plot we can extract the time to reach 100 kph and the maximum speed. These values can be obtained by running the following Scilab instructions:

// maximum vehicle speed [kph] maxVehSpd_kph = max(sVehSpd_kph.values); // 0 - 100 kph time [s] idx=find(sVehSpd_kph.values>100); t_0_100_s = sVehSpd_kph.time(idx(1));

For a 60 s simulation, the maximum vehicle speed is 253 kph. For a 100 s simulation, the maximum vehicle speed is **258 kph**.

The time to reach 100 kph from standstill is **5.00 s**.

### Conclusions

The model gives a very good match compared with the advertised vehicle parameters.

Advertised | Simulation | |

Maximum vehicle speed [kph] | 260 | 258 |

0 – 100 kph acceleration time [s] | 5.3 | 5.0 |

Even if the simulation model is relatively simple, by running it, we can extract a lot of information about the vehicle dynamics:

- what is the maximum speed of a given vehicle
- what is the 0 – 100 kph acceleration time of a given vehicle
- what is the impact of different parameters (mass, gear ratios, shift scheduler, etc.) on the vehicle performance
- what is the impact of different engine torque curves (at full load) on the vehicle performance

This simulation model is also a very good source of understanding the basic phenomena of vehicle dynamics, which can be valuable to engineering students, engineers or vehicle enthusiasts.

If you like this tutorial and want more for the future, you can support me on Patreon.

Don’t forget to Like, Share and Subscribe!

## Chris Hu

Dear Tutor

Thanks a lot for your sharing, the contents are real helpful. here are two questions:

1. Can your code be converted into Mathlab/Simulink one?

2. How to register your site? any charge for being your member?

thanks

Chris

## Anthony Stark

Hi,

1. Yes, it can be converted easly Scilab/Xcos and Matlab/Simulink are very similar.

2. Please use social media channels to stay in touch, see the bottom right of the page.

## Dan

Your work is awesome! Thanks for sharing! If the model doesnt work for you, here is the fine tuning which made it work for me: In the Shift Scheduler the Dynamic blocks must be set to “1” in “pass first input if” –> u2>a

## Bruce Banner

Hey Tony, Banner here. Just need some clarity on where your “rear axle load co” comes from. I thought it was a derivation of wheel drive type/weight distribution since I had seen the “65” some where before. But after scouring the net, I couldn’t find any mention of axle load/load coefficients/etc except in reference to commercial trucks packing a load. The closest I found was the relationship between wheel drive type, engine location and weight distribution, but this jag is a front engine, rear drive (FR), whose respective weight distro is 55/”45″ <– so that wasn't it either lol. I'm completely at a loss of where this number comes both conceptually and in practice. Which sucks bc it's the most influential var in the program lol. If you could just provide a bit of guidance here, I would appreciate it very very much. Great algorithm btw, fantastic!

## Anthony Stark

Hi Banner,

I didn’t know that you’re also in engineering… you were suppose to work with radiation, gamma rays and other radioactive stuff. Anyway, the Jag F-type weight distribution is 50/50. But this is static! When you are in acceleration state, the rear suspensions compresses and more weight is transferred on the rear axle. The 65% rear axle load is just a guess, starting from 50% and considering weight shift during acceleration. Thanks for dropping by!

## Joe

Thanks for posting this!

I’ve done the math and coded a similar function in python (without simulation) under various acceleration profiles including Akcelik and Biggs from 1987, but would like to check my numbers. The problem is, I’m getting an algebraic loop error in my recreation. I’m guessing it’s in the transmission Xcos with the integrator. I’m not sure how to fix it. Any way you could send me the files so I can find my error?

## Anthony Stark

Hi Joe,

Yes, the integrator introduces a delay, that is why in the Xcos model I don’t have any algebraic loops. I don’t know how you can fix you’re Python code though. The plots are coming straight from the simulation, you can use them to check your numbers. If you want the source file, check my Patreon page.

## Versolalto

I did il for lot of cars in Excel. Interesting subject!

## Vic

Where can you find more car parameters such as the jaguar. So that you can apply this model for different cars? For example i’m trying to use the same process,except for a 2018 mustang and i cant find the speed points at full load or the torque points at full load.

## Anthony Stark

You have to search them on the internet. For example I’ve found:

https://www.quora.com/What-is-the-torque-curve-for-a-2017-Ford-Mustang-GT-with-the-5-0-litre-Coyote-motor

https://news.pickuptrucks.com/2011/04/how-we-dyno-tested-fords-3-5-liter-ecoboost-v6-and-5-0-liter-v8-engines.html

From the picture of the torque/power curves you can get the actual values by using a software like:

http://markummitchell.github.io/engauge-digitizer/

## Daro

You are sharing with * .xcos / * .xcos files ???

## Anthony Stark

All the models and scripts can be recreated from the article. However, if you want directly the *.sce and *.zcos files, they can be found on our Patreon page.

https://www.patreon.com/xengineer

## Daro

I have recreated these files but they do not work correctly. Can I send them to you via email to check?

And one more thing.

You did not take into account the problem of the throttle opening / closed and the problem of rotating masses.

http://transportproblems.polsl.pl/pl/archiwum/2010/zeszyt1/2010t5z1_04.pdf

## Anthony Stark

As it is described in the article you shared, to take into account the inertia of the rotating components (crank mechanism, shafts, gears, etc.) multiply the mass with a coefficient delta (e.g. 1.2).

You can send the files to the e-mail in the contact page, I’ll have a look.

## Daro

Thanks. I recreate it before you answer to me and now works fine. My problem lay in “shift scheduler” block in Dynamics, “pass input if:” must be set to 1 value [ u2>a(1) ].

Nevertheless, thank you for your interest and answer.

## Daro

How or better where to add simple throttle on/off mechanism for increase/decrease vehicle speed.

From minimum idle speed 20[%] throttle open and ~75[%] throttle set to control velocity.

I tried to realize it by multiply Eng_spd[rpm] by values (0.0, 1.0> but velocity reduce only a little bit.

## Anthony Stark

If you want to add a throttle you need a 2-D map for the engine torque, which will be function of accelerator pedal (throttle) position and engine speed. You can use the maps from the article:

https://x-engineer.org/automotive-engineering/internal-combustion-engines/performance/power-vs-torque/

After you define the map in the Scilab workspace, in the “Engine model” replace the “Interp” block with a “Interp 2” table. The engine speed input you keep the one from the model and the throttle input you set it yourself, between 0-100 %.

Hope this helps.

## Ginge

The Scilab files would be amazing. I’ve been trying to troubleshoot mine for months, but without a working version and being completely new to Scilab/Xcos it’s really difficult to figure out. I’ve tried breaking it down into smaller chunks to see if the right values are coming out compared to an excel sheet I’ve made which will calculate some of the values at a specified point in time, but I can’t figure out where I’ve gone wrong.

## FStein

Not sure if my last comment went through, so here it is again:

in the engine model you implemented a mechanical inertia filter. In this formula, what does the variable s represent? Thanks!

## Anthony Stark

The “s” is the output variable from a Laplace transform of a first order differential equation of a low-pass filter…. The idea is that a transfer function was used to simulate the inertia of the engine.

To understand transfer functions, read:

https://x-engineer.org/graduate-engineering/signals-systems/control-systems/find-transfer-function-system/

## F

In the engine model you implemented a mechanical inertia filter. What is the value “s” in this formula?

## Fred

Is the Scilab file available anywhere? I’ve never used Scilab and am having a hard time recreating the block diagrams.

## Anthony

Where exactly are you stuck? The best way of learning how to use Xcos is by making a block diagram.