Megasquirt Forum Area is for discussing Megasquirt EMS

Megasquirt Running with Fuel!!!

Old Dec 7, 2005 | 10:38 AM
  #51  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
Alright, just an update...

I did some mods to my idle advance code, and I've gotten about 75% of the way done with the staging transition code.

I've made it configurable from 0 to 255 ignition events for the transition, and tonight I'll just be writing the code to actually do the transition (I'm changing where it does the transition in the code to make it easier to do a timed gradual transition, and figuring out exactly how it was done already took the bulk of my time last night.... about an hour or so for coding).

So hopefully by the end of tonight or tomorrow I'll have something worth trying out in a car... and it's also possible that tofuball will have tried it.

After I get this stuff done, I'll try to implement the multiple transitions (KPA+RPM) with the and/or functionality.
Reply
Old Dec 7, 2005 | 06:37 PM
  #52  
Rex4Life's Avatar
Thread Starter
RX-7 Alumni
Tenured Member 10 Years
 
Joined: Oct 2002
Posts: 1,140
Likes: 1
From: Spacecenter Houston
Originally Posted by muythaibxr
Alright, just an update...

So hopefully by the end of tonight or tomorrow I'll have something worth trying out in a car... and it's also possible that tofuball will have tried it.
Sounds great Ken! I'll be ready to run it but not sure if I'll have wbo2--I think my sensor is going out .

I have been driving with the 4k rpm transition and while not as bad, it is still noticable. I may have one descent log w/good AFR readings.

Scott
Reply
Old Dec 7, 2005 | 07:14 PM
  #53  
Parastie's Avatar
Mountain Rotary Mod
Tenured Member 05 Years
 
Joined: Nov 2003
Posts: 2,411
Likes: 0
From: Freaking Poland!!
This is awesome! By the time my car is put back to together, the megasquirt will be nearly perfect!
Reply
Old Dec 7, 2005 | 10:04 PM
  #54  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
I managed to get some done with it tonight, but only had an hour to work... I need probably another 2 or 3, but I'm still working on it.
Reply
Old Dec 8, 2005 | 07:16 PM
  #55  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
another update, I got the code written and compiling/assembling, I changed the logic significantly from what I was doing before, and that made it a lot more simple.

I'll try to test it tonight if I have time, otherwise I'll have to get to it this weekend sometime.

After that's well tested, I'll add the and/or with a second parameter functionality.
Reply
Old Dec 8, 2005 | 09:25 PM
  #56  
renns's Avatar
Rotary Enthusiast
Tenured Member 20 Years
 
Joined: Oct 2001
Posts: 1,022
Likes: 4
From: Ontario, Canada
Ken,

What's the algorithm you came up with? Does it work with various primary/secondary injector size combinations? I took a quick look at my old blended transition code, and it was written assuming identical primary and secondary injector sizes, and would not be well-suited to injectors of differing sizes. After thinking about it further, it might be easier to simply add a transition enrichment feature, very similar to accel enrichment, rather than trying to calculate separate primary and secondary pulse widths during that transition period.

Here's what I'm thinking: Use two config bytes, one for the pulse width adder when in transition mode (transition adder), and the second to determine the number of cycles over which to add this extra fuel. With each subsequent squirt, reduce the transition adder. Pseudocode as follows:

if (conditions for staging = true AND counter = 0) then (transition = true AND staged = true)
if conditions for staging = false then counter = 0 ; reset counter when exiting staged mode
calculate staged pw ; as in present code
if (transition = true AND counter < transition cycles) then ; set transition bit when staged logic = true
staged pw = staged pw + (transition adder) * (transition cycles - counter)/transition cycles
end if

increment the counter with each squirt

It could easily be further modified to use a constant pulse width adder for the first 'x' cycles as well. Also, users who have no need for this modification could disable it by simply setting the transition adder constant to zero.

I'd love to see fuel rail pressure datalogged during that transition event. It's very possible that firing all four injectors simultaneously causes rail pressure (and therefore fuel delivered) to drop considerably. Perhaps the dynamics of the system are such that there is a delay prior to the pressure regulator compensating for the new operating conditions, or maybe the VE table itself compensates once you move past that transition event?
Reply
Old Dec 8, 2005 | 10:24 PM
  #57  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
The algorithm I came up with should take care of both Injectors of indentical and differing sizes, and should take care of a VE that changes over the course of the transition.

My logic for turning off and on the staging transition is similar to yours, except I have it set up such that if REStaging is set, but StgTransitionDone is not set, it assumes it's supposed to be transitioning, and increments a counter (lets call this StgTransitionCnt) every ignition event. If StgTransitionDone is set, it uses the staged pulse width for both.... I reset the counter almost exactly how you describe it. I decide if StgTransitionDone should be set if StgTransitionCnt == StgTransition (StgTransition is the configurable transition count).

For the staging transition period (I'm leaving out the injector opening time here to make it easier to explain), I made the number of ignition events configurable from 0 (old behavior) to 255 (lets use StgTransition as the variable). I also created another variable, which I called pw_staged2...

I allow your normal calculation of pw_staged to complete, and then use the following for the amount of fuel to increase the secondary by and decrease the primary by:

pw_staged2 (during transition) = (pw_staged / StgTransition) * StgTransitionCnt
pw_staged (during transition) = tmp11 - (((tmp11 - pw_staged) / StgTransition) * StgTransitionCnt) where tmp11 is the total pulse width passed into your staged calculation subroutine.

The only thing I have left to do is to add a little code to round up a bit when the divisions end up less than .1 ms (I just realized that part).

After getting pw_staged and pw_staged2, I changed the part of the code that was setting the pulse widths of pwcalc1 and pwcalc2 so that pw_staged and pw_staged2 are used instead of just pw_staged.

I'm sure I've missed a thing or two here or there (like the rounding above in the case of 0 answers with remainders in divisions above), but I think I can get it all working in a satisfactory manner after some testing... If anything with the rounding I plan on doing, during the transition, the AFR will go slightly rich (from being a little too rich by .1 ms or so on the secondaries).

As for your pressure drop stuff, I think the way the stock ECU compensates is by turning off vacuum to the fuel pressure regulator when the secondaries come on... That's also how I plan on tuning my cars.... (letting the MS control the fuel pressure regulator solonoid). I think the pressure drop is most likely a momentary thing when the secondaries first come on... making sure that no vacuum is getting to the FPR will maximize the pressure, getting rid of anything but a temporary pressure drop... besides, from my reading, I believe all 4 injectors fire in batch after the transition on the stock ECU, which is exactly what we do after the transition...

Last edited by muythaibxr; Dec 9, 2005 at 09:58 AM.
Reply
Old Dec 9, 2005 | 06:50 AM
  #58  
renns's Avatar
Rotary Enthusiast
Tenured Member 20 Years
 
Joined: Oct 2001
Posts: 1,022
Likes: 4
From: Ontario, Canada
Ken,

Your algorithm should work fine. I checked it via spreadsheet, and assuming the injector opening time compensation is applied correctly (scale _active_ pulse widths, not _commanded_ pulse widths), it works out perfectly.

As for your pressure drop stuff, I think the way the stock ECU compensates is by turning off vacuum to the fuel pressure regulator when the secondaries come on... That's also how I plan on tuning my cars.... (letting the MS control the fuel pressure regulator solonoid).
This may be something you want to reconsider. The whole purpose of the regulator is to maintain a constant pressure difference across the injectors (rail pressure vs manifold pressure). If you arbitrarily yank the manifold pressure reference at certain times, other compenstations in code will be needed. This proposed scheme would be devastating in a turbo application, as manifold pressure may be above ambient in that case, so fuel pressure would drop, and a lean condition would result.

[quote]I think the pressure drop is most likely a momentary thing when the secondaries first come on... making sure that no vacuum is getting to the FPR will maximize the pressure, getting rid of anything but a temporary pressure drop... besides, from my reading, I believe all 4 injectors fire in batch after the transition on the stock ECU, which is exactly what we do after the transition...[/qoute]Have you scoped the injectors running on the stock ecu to verify this? If you've got the means to do that, it'd be another 'interesting to know' tidbit.
Reply
Old Dec 9, 2005 | 09:05 AM
  #59  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
Yeah, I hadn't considered the turbo case... on an NA engine, turning off vacuum to the regulator makes perfect sense because that'll maximize the fuel pressure... On a turbo, I would guess that you'd want the pressure going into the regulator to increase the fuel pressure even more... I didn't see anything in the FSM that says how they turn that solonoid on and off on the NA, I'll have to take a look at the turbo to see what they do, or maybe even just have someone drive a stock S4 around, and see what the ecu does and when...

The only thing I noticed with my algorithm is that if you specify too many ignition events for it to transition over, and the original pw_staged is too small, you'll end up rounding up from 0 with a remainder to .1 on the divisions... and then you'll end up reaching the end of the transition a bit sooner than the user specified... So the ignition events setting is really a "max" igntion events setting due to the .1 ms resolution of the megasquirt (due to the fact that we're using a single byte to hold the pulse width). This is fine with me, and can be well documented... Once I add code for a second parameter for staging, it'll be possible to just have staging on when the pulse-widths will be high enough to avoid this problem. (based on rpm/map for example)

Last edited by muythaibxr; Dec 9, 2005 at 09:14 AM.
Reply
Old Dec 9, 2005 | 10:01 AM
  #60  
Parastie's Avatar
Mountain Rotary Mod
Tenured Member 05 Years
 
Joined: Nov 2003
Posts: 2,411
Likes: 0
From: Freaking Poland!!
I'm not certain if you guys knew this or not, but there's a thread in the 2nd gen section in regards to how the stock staging works.
Originally Posted by RETed
To go into a little more detail...

Primaries are fired sequentially under ~3,800RPM or so.
They alternate firing front versus rear.

At the fuel injector crossover, the primaries and secondaries are all batch fired.
So the pulsewidth is dropped, and all 4 fuel injectors fire at the same time.

That hesitation is typical grounding problems, as the current requirements are suddenly doubled due to all the fuel injectors are firing at that point.
Bad grounding will cause all kinds of headaches due to the sudden increase in current demand.
Don't know if this helps you guys or not.
Reply
Old Dec 9, 2005 | 11:03 AM
  #61  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
yeah I saw that thread... the main thing I'm wondering is when does mazda have the stock fuel pressure regulator solenoid on/off.
Reply
Old Dec 11, 2005 | 01:25 PM
  #62  
KamakazieX's Avatar
Senior Member
Tenured Member 05 Years
 
Joined: May 2005
Posts: 283
Likes: 0
From: MA
I think the only solution for this is an upgraded pump and going from 40psi to about 50-55. The stock ecu doesnt push the injector duty cycle above something like 65
Reply
Old Dec 11, 2005 | 02:07 PM
  #63  
turbosa22c's Avatar
Full Member
Tenured Member 05 Years
 
Joined: Jun 2003
Posts: 157
Likes: 0
From: honolulu
in the service manual it says that vacuum is cut from the fuel pressure regulator for above 50 seconds after cranking if coolant temp is above 60C and Iat is above 60C

To prevent percolation of the fuel during idle after the engine is restarted, vacuum is cut to the pressure regulator increasing fuel pressure.
Reply
Old Dec 11, 2005 | 03:18 PM
  #64  
Rex4Life's Avatar
Thread Starter
RX-7 Alumni
Tenured Member 10 Years
 
Joined: Oct 2002
Posts: 1,140
Likes: 1
From: Spacecenter Houston
Originally Posted by turbosa22c
in the service manual it says that vacuum is cut from the fuel pressure regulator for above 50 seconds after cranking if coolant temp is above 60C and Iat is above 60C

To prevent percolation of the fuel during idle after the engine is restarted, vacuum is cut to the pressure regulator increasing fuel pressure.
That sounds reasonable to me. I always knew the FPR vacuum was cut on hot start but couldn't figure out why it needed more fuel--guess it really doesn't--more to do with the physics of keeping the fuel from boiling.
Reply
Old Dec 11, 2005 | 03:31 PM
  #65  
renns's Avatar
Rotary Enthusiast
Tenured Member 20 Years
 
Joined: Oct 2001
Posts: 1,022
Likes: 4
From: Ontario, Canada
To prevent percolation of the fuel during idle after the engine is restarted, vacuum is cut to the pressure regulator increasing fuel pressure.
Now that makes much more sense. I really couldn't see Mazda fiddling with the regulator reference signal to modify fueling when the ecu could simply change pulse width to perform the same task. When in that hot-start operating mode I bet they run a reduced pulse width to compensate.
Reply
Old Dec 11, 2005 | 08:42 PM
  #66  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
hrmm, don't think there's currently any way to have a single output trip on 2 parameters...

I guess I'll just set it up to be on all the time as long as the engine is running so there's always a vacuum reference for the fuel pump, or users could just eliminate it....

I don't really care as long as it works, so it's really up to users to make it do what they want.
Reply
Old Dec 11, 2005 | 10:08 PM
  #67  
Rex4Life's Avatar
Thread Starter
RX-7 Alumni
Tenured Member 10 Years
 
Joined: Oct 2002
Posts: 1,140
Likes: 1
From: Spacecenter Houston
Originally Posted by muythaibxr
hrmm, don't think there's currently any way to have a single output trip on 2 parameters...

I guess I'll just set it up to be on all the time as long as the engine is running so there's always a vacuum reference for the fuel pump, or users could just eliminate it....

I don't really care as long as it works, so it's really up to users to make it do what they want.
Eventually I'd like to remove the FPR solenoid, it's just something else to go wrong. If the solenoid begins to leak pressure it could be fatal for a turbo engine under boost--but the guys with NAs will just run rich.

In any event, I don't think the mechanics involved with the fuel system could chase a pressure pulse that quick. Remember the FPR is chasing pressure all the time, thats what it does. A single blip of starting the secondaries should be well within the noise of everything else going on.

I'm pretty sure the staging logic you and Roger discussed above will solve the problem.
Reply
Old Dec 11, 2005 | 11:10 PM
  #68  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
speaking of this logic... I'm 99% of the way done.... I still have an intermittant case where it will sometimes skip the transition and go straight into the staged pulse-width, but other than that it's looking good... a nice slow transition that I could see on the 'scope and in megatune.

Most likely I will post code tomorrow for jsmcortina on msefi.com to look at, and I'll also try to test in an actual car. Once those things are done, and I'm sure that last little intermittant problem is gone, I'll post it here.
Reply
Old Dec 12, 2005 | 11:51 PM
  #69  
muythaibxr's Avatar
MegaSquirt Mod
Tenured Member 15 Years
 
Joined: Sep 2004
Posts: 4,721
Likes: 1
From: Maryland
OK, I have code that I'm reasonably confident in.... It worked flawlessly on the oscilloscope, and I believe I accounted for all of the "weird" cases, like accel enrichment is engaged while the transition is in progress, the code should handle it.

I'll post it as soon as it's integrated into msns-extra.
Reply
Old Dec 13, 2005 | 06:11 AM
  #70  
Rex4Life's Avatar
Thread Starter
RX-7 Alumni
Tenured Member 10 Years
 
Joined: Oct 2002
Posts: 1,140
Likes: 1
From: Spacecenter Houston
Originally Posted by muythaibxr
OK, I have code that I'm reasonably confident in.... It worked flawlessly on the oscilloscope, and I believe I accounted for all of the "weird" cases, like accel enrichment is engaged while the transition is in progress, the code should handle it.

I'll post it as soon as it's integrated into msns-extra.
Sounds great--can't wait to try it out. I've needed to upgrade my version anyways for the rotary ignition. Looks like I can knock em both out with this new one.

Thanks Ken
Reply
Old Dec 19, 2005 | 09:10 PM
  #71  
Rex4Life's Avatar
Thread Starter
RX-7 Alumni
Tenured Member 10 Years
 
Joined: Oct 2002
Posts: 1,140
Likes: 1
From: Spacecenter Houston
Originally Posted by muythaibxr
OK, I have code that I'm reasonably confident in.... It worked flawlessly on the oscilloscope, and I believe I accounted for all of the "weird" cases, like accel enrichment is engaged while the transition is in progress, the code should handle it.

I'll post it as soon as it's integrated into msns-extra.
How's it all going Ken? Is this in the 028a over in msefi? I'm getting close to try out the ignition and wanted to do all the code updates at the same time.

TIA,

Scott
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
trickster
2nd Generation Specific (1986-1992)
25
Jul 1, 2023 04:40 PM
Rotospectre
New Member RX-7 Technical
3
Mar 28, 2018 03:33 PM
alphawolff
1st Generation Specific (1979-1985)
17
Nov 17, 2015 05:57 PM


Thread Tools
Search this Thread

All times are GMT -5. The time now is 05:52 AM.