Week 7 Challenge
Model is implemented in Simulink as shown below. It contains two main blocks, Driver and Vehicle model.

The simulation time is 598 seconds.
The parameters for the block are initialized using init function.

An EUDC drive cycle is given as desired velocity.
The driver block is modelled as shown below

A PID controller has been modelled. Antiwindup has been implemented too. The outputs obtained are acceleration and brake commands.
Tractive force is given from signal builder block to vehicle model as shown below

The vehicle block is designed as shown below

The opposing forces i.e, gradient force, drag force and resistance force are calculated and subtracted from tractive force.
It is divided by mass to get acceleration which is integrated to get actual velocity.
The velocity is obtained as shown below.

It can be seen that as PID controller isn't tuned yet, the velocity follows tractive force input.