0% found this document useful (0 votes)
2 views

MBSD_Lab 2

The document outlines the requirements for MBSD Lab #2 for the academic year 2023/24, focusing on implementing a 'one pedal controller' using Simulink. It specifies the creation of three separate Simulink files for the harness, controller, and plant models, along with a report detailing the controller's design. The deliverables must be submitted as a .ZIP file by May 24th, including the models and a brief report, while also providing a description of the system's components and functionalities.

Uploaded by

Ayman Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

MBSD_Lab 2

The document outlines the requirements for MBSD Lab #2 for the academic year 2023/24, focusing on implementing a 'one pedal controller' using Simulink. It specifies the creation of three separate Simulink files for the harness, controller, and plant models, along with a report detailing the controller's design. The deliverables must be submitted as a .ZIP file by May 24th, including the models and a brief report, while also providing a description of the system's components and functionalities.

Uploaded by

Ayman Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

MBSD Lab #2 A.Y.

2023/24
Purposes
 Implement the “one pedal controller” as a Simulink model.

To implement the system, follow the description already provided in the Laboratory 1
document considering also eventual assumptions already stated in this latter document.
The safety mechanisms are not required in this laboratory.

The Simulink project has to be split into 3 files:


 Harness.slx, containing reference models for the controller and plant and test stimuli
generation
 Controller.slx, containing the controller (to be developed)
 Plant.slx, containing the car longitudinal physical model.

The longitudinal physical model and the test stimuli generators shall demonstrate the
effectiveness of the implemented controller with respect to the expected functionalities.
Consider the plant model description as an example of the comments to be inserted in the
Controller Software Unit description report.

Templates of these files are available alongside this document.

The deliverable, composed of the 3 Simulink models and a PDF file obtained by filling the
following pages of this document (please delete this first page), has to be provided as a .ZIP
file up to May 24th at 23:59 through “Consegna Elaborati” of the Portale della Didattica. It
shall also contain a brief report explaining the design of the controller, using the following
template. It is sufficient that only one of the group members uploads it.
Model-Based Software Design, A.Y. 2023/24

Laboratory 2 Report

Components of the working group (max 2 people)


 Name Surname, student ID
External interfaces of the plant
Name Direction Type
Requested_Torque_Nm Input CAN
Vehicle_Speed_km_h Output CAN
Automatic_Transmission_Selec Input (from the driver to CAN {P, R, N, D, P}
tor the controller)
Selected mode/errors Output (to the driver) CAN

Equations of the plant


The plant considered in this model is the so-called Vehicle Longitudinal Dynamics.
Considering:

 v̇ ( t ) the vehicle acceleration, expressed in [m/s 2]


 v ( t ) the vehicle longitudinal speed, expressed in [m/s ]
 m the vehicle mass, expressed in [kg ]
 F x ( t ) the longitudinal force applied to the vehicle center of gravity, expressed in [ N ]
 F s ( t ) the longitudinal force applied to the wheel on the terrain, expressed in [ N ]
 F d ( v ) the longitudinal force applied to the vehicle center of gravity due to the
