Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Human Math and Fortran Math

JohnNichols
Valued Contributor III
1,655 Views

I have been playing with some data. The data is acceleration results in 3 axes, X, Y and Z.  

The human being who set up the models shows the standard RH Rule with Z vertical in the manual.

The sample code returns Z measured for gravity as 1.  It should be -1. The human math intervened to make it convenient and match our minds, not the pure science math.  

It did not become a problem, one's mind allows for the conversion in your head, until I started to code the changes in plate angles, then one needs atan2,  [I always think of this board and blast atan2 with the 2pi change at 180 degrees. ]  and one has to stop thinking in human math and do real math.   We need an atan3 function that does not have Y and X the wrong way round and acts like a compass not a step function.  [I will await the onslaught with interest.] 

An American in Washington, DC, a few weeks ago, asked me if I thought in metric or imperial.  I said they are the same thing due to the 1866 law in the USA.  It is just imperial is weird metric.  

I started talking about stones and barleycorns, both perfectly sensible units.  Density as stones per cubic barley corn is nice.  

The board has been slow.  

Some seek humour in interesting places.  

0 Kudos
5 Replies
jimdempseyatthecove
Honored Contributor III
1,636 Views

>>The sample code returns Z measured for gravity as 1.  It should be -1. 

Not really. The direction depends on the frame of reference for the XYZ and position of the two masses.

While the magnitude of the force (not withstanding the argument that gravity is not a force) can be computed from the mass values and distance of separation (neglecting relativistic velocities) of the bodies. With the direction towards each body. The force with respect to a body, is the force magnitude dot direction from that body to the other body (and vice versa for the other body). IOW the gravitational force is in both directions/between the bodies.

 

I agree that should the X/Y plane be tangent to the surface of (Earth or other body of non-zero radii), then for that frame, the Earth's contribution to a gravitational force, for the special case of any object along the Z axis, that the gravitational force is in the -Z direction. The force direction experienced by this other body on the Z axis, would depend on its body frame.

 

When this other body is not located on the Z axis, then the direction will vary depending on position.

 

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
1,589 Views

You see the pictures have the Z pointing vertically away from the ground in the manufacturer's manual.   It is a human definition, not a techical defininition.  But the program with the manual with the device aligned as per the manual sketch returns 1g.  

It is joys of dealing with humans and engineering.  It is nice to agree on the definitions.  

I am simply trying at the moment to calibrate the device.  

Case in point, the manual said the temperature will be returned as an integer between 0 and 50 for C.  I got 3384. There is a very small note on the page, it may in some rare circumstances require calibration.   This is the first one tested for temperature.  It is hard to stick everything in the frig to cool it off a bit, as it is impossible to tell if it is a slope or offset or combined error.

It is all fun.  

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,576 Views

>>the manual said the temperature will be returned as an integer between 0 and 50 for C.  I got 3384. 

If the manual were written by a non-english (?US?) speaking person (e.g. Chinese ), he/she may have translated for

"For temperatures between 0 and 50C, the instrument will return an integer."

If said instrument is calibrated for 0:50C and using a 12-bit (unsigned) ADC, then 3384 might represent 41.3C (106.35F). Was the instrument that hot?

 

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
1,538 Views

No, the integer range is limited to 0 to the integer 50, it appears to be in 1 degree steps.  Six of the bits are set to constant zero, and the range on the other six is limited to fifty steps.  

I have asked the manufacturer to explain and I am meeting with them.  I would prefer that you are correct, but it appears not.  

It is all just fun as one explores the device.   Plus your thoughts are always great. 

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,530 Views

Is the output in BCD?

3384 = 1101 0011 1000

1101 = ?? may be used for something else, control information, error, humidity, +/-, ???

              or  a code indicating what is being reported 1101 being temperature in C

0011 =  3

1000 = 8

 (?something? and) 38

 

Was the temperature around 38C?

 

Jim Dempsey

0 Kudos
Reply