Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: zz-x2580
· Due date:5pm,Friday of Week-10.
· Late Penalty:Late submissions will be penalised at the rate of 0.2%per hour for 121 hours.Followed by 75.8%per hour for 1 hour.
·Submissions will not be accepted after 9am Monday of Week-11.
Change Log
·25/07124-Added submissions instructions.
Introduction
This assignment is inspired by the Millennium Bridge in London,England.The Millennium Bridge is a suspension bridge for pedestrians only.Many visitors walked across the bridge in the first day of its opening in 2000.However,these visitors were treated to something unusual.They noticed that,when there were many people on the bridge,the bridge started to sway a lot.You can watch the wobbling of the bridge in this YouTube video.Since the bridge did not sway much if there were few people on the bridge,the authority decided to limit the number of people on the bridge.Eventually,the bridge was closed a few days after its opening.The bridge was re-opened after additional dampers have been put on the bridge,see [1] for a report on how the bridge was stabilised.
Engineers and scientists wanted to understand why the Millennium Bridge started to sway when there were many people on the bridge.You probably have learnt about resonance in your Physics class and you are right to guess that the wobbling had something to do with resonance.However,the baffling part is how pedestrians could have caused resonance to occur.One theory,which was published in [2],is that the pedestrians would synchronise their walking with that the bridge's motion and their synchronised movement caused the bridge to sway more.There are also other theories,such as [3] ,which disputes the theory proposed in [2] .
The aim of this assignment is_to give you an opportunity to work on a small-scale engineering problem in Python.The engineering system that you will be working on is the Millennium Bridge motion model from [2] .(Note that we are not claiming that [2]is the correct model.We are merely using the model in [2]in a computing exercise.)You will first develop a Python function to simulate the motion of the bridge due to the pedestrians movement.After that,you will use the simulation program to try out different modifications that can reduce the amount of swaying.On the whole,this assignment relates computer science to two important aspects of engineering,which are simulation and design.
The key objective of this assignment is to for you to learn and use Python and numpy to solve problems.At the same time,we would like to give the problem an engineering context so that you can get some ideas how computing is used in engineering.Note that we used the word inspired earlier because,for this assignment,we took the liberty to simplify the model in [2] and the engineering design problem.
Learning objectives
This assignment is designed to give you practice in
·Applying programming to solve a simple engineering simulation and design problem
·Applying a number of numpy features,which include array,slicing,elementwise
computation,built-in functions and others
·To organize programs into modules by using functions
·To use good program style including choice of variable names,comments and documentation
·To get a practice on software development,which includes incremental development, testing and debugging.
Intuition behind the bridge and pedestrian motion modelling
We will give you a basic mental picture that you can use to visualise the bridge and pedestrian motions.We will use Figure 1 below,which is taken from [2],for our description.
Figure 1.Taken from [2].
The left side of Figure 1 depicts the Millennium bridge.We are particularly interested in the lateral motion (i.e.side-to-side motion or sway)of the bridge.
For the modelling of the bridge,we can think about the bridge as a wheeled cart with mass M,see the top-right of Figure 1.This wheeled cart can only move in one dimension along the X-axis and this motion is representative of the sway of the bridge.The sway of the bridge is restricted by both stiffness and damping.A material is stiff if a force can only extend the material a little.Engineers like to think about stiffness as a spring where a stiff spring is hard to extend.If we go back to the picture of the cart in Figure 1,the quantity K represents the stiffness of the bridge.A damper is used by engineers to resist or to slow down motion.A common example of a damper in day-to-day life is a door closer which slows down a door so it will not slam.In the picture of the cart in Figure 1,the quantity B denotes damping where a larger B means more resistance.
With correctly chosen stiffness and damping,the sway of a bridge will eventually diedown. If we simulate the lateral motion of bridge without pedestrians (which can be done with the simulation program which you will develop),we obtain the lateral displacement and lateral velocity in Figure 2 and you can see that their magnitudes become smaller over time.
Figure 2.Displacement and velocity of the bridge without pedestrians
Since we will only consider lateral motion in this assignment,we will drop the word lateral for brevity from now on.
You can see from Figure 2 that the motion of the bridge is oscillatory.Engineers and scientists like to think about an oscillatory motion as a point going round in a circle.You can see how the motion of a circle maps to a sine curve here.We know that we can specify the position of a point on a circle by using an angle,so we can use an angle to describe the oscillatory motion of the bridge.This angle is commonly referred to as the phase angle or simply phase (in the same sense of the word "phase"in the expression "moon phase").The bottom-centre picture in Figure 1 depicts an angle using the Greek alphabet ψ(Psi).This angle is used to describe the phase of the oscillatory motion of the bridge.
The walking of a pedestrian can also described as a cycle since walking is a repetition of: lifting of the left foot,landing of the left foot,liting of the right foot,landing of the right foot, and so on.For each pedestrian,we can use a phase to describe their motion,see the angle 日 ;(Theta)in the bottom-right picture in Figure 1.Note that each pedestrian on the bridge has his/her own phase,the subscript i in曰;is used to indicate the pedestrian whose index is i.
The theory in [2] is that the pedestrians synchronised their motion with that of the bridge.If we simulate the motion of the bridge with the pedestrians (which can be done with the simulation program which you will develop),we obtain the displacement and velocity in Figure 3 and you can see that their magnitudes grow over time.If you simulate for longer, the magnitude of oscillation will grow larger until it reaches a steady value.
Figure 3.Displacement and velocity of the bridge with pedestrians
The bottom plot in Figure 3 shows the sine of the pedestrians'phase.There are 20 pedestrians and there are in fact 20 lines in different coloured lines in the plot.You can see the different coloured lines near time 0,but afterwards,these lines overlap and you can only see one coloured line.This means the pedestrians synchronised their walking.
Having seen that the displacement and velocity of the bridge will become large,a part of this assignment for you to see what modifications are needed to stabilise the bridge.
The above mental picture should give you the intuition you need for this assignment.In order to do simulation,we need a mathematical model which we will discuss next.
A mathematical model for the bridge and pedestrians
From the bridge and pedestrian motion that we have discussed above,you know that we are interested in a few quantities:
·The displacement of the bridge at time t,which is denoted by x(t) ·The velocity of the bridge at time t,which is denoted by v(t)
·The phase of the bridge ψ(t)at time t,which can be calculated from x(t),v(t),M and K.(Reminder:M is mass and K is stiffness)
·Each pedestrian's phase.We index the pedestrians by an index i where i takes on values from 0,...,N-1 where N is the number of pedestrian on the bridge.At time t, the phase of the pedestrian iis denoted by O;(t).
The mathematical model tells us how x(t),v(t),ψ(t)and θ;(t)evolve over time.
The model has six model parameters.You have seen M,B,K and N before.There are two more:G and C.The table below summarises all the model parameters and their meaning. The Python programs will use the same notation for these model parameters.
Constants |
Meaning and their unit |
M |
Mass [kg] |
B |
Damping [kg/s] |
K |
Stiffness [kg/s/s] |
N |
Number of pedestrians |
G |
The maximum force that a pedestrian exerts on the bridge [N] |
C |
Larger C value means the pedestrians take shorter time to synchronise with the bridge [/m/s] |
We have placed the mathematical model for the bridge and pedestrians on a separate page.We believe it is best for you to get to know the different parts of the assignment before dwelling into the mathematical model.You should be able to get a big-picture understanding on what you need to do for this assignment without going into the mathematical model at this stage.(The model is here and you can read it later.)The mathematical model is modified from [2] .If you would like to read [2],click on this which will take you to the reference and there are links to download the paper.
Overview of tasks
We have divided the assignment intofour tasks where each task corresponds to the writing of a Python function.
·Task 1 is to write the function sim_bridge()which simulates the bridge's displacement and velocity,as well as the pedestrians'phase
·The aim of Task 2 is to use the displacement and velocity of the bridge to compute a design objective.This design objective is such that,if the bridge oscillates more,then the design objective is bigger.In this task,you will write the function comp_obj().
·Assuming that it is possible to change the stiffness and damping of the bridge,you will use different values of stiffness and damping to see whether you can reduce the oscillation.You can do this because you have developed a simulation program.The aim of Task 3 is to develop the function run_different_designs().
·Now that you have got the different designs,the aim of Task 4 is to choose the best design.For this task,your aim is to write the function find_best_design().
Task 1:Simulation
The aim of this task is to write a Python function sim_bridge()to simulate the bridge and pedestrian motion.In the yellow box below,you can see some code for sim_bridge)which you can use to start your work.
import numpy as np def sim_bridge(t_array,M,B,K,G,N,C,Omega_array,dis0,vel0,ped0): #BEGIN:Supplied code ************************************ #Time increment dt =t_array[1]-t_array[0] #Initialise dis_array,vel_array,ped_array dis_array =np.zeros_like(t_array) vel_array =np.zeros_like(t_array) ped_array=np.zeros((N,len(t_array))) #Initialise for index 0 dis_array[0]=dis0 vel_array[0]=vel0 ped_array[:,0]=ped0 #Compute Y_0 [from eq4] Y_0=np.sqrt(K/M) #END:Supplied code ************************************ #Your code to compute the entries in dis_array,vel_array,ped_array # #Hint:Should use arctan2()from the numpy library to calculate Psi(t) #BEGIN:Supplied code ************************************ #Return the array return dis_array,vel_array,ped_array #END:Supplied code ************************************ |
The function sim_bridge()takes on a number of inputs.We will provide you with the parameter values to use so the important thing for you is to understand what they are referring to.The meaning of M,B,K,N,G and C have already been explained earlier at here.The meaning of the other inputs are explained in the table below.
Python variable name |
Meaning |
t_array |
A numpy array of regularly spaced points.They are the time instances in simulation. |
Omega_array |
This is a numpy array with N entries.The entry Omega_array[i]is the value of Q;in the mathematical model. The quantity Ω;is related to the walking speed of the the pedestrian with index i. |
|
We will explain how you can use Omega_array on the page where we describe the mathematical model.It is here and it is best that you read that later. |
dis0 |
Initial displacement of the bridge.This is a scalar. |
vel0 |
Initial velocity of the bridge.This is a scalar. |
ped0 |
This is a numpy array with N entries.The entry ped0[j]is the initial phase of the pedestrian with index i. |
The function sim_bridge(returns three outputs,see the second last line of the code above. All the three outputs are numpy arrays and their meanings are explained in the table below.
Note that the template file has included code to create these three arrays with the specific shape mentioned above.Please do not change these lines of code.In addition,the template also includes lines of code which initialise these arrays for time 0.Again,please do not change these lines.
In order for you to complete sim_bridge(),what you need to do is to add the for-loop for simulation.
In the simulation,you will need to use arctangent (or inverse tangent)to compute the phase ψ(t)of the bridge.We ask you to use the numpy function arctan2()for this purpose.More explanation is on this page .
(Testing and incremental development) You can test this function by using the test file test_sim_bridge.py.There are four test cases in this test file.We have developed these test cases so that you can develop your sim_bridge()incrementally.We will be explaining these test cases on a separate page because it requires some understanding of the mathematical model.Our suggestion is that you keep going with this document first to get an understanding ofthe whole assignment.After that,you can read the mathematical model and when you are ready to think about how to implement sim_bridge(),you can read how you can incrementally develop it on this page,which is also where the mathematical model is.
Task 2:A function to calculate the design objective
The function sim_bridge()allows you to compute the displacement and velocity from the bridge parameters.In the next task (Task 3),you will explore different designs by varying the values of stiffness and damping.In order for us to choose a design later on,we need a way to measure how good a design is.This measure is known as the design objective.The aim of this task (Task 2)is to develop the function comp_obj()whose aim is to compute the design objective.
The def line of comp_obj(is:
def comp_obj(dis_array,vel_array,M,K):
The names of the inputs have been chosen to reflect their roles.The function is expected to return one number as the design objective.We will use an example to explain how you compute the design objective.
(Example) Note that both dis_array and vel_array are expected to be 1-dimensional numpy arrays of the same shape.For this example,we assume:
·The entries of dis_array are [d0,d1,d2]
·The entries of vel_array are [vO,v1,v2] We compute the following three numbers
square root of ((do²+(M/K)vo² ) , square root of (d1²+(M/K)v12 ) , square root
of ( d2²+(M/K)v2² )
where do²denotes the square of d0 etc.The design objective is the maximum of these
three numbers.In general,if there are H entries in each of dis_array and vel_array,you will
be computing H numbers and finding the maximum of them. As a numerical example,if
·dis_array is np.array([-1.1,2.1,3.1]) ·vel_array is np.array([-4.1,-2.1,1.3])
·K=1.1
·M=4.2
then you first compute
square rootof(-1.1)²+(M/K)(-4.1)² ) , square root of ((2.1)²+(M/K)(-2.1)²) square root of((3.1)²+(M/K)(1.3)² )
Their numerical values are approximately 8.09,4.61 and 4.01.The maximum is 8.09 which is the design objective.Your comp_objO will need to return this number.
You can test this function by using test_comp_obj.py.
Note that it is possible to do all of the computation of this function with merely one line of code in numpy.The lectures in Week 8 will give you some inspiration.