Introduction

In the first part of this lab you went through the building blocks that will allow you to set up the models in a basic network in a 2D planar coordinate system:

While these are basic, even these simple linearized models can come together to make for a pretty powerful tool that can help you understand the design and analysis of networks.

And that’s what we’re setting the stage for with this lab. You’re going to begin putting all these pieces together.

Situation

Imagine that you want to know the coordinates of two new previously un-surveyed points, 4 and 5, in a network where the coordinates of three points, 1, 2, and 3 are already known.

Further imagine that you plan to measure the distances, d, and angles, \theta, shown in the figure below.

And imagine that you are given the following:

The coordinates of the known points:

  • E_1 = 50.2115 \text{ m} \text{ and } N_1 = 246.0513 \text{ m}
  • E_2 = 79.9919 \text{ m} \text{ and } N_2 = 113.4213 \text{ m}
  • E_3 = 263.8717 \text{ m} \text{ and } N_3 = 40.8892 \text{ m}

The measurements:

  • of the distance between points 1 and 5: 164.19294 \text{ m}, 164.19133\text{ m} (measured twice)
  • of the distance between points 4 and 5: 163.10721 \text{ m}
  • of the distance between points 3 and 4: 98.12490 \text{ m}
  • of the distance between points 2 and 4: 188.77869 \text{ m}, 188.78384\text{ m} (measured twice)
  • of the distance between points 2 and 5219.01293 \text{ m}
  • of the angle measured at point 1 between points 5 and 2: 93^o15^{'}5.4859^{"}93^o15^{'}7.2564^{"} (measured twice)
  • of the angle measured at point 2 between points 1 and 5: 48^o27^{'}28.8264^{"}48^o27^{'}28.3719^{"} (measured twice)
  • of the angle measured at point 2 between points 4 and 3: 29^o18^{'}15.4444^{"}

The approximate coordinates of the unknown points:

  • E_4^0 = 267.0 \text{ m} \text{ and } N_4^0 = 139.0 \text{ m}
  • E_5^0 = 208.0 \text{ m} \text{ and } N_5^0 = 291.0 \text{ m}

Step 1: Pre-analysis

In your report for Part 2 of this lab I want you to include a pre-analysis. The pre-analysis should contain the following:

a) A summary of the situation including the sketch

b) A quick accounting for what are the values u, n, and r for the whole thing

c) An explicit statement of what are the vectors \mathbf{x}, \mathbf{x}_0, \boldsymbol{\delta}, and \mathbf{l}_{measured} in terms of the variables they represent, and what sizes they are (even though their sizes should be clear by looking at what’s in the matrices)

d) The corresponding nonlinear functional model, \mathbf{F}(\mathbf{x},\mathbf{l}_{true}) = \mathbf{0} as a vector function, which means a set of r equations like this:

    \begin{equation*} \begin{bmatrix} f_1(\mathbf{x},\mathbf{l}_{true}) = 0 \\ f_2(\mathbf{x},\mathbf{l}_{true}) = 0 \\ \vdots \\ f_r(\mathbf{x},\mathbf{l}_{true}) = 0 \end{bmatrix} \end{equation*}

e) An expression for the design matrix, \mathbf{A}, in terms of the partial derivatives needed to derive it for the case in the sketch. Include an indication of what size it is (although, again, this should be clear from looking at it).

f) An expression for the full \mathbf{A} matrix. The linearized models you developed in Part 1 of this lab should make pretty short work of this. That’s why you did all that work, so don’t hesitate to use it here.

g) An expression for the misclosure vector, \mathbf{w}, including an indication of its size too.

h) Anything else you think is relevant to developing the full linearized model in the form: \mathbf{A}\boldsymbol{\delta} - \mathbf{e} + \mathbf{w} =\mathbf{0}

