## ENGG1811

• May 15, 2020

ys the verticle displacement of the center of the car body
from a reference level (array of floats)
yu the verticle displacement of the center of the wheel/tyre
from a reference level (array of floats)
vs the verticle velocity of the quarter car body (array of floats)
vu the verticle velocity of the wheel/tyre (array of floats)The inputs are: Inputs:
time time_array
ms the mass of 1/4 of the car body
mu the mass of the tyre and wheel
kt tyre stiffness
k spring stiffness
b inertance
c damping coefficient
The implementation of simulate_qc requires the mathematical model for the quarter car. The model is here (click here), you need to use equations 7 to 12. You can use the python simulation programs from the lab.Hint: You can use the python simulation program para_ODE_ext_lib.py and para_speed_height_by_ODE.py (code from Week 7’s lecture) or the material from “Lab 08: Simulation and its applications” as a starting point to develop the function for this task.You can assume the following initial conditions: vs(0) = vu(0) = ys(0) = yu(0) = 0.Testing: You can test “Task 1” using the file test_task1_task2.py (available in assign2.zip).Task 2: A function to calculate discomfortThe aim of Task 2 is to determine the discomfort level for a given set of suspension parameters. Intuitively, a comfortable ride means the passengers are not experiencing much vibration. We can express this quantitatively by calculating how much acceleration the car body experiences. The higher or longer the acceleration is, the more uncomfortable the ride is. (Note: An important part of using computers to perform engineering design is to express the design objective quantitatively. You will learn that in later years but this assignment will show you how to do that.)Since the function simulate_qc gives us the velocity of the car body, we can use it to determine the acceleration and subsequently the discomfort level. For this task, you are asked to write a python function     def calc_discomfort(vs , dt): The above function should be in a file calc_discomfort.py .The inputs and output values are:Purpose:
Determining the discomfort level for a given set
of suspension parameters

Inputs:
vs the verticle velocity of the quarter car body
dt time increment

Output:
discomfort: a scalar representing the discomfort level
for the given vehicle and suspension parameters Let us assume that the array vs has n elements and let us use dt to denote the time increment used in the array time. We can use vs to calculate the acceleration at (n-1) time instances:a[i] = ( vs[i+1] – vs[i] ) / dt where i = 0, 1, …, n-3, n-2where vs[i] is the i-th element of the array vs and a[i] is the i-th element of the acceleration array a. The discomfort level is then given bydiscomfort = a2 + a2 + … + a[n-3]2 + a[n-2]2This should be the output of the function calc_discomfort. Intuitively, this calculation says the discomfort is higher if the acceleration is higher.Hint: Consider the python and numpy functions like numpy.sum, and numpy.diff, they may prove useful here.Testing: You can use the python program test_task1_task2.py (a file in assign2.zip) to test whether your calc_discomfort function is working correctly. If the reported error is small, i.e. less than 10-4, then it should be fine.Important requirement on implementation: The calculation of the discomfort level from the array vs can be done without using any loops. You will only receive full marks for this part if the calculation is done without using loops, otherwise you will receive a reduced mark if loops are used.Task 3: Calculating discomfort level for many pairs of (inertance, damping coefficient)The function calc_discomfort allows you to determine the discomfort level for each set of suspension parameters: spring stiffness k, damping coefficient c and inertance b. For simplicity, we will not change the value of k. We will calculate the discomfort level for many different pairs of (inertance,damping coefficient) or (b,c) values.     def explore_qc(time_array, y_road, ms, mu, kt, k, inerter_array, damping_coefficient_array): The above function should be in a file explore_qc.py .Purpose:
Determining the discomfort levels for a given damper values and inerter values

Inputs:

time time_array
ms the mass of 1/4 of the car body
mu the mass of the tyre and wheel
kt tyre stiffness
k spring stiffness
inerter_values inertance values (array of type float)
damping_coefficient_values damping coefficient values (array of type float)

Output:
discomfort_array 2-dimentional numpy array with discomfort values for
given damper values and inerter values (read the specs)
The steps for this Task are:Create a 2-dimentional zero array discomfort_array with len(inerter_array) rows and len(damping_coefficient_array) columns.The (i, j) element of the 2-dimentional array discomfort_array, i.e. discomfort_array(i,j), should be assigned the discomfort level of a suspension when inerter_values[i] and damping_coefficient_values[j] are used.For example, You can assume all other parameters are as specified.You can use loops to complete this task.Testing: You can use the file test_task3_task4.py to check whether you have calculated the array discomfort_array correctly or not.Hint: please read the examples in the file numpy_2d_examples.pyTask 4: Determining the (inertance, damping coefficient) pairs that give, respectively, the best and worst comfortThe engineering design problem is to choose good design parameters to meet our design requirements. In our case, a design has two design parameters inertance and damping coefficient.By using the discomfort_array, determine the (inertance, damping coefficient) pair that gives the best comfort. For example, the pair that gives the smallest value of discomfort level in the array discomfort_array.For comparison purpose, we will also determine a poor design which we define as the design that maximises the level of discomfort, that is less than or equal to discomfort_upper_limit. Determine the (inertance, damping coefficient) pair that gives the worst comfort, that is less than or equal to discomfort_upper_limit. For example, the pair that gives the largest value of discomfort level in the array discomfort_array, that is less than or equal to discomfort_upper_limit.Once you have obtained the best design and the poor design, you need to return these four values from the following function you need to implement for his task.    def optimise_qc(discomfort_array, inerter_array, damping_coefficient_array, discomfort_upper_limit): The input and output values are:Inputs:
discomfort_array 2-dimentional numpy array with discomfort values for
given inerter_values and damping_coefficient_values (read the specs)
inerter_values inertance values (array of type float)
damping_coefficient_values damping coefficient values (array of type float)
discomfort_upper_limit maximum discomfort value to calculate worst comfort
(i.e. ‘max_inerter’ and ‘max_damping_coefficient’ values)

Output:
min_inerter and min_damping_coefficient the pair that gives the smallest value of discomfort
max_inerter and max_damping_coefficient the pair that gives the worst value of discomfort, that
is less than or equal to a given ‘discomfort_upper_limit’