View Full Version : Embedded if statements?
2002_z28_six_speed
July 1st, 2008, 10:53 AM
Before I go through alot of work...
would efi live calc pid support embedded iff's? six deep?
2002_z28_six_speed
July 1st, 2008, 12:27 PM
Yes. EFI live does support them it seems.
joecar
July 1st, 2008, 02:06 PM
iff(boolean_condition, then_calculation, else_calculation)
2002_z28_six_speed
July 1st, 2008, 03:25 PM
Such would be correct.
But no case statments, elseifs, do whiles or fors..... sigh
2002_z28_six_speed
July 1st, 2008, 03:25 PM
Basically I fabbed a casestatement from 7 embedded if statements. It is super hard to logically understand by just looking at it but it seems to work ok. It kinda guesses what gear I am in. Seems to work.
Garry
July 2nd, 2008, 06:24 AM
Cool ... care to share?
2002_z28_six_speed
July 2nd, 2008, 03:35 PM
Could do that. Do you have M6 or A4? I don't think it would work for A4 due to stall up and the 4L60E can only lock up in 3 and 4.
Basically, I took the theory that MPH/RPM was appox constant IN GEAR and fell in a certain range for each gear.
Like this:
IF MPH/RPM>X AND MPH/RPM<Y,
......gear = 6
..........ELSE
...............IF MPH/RPM > A AND MPH/RPM <B,
....................gear =5
..........................ELSE
........
the periods are to mark the position
I made a case for each gear and finally I stated if it isn't in any of those ranges just say 0. 0 could mean alot of slipping or not moving or in N.
What gears do you have? I wrote out code for my car. It is a M6 with 4,56 gears.
I can't test it much because my laptop battery dies in less than 1 min. I applied it to a logged file and it seemed to work. Haven't tested in real time yet.
joecar
July 3rd, 2008, 02:12 AM
lookup(x, a1,b1, a2,b2, a3,b3, ...)
let x = MPH/RPM
then gear = look(x, x0,0, x1,gear1, x2,gear2, x3,gear3, x4,gear4, x5,gear5, x6,gear6, x7,0)
Garry
July 3rd, 2008, 02:51 AM
Mine is an M6 w/ 3.73 ... sounds pretty straightforward ...
Ninety8C5
July 3rd, 2008, 03:18 AM
Mine is an M6 w/ 3.73 ... sounds pretty straightforward ...
Same here. I would be very interested if someone could work out the values as the PID GM.GEAR doesn't seem to work for the M6.
joecar
July 3rd, 2008, 04:55 AM
lookup(x, a1,b1, a2,b2, a3,b3, ...)
let x = MPH/RPM
then gear = look(x, x0,0, x1,gear1, x2,gear2, x3,gear3, x4,gear4, x5,gear5, x6,gear6, x7,0)I just remembered that lookup() interpolates between points... so this may not work in your case.
2002_z28_six_speed
July 3rd, 2008, 07:14 AM
Same here. I would be very interested if someone could work out the values as the PID GM.GEAR doesn't seem to work for the M6.
I got the values by looking at what RPMS i had at different speeds and different gears.
This can also be done by calculation instead of observation.
2002_z28_six_speed
July 3rd, 2008, 07:29 AM
I just remembered that lookup() interpolates between points... so this may not work in your case.
When I get home maybe I will look to see if EFI Live has an interger or round function.
2002_z28_six_speed
July 3rd, 2008, 12:01 PM
"iff({SAE.VSS.mph}/{SAE.RPM} > 0.0357 && {SAE.VSS.mph}/{SAE.RPM} < 0.0445,6,iff({SAE.VSS.mph}/{SAE.RPM} > 0.0255 && {SAE.VSS.mph}/{SAE.RPM} < 0.029857,5,iff({SAE.VSS.mph}/{SAE.RPM} > 0.01881 && {SAE.VSS.mph}/{SAE.RPM} < 0.022,4,iff({SAE.VSS.mph}/{SAE.RPM} > 0.014625 && {SAE.VSS.mph}/{SAE.RPM} < 0.0165,3,iff({SAE.VSS.mph}/{SAE.RPM} > 0.0108 && {SAE.VSS.mph}/{SAE.RPM} < 0.0121,2,iff({SAE.VSS.mph}/{SAE.RPM} > 0.0075 && {SAE.VSS.mph}/{SAE.RPM} > 0.007857,1,0))))))"
I think I have the wrong numbers or I have the syntax wrong and it isn't running right. Kinda shows the idea though. it hits 1 3 5 6 on my stored log. I want to test in real life but my lappy battery is dead. i ordered a new one and the fedex terminal is so far away...
I would suppose a 3,73 M6 would like these numbers better
First=====Second=====Third=====Fourth=====Fifth=== ==Sixth
0.0075===0.0108===0.014625====0.018=====0.0255==== 0.0375
0.00785===0.0121===0.0165=====0.022====0.02985==== =0.044
2002_z28_six_speed
July 3rd, 2008, 12:54 PM
Got my first mistake. I wrote up the equation for me with the 373 numbers. Guess that makes it easy for you. Maybe if I plug MY correct gear in there it will work better for me. lol
This site is useful btw
http://www.f-body.org/gears/
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.