Duty Cycle

For discussing injector selection,manifold modifications, throttle bodies, fuel supply system design and construction, and FIdle valves and IACs.
Forum rules
Read the manual to see if your question is answered there before posting. Many users will not reply if the answer is already available in the manual.

If your question is about troubleshooting, configuration, or tuning, you MUST include your processor type (MS-I or MS-II) and code version in your post. If your question is about PCB assembly or modifications, you must also include the main board version number (1.01, 2.2 or 3.0).

If you have questions about MS1/Extra or MS2/Extra code configuration or tuning, please post them at www.msextra.com Such questions posted here will be moved to: a temporary MSextra sub-forum, where they will be removed after 7 days

The full forum rules are here: Forum Rules, be sure to read them all regularly.
Post Reply
dbh86
MegaSquirt Newbie
Posts: 4
Joined: Mon Aug 09, 2010 8:27 am

Duty Cycle

Post by dbh86 »

This is a question about the duty cycle calculations that MS makes for the % gauge in MT/TS. I haven't found a firm statement that this is how it is calculated, but I will try my best to explain how I believe it works. Please correct me if I'm wrong. The entire reason for this is that there appears to be more fuel available even after you go over 100% on the gauge.

So here is my hypothesis:

Duty cycle is time active/ time available for the cycle: 50% DC = 5 ms injection / 10 ms cycle time
The cycle time is dependent on rpm. 6000 rpm = 10 ms, 3000 rpm = 20 ms.
The injection time is a combination of the opening, full open injection, and closing. So the 5ms would actually consist of ~1ms opening time, ~3.9ms full open, 0.1ms closing time.

So, at 100% DC for a 10ms cycle time: 0-1ms is opening, 1-9.9ms is full open, and 9.9-10ms is closing.

^^^ Is this correct?

If so, then you could actually go above 100% DC and still find more fuel.
So, at ~112% DC for a 10ms cycle: -1 to 0ms is opening, 0-10ms is full open, 10-10.1ms is closing ... Because these will overlap with the cycles before and after the current cycle, the injector will never actually see anything more than being full open... i.e. 0-10ms is full open for each cycle

Can anyone else offer some insight into this?
DonTZ125
Experienced Squirter
Posts: 337
Joined: Sat May 16, 2009 1:49 pm
Location: Scarborough, ON
Contact:

Re: Duty Cycle

Post by DonTZ125 »

Duty cycle is based the OPEN time, and does not include the opening / 'dead' time. Also, when you exceed ~ 80-85% duty cycle, you enter a non-linear region. The flow difference between 80% and 88% duty is not necessarily 10%; it could be 5%, it could be 15%. It's very difficult to tune in this region, so most recommend avoiding it.

100% duty cycle = fully open all the time. Can't open more than 100%...
Bernard Fife
Master Squirter
Posts: 475
Joined: Thu Oct 29, 2009 12:54 pm

Re: Duty Cycle

Post by Bernard Fife »

Guys,

The duty cycle includes the opening time.

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it.” - George Bernard Shaw
dbh86
MegaSquirt Newbie
Posts: 4
Joined: Mon Aug 09, 2010 8:27 am

Re: Duty Cycle

Post by dbh86 »

LOL...
Is the code viewable for it somewhere?
Bernard Fife
Master Squirter
Posts: 475
Joined: Thu Oct 29, 2009 12:54 pm

Re: Duty Cycle

Post by Bernard Fife »

dbh86,

Yes, you can find links to the embedded code in the manual table of contents: http://www.megamanual.com/mtabcon.htm

The duty cycle isn't computed directly by MegaSquirt though, it is done by the tuning software. In MegaTune it is in the INI is the [OutputChannels] section:

Code: Select all

dutyCycle1       = { 100.0*nSquirts1/altDiv1*pulseWidth1/cycleTime1 }, "%"

cycleTime1       = { 60000.0 / rpm * (2.0-twoStroke)                }, "ms"

altDiv1          = { alternate ? 2 : 1                              }
Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it.” - George Bernard Shaw
dbh86
MegaSquirt Newbie
Posts: 4
Joined: Mon Aug 09, 2010 8:27 am

Re: Duty Cycle

Post by dbh86 »

Awesome, but alas I can't really figure out the assembly code part of it.

Code: Select all

PWCALC = TMP6 + TMP11 + TPSACCEL - INJOCFUEL
The best guess I can make is that this is the variable that gets passed to MT for the "pulsewidth1" variable. Or is there a different variable that is passed to MT?
Bernard Fife
Master Squirter
Posts: 475
Joined: Thu Oct 29, 2009 12:54 pm

Re: Duty Cycle

Post by Bernard Fife »

dbh86,

In the INI [OutputChannels] section there is a line like this:

Code: Select all

pulseWidth1      = scalar, U16,    2, "s",     0.001, 0.0
The 2 in this is telling use that pulse width 1 is located at an offset 2 of two words (16 bits) in the OUTPC structure in the code (all of the variable going from MegaSquirt to the tuning software are in outpc, the variables going from the tuning software to MegaSquirt are described in the
[Constants] section of the INI and are found in INPRAM or INPRAM2).

Looking at the code itself (2.89), around line 1360 you will find:

Code: Select all

// rs232 Outputs to pc
typedef struct {
unsigned int seconds,pw1,pw2,rpm;           // pw in usec
int adv_deg;                                // adv in deg x 10
unsigned char squirt,engine,afrtgt1,afrtgt2;    // afrtgt in afr x 10 (or Vx100)
...
The first variable (seconds) takes up two words because it is an int, so the offset of two gives us pw1 for the variable that corresponds to pulseWidth1 in the INI. So if you want to see how pw1 (aka outpc.pw1 in the code, pulseWidth1 in the INI) is calculated by the code, you need to look up pw1 and see where it is used in the code (which will lead to a number of other variables).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it.” - George Bernard Shaw
dbh86
MegaSquirt Newbie
Posts: 4
Joined: Mon Aug 09, 2010 8:27 am

Re: Duty Cycle

Post by dbh86 »

Thanks Lance,
I see the code you quoted is MS2 and in C... much easier to understand. I should be able to figure it out from here. :D
Post Reply