Fuel calcs

Official FreeEMS vanilla firmware development, the heart and soul of the system!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fuel calcs

Post by Fred »

Well, the file calcs.c is at 300 lines already and 200 of them just obtain 10 basic input variables. I'm guessing it's about 15% complete, so I may cut it down into more functions or include.c files to keep it managable and clean/readable. I've laid it out in distinct stages and drawn up a todo list of stuff to add. I'll be having a solid think about what order to do everything and doing a bit of a writeup on it all soonish.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
gearhead
LQFP112 - Up with the play
Posts: 120
Joined: Sun Feb 03, 2008 9:30 pm
Location: Chicago, USA

Re: Fuel calcs

Post by gearhead »

Fred, Even if it is longish, I still think it is beneficial to have all the fuel calcs in one *.c file. Get to a final pulsewidth in this chunk. I do not even want to start talking about driving multiple injector sets, yet, but this chunk would be the start point for that.

Gearhead
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fuel calcs

Post by Fred »

gearhead wrote:Fred, Even if it is longish, I still think it is beneficial to have all the fuel calcs in one *.c file. Get to a final pulsewidth in this chunk.
I agree, I would prefer one file too. We'll see just how long and difficult to think about it gets. I'd draw the line at maybe 2k lines? That's border line excessive.

It could be as simple as calling a function to get initial vars, another to average them, another to get derived ones etc. Functions add overhead though.

Provided it is clean and organised into blocks with a nice sequential flow it should be OK in one file.
I do not even want to start talking about driving multiple injector sets, yet, but this chunk would be the start point for that.
Why not, I've already thought about it and it's ready to be coded once the things that precede it are done ;-)

I'm on the ball I tell you ;-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Fuel calcs

Post by MotoFab »

(P * VE * V)

Whenever looking at fuel equations, I can't help but to think about these two variables replaced with the actual measured volume so the whole thing works without tables.
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Fuel calcs

Post by MotoFab »

A minimum set of two Air Fuel Ratio points, based on load, is something to consider. 14.7 AFR is neither a Best Power ratio, nor a Best Economy ratio. 14.7 does result in the hottest cylinder head temps and hottest exhaust valves. Maybe good for warm-up or something.

Edit
thebigmacd
LQFP112 - Up with the play
Posts: 205
Joined: Thu Apr 10, 2008 5:51 pm

Re: Fuel calcs

Post by thebigmacd »

MotoFab wrote:A minimum set of two Air Fuel Ratio points, based on load, is something to consider. 14.7 AFR is neither a Best Power ratio, nor a Best Economy ratio. 14.7 does result in the hottest cylinder head temps and hottest exhaust valves. Maybe good for warm-up or something.

Edit
You are correct. Don't forget, it results in proper operation of the catalytic converter.

I would suggest a minimum of three or four points, the location of which in the rpm vs load plane may even be calculated from the basic engine parameters.

I would suggest a minimum:

Low load low speed (idle)
Low load high speed (cruise + decel)
High load low speed (out of the hole tip-in) <- might be able to cut this out and map the targets based on a three-point triangle (brought to you by the department of redundanacy department ;)) if not critical
High load high speed (somewhere well-placed in the power band[ peak power? peak torque? im thinking peak torque...VE tends to be high here])

Image
Keith MacDonald
Control Engineering (Systems) Technologist
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Fuel calcs

Post by MotoFab »

thebigmacd wrote:You are correct. Don't forget, it results in proper operation of the catalytic converter.

Image
The three point, idle, high load, and low load sounds good. I forgot about idle as a 'operating condition'.

The catalyst needs the Exhaust Gas Oxygen to swing back and forth above and below 14.7 AFR to operate. Excess oxygen bonds to the metals on the slightly lean swing, and oxidizes the fuel compounds on the slightly rich swing. The catalysts sort of breathes.
thebigmacd
LQFP112 - Up with the play
Posts: 205
Joined: Thu Apr 10, 2008 5:51 pm

Re: Fuel calcs

Post by thebigmacd »

I just played around trying to work out the algorithm to do the interpolation of three arbitrary points...it has eluded me so far.
Keith MacDonald
Control Engineering (Systems) Technologist
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Fuel calcs

Post by MotoFab »

Can the VE itself suffice as an above/below threshold value? Seems like a pretty good measure of load.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fuel calcs

Post by Fred »

Good discussion guys, but ALL variables in there are sourced for each calculation ;-)

So, my current thoughts on AFR are this :

8x8 <= AFR table <= VE table

Although, you could probably get away with less.

On top of this it would be possible to turn on a feature that switched the target back and forth when the input target was 14.7 (or close to it) for catalytic converter operation.

I think allowing the user to choose the shape of their AFR contour is a more flexible approach than interpolating based on the triangle of three points. I realise that would work well, but what if they want some waver somewhere for a particular reason, or rich in boost at 5k and slightly leaner at 7k etc. It wouldn't be enough control.

MAF support is intended and would do exactly what you say about replacing VE and V.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply