JEIS2004: Systems Design and Computing
A2: Computing Assignment
Module Weighting 40%
Individual Assignment
Submission through blackboard consisting of a single a jupyter notebook (ipynb) report and python (py) file with your functions.
Introduction
You have been provided with an example set of data from an experiment to determine the roll response of a scale model of container ship. In this experiment the ship model is force rolled using a counter rotating weights system, which are rotated by a computer-controlled motor. The roll response of the model is recorded against time for a range of frequencies between 0.1Hz and 1.1Hz. An example of a single time trace is shown in figure 1. You are also provided with basic information on the ship model in Table 1.
Figure 1: Forced roll response of ship model at 0.3 Hz encounter frequency
Table 1: Ship Model Properties
L | 7.356 m |
B | 1.019 m |
T | 0.342 m |
CB | 0.642 |
Ñ | 1.646 m3 |
I4 | 273 kgm2 |
A44 | 82 kgm2 |
B44 | 64 kgm2/s |
C44 | 4070 m2/s2 |
Assignment
1) Download the example data in the file RollExpData.xlsx from blackboard. Use the pandas read_excel function to import the data into a data frame, setting the time column as the index and using the column headings in row 1.
[1 mark]
2) Each data set has a few unwanted signal artefacts such as noise, drift, etc which appear across all the frequency tests in the dataset. Load any one of the frequency tests and develop a signal processing routine to remove any unwanted signal artefacts, whilst retaining the roll response.
Determine the amplitude and frequency of any noise in the signal. Then apply your signal processing routine to all the frequency tests in your data set.
[9 marks]
3) Write a function to calculate the root mean squared (RMS) of a signal as defined by the equation below:
Use this function to calculate the RMS of each frequency test in your data set.
Write a function to determine the frequency of the roll response from the peak in the FFT of each signal. Plot a graph of RMS roll amplitude against frequency in Hz.
[4 marks]
4) Calculate the theoretical damped natural frequency of the system, , and plot this as a vertical line on the graph of RMS roll amplitude against frequency. Note the equation below returns the damped natural frequency in rad/s, so you will need to convert this to Hz using the relationship between circular frequency and frequency (
[2 marks]
5) Create a state space representation of the equations of motion of the ship model in roll, in matrix form. The equation of motion for the ship model in roll,
Where the terms are defined in table 1 and are the first and second time derivatives of the roll displacement. The external force provided by the counter rotating weights is given by .
With the force, set to zero, set the initial condition to
6) Using the find_peaks function from scipy.signal, determine the maxima in the response curve.
Calculate the difference between successive maxima,
Use linear regression to determine a linear trendline through the data points. The data should pass through the origin. From this graph, determine the damping ratio
[8 marks]
7) Using the state space model you developed of the forced roll system. Simulate the roll response of the ship model over a range of frequencies which include the damped natural frequency of the system. You should use the roll force function , where
[4 marks]
8) Modify your model by changing the damping coefficient to 50%, 75%, 100%, 125% and 150%. For each case evaluate the response of the system and plot the RMS roll response against frequency.
a. Produce a wire frame plot of the resulting surface, RMS response against damping coefficient and frequency in Hz.
b. Produce a contour plot of the resulting surface, RMS response against damping coefficient and frequency in Hz.
[4 marks]
9) Write a short lab report (less than 1000 words) in Jupyter which describes your analysis and presents the main results. Your report should contain the following sections:
· Introduction
· Method
· Results
· Analysis and Discussion
· Conclusions
Your jupyter notebook should call your py file in which you have defined any functions. Your code should run just by loading and running your jupyter file. You should plot any graphs in jupyter rather than in your python file.
Your code will be tested using a different set of experimental data than the one you have been proved with, so ensure that it uses dynamically calculated variables and not hard coded variables. Your python file should only contain function definitions, everything else should be in the jupyter notebook. Marks will be awarded for including examples of the following:
· Headings
· Text emphasis
· Equations
· Tables
· Figures/plotting
· Calling/importing your own functions
[8 marks]
Important Notes
You need to submit two files to blackboard, a jupyter notebook (*.ipynb) file and a python (*.py) file. Name these files with your name eg LastnameFirstname.ipynb and LastnameFirstname.py
Please comment each line of your code in the python py file, and where possible provide default values for any functions you define. Only define a function if it does not already exist in the standard libraries, so for example don’t create a new mean function since one already exist in NumPy. Do not create multiple functions that do the same thing, such as calculate the RMS or different versions of the roll state space model.
Where possible you should use NumPy arrays or pandas dataframes. Try to avoid using for or while loops where array operations could be used.
Ensure that all figures have labelled axes, a suitable legend and figure captions or titles. Figures should be produced in monochrome using line types and markers to distinguish each series.
The work must be your own, but you can use the work you have done in previous computing labs. If there is any doubt as to whether the work is your own you will be asked to explain your code, so you should comment your code as you work.
Finally, before you submit your work it is worth resetting the workspace and re-running your files to ensure that it works as you intended.