frictions with air and terrain, expressed in [ N ]
 I the moment of inertia of each one of the wheels, expressed in [kg ⋅ m2]
 r the radius of the wheel, expressed in [m ]
 ω ( t ) is the angular speed of the wheel, expressed in [rad / s
 ω e ( t ) is the angular speed of the engine/electrical motor, expressed in [rad / s
ω ( t ) ⋅60
 ω eRPM ( t )= e is the angular speed of the engine/ electrical motor, expressed in

[revolutions per minutes
 ω̇ ( t ) is the angular acceleration of the wheel, expressed in [rad / s2
 S is the frontal surface of the car, expressed in [m2]
 c x =0.3 is the automobile drag coefficient
 ρ is the average density of air at sea level in standard conditions 
3
ρ=1.25 kg/m
 i g is the gearbox reduction ratio
 i f is the final drive reduction ratio
 i t =i g ⋅i f is the total power train reduction ratio.
An extremely simplified model can be obtained as follow:
F (t )− Fd (v )
v̇ ( t )= x ( 1)
m
where v̇ ( t ) is the vehicle acceleration, m is its mass, F x ( t ) is the longitudinal force applied to
its center of gravity by the effects of the torque applied on the wheels, and F d ( v ) is the sum
of the friction forces on the vehicle due to wheel-terrain and vehicle-air interactions.

Considering that the torque is equally split between the two wheels (valid only on straight
tracks)
T ( t ) −2 ⋅F s ( t ) ⋅ r=2 I ⋅ ω̇ ( t ) ( 2 )

the absence of slipping:

{
2⋅ F s ( t ) ⋅r =F x ( t )
v ( t )=2 π ⋅r ⋅ ω ( t )
and considering the moment of inertia of the wheels I =0 , we can define the following
T (t )
equation, given that T ( t )=2 ⋅ F s ( t ) ⋅r  F s ( t )= .
2 ⋅r

The drag force that limits the maximum speed of the vehicle is equal to:

2
F d ( v ( t ) )=X air ⋅ ( v ( t ) ) + X tyres ⋅ v ( t ) ( 3 )
where:
1
X air = ⋅ S ⋅ c x ⋅ ρ ( 4 )
2
and, as usually modeled:
X air ⋅50
X tyres ❑ → X tyres = ( 5)
Xtyres ( 50
km
h ) (
= X air 50
km
h ) 3.6

By substituting the (2) equation in (1), and by integrating both sides, we obtain:
t t
1 1
v ( t )= ∫ F x ( t ) − F d ( v ( t )) dt = ∫ 2 ⋅ F s ( t ) − F d ( v ( t ) ) dt=¿
m 0 m 0
t
1 T (t)
∫ − Fd ( v ( t ) ) dt ( 6 )
m 0 r

and, by substituting (3) in (6):


t
1 T (t)
v ( t )= ∫ − X air ⋅ ( v ( t ) )2 − X tyres ⋅ v ( t ) dt ( 7 )
m 0 r

Remember that the integrator block of Simulink requires an initial condition corresponding
to the vehicle's longitudinal speed at the beginning of the simulation, v ( 0 ). A possible
configuration of the integration block is shown in Figure 2.

During the model development, put all the needed gain to obtain as an output of the
physical model a speed expressed in km/h.
To simulate the slope θ of the terrain, it is possible to add the gravity force F g ( θ ) as follows:
t
1 T (t)
v ( t )= ∫
2
− X air ⋅ ( v ( t ) ) − X tyres ⋅∨ v ( t ) ∨⋅ dt+m ⋅ g⋅ sin ⁡( θ ) ( 8 )
m 0 r
With g=9.81 the gravity acceleration on Earth.
Reasonable values for an electric compact car can be:
 m=1600 kg
 r =0.3 m
 The torque T (at the wheel) can vary in the range [ −60 ; 960 ] Nm
 S=3.5 m2
 c x =0.3

Figure 1 Graph showing drag forces of tires (in orange) and air (in blue) at various speeds. It is possible to observe that, as
imposed in equation (5), X tyre =X air at 50 km/h. Below this speed, the tire drag is dominant, after that, the air drag is
T
dominant. Moreover, it is possible to see the top speed of the car (around 230 km/h) when F x = = X + X air , with
r tyre
F x =3200 N .

With those values, the top speed on level ground reachable by the car is about 230 km/h,
where the drag forces equal the traction force (3200 N).
Considering the reverse direction, the maximum speed reachable with a limitation of -60
Nm is about 45 km/h.
Figure 2 Settings window for the Integrator block of Simulink

Use these values (with a certain tolerance, for example, 10 %) to saturate the integrator
block.

To make the model more realistic, it is possible to compute the torque request at the
engine/motor. A typical ratio value for transmission of an electric car with a single gear can
be around i t =12.

All the initialization parameters of the model are automatically loaded model by a callback
of the function init_fn as shown in Figure 3.

Figure 3 init_fn callback configuration in the harness model properties.


Description of the whole system
Draw the I/O block diagram of the plant and the controller, showing how they interact.
Controller SW Unit specifications
Provide a brief description of the Controller functionalities and its interfaces.
Input, Output, Local, Global, Volatile
Interfaces
Name Unit Type1 Data Dimensio Min Max
Type2 n
BrakePedalPressed NA boolean Input 0 1
AutomaticTrasmissionS NA Enum input 0(park) 4(brake)
electorState
VehicleSpeed Km/h single input -60 240
ThrottlePedalPosition NA single global 0 1
TorqueRequest Nm single output -40 80
AutomaticTransmission Na enum local 0(park) 4(brake)
State
*NA: it doesn’t have a unit

Draw the Finite State Machine (FSM) representing the controller logic

Comment on the design choices of the FSM, which are not trivial to be understood just by
analyzing the controller logic.

When moving the Park state, the transmission locks and the wheels cannot move.
While in the neutral state, the car is in an intermediate state between reverse and drive. In
this state, pressing of the Throttle pedal does not produce any torque demand from the
controller.
In the reverse state the pressure of the pedal produces a negative torque demand that will

Usually, the first gear of a car has a transmission ratio about i g =3


, hence the engine makes 3 complete rotations very single rotation
of the pinion gear of the differential. In the differential (final drive),
the pinion gear makes about i f =4 revolutions for every

2
Input, Output, Local, Global, Volatile
go to move the car with negative speed.
In the drive state the pedal pressure is translated into a positive torque demand that will
induce positive speed.
In the brake state, a pedal pressure of more than one-third of its travel produces behavior
comparable to the behavior of the drive state; whereas if less than one-third of the pedal is
pressed, the engine brake comes into action, which will cause the car to brake.

To move between states certain conditions must be met and these conditions are shown in
the above graph

Comment with plots of the results obtained from the test cases (it is suggested to use the
Data Inspector)

The graph doincide with the expected results. The speed trend appears to increase, almost,
linearly until it reaches 85.4 and then stabilizes for about 10 seconds. The stabilizing
coincides with the reduction in pedal pressure.
After the 30 seconds the speed begins to decrease, almost, linearly after the throttle pedal is
completely released. when pressed again the speed stops decreasing and then resumes
when the pedal is released. Once the speed is reset it remains so until the reverse gear is
engaged and the throttle pedal is depressed. At that time the vehicle begins to move with
negative velocity.

You might also like