Searching \ for 'my math error (was Weather Anamometer)' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=math
Search entire site for: 'my math error (was Weather Anamometer)'.

Truncated match.
PICList Thread
'my math error (was Weather Anamometer)'
1996\06\04@162411 by Scott Newell

flavicon
face
I just knew I'd screw up a sign somewhere.  Funny how the signs change once
your post makes it out across the list, isn't it?


Ok, let's assume that we have:

d = distance between ultrasonic sensors.
w = wind speed
v = speed of sound
t1 = time for left to right transit
t2 = time for right to left transit

(I'm gonna do the math assuming a positive wind speed means left to right; a
negative wind speed would then mean the wind is traveling from right to left)

From left to right, we get

d = rate * time
   rate = w + v        ; I'm assuming the wind is also from left to right
d = (w+v) * t1
d/t1 = (w+v)            ; we're gonna use this again, in a minute


Now, from right to left

d = rate * time
   rate = v - w        ; since we're going against the wind (not w-v as before!
)
d = (v-w) * t2
d/t2 = (v-w)            ; compare to above, this is the important part


Now, we can subtract.

(w+v)  -  (v-w) = 2w
(d/t1) -  (d/t2) = 2w

w = 1/2 ((d/t1) - (d/t2))


or, continuing on,

    1      (d * t2)        (d * t1)
w = ---  *  --------   -    --------
    2      (t1 * t2)       (t1 * t2)


    1       d * (t2 - t1)
w = ---  *  --------------
    2         (t1 * t2)


    d       t2 - t1
w = ---  *  ---------
    2       t1 * t2

Since you're gonna build the thing, you'll know the distance at compile
time.  Measure the transit time in both directions, and forget about the
speed of sound.


later,
newell

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...