Injector Staging Bug?

All questions about MS2/Microsquirt/Microsquirt module. See also MS2/Extra manuals

Moderators: jsmcortina, muythaibxr

Post Reply
drdisco69
MS/Extra Newbie
Posts: 4
Joined: Tue Sep 05, 2006 6:56 am
Location: Charlotte, NC

Injector Staging Bug?

Post by drdisco69 »

I'm working on getting an engine running, and besides a bunch of other stupid problems, I found some odd behavior in the injector staging function using the stim (as other stupid problems prevent the actual engine from running). I'm using the latest stable release of the Extra code, 1.0.0. I set up all the triggers and everything starts to trigger fine. Using the smoothing option, I can watch the PW1 fall while the PW2 rises. But as the transistion completes, both values jump to some smaller value, lower than what the PW2 was transitioning up to. Both PW1 and PW2 become identical, and respond properly to sensor inputs. But I was confused as to why the primary injector would still run once the staging transition was complete. I looked in the staging code (I'm a coding noob, mind you) and found this at the end:

Code: Select all

if (transition_done) {
		calculated_pw2 = calculated_pw1 = calculated_base_pw;
	    }
	} else {
	    calculated_pw2 = calculated_pw1 = calculated_base_pw;
	}
So after staging is complete, PW1 and PW2 are set equal to each other? Yet at the very end of the whole staging routine, if the staging should be off, the pulsewidths are set as follows:

Code: Select all

pw_staged1 = base_pw;
	pw_staged2 = 0;
In this case, PW2 is disabled, and PW1 does it's thing. I would think the opposite would be true if staging was in effect: PW1 would be disabled, and all injection would rely on PW2. Otherwise, it would give staging_percent % extra fuel.

I'm going to run through the math in the code to see if this lower pulsewidth that they jump to is the right one for the larger injector. If so, it should be safe to change the code to set the PW1 to zero after staging is complete. But then again, I'm a programming doofus, so who's got the real answer? :D
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Post by muythaibxr »

No, the primary injectors are supposed to be on still even after staging is complete... Staging isn't designed to turn the primaries off, it's designed to reduce the pulse width by an amount (depending on the size of the secondaries in relation to the primaries) that will keep their duty-cycle down, while still providing enough fuel to run the engine.

In other words, it's doing what it should.

Ken
drdisco69
MS/Extra Newbie
Posts: 4
Joined: Tue Sep 05, 2006 6:56 am
Location: Charlotte, NC

Post by drdisco69 »

Ok, that makes sense then. In that case, what is the deal with the secondary pulsewidth rising to about 9ms, then jumping back down to around 5ms when the staging is complete? Changing the main setup options made the exact numbers change, but the secondary pulsewidth always rose and then jumped back to some smaller value when the staging transition was complete.
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Post by muythaibxr »

I have never seen that happen, I will have to reproduce that on the bench.

Ken
drdisco69
MS/Extra Newbie
Posts: 4
Joined: Tue Sep 05, 2006 6:56 am
Location: Charlotte, NC

Post by drdisco69 »

I datalogged the condition I described, and did some charts and fancy math and junk. First, the pulsewidth of the injector is multiplied by the mass flow rate of the injector. This value was then converted to cc/ms, and the sum of the fuel from both injectors was found. Basically, the sum of the fuel provided by both injectors doesn't add up to anything that makes sense, it's all over the place.

From what I can tell, there is no check to see if the amount of fuel injected is more than the required fuel. There is a check to see if there is overrun of the secondary pulsewidth, and if the set number of transition events has occured, but nothing that checks if the sum of the primary and secondary injectors is sufficient. In addition, the final value that the pulsewidths arrive at when they are equal is not the same as when the primary injector alone is running.
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Post by muythaibxr »

That is all as intended... (except I'm not sure your "charts and junk" are correct) as it depends on how large the secondary injectors are. With the primary and secondary injectors squirting at the same time, with larger secondaries than primaries, the pulse width might drop considerably after staging.

Basically, what we do, is based on the percentage difference between primary and secondary, we figure out an end pulse-width, then during the transition, we scale one down and the other up, finally meeting that end pulse-width.

The injector opening time is then added on top of whatever the calculated pulse-width is.

So:

say the primaries and secondaries are the same size, and you have an opening time of 1ms, and your final pulse-width is 9 ms:

9 ms - 1 ms = 8 ms actual fuel being injected....

say your injectors are 460 cc's for primarys, and 460 cc's for secondaries, which gives you 50% (meaning primaries are 50% of total flow when staging is engaged)...

8ms * 50% = 4 ms

4ms + 1 ms opening time gives 5 ms end pulse-width...

So 5ms + 5ms doesn't add up to 9 ms, but you have to add the opening time to EACH SET of injectors... the total amount of fuel going into the engine is still 8 ms per squirt, but there is 1ms of opening time per injector channel.

The transition code just brings in the secondaries a little bit a a time based on the number of ignition events you want them to come in over. There is a bug in the way I did that though... that code as it is will only work if the primaries and secondaries are the same size. I'll fix that problem in the 1.0.1 release. It is a bug in the way I ported the feature over from ms1/extra to ms2/extra.

I also went through the process of figuring out how many actual "cc's" of fuel are injected in the case of larger secondaries than primaries, and the number with staging on comes out to be VERY close to the number with only the primaries... enough that I'm sure it was only the fact that I'm using units of 1% on the staging_percent number that caused it to be off at all. With primaries and secondaries that are the same size, it came out EXACTLY right.

Ken
drdisco69
MS/Extra Newbie
Posts: 4
Joined: Tue Sep 05, 2006 6:56 am
Location: Charlotte, NC

Post by drdisco69 »

In our case, we're using a 310cc primary and a 750cc secondary, squirting E85 on a single cylinder. It just seems there's a big jump at the end of the transition, but if it works it works. Let me know when you've got the bug fixed, or just send the code so I can compile a test version. Thanks for your help on this, we've got the motor running just a few minutes ago on the engine dyno and we're working on tuning.
muythaibxr
Site Admin
Posts: 8230
Joined: Thu Oct 14, 2004 12:48 pm

Post by muythaibxr »

yeah, the jump at the end is likely due to the bug when using different sized injectors.

I'll post in this section when 1.0.1 is released.

Ken
Post Reply