Well, I really do not know where to start but again, I suggest you go to MegaSquirt and 'study up' on this whole topic. You could start with this page:
http://www.megamanual.com/v22manual/mtune.htmThere are two basic methods to control the air / fuel ration on any I.C. engine: speed- density and Alpha-N. Different devices use different systems but motorcycles generally (I believe always) use one induction system per cylinder (one throttle body, one fuel injector, and they are all isolated) and Alpha- N.
Fuel injectors are either open or closed so 'throttling' is accomplished by PWM or pulse width modulation. All fuel injectors have a flow rating, usually in the very odd 'pounds per hour' units. So, the first thing to do is to figure out how much fuel one cylinder of your engine can possibly ever use, under any circumstances and then get a fuel injector that will deliver that amount of fuel if open 85% of the time. Now you have the top RPM and 100% throttle open point of the look- up table.....
Then you construct a look- up table that corresponds with the RPM of the engine and the throttle opening (the X vs Y grid of the table). So the Y axis is engine RPM and the X axis is throttle opening in percentage.
For a rough tune, you can use the air / fuel ration of 12.5:1 (12.5 units of air for every 1 unit of fuel, measured in MASS, not volume). So for a crude example, if the engine's max. RPM is 10,000 RPM, and of course the max throttle opening is 100%, you will set the injector up to have a PWM ON-time long enough to deliver enough fuel to get to that 12.5:1 ratio. So at 5,000 RPM, the PWM On time is one- half of the 10,000 RPM value (assuming 100% throttle opening). Now of course in the real world it is not that simple and there are a LOT of other variables but let us just keep going with our crude example. So you make a look- up table for each, say, 500 RPM increment between 500 RPM and 10,000 RPM. And each 5% increase in throttle from 0 (which is really not zero because you want the engine to idle when the throttle is closed) and 100% open.
Now add to this the nominal air density measured by an absolute air pressure gauge, crank the data from the look- up table through an algorithm that adds / subtracts depending on the air density (for example, altitude changes) and Viola! you know how long to hold the injector open for each 2 engine rotations (remember, a 4- cycle engine has 720 degrees of rotation per cycle, not 360 degrees).
You will also need what is called a Lambda sensor or O2 sensor to know what the engine is really getting regarding fuel delivery. The more O2 in the exhaust, the more lean the mixture, and vice- versa. The nice Lambda sensors are the Bosch 5- wire types, readily available though you do need some electronics to use the data the sensor puts out and put it in some usable, workable form. Again, many devices on the market to do this.
As Lambda sensors are not fast enough to be used in real- time (about 1/12 th second response time), they cannot be used to actually close the control loop. But they are very useful to make minor corrections to the main control algorithm to 'tweak' the mixture for the exact conditions the engine is operating in. That said, they cannot be used even in an speed- density system above 70% throttle opening, at which point you go over to pure look- up table response and forget about any 'real time' input at all. But the Lambda sensor is invaluable, and I believe unreplaceable, for the initial setup of the system, the look- up tables and so forth.
Once you get to that point, you will have to figure out some other things such as injector lag time, hysteresis and a few other (dozen) natty problems but essentially, you will have a running engine.
You will need to sense the crankshaft position (or camshaft) so that you can 1) sense RPM, 2) sense when 'one cycle' is occurring. This is often done with a scheme called the 'missing tooth' scheme, where there are a series of teeth on the crankshaft that an inductive sensor 'watches' pass but there is one tooth missing; typically the number of teeth is 35 (with the one vacant or missing tooth, making 36 even divisions of 10 degrees each).
Now all of this is just the control loop or algorithm. There is still a lot of work to be done regarding venturi size, runner length, injector position and inclination (angle relative to the induction bore) but these are <relatively> small issues if you just want an engine to "work". The good news is that modern injectors such as the 4 and 5 port Bosch's, are actually outstanding regarding atomization of the fuel so putting the injector a bit in the wrong place or position is pretty forgiving.
But all this is just the tip of the iceberg, so to speak. It is a complex and involved subject, even to just do one engine, one time and not even looking for best performance.
The good news is that the PWM nature of fuel injection, along with modern control MPU's, sensors and lots and lots of real- world knowledge make this whole thing much more of a building- block process instead of a solo effort. Which means there are lots of building- block systems as well as knowledge out there to tap into without having to figure all this out.... again. :-) Sorta' like Nicola Tesla did the hard part, all we have to do is follow along and we too can make an induction motor work..... but that first one was a cast- iron B!TCH!
The first MegaSquirt system I set up used factory injectors in factory T.B.s but I had absolutely no idea what their value was. So I did it 'backwards' and made a look- up table based on 12.5: 1, then varied the size of the injector (in the set- up software) of the MegaSquirt and basically 'backed- out' the injector size. Once that crucial pivot point was reached, the rest was straightforward.
But in all seriousness, if you really want to learn how this stuff works, go read the MegaSquirt manual, concentrating on the Alpha- N part (trust me- that IS the easy one and speed- density is far more complex.... plus it does not work in a multi- induction system such as used on motorcycles).
Best of luck going forward.
Brian
I am just thinking out loud and as someone that has some experience I hope you read this and have an opinion.
Seems to me that each vehicle whether motorcycle or automobile has a look up table for setting the fuel injector pulse width based on a number of input variables mainly air flow.
Many of those look up table are available for download for free. But the problem is that they are for a specific vehicle and are not optimized for you vehicle, temperature, altitude and gasoline quality. So to use one of those tables would require you to modify it based on your conditions and which injector you are using and any other parameters that are pecular to your bike.. And It would vary based on the fuel you were using and whether you are at sea level or in the mountains.
So what I am getting at is this, why not use a powerful enough processor that you don't need to use a look up table but calculate the pulse width based on input parameters in real time. You could input your altitude, engine size, injector size and fuel type and have processor calculate the tables for you. If you are coming down from the mountains the air density could be calculated. If you change fuel you could flip a switch to tell the computer you are using ethanol . I think there are 32 bit processors with enough processing speed to do all this on the fly.
I mean, where did the look up tables come from in the first place...? They were calculated from a number of input parameters . So why not use the same formulas and do the same calculations but in real time?
Any thoughts?