Solved

Can someone check to see that I have obtained the correct figures as follows;

Posted on 2009-03-30
11
339 Views
Last Modified: 2012-05-06
http://www.experts-exchange.com/Other/Math_Science/Q_24256263.html

Following on from the above, can someone check to ensure that I have correct figures and that I am doing this right because the figures are coming up incorrect when I run them through a java multilateration program that I got of the paper below (pdf attached). (I converted to java to work with my software)

The figures I get are

x=0

ti=19.0

tk=24.0

tj=24.0

tl=28.0

x=0
y=-49
z=0
 
package DataCalculations;
 
import java.lang.Math;
 
public class Multilateration {
 
     public double calcCord(int rNum, char cord) {
          
 
            OrgData og = new OrgData();
 
            double ti = og.getValue(rNum), tk = og.getValue(rNum + 1), tj = og
                        .getValue(rNum + 2), tl = og.getValue(rNum + 3);           // invoke toa figures from database
            
            System.out.println("\nti="+ti);
            System.out.println("\ntk="+tk);
            System.out.println("\ntj="+tj);
            System.out.println("\ntl="+tl);
            double xi = 1, xk = 0, xj = 10, xl =0;
            double yi = 1, yk = 1, yj = 0, yl = 0;
            double zi = 0, zk = 0, zj = 0, zl = 0;
 
            double xji = xj - xi;
            double xki = xk - xi;
            double xjk = xj - xk;
            double xlk = xl - xk;
            double xik = xi = xk;
            double yji = yj - yi;
            double yki = yk - yi;
            double yjk = yj - yk;
            double ylk = yl - yk;
            double yik = yi - yk;
            double zji = zj - zi;
            double zki = zk - zi;
            double zik = zi - zk;
            double zjk = zj - zk;
            double zlk = zl - zk;
 
            double rij = Math.abs((10*(ti - tj))/33);
            double rik = Math.abs((10*(ti - tk))/33);
            double rkj = Math.abs((10*(tk - tj))/33);
            double rkl = Math.abs((10*(tk - tl))/33);
 
            double s9 = rik * xji - rij * xki;
            double s10 = rij * yki - rik * yji;
            double s11 = rik * zji - rij * zki;
            double s12 = (rik
                        * (rij * rij + xi * xi - xj * xj + yi * yi - yj * yj + zi * zi - zj
                                    * zj) - rij
                        * (rik * rik + xi * xi - xk * xk + yi * yi - yk * yk + zi * zi - zk
                                    * zk)) / 2;
 
            double s13 = rkl * xjk - rkj * xlk;
            double s14 = rkj * ylk - rkl * yjk;
            double s15 = rkl * zjk - rkj * zlk;
            double s16 = (rkl
                        * (rkj * rkj + xk * xk - xj * xj + yk * yk + zk * zk - zj * zj) - rkj
                        * (rkl * rkl + xk * xk - xl * xl + yk * yk - yl * yl + zk * zk - zl
                                    * zl)) / 2;
 
            double a = s9 / s10;
            double b = s11 / s10;
            double c = s12 / s10;
            double d = s13 / s14;
            double e = s15 / s14;
            double f = s16 / s14;
            double g = (e - b) / (a - d);
            double h = (f - c) / (a - d);
            double i = (a * g) + b;
            double j = (a * h) + c;
            double k = rik * rik + xi * xi - xk * xk + yi * yi - yk * yk + zi - zk
                        * zk + 2 * j * yki;
            double l = 2 * (g * xki + i * yki + zki);
            double m = 4 * rik * rik * (g * g + i * i + l) - l * l;
            double n = 8 * rik * rik * (g * (xi - h) + i * (yi - j) + zi) + 2 * l
                        * k;
            double o = 4 * rik * rik
                        * ((xi - h) * (xi - h) + (yi - j) * (yi - j) + zi * zi) - k * k;
            double s28 = n / (2 * m);
            double s29 = (o / m);
            double s30 = (s28 * s28) - s29;
            double root = Math.sqrt(s30);
            
            if (cord == 'x'){
               int x;
                x = this.getX(g, zl, h);
                System.out.println("\nx="+x);
                return x;
            } 
            
              if (cord == 'y'){
                int y;
                y = this.getY(a, this.getX(g, zl, h), b, this.getZ(s28,root), c);
                System.out.println("\ny="+y);
                return y;
            }
            
            if (cord == 'z'){
                int z;
                z = this.getZ(s28,root);
                System.out.println("\nz="+z);
                return z;
            } 
            
            return -1;
 
      }      
 
