Searching \ for 'Pressure to MPH [OT]' in subject line. ()
Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=
Search entire site for: 'Pressure to MPH [OT]'.

Truncated match.
'Pressure to MPH [OT]'
2000\05\10@162632 by

Andy wrote...
> Not for airspeed, for waterspeed.
>
> Bary pressure not a problem, as I can handle the zero-offset at startup.  These
> things are running on the surface of the water, I need to know how fast it's
> going (within reason).
>
> At this point I just need to figure out which sensor to use - they range from 1
> to 1000 kPa for full-scale.  Next will come the equations.
>
> Andy

This sounds like an inspired case for empirical data
capture.
Load up a full sized boat (with food and fishing rods) and
measure that sucker.
That should take...oohh.. a day.
Or Two if the weather is good!
_____________________________

Lance Allen
Technical Officer
Uni of Auckland
Psych Dept
New Zealand

http://www.psych.auckland.ac.nz

_____________________________

At 02:53 PM 5/10/2000 -0400, you wrote:
>I need to convert kPa to MPH or km/h for a quickie project.
>
>Anybody have the info I need?
>
>Andy
>
>

The routine below works mostly OK - it seems to have about a 20% error. If
anyone sees the problem please drop me a note.

Regards,

Jim Ham

/***********************************************************************\
*
* return indicated airspeed (kts)(assume std density at sea level
* also assume 80mv FS in A2D
* returns airspeed in 10ths of knots
*
\***********************************************************************/
int SpdLookup( ulong raw )
{
/*
return (int)sqrt( raw * 200 )/10 ;
*/

byte iteration ;
unsigned long guess ;
unsigned long last_guess ;

// 1 psi = 2.13e6 counts from A/D
// rho 2.378e-3 slugs/cu.ft - density of air at sea level
// p(psf) = 1/2 rho(slugs/cu.ft) V^2(ft/sec)
// p(psf) = raw / 14789 ;
// V(ft/sec) = sqrt( 2 * p /rho )
// 1 kt = 0.5925 ft/sec
// V(kts) = 0.5925*sqrt( 2 * p /rho )
// V(kts*100) = 59.25*sqrt( 2 * p /rho )
// V(kts*100) = sqrt( (59.25^2*2*raw) /(2.378e-3*14.789e3) )
raw *= 200ul ;
//***********************************************************************
//*
//* Take a square root - Newton's method
//*
//***********************************************************************
iteration = 20 ;
last_guess = guess = raw / 128  ;
do {
if (guess == 0l ) guess = 1l ;
guess += (raw / guess) ;
guess /= 2 ;
if (last_guess == guess) break ;
last_guess = guess ;
} while ( --iteration ) ;
return MakeInt(guess/10l) ;
}

Jim Ham, Porcine Associates
(650)326-2669 fax(650)326-1071
"http://www.porcine.com"

On Wed, 10 May 2000, Jim Ham wrote:

> The routine below works mostly OK - it seems to have about a 20% error. If
> anyone sees the problem please drop me a note.

Yeah the problem is that the PIC is getting bored taking such a long time
calculating the square root and is forgetting the answer before the algorithm
completes :). But seriously, if you need a square root routine I'd suggest
looking at James' pic pages  (what's the latest URL James?) or

http://www.dattalo.com/technical/software/pic/picsqrt.html

I've haven't been paying attention to the thread so I'm not sure what your
equation looks like.

Scott

{Quote hidden}

Latest URL? I don't remember
http://www.piclist.com/FAQ
ever changing.

The techref site has been all over the place and is now
http://techref.massmind.org
Which should not ever change.

---