Notes:

  • For the \mathbf{A} and \mathbf{w} matrices, you don’t need to calculate the values of each element in the matrices in this pre-analysis. Rather, you’re just clearly articulating the calculations that need to be made – so you can make them in the steps that follow. Think of the above as algorithm guidelines or requirements.
  • As you’ll see below, I’d like a single report for Part 2 of this lab. It can be hand written or done digitally, but should be scanned to a PDF and saved to the folder you created for Lab 2. This pre-analysis should be the first section of that report.

Step 2: Set up a project for a new console-based application

Like you did in Parts 1 and 3 of Lab 1, I want you to create a Windows-based console application in C++ using Microsoft Visual Studio, and using the Eigen matrix.

When doing this, be sure to:

  • give your application an appropriate name, e.g. YourName-Lab2Part2
  • include and use the Eigen template library in your project – I want you to use / get used to this now because it’s going to be so important to us in later labs
  • properly document and organize your code
  • create an executable that can be run on any Windows computer (although this time I’m not going to ask you to submit this – only to have it on hand in case we ask for it)

Step 3: Write a library for setting up the linearized models from Part 1

As a first step in writing your own C++ geomatics networks library, I’d like you to create the functions required to implement the linearized model building blocks from Part 1 of this lab that are needed for the situation provided here.

Think of this as creating an include file that will allow you to efficiently fill the \mathbf{A} matrix and \mathbf{w} vector for a given set of desired parameters, approximate values, and measurements.

Keep in mind as you’re doing this that:

  • The next step (below) is to implement some code that calls these functions so you can calculate the required elements of the combined \mathbf{A}\boldsymbol{\delta} - \mathbf{e} + \mathbf{w} = 0 model for the situation given above.
  • You won’t be solving for the unknown coordinates at all in this lab; only computing \mathbf{A} and \mathbf{w}. We’ll be dealing with errors and adjustments soon enough. My goal for this lab is for you to demonstrate a strong enough understanding of the functional modeling and linearization that I know you can set up basic networks in future labs too.
  • Your program needs to be able to read the information contained under the heading “Situation” above from a file (of your own design based on the provided information).
  • In future labs you won’t always be given exactly the same configuration of measurements and known coordinates, so the less you hard code things, the easier life might be for you in the future:
    • There are various levels of automation and logic you could implement here, e.g. the format of your input file could use a logic and tags that specify things like: whether a line of the input file contains a measurement, a known coordinate, or an approximate coordinate; whether a measurement is of one type or another; whether a measured distance is between two unknown points or from one known point to an unknown point, etc … But this isn’t required – good code and an efficient input file format can achieve the same output that works perfectly well for this lab.

Step 4: Calculate and output the A matrix and w vector

Next, you need to add code so that your application will:

  • read the provided input from your own input file
  • call the functions required to calculate and populate the values in the \mathbf{A} matrix and \mathbf{w} vector
  • output those to a new file containing:
    • the \boldsymbol{\delta} vector or equivalent, just so readers of the output know the order of the unknowns you were working with and the units of each
    • the computed \mathbf{A} matrix
    • the computed \mathbf{w} vector, including some way of indicating to the reader the units of each row

Step 5: Reflect on coding this kind of thing

In Part 1 of of this lab I asked you to develop some coding guidance for yourself. Go back and read it. Now I want you to tell me what guidance you’d give yourself in hindsight. Articulate this under the heading “Guidance I’d give my past self now on coding this”. As you will see from the assessment rubric, what I’m interested in here is that you can articulate:

  • what’s required for coding the linearized models for a situation like the one provided to you
  • what you learned by doing it that you didn’t know before, or what you confirmed about what you had predicted
  • what you would do differently next time or if you had more time

Step 6: Submit your code, and input and output files

When you’ve completely finished your application you need to submit it.

To do this, submit following according to the directions provided:

  1. Your lab report, including:
    • an introduction and preamble as required by the template
    • your “Pre-analysis” section
    • a section referring the reader to the code found in the appendices (see below)
    • a section referring to the reader to the input and output files in the appendices (see below)
    • a conclusion including your “Guidance I’d give my past self now on coding this”
    • an appendix containing the input file you created
    • a second appendix containing the output file created by your application
  2. Listing of your code in the appendices