      int getZ(double s28, double root) {
            int z1 = (int) (s28 + root);
            return z1;
      }
 
      // int z2=(int)(s28-root); // 
 
      int getX(double g, double z1, double h) {
            int x1 = (int) (g * z1 + h);
            return x1;
      }
 
      // int x2=(int)(g*z2+h); // 
      
      int getY(double a, double x1, double b, double z1, double c) {
            int y1 = (int) (a * x1 + b * z1 + c);
            return y1;
      }
      // int y2=(int)(a*x2+b*z2+c); 
      
     
 
}

Open in new window

A-Synthesizable-VHDL-Model-of-th.pdf
0
Comment
Question by:jtiernan2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 1

Author Comment

by:jtiernan2008
ID: 24019482
pic 2 attached below;
pic.png
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 24019944
The distances and time delays seem to be correct.

There is no particular reason to use integer arithmetic in Java.
There might me if you were using FPGA/CPLD to run the calculations.

I don't understand Java that well or what you are trying to do in the program.

You do have to work with differential times.  So you need to subtract 19 from all
of your values before passing on the position solver.
0
 
LVL 1

Author Comment

by:jtiernan2008
ID: 24020053
The program comes from the tutorial below
It algorithm and equation derivation are at the start of the paper.
A-Synthesizable-VHDL-Model-of-th.pdf
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:d-glitch
ID: 24020220

Your drawing has X1, X2, X3, X4
And your program has i, j, k, l 
 
l (el) in indistinguishable from 1 (one) in this font.
 
And your values don't seem to match.
 
            double xi = 1, xk = 0, xj = 10, xl =0;
            double yi = 1, yk = 1, yj = 0, yl = 0;
            double zi = 0, zk = 0, zj = 0, zl = 0;
 
Shouldn't all the values be 0 or 10.  You have three 1's in there.

Open in new window

0
 
LVL 27

Expert Comment

by:d-glitch
ID: 24020308
The order of the points may be scrambled as well.
I can't tell if that makes a difference.
0
 
LVL 1

Author Comment

by:jtiernan2008
ID: 24020675
I enter the database details from the drawings and calculations as per the screenshot and get results;


ti=19.0
tk=24.0
tj=24.0
tl=28.0

and x=0, y=0, z=0

This does not match so I check my co-ordinates

ti=19.0 so from my diagram this must be RX3
tk=24.0 so this must be eigther RX1 or RX4
tl=28.0 so this must be RX2

So this must be a problem with the coding? Did I do the above ok?

database.jpg
0
 
LVL 27

Accepted Solution

by:
d-glitch earned 500 total points
ID: 24020802
In the screen shot, is see two RX4's and no RX2.  That doesn't seem correct.

What is the program supposed to do??

   Take in a set a DTOA data and generate a position estimate?
0
 
LVL 1

Author Comment

by:jtiernan2008
ID: 24021239
Sorry that is a typo in the database but it does not matter as the program does not check this...
RX4 in the second row should be RX2

The formula is explained in the attached tutorial pdf above. It takes in toa data and calculates the dtoas line 39-40..

I know it is using integers for the CPLD system but it should still work?

The maths is explained in the first part of the attached pdf... does it look ok for my system?
0
 
LVL 1

Author Closing Comment

by:jtiernan2008
ID: 31564337
it must be a problem with the code.
thanks for checking the diagram and workings at least they are ok.
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 24023114
The mathematical approach described in the VHDL paper can work for your
application as well.

Note that they are not bothering to solve for or plot any of the hyperbolae.

Instead they are solving simultaneous equations for the position coordinates
(x, y, z) directly.

As you can see, the math is fairly tedious.
0
 
LVL 1

Author Comment

by:jtiernan2008
ID: 24023175
thanks that's the answer I was looking for
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaFX TableView not displaying correctly 3 105
java mysql insert application 14 44
Java 8 to Java 6 8 32
Java Inheritance super keyword use 8 33
We are taking giant steps in technological advances in the field of wireless telephony. At just 10 years since the advent of smartphones, it is crucial to examine the benefits and disadvantages that have been report to us.
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question