Rules instead of maps?

Official FreeEMS vanilla firmware development, the heart and soul of the system!
Rufe0
TO220 - Visibile
Posts: 13
Joined: Fri Jul 17, 2015 11:54 pm

Rules instead of maps?

Post by Rufe0 »

Hello

I'm new to the forum, never built an ECU or had much experience with them but I am a tinkerer, a programmer, and very interested in engines.

It strikes me that an ECU could run an engine based on a few simple mathematical rules instead of maps.

I was wondering if there where any good reasons to use maps instead of a rule based system?

My hypothesis is that when ECU's where first developed the hardware was lacking in speed and power, making it faster to lookup a value in memory rather than calculate it. By the time hardware caught up maps would be the industry standard, but surely now we have the hardware to calculate the values on the fly?

Having a rule based system would be beneficial to the tuner in that there would only be a handful of rules and values to tweak.

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

Re: Rules instead of maps?

Post by Fred »

On the contrary, we use tables because they're easy and fast to calibrate. Models are difficult to understand, and to model the typical curves of a million engines would be very difficult indeed, as the shapes vary wildy. OEMs use models, however they have large budgets and entire teams of engineers to develop calibrations with.
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!
Rufe0
TO220 - Visibile
Posts: 13
Joined: Fri Jul 17, 2015 11:54 pm

Re: Rules instead of maps?

Post by Rufe0 »

Hmm the kind of formulas I'm thinking of would definitely be easier than maps and probably would fit all types of engines with only a few tweaks of a couple values.

I can see how some engines, variable valve timing etc would start to get considerably more difficult but still doable.

Consider a basic engine with fixed valves and intake geometry, throttle by wire so pedal position sensor, throttle servo, rpm sensor, knock sensor, temperature sensor and lambda sensor.

Startup rules would be something very simple like increase fuel by X% for 1min or until temp > 80degrees C or whatever, retard spark by Y% etc, simple stuff.

Then you would have a system where you have a target RPM(pedal position sensor) and actual RPM , if there is a discrepancy adjust throttle servo accordingly based on a percentage of a max aggressiveness value. This would give you an acceleration factor which is a temporary number which tells the rest of your code if the engine is trying to accelerate and by how much. Its a bit like tuning a servo motor on a CNC machine if you've ever done that. Basically just a few values which control how aggressively the algorithm tries to match the target and actual speed which stops overshooting and hunting.

Then you have a loop that would check the AF ratio and adjust your injector timing as necessary, factoring in a value that adjusts AF ratio based on acceleration factor.

Same for spark timing, adjust timing based on RPM*spark value+ any adjustments needed based acceleration factor + knock value.

Then simply max and min RPM.

Thats 4 tuning values and 3 or 4 basic parameters. The code needed to run it would be probably 4 or 5 code blocks probably couple hundred lines max.

You could easily optimize the 'tune' of this system by driving around, logging the acceleration factor, adjusting your values, rinse repeat untill you have a lowest average acceleration factor, meaning that the engine is achieving the desired RPM more of the time. It would even be easy to have the ECU adjust itself with some sort of learning algorithm based on average acceleration factor.

It could get more complicated if you have to set tuning values based on RPM instead of fixed values but still relatively easy to use.

Am I wrong?
Rufe0
TO220 - Visibile
Posts: 13
Joined: Fri Jul 17, 2015 11:54 pm

Re: Rules instead of maps?

Post by Rufe0 »

Obviously I left out that you need a crank position sensor and a code loop that would handle each cylinder based on crank position or whatever.
User avatar
sim
LQFP112 - Up with the play
Posts: 112
Joined: Thu Jun 02, 2011 8:17 pm

Re: Rules instead of maps?

Post by sim »

Carburettors and distributors use rules.
<@TekniQue> but in the end, it's code that makes a computer useful
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Rules instead of maps?

Post by Fred »

Rufe0 wrote:Am I wrong?
Basically, yes :-) I don't have time to go into it more, though. Sorry.

PS, sim's post was before he could see your last two posts. Whether that affects what he'd have written, I don't know. Probably not much.
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!
Rufe0
TO220 - Visibile
Posts: 13
Joined: Fri Jul 17, 2015 11:54 pm

Re: Rules instead of maps?

Post by Rufe0 »

Could you possibly go into detail when you have more time?
reanimotion
QFP80 - Contributor
Posts: 34
Joined: Sun Apr 14, 2013 8:50 am
Location: Australia

Re: Rules instead of maps?

Post by reanimotion »

Table based mapping is done because it's easy, not because it's the only correct way.
Model based engine control is just simply difficult and very engine specific by nature, which is why virtually every generic ECU avoids it.

Look at true VE and pulse width fuelling, some of the high end systems avoid even VE because it's not as easy to explain to the end user.
Some claim they use VE but don't, and others claim they only need milliseconds of fuel, and some are just misguided or following tradition.

There are still correction tables even in the OEM world regardless of the control strategy as engines are just not able to play nice and follow rational formulae.
Have a look at the SAAB Trionic8 system for a pretty well documented torque demand/delivery model, Bosch ME-Motronic might also be a relevant reference.

Given enough time and money anything is possible, so if you have an idea and some time to spend on developing it, then go ahead and have a whack at it.
The task won't be easy, but you know that :)
Steve
1981 Porsche 928S Bosch KE3-Jetronic Injection with FrankenCIS http://www.FrankenCIS.com
reanimotion
QFP80 - Contributor
Posts: 34
Joined: Sun Apr 14, 2013 8:50 am
Location: Australia

Re: Rules instead of maps?

Post by reanimotion »

Rufe0 wrote:Having a rule based system would be beneficial to the tuner in that there would only be a handful of rules and values to tweak.
This is probably the sticking point, "tuners" aren't rocket scientists so there is going to be a bit of resistance to learning new things, new concepts and the science behind them just wont be an easy sell.
Steve
1981 Porsche 928S Bosch KE3-Jetronic Injection with FrankenCIS http://www.FrankenCIS.com
Rufe0
TO220 - Visibile
Posts: 13
Joined: Fri Jul 17, 2015 11:54 pm

Re: Rules instead of maps?

Post by Rufe0 »

Hmmm OK so I think I'd like to have ago at making a virtual mathematical engine which I could write control algorithms for and run on a virtual dyno to see how well the control algorithm works.

I can see this being very useful but it would have to do a decent job of replicating a real engines oddities.

Writing the simulation and the control mechanism means I could easily get into a situation where I'm setting it up to work perfectly every time which wouldn't be useful at all.

Do you think it's feasible? Would it be useful? Is there already something out there like this? Would you be willing to help?

I guess for a start I would need a detailed list of all engine parameters, what effect a high value would have and what effect a low value would have. Assume I know nothing about engines at all.

Thanks Rufe0
Post Reply