ENGG1801 Project: Instructions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

ENGG1801 PROJECT 1

ENGG1801 Project
Instructions
Submission deadline: 8pm Tuesday 3rd June 2014 (week 13).
This assignment must be completed and submitted in pairs. Both students will receive the same
mark. Pairs can include students from any tutorial and lecture. Submissions from only 1 student will
attract a 2 mark penalty. If you need a partner, then attend the lectures to find a partner, or email
engg1801help@it.usyd.edu.au
Data files: There are files to download from the course website to help you start the project.
Submission instructions: These will be posted soon on the course website.

Project Options
There are 3 options to choose from for this assignment. Each option involves a similar amount of
programming at broadly the same level of difficulty. You can choose any 1 of the 3 options
regardless of which degree program you are in.

Solving the parts


The assignment has two components a structured series of three parts that build on each other and
then an open-ended extension. Each part should be solved in a separate m-file that is included in the
zip file for each option.
You may (and should) have many m-files for each part, since you may (and should) write many
functions. But the files downloaded from the course website is where the program from each part
should begin, which can then call other functions in other files, etc.
Since the later parts rely on completing the earlier parts, you need to solve them in order. We
recommend solving each part (e.g. strad1.m) and then copy the code into the next part file (e.g.
strad2.m) and extending on it to solve that part. This will help avoid problems of breaking code
for earlier parts whilst trying to solve later parts.

Plagiarism

Do not give or receive any m-files, to or from any other person, at any time during or even
after the semester. Doing so, for any reason, is plagiarism, even if the file is modified. The
only exception is to give and receive project files to and from your project partner before the
project submission deadline.
Do not use any files from previous sessions (semesters, or summer school), even if they
were created by you. Doing so is plagiarism (see the policy below).

The University of Sydneys Plagiarism Policy is available here:


http://sydney.edu.au/policies/showdoc.aspx?recnum=PDOC2012/254&RendNum=0
Students who are caught breaking this plagiarism policy will be very severely dealt with.

Marking Scheme
The project is worth 40 marks, or 20% of your entire assessment. Both students in each pairing will
score the same marks.

Part 1
Part 2
Part 3
Part 4
Comments & coding style

astro
6 marks (15%)
12 marks (30%)
4 marks (10%)

strad
4 marks (10%)
10 marks (25%)
8 marks (20%)
8 marks (20%)
10 marks (25%)

gasleak
4 marks (10%)
14 marks (35%)
4 marks (10%)

We will discuss how to score the best marks in more detail in lecture 10-2.

Parts 1 3
For parts 1-3, we are mainly interested in:

Does your code have good comments and good coding style? See below.
Is the general behaviour of your program sensible?

If it is not entirely clear from the project description what to do specifically (e.g. what color to use
to represent something), then the specific details are not important, as long as it is sensible.

Part 4
For part 4, we mark it in the same way as parts 1-3, but we also look at:

How interesting / creative is your extension?


How is it implemented?
o Doing something interesting, challenging, and useful, but with simple and elegant
code is much better than lots of very complicated code that is difficult to understand
How well does it work?

Full marks in Part 4 will be awarded to submissions of that option (out of the 3 options) that are
considered to be the best, or very comparable to the best, based on all the submissions that we
receive from all student pairings that choose that option.

Penalties
Marks may be deducted for failing to follow instructions (including submission instructions), not
filling in your details at the top of each m-file, etc.

ENGG1801 PROJECT 3

Comments & coding style


In previous years, this is the area that has seen the widest range of marks. It is by far the area that
has seen the least number of full-marks awarded, even compared with part 4. It is worth 25% of the
entire project, and is one of the easiest ways to score marks. So you should concentrate heavily on
this area.
Full marks in this area will only be awarded for submissions that are so well written (specific
details below), that they could be used as sample solutions (like the lab exercises sample solutions).
You are very strongly recommended to write code with comments and good coding style from the
very beginning. It will save you the most time, and score the best marks.
It is extremely difficult and costly in time to change a working but badly written program into a
nicely written program that still works.
But it is easy to change a program that is well written, but has a few errors, into a program that is
still well written, but does work.
We have been discussing this throughout the semester. Briefly, you should have:

