Calculating distances
Hi,
i need some guidance, i need to calculate the distances between two atoms (all combinations). Each atom as x, y and z axis points e.g.
x y z
ATOM 5 CA PHE 1 113.142 75.993 130.862
ATOM 25 CA ARG 2 113.940 72.288 131.419
ATOM 49 CA TYR 3 116.236 72.885 134.471
i have used the following code to reference these values
this.x = (double)(new Double(line.substring(30,38).trim()).doubleValue());
this.y = (double)(new Double(line.substring(38,46).trim()).doubleValue());
this.z = (double)(new Double(line.substring(46,54).trim()).doubleValue());
but my question is how do i; setup x1, x2 etc to calculate the distances based on the co-ordinate information for two atoms
i plan on using the squareroot-method from java.lang.Math to calculate the distance s in Angstroms'.
I wouldn't be using the substring since the length seems to vary. Is this perhaps what you need?import java.util.*;
import java.io.*;
public class AtomDistanceTest {
public static void main(String[] args) {
new AtomDistanceTest();
public AtomDistanceTest() {
Vector atomArray = new Vector();
String line;
try{
System.out.println("Enter file for distance chek-up");
BufferedReader inputDistance = new BufferedReader (new InputStreamReader(System.in));
while ((line = inputDistance.readLine()) !=null && !line.equals("")) {
Atom atom = new Atom(line);
atomArray.addElement(atom);
for (int j=0; j<atomArray.size(); j++) {
for (int k=j+1; k<atomArray.size(); k++) {
Atom a = (Atom) atomArray.elementAt(j);
Atom b = (Atom) atomArray.elementAt(k);
Atom.printDistance (a,b);
} catch (IOException e) {
System.out.println("Input file problem");
} catch (Exception ex) {
System.out.println (ex);
class Atom {
public double x, y, z;
public String name;
public Atom(String s) throws IllegalArgumentException {
try {
StringTokenizer t = new StringTokenizer (s, " ");
t.nextToken();
this.name = t.nextToken();
for (int j=0; j<3; j++) t.nextToken();
this.x = new Double(t.nextToken()).doubleValue();
this.y = new Double(t.nextToken()).doubleValue();
this.z = new Double(t.nextToken()).doubleValue();
} catch (Exception ex) {
throw new IllegalArgumentException ("Illegal atom description");
public String toString() {
return "atom : " + name + "(x=" + x + " y=" + y + " z=" + z + ")";
public double distanceFrom (Atom other) {
return calculateDistance (x, y, z, other.x, other.y, other.z);
public static double calculateDistance (double x1, double y1, double z1, double x2, double y2, double z2) {
return Math.sqrt(Math.sqrt(Math.pow(Math.abs(x1-x2),2)+Math.pow(Math.abs(y1-y2),2))+Math.pow(Math.abs(z1-z2),2));
public static void printDistance (Atom a, Atom b) {
System.out.println ("Distance between " + a.toString() + " and " + b.toString() + " is " + a.distanceFrom(b));
}
Similar Messages
-
Calculating distance between Lat Long points
I'm wondering if anyone out there has done this before in LabVIEW. Does anyone have a model of the "Great Circle" calculation? I have a file of lat/long points that I need to calculate the distance between. Any help??
V/r,
ChrisI haven't done it in LV, but if you go to Wikipedia and search for Great Circle Distance you'll find the formual and an example.
-
Calculating Distance given a 4 point 2D image
Hi All,
3d n00b so play nice :-)
I'm trying to use a Wii remote camera to calculate real world distance from an object in Java.
The Wiimote will supply me the x and y coordinates of the 4 point object, which is actually 4 lights on the floor in this configuration.
I know the exact measurements of the 4 objects and the distance between them in the real world.
I know the 2D co-ordinates as represented on a 1024x768 screen.
I know the Angle of the Wiimote.
The lights will only ever be on a flat horizontal plane.
Is there anyway to reverse transform the 2D image from the camera back into 3D, taking into account the fact that the image may be rotated, and thus calculate the distance in the real world?
I'm guessing its some clever trig and some wizzy transformations although its been 20 years since I was in school! :-)
If you need any more explenation I'd be happy to attach some drawings.
Thanks in advance.
Uzerfriendlyhi
did you ever find out anything regarding your query?
i was trying to solve maybe a similar problem
though i'm not sure
how can i calculate the distance of an object of a known size (say, a person) that appears in a picture
presupposing the picture was image is not magnified or is somehow "sstandardized" or somehow "like" human vision
does it make any sense?
be happy to hear
thanks
doron -
Calculating distance between lat long coordinates best possible way?
Hi,
Am proposing to have a table A with latitude and longitude values along with some other info for that lat lon in it. The number of rows of data will be more and it will be growing day by day. i am having one application which will provide a latitude and longitude value and this i have to compare with all the lat lon of the table A and fetch the nearest (distance wise) information from other columns corresponding to that lat long in table A.
what is the best method available to implement this so as to reduce the time required to compare lat lon supplied with all rows of data in table A.
Thanks in advance.Have a look at the spatial option from oracle. Also there is a forum dedicated to this type of questions.
http://www.oracle.com/technetwork/database/options/spatial/index.html
especially: http://download.oracle.com/otndocs/products/spatial/pdf/locator11g_feature_overview.pdf
Edited by: Sven W. on Nov 30, 2010 5:53 PM -
Calculating distance from sensor
I have linear sensor(0,7metres) with analog 4-20 mA signal,
how i can calculate total distance, when sensor goes up and down while the program is running, i.e. sensor starts from 0 goes to max. 0,7 metres and back to zero -> 1.4 metresThe information you get from your sensor is the position. To obtain the overall length of all the displacements (Distance) you have to :
1/ calculate the instant speed : make consecutive readings of the position at defined time intervals, and divide the difference between the positions (DeltaPos) by the DeltaT. The lower the DeltaT, the higher the sensitivity to tiny displacements, but also to signal noise...
2/ integrate the absolute value of speed over time.
Not difficult again : get the absolute value of the speed, multiply by the DeltaT (?!), then add to the previous distance to get the new one.
As you can see there is a kind of stupid operation here : division then multiplication by DeltaT. Well, if you don't need specifically the speed inform
ation, you can suppress this step and just calculate Sum(Abs(DeltaPos)).
The attached vi is an example of what you could do.
Does that help, or am I missing something ?
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left...
Attachments:
Position.tiff 4 KB -
Calculating distance between polyons in a donut
Is there any easy way of measure the nearest distance between the outer ring of a donut and the inner ring?
I've split the polygons into two discrete objects and tried sdo_distance but always get 0.00.
Any help would be appreciated?Hi David,
In Oracle10g there is a function sdo_util.polygontoline.
If you extract each of the elements of interest, you can convert them to lines, then the distance will work for you.
If you keep the geometries as polygons, then the distance is 0 because one polygon is inside the other polygon.
Hope this helps, and all is well with you.
Dan -
Calculate distance between Latitude and Longitude
Hi All,
I have one Latitude and Longitude points. I need to calculate distance between them.
Right now we are using HAVERSINE formula but the query takes longer time to complete.
Reference: http://www.movable-type.co.uk/scripts/latlong.html
Please assist on this.
Thanks in advance.Check this link...
http://www.mrexcel.com/forum/excel-questions/202255-calculating-distance-between-two-latitude-longitude-points.html
I never did this before, but gave it a try using the formula mentioned in that link..
Data:
Lat Long R = 6,371 (Radius of earth (approximated))
Origin: 44.844263(B2) -92.914803(C2)
Destination: 44.822075(B3) -92.912498(C3)
Formula used:
A: =SIN(ABS(B3-B2)*PI()/180/2)^2+COS(B2*PI()/180)*COS(B3*PI()/180)*SIN(ABS(C3-C2)*PI()/180/2)^2
B: =2*ATAN2(SQRT(1-A),SQRT(A))
C: =R*B ---> DISTANCE!!!!
WITH t AS
(SELECT POWER (
SIN (ABS (44.822075 - 44.844263) * ( (22 / 7) / 180 / 2)),
2)
+ COS (44.844263 * ( (22 / 7) / 180))
* COS (44.822075 * ( (22 / 7) / 180))
* POWER (
SIN (
ABS (-92.912498 - (-92.914803))
* ( (22 / 7) / 180 / 2)),
2)
E2
FROM DUAL)
SELECT (2 * ATAN2 (SQRT ( (1 - E2)), SQRT (E2))) * 6371
FROM t;
Check if this gives correct values... (I did not verify this properly.. ) And this is faster in my opinion..
Please post your code for better suggestions from volunteers...
Cheers,
Manik. -
Trip Distance application functioning of firmare h...
Can anyone who has updated their software past version 11.047 get the Trip Distance application to work? I have updated with a prior N85 to version 20.175 and it caused the feature to stop calculating distance.
Moved to navigation section
-
I'm getting desperate for a solution to this problem (as is the rest of the development team!).
Basically we've been trying to create a system that automatically assigns values (frequencies) to objects (nodes) based on a rule set. Each node contains a varying number of sub-objects (radios) and each radio needs one frequency. The database has been set up and has test data for our Solution class to go through. However, we've run into an odd problem where our ResultSets are suddenly closing.
The classes work like this:
Database Broker (handles connection to DB, as well as executeQuery and executeUpdate statements.)
Entry Broker (Holds all SQL statements for data retrieval in various methods. Each method contains an SQL statement to access data, and code to format that data into something useable by the main class.
Solution/Main class (Contains methods to use the data from the Entry Broker to test valid solutions. Certain rules apply to assigning frequencies to radios and this class ensures that the data applies to these rules before it writes the data back to the DB (via the EntryBroker).
The problem we continually run into is that whilst the ResultSets work fine in the Entry Broker, they are closed when they return to the Main class.
Here's the catch: It seems in most cases that only the FIRST ResultSet returned in each method is closed, the remaining ResultSets work fine. We worked around this problem by creating a 'dummy' ResultSet, which obtained data from the database which was never used (the project name). We put this in its own try catch bracket so it would not interrupt the project.
It worked fine for a few classes, but for others (notably the following one) it was ineffective. We've searched and searched but we cannot find anyone with a similar complaint (except a few people who have commented about ODBC version problems). Our ODBC version is 3.520.7713.0
Here's an example method from the Solution class (The entire class is over 1000 lines):
// Method to test Harmonic resonance for nodes within 10m
private boolean resonanceGlobal (boolean tstResonanceG, double txFreq, double rxFreq, int distance) {
System.out.println("Beginning global harmonic resonance check");
try {
// Getting Nodes
rsNode2 = eBroker.getNodes(projectNo);
// node loop
while (rsNode2.next()) {
System.out.println("602 Test Marker GHarm 1");
// get next node, store in nodeTemp
nodeTemp = rsNode2.getInt(1);
// System out to show which nodes will pass if statement
System.out.println(node + " compare to " + nodeTemp);
// avoid testing the same node against itself
if (nodeTemp != node) {
// distance check (only neccesary within 10m)
System.out.println("Test Marker Before Distance check");
distance = getDistance(node, nodeTemp, distance);
System.out.println("Test Marker After Distance check");
// distance check if statement
if (distance <= 10) {
System.out.println("618 Test Marker GHarm 2");
// get the radios of the node, foreign node
rsRadiosTemp = eBroker.getRadios(node);
rsDummy = eBroker.getDummy(projectNo);
rsRadios2 = eBroker.getRadios(nodeTemp);
// This dummy ResultSet normally fails so that
// the other ResultSets perform normally
try {
rsDummy.next();
} // end try
catch (java.sql.SQLException dummyException) {
System.out.println("dummyException " + dummyException);
} // end catch
// radio loop
while (rsRadiosTemp.next()) { // error occurs here
System.out.println("627 Test Marker GHarm 3");
// loop for foreign node radios
while (rsRadios2.next()) {
System.out.println("631 Test Marker GHarm 4");
// get next radio
radioTemp = rsRadios2.getInt(1);
// get the TX and RX of the radio
genericTX = getTX(radioTemp);
radioTempCon = getConnection(radioTemp);
genericRX = getTX(radioTempCon);
// calculate bounds for harmonics test
txLo = ((txFreq * 2) - genericTX) - 4; // 4Mhz below TX harmonics check
txHi = ((txFreq * 2) - genericTX) + 4; // 4Mhz above TX harmonics check
rxHi = ((rxFreq * 2) - genericRX) + 4; // 4Mhz above RX harmonics check
rxLo = ((rxFreq * 2) - genericRX) - 4; // 4Mhz below RX harmonics check
// checks TX and RX of foreign radio against TX, RX of current radio for separation
if ((txLo > genericTX && txHi < genericTX) || (rxLo > genericRX && rxHi < genericRX)) {
tstResonanceG = false;
break;
} //end if
else {
tstResonanceG = true;
} // end else
} //end foreign radio loop
// breaking out of loops for return
if (tstResonanceG == false)
break;
} // end radio loop
rsRadios2.close();
rsRadiosTemp.close();
} // end sameradio check
} // end distance check
}// end node loop
rsNode2.close();
} // end try
// Catch statement to stop from crashing in the
// event of an error during SQL statements.
catch (java.sql.SQLException resonanceGlobalException) {
// Prints out the error message produced
System.out.println(resonanceGlobalException);
} // end catch
// returns result
return tstResonanceG;
} //end checkHarmonicResonanceGlobal()
My apologies if it is a little hard to read, but the indenting is accurate. The Entry Broker methods which this method uses are here:
public ResultSet getNodes (int projectNo) {
// creating SQL statement
sqlStatement = "SELECT nodeNo from tblNode WHERE projectNo = " + projectNo;
System.out.println(sqlStatement);
// executing SQL statement
rsNodes = db.runQuery(sqlStatement);
// returns ResultSet
return rsNodes;
} // end getNodes
// Method to get the distance between any two nodes
public int getDistance (int projectNo, int node, int tempNode) {
ResultSet rsX1; // Used for obtaining the X-coord of node 1
ResultSet rsX2; // Used for obtaining the X-coord of node 2
ResultSet rsY1; // Used for obtaining the Y-coord of node 1
ResultSet rsY2; // Used for obtaining the Y-coord of node 2
double distance = 0; // Used in Global checks
int dist = 0; // Used in Global checks
int x1 = 0; // Used in calculating distance
int x2 = 0; // Used in calculating distance
int y1 = 0; // Used in calculating distance
int y2 = 0; // Used in calculating distance
int xDist = 0; // Used in calculating distance
int yDist = 0; // Used in calculating distance
int distint = 0; // Used to store converted values
try {
// get the X and Y co-ordinates of both nodes
sqlStatement = "SELECT xCoord FROM tblNode WHERE nodeNo = " + node + " AND projectNo = " + projectNo;
rsX1 = db.runQuery(sqlStatement);
rsX1.next();
x1 = rsX1.getInt(1);
sqlStatement = "SELECT yCoord FROM tblNode WHERE nodeNo = " + node + " AND projectNo = " + projectNo;
rsY1 = db.runQuery(sqlStatement);
rsY1.next();
y1 = rsY1.getInt(1);
sqlStatement = "SELECT xCoord FROM tblNode WHERE nodeNo = " + tempNode + " AND projectNo = " + projectNo;
rsX2 = db.runQuery(sqlStatement);
rsX2.next();
x2 = rsX2.getInt(1);
sqlStatement = "SELECT yCoord FROM tblNode WHERE nodeNo = " + tempNode + " AND projectNo = " + projectNo;
rsY2 = db.runQuery(sqlStatement);
rsY2.next();
y2 = rsY2.getInt(1);
} // end try
catch (java.sql.SQLException getDistanceException) {
System.out.println(getDistanceException);
// calculating distance
yDist = y2 - y1;
xDist = x2 - x1;
// perform pythagoras theorem for distance
dist = (xDist * xDist) + (yDist * yDist);
distance = java.lang.Math.sqrt(dist);
Double roundFreqTemp = new Double(freqTemp);
distint = roundFreqTemp.intValue() ;
return distint;
} // end get distance method
// Method to get all the radios in a node
public ResultSet getRadios(int node) {
ResultSet rsRadios; // Used for obtaining radios in a node
// creating sql Statement
sqlStatement = "SELECT * FROM tblRadio WHERE nodeNo =" + node;
System.out.println(sqlStatement);
// executing sql Statement
rsRadios = db.runQuery(sqlStatement);
System.out.println("EB Test Marker 1: Line 261");
// returning radio no
return rsRadios;
}//end getRadio
public double getTX(int radioTemp){
double txTemp = 0; // Used for storing TX of a radio
int freqNoTemp = 0; // Used for storing the frequency ID
rsDummy = getDummy(projectNo);
// creating SQL statement
sqlStatement ="Select frequencyNo from tblRadio where radioNo = " + radioTemp;
System.out.println(sqlStatement);
// executing SQL statement
rsTX = db.runQuery(sqlStatement);
try {
System.out.println("Test Marker EB1: 317");
try {
rsDummy.next();
} // end try
catch (java.sql.SQLException dummyException) {
System.out.println("dummyException" + dummyException);
} // end catch
System.out.println("Test MarkerEB2: 330");
// moving to first position in rs
rsTX.next();
System.out.println("Test MarkerEB3: 334");
// obtaining data from rs
freqNoTemp = rsTX.getInt(1);
System.out.println("Test MarkerEB4: 337");
rsTX.close();
} // end try
catch (java.sql.SQLException rsTXException) {
System.out.println("rsTXExeption: " + rsTXException);
} // emd catch
System.out.println("Frequency No is: " + freqNoTemp);
rsDummy = getDummy(projectNo);
sqlStatement = "Select frequency from tblFreq where frequencyNo = " + freqNoTemp;
System.out.println(sqlStatement);
rsRX = db.runQuery(sqlStatement);
try {
try {
System.out.println("Test MarkerEB6: 361");
rsDummy.next();
} // end try
catch (java.sql.SQLException dummyException) {
System.out.println("dummyException" + dummyException);
} // end catch
System.out.println("Test MarkerEB5: 373");
rsRX.next();
System.out.println("Test MarkerEB7: 376");
txTemp = rsRX.getDouble(1);
System.out.println("Test MarkerEB8: 379");
rsRX.close();
} // end try
catch (java.sql.SQLException rxException) {
System.out.println("rxException " + rxException);
} // end catch
System.out.println("393 Before return");
return txTemp;
} //end getTX
public int getConnection(int radio) {
int nodeCon = 0; // Used to return the connected node no
ResultSet rsConnection; // Used for obtaining the foreign radio
// creating SQL statement
sqlStatement = "SELECT radioNo FROM tblRadio where recRadio = " + radio;
System.out.println(sqlStatement);
// executing SQL statement
rsConnection = db.runQuery(sqlStatement);
try {
// moving to first position in rs
rsConnection.next();
// obtaining data from rs
nodeCon = rsConnection.getInt(1);
} // end try
catch (java.sql.SQLException getConnectionException) {
System.out.println("getConnectionException : " + getConnectionException);
} // end catch
// returns node no.
return nodeCon;
And finally, the dummy rs:
// Dummy method to fix resultSet closed error
public ResultSet getDummy (int projectNo) {
sqlStatement = "Select projectName from tblProject where projectNo = " + projectNo;
System.out.println(sqlStatement);
rsDummy = db.runQuery(sqlStatement);
return rsDummy;
Here is some sample output that we have:
----jGRASP exec: java MainGui
slider value constructor: 50
116: if(singleton==null) {
120: singleton=new Resolvotron
Connection to D/Base establised
Select projectName from tblProject where projectNo = 3
Init OK. Beginning solve process
main OK: beginning frequency assign process
SELECT nodeNo from tblNode WHERE projectNo = 3
267: Node number = 2
SELECT * FROM tblRadio WHERE nodeNo =2
EB Test Marker 1: Line 261
Test Marker 1: Line 289
298: Radio number = 4
Test Marker 5: Line 308
Test Marker 3: Line 313
SELECT frequency from tblFreq WHERE projectNo = 3
125.5
Beginning test process
Test Marker 4: Line 386
Beginning check 257072
Test Marker 6: Line 774
70 Mhz Margin = false
Beginning local 10Mhz separation check
SELECT * FROM tblRadio WHERE nodeNo =2
EB Test Marker 1: Line 261
Getting TX of radio: 4
Select projectName from tblProject where projectNo = 3
Select frequencyNo from tblRadio where radioNo = 4
Test Marker EB1: 317
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB2: 330
Test MarkerEB3: 334
Test MarkerEB4: 337
Frequency No is: 2
Select projectName from tblProject where projectNo = 3
Select frequency from tblFreq where frequencyNo = 2
Test MarkerEB6: 361
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB5: 373
Test MarkerEB7: 376
Test MarkerEB8: 379
393 Before return
432: getting connection
SELECT radioNo FROM tblRadio where recRadio = 4
438: getting TX of radio: 6
Select projectName from tblProject where projectNo = 3
Select frequencyNo from tblRadio where radioNo = 6
Test Marker EB1: 317
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB2: 330
Test MarkerEB3: 334
Test MarkerEB4: 337
Frequency No is: 2
Select projectName from tblProject where projectNo = 3
Select frequency from tblFreq where frequencyNo = 2
Test MarkerEB6: 361
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB5: 373
Test MarkerEB7: 376
Test MarkerEB8: 379
393 Before return
java.sql.SQLException: ResultSet is closed
10 Mhz Local = true
Beginning 10 Mhz separation check
SELECT nodeNo from tblNode WHERE projectNo = 3
Node number is 2
10 Mhz Global = false
Beginning local harmonic resonance check
SELECT * FROM tblRadio WHERE nodeNo =2
EB Test Marker 1: Line 261
Select projectName from tblProject where projectNo = 3
Select frequencyNo from tblRadio where radioNo = 4
Test Marker EB1: 317
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB2: 330
Test MarkerEB3: 334
Test MarkerEB4: 337
Frequency No is: 2
Select projectName from tblProject where projectNo = 3
Select frequency from tblFreq where frequencyNo = 2
Test MarkerEB6: 361
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB5: 373
Test MarkerEB7: 376
Test MarkerEB8: 379
393 Before return
SELECT radioNo FROM tblRadio where recRadio = 4
Select projectName from tblProject where projectNo = 3
Select frequencyNo from tblRadio where radioNo = 6
Test Marker EB1: 317
dummyExceptionjava.sql.SQLException: ResultSet is closed
Test MarkerEB2: 330
Test MarkerEB3: 334
Test MarkerEB4: 337
Frequency No is: 2
Select projectName from tblProject where projectNo = 3
Select frequency from tblFreq where frequencyNo = 2
Test MarkerEB6: 361
I'll leave it at that, since the program goes into an endless loop. The dummy Exceptions are our dummy resultsets crashing so the rest can survive. The other stuff is from different methods. You should be able to locate the logic of the program by following the System.outs
Test Markers with EB refer to the Entry Broker.
Any help would be appreciated since we cannot find any other way of running this class successfully.
SteveOk problem solved...
Basically I was calling one ResultSet after another. Thanks to the Database Broker's structure, this was killing the first ResultSet. I fixed up the loops so that ResultSets were only ever called just before they were needed, and it fixed the problem. The only other errors were simple logic faults which I drummed out in short order. Thanks for the help everyone! -
How to consume Google REST web service
Dear All,
I have a task to embed Google Maps into web dynpro and/or CRM WebUI.
There is no problem with embedding only map with route on it, but I need also calculated distance.
In WebDynpro I've just created iFrame CHIP component which targets: http://maps.google.pl/maps?output=embed and two CHIPS with import parameters to give source and destination address. Route is calculated and drawn.
Problem is with the distance, because the only way is to consume google web service (which is not SOAP, so I can't use service consumer). It must be something like web request.
URL which I need to access is:
http://maps.googleapis.com/maps/api/distancematrix/xml?&mode=driving&sensor=false&origins=Warsaw&destinations=Hamburg
or
http://maps.googleapis.com/maps/api/distancematrix/json?&mode=driving&sensor=false&origins=Warsaw&destinations=Hamburg
where origins and destinations must be connected with import CHIPS. How to access such service in a proper way?
Second thing is that I have to parse response.. it could be XML or JSON format. I just need summary distance. Any idea?
Btw - I'm quite fresh with WebDynpro and WebUI, so I'm looking for good 'HOW TO' guide. Can you recommend something which is good to start with?
thanks in advanceHi,
check this reference to start with: [How to integrate google maps in Web Dynpro ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0bca5ae-3c5c-2d10-938d-a81787f59ace?QuickLink=index&overridelayout=true]
Also this demo by Thomas Jung Sir: [Google Maps: Flash Islands in WDA|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/80f16eef-91ef-2b10-4fb5-d709436f3cc3&overridelayout=true]
hope this helps u.,
@moderators: Don't Close this thread instead move to Web Dynpro ABAP Forum
Thanks & Regards,
Kiran -
Outdoor 5ghz MIMO deployment.
Hello..
We are interested in adding 5ghz N MIMO to our existing outdoor wifi 2.4ghz hotspots. Currently we have 3 x 1310 ap's with MSO24014 all-terrain antennas (seen in the attached photo) atop 19 foot towers..
I'm looking at either 3 x 1532E AP's paired with 8 dBi AIR-ANT2588P3M-N antennas or 3 x 2603 paired with the 6dBi AIR-ANT2566P4W-R antennas.
Here are my questions:
The 1532E has a 27dbi (500mw) tx power, while the 2603 has only a 23 dbi (200mw) tx power.. Both are obviously better that the 1310's 20dbi (100mw) tx power. But how much is too much? It seems like these 1532e's at full tx paired with the 8 dbi 2588P3M antenna might push the signal too far for mobile devices to respond.
I'm curious how an omni 5 dbi cisco antenna would perform on these towers if mounted on the metal tower structure. Would it be a waist of time due to the obvious reflection pattern the towers would cause?
I was thinking about placing the antennas around the 17 foot mark..
My goal is to bring pure 5ghz N MIMIO to the existing towers while leaving the 2.4gh alone. Bringing cell coverage in for a good quality coverage but not too close since this is an RV park.Thanks for all of your assistance..
I'm having trouble finding a strait forward webiste for calculating distance, but I have been able to figure out the formula from these forums..
The Cisco 1532E ap has a tx power of 27dbi. We're using 2 x 25 foot CFD-400 cables (.35dbi loss per meter). Combined with Cisco's 8 dBi AIR-ANT2588P3M-N.
EIRP = Device TX Power - Cable Loss + Antenna Gain
That gives me 27dbi - 2dbi + 8dbi = 33dbi
(do I need to add both cable -dbi loss into the above equation)
Free Space Loss =(20*LOG10(D5*1609.344))+(20*LOG10(D9))-27.55
I have the MCS -dbm chart for the AP but I'm not sure how to put that together with a typical Laptop / iPad device.
Is 25mw with 0 - 2di antenna still pretty average for Laptops and iPads?
Thanks for your help -
Help interfacing a DC bicycle generator with my vi
Hello
I have a bicycle/DC generator displ;ay setup for the public to view here at the university. I have a vi that will count revolutions, keep time and calculate distance in meters. I used a bike computer. I cutoff the puter, juice up the pick up and when the magnet on the spoke goes by the voltage drops from whatever it is to 0v. I have the vi counting revolutions, calculating distance (known circumference of tire) in meters and a timer set for 5 minutes. It is hard puching against the generator when on the bike so a user will only be on it for a few minutes. I had to add a delay to count just one revolution when the boolean goes from Hi to Lo. Without this delay, the count can run more than one tick.
The generator output is 0-12vdc. A user can pound out more volts, but I am not interested in that. I want to display calorie per watt, volts, distance, power etc....In the image below you can see the display table. The watts are displayed as 50W, 75W, 100W, 125W, 150W and 175W respectively as the volt trip the relays - and the lightbulb goes on. You can also see an op amp circuit. This is to shape the DC generator output from 0-12v to 0-10v for Labview (the generator output is negative from my 2nd stage inverting amp to the DAQ card). My signal conditioning of the DC generator output is perfect. The display table is perfect. As can be
My problem is when I run the vi, nothing is displayed on the front panel gauge for DC volts out.
I am not very familiar with consumer/prodeucer programmimg. I really need someone to help me develop this. I would like to use what I have, but am not adverse to a complete change.
Anyone?
Thanking you all in advance,
NK
Another thing. I am using a battery supply for rail to rail volts for the op amps (w/virtual ground). See image.
Do I need to ground my DC generator signal in to the card. Chasis gnd? Or none at all? I am not sure about that.
Attachments:
Count_Digital_Events_RPM[1].vi 249 KB
DC Bike Genenrator_Labview Interface.jpg 123 KB
battery power schematic.jpg 29 KBYour program is could effectively be refactored as a state machine. It's not a bad overall effort, mind you, but you should do some research on state machines (start by searching this forum).
Some general programming things (this is not everything I see, but I'm a bit pressed for time):
Your FOR loop does nothing. It will either iterate once (in which case you don't need it) or zero times (in which case you REALLY don't need it). And why are you ANDing your "start" button value with a T constant? Just use the boolean value by itself. Same thing.
You can eliminate your local variables and use a shift register instead. (If you don't know about shift registers, that would be another terrific thing for you to learn.) You do some odd things with that "revolutions" value -- why the local write variable? just wire the final value straight to the indicator and get rid of the local write -- and some strange things with your "reset" button value. You're converting the boolean to a number (1 or 0), then comparing it to a value of 1...in other words, you're checking to see if the value is T. The boolean value itself already tells you that. Just use the boolean by itself.
You don't need to invert your "cadence" value before inputting it to the "select" function. Wire the boolean value in, and switch the numeric operations (so that the "+1" is input to the F terminal and the previous value is input to the T terminal). Same thing as what you have, but cleaner.
I don't really understand your "time elapsed" loop within another loop. Exactly what are you trying to accomplish with all that? Is your elapsed time indicator supposed to be somehow related to your DAQ operation? Right now it is not.
Now, your DAQ things:
You are using all of the default values for your physical analog channel, which means that the channel is configured for a range of -5V to 5V (which I'm pretty sure is not what you want) and the wire configuration is set to "default". I don't know what board you're using, so I don't know what the default channel config for that board is, but you do need to make sure it matches your actual wiring. Are you wired as differential? Referenced single-ended? You ask about whether you need to ground. The DAQ board does need some kind of reference in order to measure a voltage.
Have you put a multimeter on your analog input terminals to see if you actually do have a voltage there?
Have you set a probe on the wire to your "generated volts" indicator to see what the DAQ board is measuring on that channel?
You are using "1Channel N Samples" but you don't configure a clock so you won't be grabbing N Samples. Use "1Channel 1Sample" instead.
Currently your "set delay" is set to 15msec. You don't need a loop iteration that fast. Set it to 500msec or thereabouts. You'll grab a DC value and update your front panel every 500msec, which should be more than often enough. You're not measuring a rapidly-varying phenomenon.
Hope some of this points you in a direction. As I said, this is not at all a bad effort. It just needs some cleanup and a better architecture. Everyone starts somewhere and you're doing fine. -
Select sdo_nn with where-clause on large table
Hi spatial-experts,
I've following problem. I use a table with more than 2.500.000 dataset. Every dataset represents one point (SDO_GEOMETRY, SDO_POINT_TYPE) and have further (text) information. (PI (point of interest) table from TeleAtlas mn_pi)
Following Select works fine:
SELECT /*+ ORDERED NO_INDEX(pi IX_PI_FEATTYP) */
sdo_nn_distance(1) distance,
id, feattyp, arnamelc, name, stname, stnamelc, hsnum, postcode
FROM multinet.mn_pi pi
WHERE
pi.feattyp IN ( 9373,9374)
AND
SDO_NN(
pi.geom,
SDO_GEOMETRY( 2001, 8307, SDO_POINT_TYPE(613.86865234375/60, 3002.94677734375/60, NULL), NULL, NULL),
'sdo_batch_size=0', 1) = 'TRUE'
AND rownum = 1
ORDER BY distance
(P.S. IX_PI_FEATTYP is an index on column feattyp, here not used. When I'm using it the select do not work (it last very long...))
When I now modify the where clause to an pi which feat type that does not exists (no entry in table) the select lasts very long (I canceled the select after 5 minutes).
for example: pi.feattyp = 9756
Otherwise I add a further where clause like
AND arnamelc = 'ITA'
the select also works very long. The point are now in italy. refrence point is in germany and is more than 500km away.
Are there some solutions to solve this problems
(should I use for every feat type a own table)?
Why is the select so slow?
Thanks for all helpfully answers,
MatthiasHi Matthias,
When you use nearest neighbor, Oracle will use the spatial index to find the nearest neighbor that meets the query criteria. It probes into the index, calculates distances, and returns data in distance order.
Using SDO_BATCH_SIZE, it keeps going back to the database, returning more and more records in distance order until the other predicates are satisfied (in your case, pi.feattyp IN ( 9373,9374).
When you specified pi.feattyp = 9756 (which doesn't exist), you told Oracle to keep going and calculating distances for each of the more than 2.500.000 records in the the data set (you killed it after 5 minutes).
I don't know why adding: AND arnamelc = 'ITA' caused Oracle to take extra time. Sometimes I will do a: set autotrace trace exp
then compare plans for something that runs quickly vs. something that runs slowly. If you want to post the plans for the fast and slow versions it might be interesting to look at.
My guess is you may want to look at a solution that incorporates various possibilities. For instance, if there are only a few of some feattyp values, you may want to select those using the non-spatial index then use sdo_geom.sdo_distance to find the closest point rather than risk having to look through a few million values for a match.
I'm sure other people have thoughts as well...
Kind regards,
Dan -
Calling Spatial functions in xs application on multiple records
Hi,
I have a table "location" with a column of type
ST_GEOMETRY(4326)
I am aware of the limitation that function like shape.st_distance can not be called in Stored Procedures
and can be called from xsjs
Now I have list of items with their locations attributes (ST_GEOMETRY).I need to find distance of these items from a constant point (e.g. center of Newyork)
I can understand that I can iterate through all the items one by one in XSJS and fire Select query using the function.
But this looks to be very costly in case list is huge.
Is there any other better way to handle the case
Regards,
ApoorvHi There,
Do have a look on the below:
SAP HANA: Calculating distance between 2 cities using Geo-Spatial functions
Regards,
Krishna Tangudu -
How to change the co-ordinayte system?
Hello to all,
I am working on a java project in which i want to display Earth's longitudes and latitudes. Right now my program giving me cartesian means the applet's own co-ordinate but i want the co-ordinates in degrees to solve some communication equations .
please help me to solve this problem.
I will be very thankfull to you all...
My code is given as:
import java.awt.*;
import java.applet.*;
import javax.swing.JApplet;
import javax.swing.JPanel;
import java.awt.event.*;
public class DrawEarth extends JApplet implements MouseListener
public void mouseClicked (MouseEvent me) {
xpos = me.getX();
ypos = me.getY();
// Check if the click was inside the Earth area.
if ((xpos >50 && xpos < 450 && ypos >50 && ypos < 450)||(xpos >450 && xpos < 850 && ypos >50 && ypos < 450)) {
mouseClicked = true;
// if it was not then mouseClicked is false;
else
return ;
repaint();
public void mouseEntered (MouseEvent me) {}
public void mousePressed (MouseEvent me) {}
public void mouseReleased (MouseEvent me) {}
public void mouseExited (MouseEvent me) {}
boolean mouseClicked;
int xpos,ypos;
String msg;
public void init() {
//addMouseListener(this);
super.init();
addMouseListener(this);
setContentPane(new JPanel() {
final Dimension size = new Dimension(1000, 1000);
final GradientPaint backgradient = new GradientPaint(0, 0, Color.WHITE, 0, 350, Color.BLACK);
final GradientPaint earthgradient = new GradientPaint(0, 50, Color.CYAN, 0, 450, Color.GREEN);
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(backgradient);
g2.fillRect(0, 0, 1000, 1000);
g2.setPaint(backgradient);
g2.setPaint(earthgradient);
g2.fillOval(50, 50, 400, 400);
g2.fillOval(450, 50, 400, 400);
g2.setColor(Color.BLUE);
g2.setColor(Color.BLUE);
g.drawString("270",35,250);
g.drawString("300",70,250);
g.drawString("330",145,250);
g.drawString("(0,0)",245,250);
g.drawString("30",345,250);
g.drawString("60",415,250);
g.drawString("90",445,250);
g.drawString("120",470,250);
g.drawString("150",545,250);
g.drawString("(180,0)",645,250);
g.drawString("210",745,250);
g.drawString("240",815,250);
g.drawString("270",850,250);
g.drawString("90",255,48);
g.drawString("60",255,77);
g.drawString("30",255,150);
g.drawString("-30",255,350);
g.drawString("-60",255,425);
g.drawString("-90",255,460);
g.drawString("90",650,48);
g.drawString("60",650,77);
g.drawString("30",650,150);
g.drawString("-30",650,350);
g.drawString("-60",650,425);
g.drawString("-90",650,460);
for (int i = 0; i <= 180; i += 10) {
int widthlong = (int) (200 * Math.cos(Math.toRadians(i)));
g2.drawOval(250 - widthlong, 50, 2 * widthlong, 400);
g2.drawOval(650 - widthlong, 50, 2 * widthlong, 400);
int widthlat = (int) (200 * Math.sin(Math.toRadians(i)));
g2.drawLine(250 - widthlat, 250 - widthlong, 250 + widthlat, 250 - widthlong);
g2.drawLine(650 - widthlat, 250 - widthlong, 650 + widthlat, 250 - widthlong);
double xco = xpos/22.22;
double yco = ypos/22.22;
if(xpos >50 && xpos < 450 && ypos >50 && ypos < 250){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
if(xpos >450 && xpos < 850 && ypos >50 && ypos < 250){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
if(xpos >50 && xpos < 450 && ypos >250 && ypos < 450){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
if(xpos >450 && xpos < 850 && ypos >250 && ypos < 450){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
if((xpos==250&&ypos==50) || (xpos== 650 && ypos==450 )){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
if(xpos >=50 && xpos <= 850 && ypos ==250 ){
g.drawString("("+xpos+","+ypos+")",xpos,ypos);
/* public Dimension getPreferredSize()
return size;
=)
For the boundaries of the globe you can test if the click was outside the globes by comparing the radius and the calculated distance from the center of each globe for each globe separately. The transform of the drawing the OP made is not a standard one so I'm having to comprehend the calculus of transformations I picked up last year and combine it with the linear algebra I learned this year ( might take until next week =( ). I tried implementing it by using weighted average procedures
i.e.
>
delta = ( 1 - t )*P + tQ>
where t is time in fraction of the total time and P and Q are two different points on a line. But there is also the effect of moving away from the equator for the longitude where the effect on the rate of change is increased when moving sideways ( longitude measures degrees around the earth from the prime meridian ) and when I tried to implement those two effects together, they seem to work for some parts but fail as I go diagonally (simply put) from 0deg,0deg which give false results in that the lat or lon (can remember which) is greater than the possible amount allowed ( i.e. abs_value > 180 for longitude or > 90 for latitude ).
Here's the code so far if you want to take a look at it:
I wasn't trying to worried too much about anything else but the algorithm for transforming the coords. I added the JLabel on the north side so I wouldn't have to look at the command prompt.
import java.awt.Dimension;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GradientPaint;
import java.awt.RenderingHints;
import java.awt.Point;
import java.awt.event.MouseListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.BorderLayout;
import javax.swing.JLabel;
public class DrawEarthPanel extends JPanel
public static final long serialVersionUID = 1L;
private static final Dimension size = new Dimension(900, 500); // width, height
private static final GradientPaint backgradient = new GradientPaint(0, 0, Color.WHITE, 0, 350, Color.BLACK);
private static final GradientPaint earthgradient = new GradientPaint(0, 50, Color.CYAN, 0, 450, Color.GREEN);
private boolean mouseClicked;
private int xpos = 0;
private int ypos = 0;
public DrawEarthPanel()
addMouseListener( new MouseEvents() );
public Dimension getPreferredSize()
return DrawEarthPanel.size;
public void paintComponent( Graphics g )
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(backgradient);
g2.fillRect(0, 0, 1000, 1000);
g2.setPaint(earthgradient);
g2.fillOval(50, 50, 400, 400);
g2.fillOval(450, 50, 400, 400);
g2.setColor(Color.BLUE);
g.drawString("270",35,250);
g.drawString("300",70,250);
g.drawString("330",145,250);
g.drawString("(0,0)",245,250);
g.drawString("30",345,250);
g.drawString("60",415,250);
g.drawString("90",445,250);
g.drawString("120",470,250);
g.drawString("150",545,250);
g.drawString("(180,0)",645,250);
g.drawString("210",745,250);
g.drawString("240",815,250);
g.drawString("270",850,250);
labelLatitudes( g, 255 );
labelLatitudes( g, 650 );
for ( int i=0; i<=180; i+=10 )
int wLon = (int) (200 * Math.cos(Math.toRadians(i)));
g2.drawOval(250-wLon, 50, 2*wLon, 400);
g2.drawOval(650-wLon, 50, 2*wLon, 400);
int wLat = (int) (200 * Math.sin(Math.toRadians(i)));
g2.drawLine(250-wLat, 250-wLon, 250+wLat, 250-wLon);
g2.drawLine(650-wLat, 250-wLon, 650+wLat, 250-wLon);
private static final Point left_globe_origin = new Point( 250, 250 );
private static final Point right_globe_origin = new Point( 650, 250 );
private static final int globe_radius = 200;
private void labelLatitudes(Graphics g, int x)
g.drawString("90",x,48);
g.drawString("60",x,77);
g.drawString("30",x,150);
g.drawString("-30",x,350);
g.drawString("-60",x,425);
g.drawString("-90",x,460);
class MouseEvents extends MouseAdapter implements MouseListener
public void mouseClicked( MouseEvent evt )
xpos = evt.getX();
ypos = evt.getY();
System.err.println("DEBUG: xpos="+xpos+", ypos="+ypos);
double lat = 0.0;
double lon = 0.0;
if ( xpos>50 && xpos<450 && distance(left_globe_origin,xpos,ypos) <= globe_radius ) // left globe
Point origin = left_globe_origin;
double radius = globe_radius;
double dx = xpos-origin.x;
double dy = -ypos+origin.y;
lat = (dy/(radius-dx))*90;
lon = (dx/(radius-dy))*90;
// lat = ypos - 250;
// lon = xpos - 250;
setLabel( String.format( "longitude >>> %.3f, latitude >> %.3f", lon, lat ) );
System.err.println( "DEBUG: lat=" + lat + ", lon=" + lon );
else if ( xpos>450 && xpos<850 && distance( right_globe_origin,xpos,ypos) <= globe_radius ) // right globe
Point origin = right_globe_origin;
int radius = globe_radius;
int dx = xpos-origin.x;
int dy = ypos-origin.y;
lat = (1d*dx/radius+1d*dy/radius)*90;
lon = (1d*dx/radius+1d*dy/radius)*90;
// lat = ypos - 250;
// lon = xpos - 650;
setLabel( String.format( "longitude >>> %3.3f, latitude >> %3.3f", lon, lat ) );
System.err.println( "DEBUG: lat=" + lat + ", lon=" + lon );
repaint();
private static JLabel output = new JLabel( "Output of Longitude and Latitude" );
public static void setLabel( String text )
output.setText( text );
public static double distance( Point origin, int x, int y )
return Math.pow( Math.pow((x-origin.x),2)+Math.pow((y-origin.y),2), 0.5 );
private static void createAndShowGUI()
JFrame frame = new JFrame( "DrawEarthPanel" );
frame.setLayout( new BorderLayout() );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setLocation(10, 10);
frame.setContentPane(new DrawEarthPanel());
frame.add( output, BorderLayout.NORTH );
frame.pack();
frame.setVisible(true);
public static void main( String[] args )
javax.swing.SwingUtilities.invokeLater(
new Runnable()
public void run()
createAndShowGUI();
}The transform isn't a regular one since the OP kept his lat. lines straight so it's kind of weird to me right now.
Happy coding
Maybe you are looking for
-
Fields appear as "Read Only" in an Int.Form called from a WD
Hi Experts! I am having a doubt in an Adobe Int.Form, that is called from a WD application. The fields that are in my Form, always appear as a "read only". It is not possible to modify anything there. Here, I describe the steps that I follow. I creat
-
Opening PDF in IE "breaking" for loop
Hi, I have a dynamic PDF that is uploaded to a website. When the PDF opens, the user has to fill in certain fields before clicking the "Next" button. Upon clicking the Next button, I have a JavaScript function that sets certain fields access to req
-
How do I create folders?
How do I create folders on my Ipad?
-
Anyone see this error on trying to install Lightroom 6?
This is what I get when trying to install Lightroom 6, either as a stand-alone product or Lightroom CC as part of my CC membership. Exit Code: 7 Please see specific errors below for troubleshooting. For example, ERROR: DF024 ... --------------------
-
I have multiple tables joined to a single master table and subtotaling works fine. However, when I join to a newly created table the totaling does not work - it just display sum: with no value. The join itself works as I am able to get data from both