PDA

View Full Version : Any way to define variables in a custom PID?



thunder550
March 31st, 2008, 07:28 PM
I wanted to see if it was possible to set up a variable that would continually add data values. I want to create an MPG PID that will not get thrown off when DFCO is enabled, but it would require a running total of fuel used and miles traveled. Is this possible?

kbracing96
April 2nd, 2008, 05:24 AM
TTT!!! I would like to know how one would go about this all so :) Something I'm VERY interested in.

kbracing96
April 3rd, 2008, 08:04 AM
Nobody knows how to make these pids add up??? :D

thunder550
April 3rd, 2008, 08:31 AM
Bueller?

Bueller?


Anyone?

joecar
April 3rd, 2008, 09:00 AM
I think it would require the integrate() function (which used to be in V5) and some conditional gating using the iff() function.

The itegrate() function sums up samples over time.

SSpdDmon
April 3rd, 2008, 09:53 AM
If you're logging MPG over a period of time, why wouldn't you want to log when in DFCO? The pure purpose of it is to save on gas when off the throttle.

When you drive, logging MPG from the time you start the car to the time you shut it off should give you an accurate representation of what you're looking for. Knowing where to look is key. You're basically asking for the average for a distance traveled. So, make a map (F11) with MPG as the data value and hit the X for the average value.

kbracing96
April 3rd, 2008, 10:08 AM
If you're logging MPG over a period of time, why wouldn't you want to log when in DFCO? The pure purpose of it is to save on gas when off the throttle.

When you drive, logging MPG from the time you start the car to the time you shut it off should give you an accurate representation of what you're looking for. Knowing where to look is key. You're basically asking for the average for a distance traveled. So, make a map (F11) with MPG as the data value and hit the X for the average value.


See, that doesn't work. The only PID we have is INSTANT MPG, which the average of is NOT true MPG. It way over compensates when in DFCO and does not subtract when you are stopped, cuz it setting at 0 and your still burning fuel. Only way to get TRUE average MPG is to is to divide miles traveled by fuel used for the entire log. Make since?

TAQuickness
April 3rd, 2008, 10:22 AM
Not trying to be a smart ass, but when you are sitting idle with the engine running aren't you getting 0 mpg?

I've used the custom MPG PID, found somewhere in this forum, and compared it to actual tank top off's and have found it to be very accurate. Also, my Dakota has one of those average MPG gizmo's by the rear view mirror and I've found it to be accurate withing .2 MPG between fillups.

It's not the same as what y'all are after, but food for thought.

kbracing96
April 3rd, 2008, 10:34 AM
Not trying to be a smart ass, but when you are sitting idle with the engine running aren't you getting 0 mpg?

I've used the custom MPG PID, found somewhere in this forum, and compared it to actual tank top off's and have found it to be very accurate. Also, my Dakota has one of those average MPG gizmo's by the rear view mirror and I've found it to be accurate withing .2 MPG between fillups.

It's not the same as what y'all are after, but food for thought.


Think about this.... Your INSTANT average is running about 18.2 MPG's on the scanner. Then you stop. Its now sitting at 0, BUT your still burning fuel, so your average MPG should be going down, right? But its not, cuz it's at 0 and not a negative number since your stopped but still burning fuel.

I've used the pid several times, it seem pretty accurate right up until I stop or go into DFCO and it shoots up into the 300 MPG range which RAPIDLY brings the average INSTANT WAY up. See what I'm getting at here. As long as you moving and not getting into DFCO it is pretty accurate, but it's still no as true as if you divided miles traveled buy fuel used. That's all I want guys, :)

thunder550
April 3rd, 2008, 06:06 PM
If you're logging MPG over a period of time, why wouldn't you want to log when in DFCO? The pure purpose of it is to save on gas when off the throttle.

The problems is that the MPG PID assigns some arbitrary value when the truck goes into DFCO mode. The calculation is done as follows:

{SAE.VSS.mph}/({GM.INJFLOW.lbpm} * {GM.IBPW1} * {SAE.RPM} * 4 / 6250 )

When DFCO mode is enabled, injector base pulse width goes to zero, which makes this whole equation a divide by zero equation. It's not possible to include DFCO situations in the MPG average because of this, which makes it very inaccurate when factoring in DFCO situations. Because of this, the only way to get a good average that includes DFCO situations is to sum distance traveled and fuel used, and calculate the average with those two variables.

thunder550
April 3rd, 2008, 06:18 PM
I think it would require the integrate() function (which used to be in V5) and some conditional gating using the iff() function.

The itegrate() function sums up samples over time.

Can you give any more insight on the syntax of these two functions?

joecar
April 4th, 2008, 03:04 AM
integrate(y): sum all values of y from frame zero upto the current frame, where y would be an expression involving pids;
this has function been absent since V5 changed to V6, it's not available (and it will slow down your PC if it's older);
you would create a calc pid that uses this (you would have to scale it);
for example, you would use this to calculate distance traveled given a log of vehicle speed.

iff(a, b, c): if a is true, then return b, else return c, where a, b, c are expressions involving pids;
you would use this to select b or c based on the value of a.

See page 93 of the scantool manual pdf.

thunder550
April 4th, 2008, 07:14 PM
Thank you :)

Highlander
June 14th, 2009, 10:53 AM
integrate(y): sum all values of y from frame zero upto the current frame, where y would be an expression involving pids;
this has function been absent since V5 changed to V6, it's not available (and it will slow down your PC if it's older);
you would create a calc pid that uses this (you would have to scale it);
for example, you would use this to calculate distance traveled given a log of vehicle speed.

iff(a, b, c): if a is true, then return b, else return c, where a, b, c are expressions involving pids;
you would use this to select b or c based on the value of a.

See page 93 of the scantool manual pdf.

how do you integrate 2 conditional iff(?

like: iff(x,yes,iff())

If i use that syntax they do not resolve.

joecar
June 15th, 2009, 02:31 AM
Do you mean: iff(a, b, iff(w, x, y))

Which means:
if a then b
else if w then x
else y

I'll try it...

Highlander
June 15th, 2009, 02:46 AM
that doesn't resolve joecar... it will output 0.
Paul told me to use the lookup () function... I'll check how it works to see if it works..

I just want to do a correleation between rpm and vss to know which gear I am in (m6).

Thanks