Descriptive and clear comments on most lines of code, explaining in plain English. There
should be no complex line of code that is left unexplained.
Good use of consistent and clear indentation, line spacing (blank lines) and meaningful
variable / function names to make the code easy to understand.
Simple code that is quick and easy to understand, and easy to detect any errors or bugs if
there are any. The marker should be able to look at the code and quickly be certain that your
code is correct.
Code that is flexible, can be easily modified for a slightly different change in the project
question, and can work in general for many situations, not just specific situations.
Many functions (and therefore, many .m files) to break up the large program into easy-tounderstand portions. Functions should generally be short and only a few lines, as
demonstrated in lectures. The use of parameters makes your functions more flexible so that
they can work in general, and not just specific situations.

Follow the lab exercise sample solutions and also sample code that comes with the lecture
notes for excellent examples of coding style.

Qualifying to receive project marks


Students are expected to contribute roughly equally to their project, and to follow the Universitys
plagiarism policy. Either or both students in a pair may be asked at any time, without prior warning,
to explain any part of their code, or perform a modification to their code. If the student(s) are unable
to do this to a satisfactory level under open-book exam conditions, given a fairly generous amount
of time, then that student(s) may score 0 marks for the entire project.

Option 1. Transient Source Detection in Astronomical Images


Next generation radio telescopes such as the Square Kilometre Array will be able to rapidly
scan the entire sky every night. We can use these instruments to search for transient sources:
astronomical objects that appear or disappear on short timescales, such as supernovae
explosions in which massive stars collapse into black holes.
The telescopes produce images of the sky every few seconds. Traditionally astronomers have
searched for new objects manually. This is a time consuming process that will not be practical
with the volumes of data new telescopes will produce.
The challenge in this question is to write a program to automatically detect transient sources.

The above figure shows a series of images from a radio telescope. They are looking at the same
patch of sky over a period of hours. The greyscale shows bright objects (e.g. galaxies and stars) in
white, with the background noise in grey. We are interested in detecting images where a new
object has appeared since the previous observation. The third image shows an example of one such
object (a transient source) circled. One simple way of doing this is to count the number of bright
pixels above a chosen threshold.

1. Reading the astronomy data and configuration values (astro1.m)


Each file you have been given (astro001.png,astro002.png, and so on) is a regular PNG
image file containing a 125 x 125 matrix of values covering the same region of sky. These can be
read using the MATLAB imread function. Each value (ranging between 0-255) represents the
brightness at the corresponding point on the sky (just like a photo).
Your program should ask the user for the threshold to use to estimate as a good signal (around 60 is
a good value). If the user enters a value outside of the range 0-255 then your program should
continue to ask for a valid value.
Your program should read and process all of the 10 image files you are supplied. It should report
the number of pixels that are above the threshold in each image, like this for a 60 threshold:
image 1 has 357 pixels above the threshold
image 2 has 363 pixels above the threshold

Save your solution in astro1.m

ENGG1801 PROJECT 5

2. Smoothing the data (astro2.m)


Like any measurement process, the telescope images contains noise, which makes automated
analysis difficult. For instance, the images contain smaller patches of brightness that are not part of
a galaxy or star. A simple way of reducing the noise is to replace each value with the average of the
point and the 8 neighbours surrounding the point, thereby smoothing out the data.
Your program should calculate new matrices where each point consists of the average of the
surrounding 8 points and itself.
x11 x12 x13
x21 x22 x23
x31 x32 x33
The new value of x22 is the average of x11x33. For simplicity, you do not need to calculate the
average for the pixels on the edge. For each of these smoothed scans, report the percentage of pixels
above the threshold as above.
Your program should also calculate the number of pixels above the threshold (called flux) for each
image, and report each image as a detection if the flux is greater than the flux in image 1 by more
than 2%, or a non-detection otherwise:
image 7 is a detection, flux/flux1 = 102%
image 8 is a non-detection, flux/flux1 = 95%

