Starting from:
$35

$29

Surveying a Wreck Site Using Trilateration Solution

Overall Assignment




For this assignment you are to write a program that reads in trilateration measurements from an input file specified by the user, and writes an output file containing the X, Y coordinates of each of the measured points. As a check, the minimum and maximum X and Y values calculated are to be reported to the screen, and the sample data results plotted in Matlab.




Background: Trilateration




There are many situations in science and engineering where it is necessary to determine the locations of points in a 2-D plane, such as the archaeological survey of an underwater shipwreck site. One approach to this is trilateration, which involves measuring the distances from the unknown point to two known reference points. Assuming the distance between the two known points is also known, this forms a unique triangle, which can be used to calculate the position of the unknown point from the known positions of the two reference points:





























































For this assignment we are going to consider the situation where a pair of divers first establishes a baseline for their survey measurements, and then makes a series of trilateration measurements around the outline of a sunken artifact or shipwreck site. Those data measurements are then stored in a data file similar to the following, in which the first line is the length of the base reference, and each following line contains a pair of measurements corresponding to a trilateration of a survey point:




Sample Input File


Sample Output File
29.6










8.2
25.0
5.37838
6.18975
9.2
23.5
6.90118
6.08389
10.5
22.2
8.33733
6.3827
11.9
20.9
9.81351
6.7309
Background: Major Relationships Used for Solving Trilateration




Consider the triangle shown below with sides labeled Base, S1, and S2, and angle Θ:














































Applying the cosine law to this triangle and some additional trigonometry yields the following equations for determining the X, Y coordinates of the peak of the triangle:




= − (


+−














)
(1)




















=
( )






(2)
=
( )






(3)



Program Details




For this assignment you are to write a computer program that reads in a base length followed by a series of trilateration measurement pairs from an input data file, and writes X, Y coordinates for each pair into a separate output data file. As a check, the minimum and maximum X and Y values found are reported to the screen, and the sample data file results plotted in Matlab.




Your program should first print out your name and ACCC account name ( e.g. astudent ), and explain to the user what the program does.




Your program should then ask the user for the names of input and output data files, and verify that they can be opened properly. ( Each file should be checked individually. If a file cannot be opened, ask the user for a different file name. )




Next your program reads in the base length from the file. There is only one base length for the entire file.




Next your program enters a loop to read the rest of the file, up until the end of the file is reached. For each line of the file your program should:




Read in the trilateraion measurements, S1 and S2.



Calculate the X and Y coordinates using the formulas given above. ( The coordinate system is chosen so that the “left” end of the base line is the origin, and the other end of the base line extends along the positive X axis. )



The X and Y values should be written to the output file, with one entry ( e.g. one X, Y pair ) per line, separated by spaces.



Update the current estimate of the minimum and maximum values of X and Y.



After the end of the file is reached, your program needs to close the input and output files, and report the minimum and maximum values of X and Y found.




As a check, plot the X-Y data as a line plot using Matlab. ( Use “axis equal” for scaling. )

Special Notes:




You should work out some sample problems by hand before writing any computer code. The sample results shown above are believed to be accurate, but you should verify this by working the problem out by hand.




Now that you know how to test input, your program should only accept valid input, ( e.g. positive angles and lengths. ) It is up to you to consider what is “valid”.




What to Hand In:




Your code, including a user documentation file, should be handed in electronically using Blackboard. For this assignment include a plot of sample results generated in Matlab.



Note that you must use “axis equal” to get uniform axis scaling for these figures.




The intended audience for the documentation file is a general end user, who might want to use this program to perform some work. They do not get to see the inner workings of the code, and have not read the homework assignment. You can assume, however, that they are familiar with the problem domain ( e.g. trilateration, the SSS problem. )



A secondary purpose of the documentation file is to make it as easy as possible for the grader to understand your program. If there is anything special the grader should know about your program, be sure to document it in the documentation file. In particular, if you do any of the optional enhancements, then you need to document what they are and anything special the TA needs to do to run your program and understand the results.



If there are problems that you know your program cannot handle, it is best to document them as well, rather than have the TA wonder what is wrong with your program.



Make sure that your name appears at the beginning of each of your files. Your program should also print this information when it runs.



Optional Enhancements:




It is course policy that students may go above and beyond what is called for in the base assignment if they wish. These optional enhancements will not raise any student’s score above 100 for any given assignment, but they may make up for points lost due to other reasons.




As written, all measurements need to be positive, and the survey points are all assumed to be “above” the baseline. Alternatively you could write the program to accept negative measurements, indicating points located “below” the baseline. ( Obviously the actual measurements are all positive, with the sign indicating on which side of the baseline the survey point is located. )




Allow the program to read in data in feet and inches, as opposed to decimal feet. In this case, 5’6 would indicate 5 feet six inches, and 5.5 would indicate five and a half feet. This would require reading in the entire line into a string variable or character array using getline( ), searching the string for either decimal points or single quotes, and then parsing the numbers depending on what was found.




Other enhancements that you think of – Check with TA for acceptability.




References:




Amanda Bowens, "Underwater Archaeology, the NAS Guide to Principles and Practice", Second Edition, The Nautical Archaeology Society, 2009.



http://www.teacherschoice.com.au/Maths_Library/Trigonometry/solve_trig_SSS.htm , viewed 31 August 2011.



Buccaneer Dive Slate, produced by the Underwater Archaeological Society of Chicago, 2010.

More products