The range check is a very weird and nonsensical idea. For a start you're inferring that the table goes to near-zero RPM, or that the engine is never at near-zero RPM and in need of some love. Or that it's an error to be cranking. You're also suggesting putting the upper bound at or above the rev limit, usually a brain-dead thing to do. Especially on a resource-limited device where you want to stretch your data all you can by putting the end RPMs approximately a half gap away from each extreme.
Re the double check, good spotting, here's my broken impl, for what it's worth, lines 133 - 149 http://builds.freeems.org/firmware/mast ... tml#l00133
There are some bugs outside of that line range.
Fred.
Arduino go kart EMS
Re: Arduino go kart EMS
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!
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!
Re: Arduino go kart EMS
Thanks guys, that does seem really obvious in hindsight
Too much late night coding!
That whole table area definitely needs a good going over as there's multiple areas where things can break or do less than desirable things under certain circumstances. The goal at this point is really just to get it into a state that will actually run an engine and then start reviewing things in more detail.
Thanks for the code link also, very useful!
Too much late night coding!
That whole table area definitely needs a good going over as there's multiple areas where things can break or do less than desirable things under certain circumstances. The goal at this point is really just to get it into a state that will actually run an engine and then start reviewing things in more detail.
Thanks for the code link also, very useful!
Re: Arduino go kart EMS
Regarding the math processing time on an Arduino, set a timer and measure the function. Send the result through the environment's serial monitor. At 10,000 revs a combustion cycle happens every 0.006 seconds. That's quite a long time to figure out a shot of fuel I think.
If measurement proves not enough clocks between combustion cycles, there are some division shortcuts to be had with interpolation. In addition to the bin values in the fuel table, make two more tables containing the slope value between bins. One table for the slope between column entries, the other for the slope between row entries. All values converted to integer of course.
To explain that a little, if the fuel table is 8x8, then the column slope table will 7x8 and the row slope table will be 8x7. I may have that backwards but you get the idea. There's one fewer slope bin than there are fuel bins. Like one fewer spaces than pickets in a fence.
Regarding figuring out new slope values each time a fuel bin is changed, I'm somewhat confident the slope values can be determined automatically with some sort of preprocess directive for the compiler.
If measurement proves not enough clocks between combustion cycles, there are some division shortcuts to be had with interpolation. In addition to the bin values in the fuel table, make two more tables containing the slope value between bins. One table for the slope between column entries, the other for the slope between row entries. All values converted to integer of course.
To explain that a little, if the fuel table is 8x8, then the column slope table will 7x8 and the row slope table will be 8x7. I may have that backwards but you get the idea. There's one fewer slope bin than there are fuel bins. Like one fewer spaces than pickets in a fence.
Regarding figuring out new slope values each time a fuel bin is changed, I'm somewhat confident the slope values can be determined automatically with some sort of preprocess directive for the compiler.
Last edited by Fred on Tue Feb 19, 2013 11:32 am, edited 1 time in total.
Reason: Remove noise from noisymime's thread.
Reason: Remove noise from noisymime's thread.
Re: Arduino go kart EMS
Currently performing 2 squirts per cycle as I don't plan on having any phase info available, so that further cuts the time between squirts down to 0.003. The math is definitely a concern, but it's also things like an analog read from the MAP sensor that are chewing up the time. Hell, even flipping digital IO pins comes with a small delayMotoFab wrote:Regarding the math processing time on an Arduino, set a timer and measure the function. Send the result through the environment's serial monitor. At 10,000 revs a combustion cycle happens every 0.006 seconds. That's quite a long time to figure out a shot of fuel I think.
I've been using the serial monitor for some basic benchmarking, learned very early on that it is a seriously slow piece of work, so need to be careful to make sure it's not interfering with things at all.
-
- DIP8 - Involved
- Posts: 24
- Joined: Fri May 10, 2013 5:43 am
- Location: Auckland, New Zealand
Re: Arduino go kart EMS
OP you might be interested in this
http://sourceforge.net/projects/arduems/
I did not write the code, just made it work on arduino.
Only uses 12kb program memory so the ATmega328 is not even half full.
Not quite ready for use as I'm sorting out hardware at the moment, but almost there
http://sourceforge.net/projects/arduems/
I did not write the code, just made it work on arduino.
Only uses 12kb program memory so the ATmega328 is not even half full.
Not quite ready for use as I'm sorting out hardware at the moment, but almost there
Re: Arduino go kart EMS
That's a pretty nifty bit of code, certainly looks very feature complete. What was the source for it?
-
- DIP8 - Involved
- Posts: 24
- Joined: Fri May 10, 2013 5:43 am
- Location: Auckland, New Zealand
Re: Arduino go kart EMS
the original source is in the downloads area. was for atmega128
The newest code I have of msavr has an event queue where you insert events into a binary heap. It makes it a lot easier to insert and schedule events, but it compiled to ~54kb so won't fit on the atmega328. It also has EDIS control which is easy once you have a relatively high precision event queue
The code is supper messy tho, don't blame me lol
The newest code I have of msavr has an event queue where you insert events into a binary heap. It makes it a lot easier to insert and schedule events, but it compiled to ~54kb so won't fit on the atmega328. It also has EDIS control which is easy once you have a relatively high precision event queue
The code is supper messy tho, don't blame me lol
Re: Arduino go kart EMS
Noisymime, it's the old MS AVR project code, IE, VEMS early code. It's a direct clone of MS1 in C, really. It's probably patent encumbered too, though the patents are laughable. For pretty much every reason, I'd not touch it with a barge pole.noisymime wrote:That's a pretty nifty bit of code, certainly looks very feature complete. What was the source for it?
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!
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!
-
- DIP8 - Involved
- Posts: 24
- Joined: Fri May 10, 2013 5:43 am
- Location: Auckland, New Zealand
Re: Arduino go kart EMS
noisymime did you get it working without floats? do you mind posting up your final interpolation code?
Re: Arduino go kart EMS
I haven't got my whole thing up and running yet (Though it is syncing with a 12-1 wheel on the bench. Not huge I know, but a milestone)crazyafrican wrote:noisymime did you get it working without floats? do you mind posting up your final interpolation code?
The float free interpolation code though is definitely working. It probably has a few edge case bugs, but feel free to check it out: https://github.com/noisymime/Kartduino/ ... er/table.h