Save your solution in astro2.m

3. Visualizing the observations (astro3.m)


You should visualize the smoothed versus original images of the sky as a colour map using the
MATLAB imagesc function. Then use the getframe and movie2avi functions to create a
movie of the 10 smoothed images in sequence to see how the transient source appears and
disappears throughout the observations.
Save your solution in astro3.m

4. Extension: Smarter source measurement (astro4.m)


Implement your own strategy that improves on how the transient source/s are detected. Rather than
just look at the total number of bright pixels, you could try to detect separate groups of contiguous
pixels. You could also keep track of the source (pixel) position so you could deal with multiple
sources in the same image. You could automatically calculate a good detection threshold by using
the mean and standard deviation of all of the image pixels.
At the top of astro4.m, you must have a very long, detailed comment (many paragraphs long) to
describe exactly what your part 4 does.
Save your solution in astro4.m

Option 2. Autonomous Systems for Container Handling


To improve container handling at seaports, the Australian Centre for Field Robotics at the
University of Sydney designed an automated straddle carrier (or strad) in 1999. The carrier is a
large, 65 tonne machine operating up to 30km/h and was one of the first fully free-ranging field
robotic vehicles in the world. The role of the strad is to find the optimal path for a container to
travel across the wharf to be stored. To accomplish this, sophisticated software is needed.
The challenge in this project is to implement software to guide this giant (and dangerous!) robot.

Consider the wharf as a grid of N x N locations. The container to be moved is in location Start. The
strad is also at location Start and needs to go to location Goal to store the container. It can move
horizontally or vertically one step at a time (it cannot move diagonally). Some locations are
forbidden as they already contain stored containers. An example is shown in the figure below,
where the wharf is an 8x8 grid. The forbidden locations are shown in gray and the container to be
moved is shown in black. The Start location is 60 and the Goal location is 19. Your task is to write
a MATLAB program to find the path from Start to Goal using different strategies.
1

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

Goal

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

Start

1. Reading the configuration of the wharf (strad1.m)


Your program should read the file wharf.csv, which contains 30x30 values representing the
configuration of the wharf. The free locations are represented with 0 and the forbidden with 1.
Your program should ask the user to enter the Start and Goal locations, e.g. using x and y
coordinates. If the locations are out of range or forbidden, the user should be prompted to re-enter
them until valid values are entered.
Save your solution in strad1.m

ENGG1801 PROJECT 7

2. Initial Strategies (strad2.m)


You need to implement possibly the simplest random strategy for finding a path from Start to Goal
to move the container: The strad moves from one tile to another neighbouring tile randomly.
It can revisit the same location, but cannot move to a forbidden location.
The program should ask the user to set a limit for the maximum number of steps the strad is
allowed (e.g. 1000 steps), so that you do not allow your strad to wander indefinitely. Your program
should display each step the strad takes formatted as columns of x and y coordinates. There are two
possible outcomes:
If the maximum number of steps is reached, it should display
Maximum steps reached
If the strad successfully relocated the container in (say) 30 steps, it should display:
Valid path found in 30 steps
Save your solution in strad2.m

3. Visualizing the strad (strad3.m)


Your program should ask the user to select a strategy: 1 for random strategy 1 or S for your smarter
strategy (if you completed the extension in Part 4 below or maybe you have multiple advanced
strategies!) and the maximum number of moves to make. It should then count the number of times
the strad visits a particular square as it tries to reach the goal.
You should visualize the wharf and the movement of the strad as a colour map using the MATLAB
imagesc function using the visits matrix. Finally, use the getframe and movie2avi functions
to create a movie of the visits matrix after each step so we can see the behaviour dynamically.
Save your solution in strad3.m

4. Extension: Smarter Strategies (strad4.m)


