Week 7 Challenge
Aim: To design a mathematical vehicle model along with the vehicle forces acting on it and observe its speed chatacteristics.
Theory:
When a vehicle moves it needs to oppose some forces in order to reach the required speed.The forces that are opposite to the vehicle movement are as follows:

1) Aerodynamic drag force:
Aerodynamic drag force is defined as the force which is faced by the vehicle as it moves through the air. This drag force depends mainly on the front area of the vehicle, side mirrors, ducts, and many other factors.
The formula for aerodynamic drag force as follows:
Faero_drag =0.5*ρ*Cd*A*V2
Where, Faero_drag = aerodynamic drag force
ρ=air density = 1.225 kg/m3
Cd = drag coeffiient
V = velocity
2) Rolling resistance force:
The force resisting the motion when a wheel rolls on a surface. It is mainly caused by non elastic effects; that is, not all the energy needed for deformation (or movement) of the wheel, roadbed, etc., is recovered when the pressure is removed.
Froll=M*g*μ*cos(θ)
M= mass of vehicle
g= acceleration due to gravity = 9.81 m/s2
θ = inclination on road
μ= coefficient of rolling resistance
3) Grade angle force:
Force acting on the vehicle when it is moving on the inclined road.
Fgr=M*g*sin(θ)
M= mass of vehicle
g= acceleration due to gravity = 9.81 m/s2
θ = inclination on road
Simulation model :
The mathematical model of vehicle model is as follows:

Here there are two subsystems. The input of the system is a drive cycle to get the reference speed of the vehicle.
Subsystem of the driver block:

- This block repesents the acceleration and braking of the vehicle.
- The inputs of the system is actual velocity and desired velocity and the outpt of the system is accelerator and brake
- Here a pid controller is used to rectify the error and get desired values.
- Integral of the controller is set with the anti windup facility where the intergrator is stopped from accumulating the error which result in the overshoots in the response. So integrator is reset whenever the velocity reaches 0.
Subsystem for vehicle motion:

Here,
Force = mass*acceleration
So to get speed of the vehicle integral of acceleration.
All the resistive forces are model using the constant blocks and the variables which are defined in the base workspace.
All the resistive forces are summed up and substracted from the tractive force(output of controller). The differnce between tractive and resistive results in acceleration of the vehicle and the integration of the accleration gives the velocity.
The parameters of the system are:
vehicle mass=1000
roll coefficient=1.2
angle of inclination =0
front area =10
drag coefficient=0.2
Output:

Here the above ones id the reference speed and the second one is the traction force and the final one is the actual speed of the vehicle.