PDA

View Full Version : Math Problem



rwskinner
- 1st March 2006, 01:10
Where am I going wrong on the following formula?

Bosch has a formula stating...

Lambda = (Xo2 / 3 + 1) / ( 1 - 4.76 * X02)

Then they show the following as references....

IP = 1.40
Xo2 = 12.0
Lambda = 2.42

This does not work given the above formula using 12.0% Xo2 or I'm doing Math Wrong.

Lambda = (Xo2 / 3 + 1) / ( 1 - 4.76 * Xo2)

Xo2 = 12.0
(12.0 / 3) + 1 = 5
1 - (4.76 * 12) = -56.12
5 / -56.12 = -0.089

Where am I going wrong?

rhino
- 1st March 2006, 02:07
Well if you're not using some kind of floating point software routine... the code you listed won't work. Picbasic only works with integers.
HERE'S (http://www.picbasic.co.uk/forum/showthread.php?t=3405) a good thread to read that speaks to the hardware side of why, and Here (http://www.emesystems.com/BS2index.htm#math)is a good reference as to get around the limitations of working with integer math. And finally, HERE (http://www.melabs.com/resources/fp.htm) is melabs solution.

rwskinner
- 1st March 2006, 03:39
I'm trying to get it to work on a calculator first, then work out the details on the pic. I'm not having any luck at either. This is a published formula, but I tried it in every operator precedence that I know of and can't make it work.

I posted here because of all the math gurus.

Ioannis
- 1st March 2006, 06:24
May be the 12% should be in your variable as 0.12 ?

Ioannis

jheissjr
- 1st March 2006, 07:59
Where is IP used in the equation and where are you getting this information from?

rwskinner
- 1st March 2006, 12:41
IP was nothing more than a reference number to lookup 12% on a table. The actual .12 is the number used to calculate Lambda.

This information, examples, and formula is from Page 10 of the Bosch LSU4 Datasheet.

eoasap
- 1st March 2006, 13:01
Ionnas is right, you need to use 0.12 for your 12 percent.
The reason is in the definition of 'percent'. for example,
50% is 50 out of 100, which is 50/100 which is 1/2. 12% is
12 out of 100 --> 12/100 = 0.12
one hundred percent would be just 1.00
one hundred and fifty percent would be 1.50

assuming you haven't gotten this on your calculator yet,
i took it step by step so you can see the order of operations.
hope it helps!

Lambda = (Xo2 / 3 + 1) / ( 1 - 4.76 * Xo2) (given equation)
= (0.12/3 + 1) / (1 - 4.76 * 0.12) (equation with values put in)
(perform division and multiplication inside parenthesis first)
= (0.04 + 1) / (1 - 0.5712)
(perform addition within parenthesis next)
= (1.04) / (0.4288)
(perform division of parenthesis last)
= 2.4253731

any modern calculator should be able to perform this if you enter it exactly
as it is written. it knows the order of operations and applys them.

(Xo2 / 3 + 1) / ( 1 - 4.76 * Xo2)
on your calculator do this:
( 0.12/3 + 1 ) / ( 1 - 4.76 *0.12 )

however, if you screw up the parenthesis, it'll give you wrong answer