Implement your own strategy that improves on the random strategy in Part 2. The simplest addition
is to not allow your strad to visit the same location twice. If it gets stuck and runs out of locations
to visit without revisiting squares, it should print a message like:
No more options available after 23 steps
Your task is to find the shortest path between Start and Goal to move the container. As an example,
you could assume the strad has sensors that can evaluate how close the neighbouring locations are
to the Goal or that it remembers how often it has visited a square.
Of course, you are free to develop any strategy you like. The extension will be marked on the
sophistication (and success!) of your solution.
At the top of strad4.m, you must have a very long, detailed comment (many paragraphs long) to
describe exactly what your part 4 does.
Save your solution in strad4.m

Option 3. Gas leak in an industrial plant


You will be given a file describing the shape of a room in an industrial plant such as in the image
below left. The room has a number of pipes running into it, one of which has a leak. The gas will
escape from the pipe into the room over a period of time. The goal is to visualise the concentration
of gas over time at all points in a room of any shape.

1. Reading the room configuration (gas1.m)


You have been supplied two files (plan1.csv and plan2.csv) showing a blueprint plan of two
different rooms (e.g. the image above right). The plan files hold 50 x 50 matrices of zeros and ones.
A zero (0) in a particular element indicates empty space at those (x, y) coordinates and a one (1)
indicates the walls or other objects that gas can not pass through. You need to read the plan file into
a MATLAB matrix which you will use to represent the room.
Your program should ask the user for 3 pieces of information: the point (x, y) at which the gas leak
is entering the room (shown as in the image above), the point in the room at which you want to
measure the concentration (shown as in the image above) and the initial concentration (in Mols)
of the gas leaking from the pipe. Your program should check that both the points fall within the
room and ask the user for new points if they dont.
Save your solution in gas1.m

2. Modelling gas flow (gas2.m)


In this problem we're going to model gas flow as a simple averaging process, ignoring any chemical
interactions with air, and also ignoring more complex fluid dynamics. We start with a matrix
representing the gas concentration at each position in the room. Before the leak, each point in the
room will have a concentration of zero. For each time step, we assume the concentration at the
current pixel is spread evenly to its (up to) eight neighbouring pixels.
x11 x12 x13
x21 x22 x23
x31 x32 x33
The new value of x22 is the average of x11x33 (including x22 itself). Where things get a little tricky
is dealing with the edge of the shape. Consider the case where x22 is a pixel at the edge of the room:
x11 x12 x13
x21 x22 x23
x31 x32 x33
Here the pixels x11, x12 and x13 are now part of the wall (and so gas cant move into them). In this
case the concentration should be averaged over the 6 values (x21x33) that are within the room.

ENGG1801 PROJECT 9

You will need three separate matrices: one for the zeros and ones representing the room itself; one
for the current concentration of gas at each pixel in the room; and one for storing the newly
calculated concentration values. Your program will need to run for a fairly large number of
iterations (e.g. 10,000) to see a significant difference in the concentrations.
You need to assume that the point where the gas is leaking remains at a constant concentration
(supplied by the user when the program begins), and all of the surrounding pixels get affected by
that concentration (and their neighbours in turn and so on)
You should choose some other point within the room to print out the gas concentration so that you
know it is changing with each new time step (iteration).
Save your solution in gas2.m

3. Visualizing the gas flow throughout the room (gas3.m)


You should visualize the room itself and the gas concentration at each pixel as a colour map using
the MATLAB imagesc function. Then use the getframe and movie2avi functions to create a
movie of the concentration change over a period of time. Since the concentration may change quite
slowly, it is worth only creating a new movie frame every 25-50 iterations or so.
Save your solution in gas2.m

4. Extension: More complex modelling (gas4.m)


There are a number of extensions that you could choose to implement for this model. For example,
you may want to have the program show what would happen if somebody detected the leak and
opened a door on one side of the room. Also, you could have suction pipes that suck the gas out of
a room, or perhaps manual pumps. Finally, you could also simulate how a fire could spread, or if an
explosion would occur.
At the top of gas4.m, you must have a very long, detailed comment (many paragraphs long) to
describe exactly what your part 4 does.
Save your solution in gas4.m

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy