PDA

View Full Version : Using the value() function with calculated PIDs



Draco
April 23rd, 2005, 02:15 PM
Hi guys,

I am working on a custom PID to calculate horsepower based on changes in Kinetic Energy of the car over time (like a dynojet works). I am trying to break up this PID into several pieces to make it easier to read, however I am having a bit of trouble with the value() function. I have a calculated PID which determines kinetic energy, and I am trying to determine the value of this PID, 10 frames in the past.

The pid calculates fine when I close the log file and re-open it after logging, however it will not calculate 'on the fly' while logging occurs.

So, does Value({CALC.PID}, frame) where frame is any frame in the past only work "offline"? I have the same problem with the dx() function, where it wont calculate the rate of change in Kinetic Energy, my calculated PID when logging. Perhaps calculated PIDs are not usable in these function if you want to seem them in real time?

Thanks guys, hope this question is clear enough.

Blacky
April 27th, 2005, 12:19 AM
I have been investigating this issue, there is a bug with the value() function when the specified frame is less than 0 or greater than the number of frames. No bounds checking is performed - at best random data will be returned, at worst it will crash the EFILive Scan Tool program with an "Access Violation" error.

Say you wanted to calculate the rpm 10 frames ago, do it like this:
value({SAE.RPM},frame()-10)
Just be aware that there will be problems displaying the first 10 frames due to the requested frame being less than zero.

Also another bug was found while testing, the unary operators were not implemented correctly :oops: :oops: :oops:
That means expressions that have only one operaand like "-10" will evaluate to random values.
Note: the expression "frame()-10" will evaluate correctly because it is a binary expression - it has two operands.

Both bugs have been fixed in the next release.

Regards
Paul