Lambda Calculation Error

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Post Reply
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Lambda Calculation Error

Post by motthomas »

Apologies if this is in the wrong section as it concerns the TS interface but as the mainController.ini is James & Kens then I thought this may be a better place for it. Please move if you feel necessary.

In a post on another thread last week (linked below) I recalled that there was an anomaly in the calculation of Lambda field within Tunerstudio and hence also the logged Lambda value. This is when using Lambda Settings in Project Properties.
http://www.msextra.com/forums/viewtopic ... 45#p517695

I have been trying to get my head around a few other things recently and came across this anomaly again.

Lines 5306 & 5307 of the mainController.ini file read as follows:

Code: Select all

lambda1          = { afr1 / 14.7 }, "Lambda"
lambda2          = { afr2 / 14.7 }, "Lambda"
This means that if you are using a fuel that has a different stoichiometric ratio than 14.7:1, the lambda value displayed and logged will be incorrect even though you have taken care to enter the correct sensor calibration and correct stoichiomentric ratio for your fuel in the General Settings -> Stoichiomentric AFR field in TS.
Right now, this has had me over on a number of logs taken during a dyno session meaning that my fuel tables have been calibrated to a different Lambda than intended.

Why is this calculation coded in this manner? Given the fact that you have the flexibility to enter the stoich ratio in General Settings, it would seem logical for TS to pull this value to use in the calculation of Lambda rather than using a coded value? My readings are only out by a few percent but this calculation makes the Lambda value useless if using E85 or Methanol fuel.

Can this calculation please be changed to use the Stoich AFR which the user inputs in General Settings?


Also related, I have been unable to find a difinitive answer in the .ini so hoping someone can confirm. It stands to reason that the controller uses AFRTarget in AFR to calculate inj PW when Incorporate AFRTarget is enabled regardless of the Project Properties Settings in TS. How is the AFR Target that the controller uses calculated when Lambda is selected in TS Project Properties? Does this also use 14.7 or does it use the user Stoichiometric AFR?
i.e. Assume I am using Lambda within TS and I have Incorporate AFRTarget enabled and a Stoichiometric AFR of 14.2 entered. If at a particular speed/load point I have entered Lambda 1.0 in the AFR Table 1, will the AFR Target that is used in the fuel calculations, "outpc.afrtgt1 = gl_afrtgt1" be 14.7 or 14.2?

For reference, I am running MS2E_3.4.2 firmware and TunerStudioMS Ultra v3.0.28.
racingmini_mtl
Super MS/Extra'er
Posts: 9128
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Lambda Calculation Error

Post by racingmini_mtl »

The MS2 never sees or uses lambda. The Lambda values are only displayed in TunerStudio using the (potentially erroneous) transformations in the ini that you mention (and possibly others but I'd have to check the ini). The MS2/extra firmware uses AFR values everywhere.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

racingmini_mtl wrote:The MS2 never sees or uses lambda. The Lambda values are only displayed in TunerStudio using the (potentially erroneous) transformations in the ini that you mention (and possibly others but I'd have to check the ini). The MS2/extra firmware uses AFR values everywhere.

Jean
Thanks Jean. Yes I figured that the MS2 wouldn't see lambda and that the conversion is done in TS. If you could confirm the Lambda/AFR table transformation calculation that would be great!
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

Hi Jean (or others),

Any update on the Lambda/AFR table transformation? I am trying to bottom out some strange fuelling data I have and I'd like to confirm what inputs are actually being fed into the fuelling equation so I can work it back and see if there are any issues.
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

For info, the latest MS3 firmware calculates the correct Lambda using the user input stoich AFR. It is still unclear to me how the Lambda target from the table is transferred to AFRtgt for the fuel PW calculation.

Code: Select all

Line 14590:    lambda1          = { afr1 / stoich }, "Lambda"
	Line 14591:    lambda2          = { afr2 / stoich }, "Lambda2"
	Line 14592:    lambda3          = { afr3 / stoich }, "Lambda3"
	Line 14593:    lambda4          = { afr4 / stoich }, "Lambda4"
	Line 14594:    lambda5          = { afr5 / stoich }, "Lambda5"
	Line 14595:    lambda6          = { afr6 / stoich }, "Lambda6"
	Line 14596:    lambda7          = { afr7 / stoich }, "Lambda7"
	Line 14597:    lambda8          = { afr8 / stoich }, "Lambda8"

Also, another error I spotted in my search is the calculation of the Boost Gauge in Bar. I recall this error being flagged up on the MS3 and it has been corrected in the latest MS3 firmware release. However, it has so far not been corrected on the latest MS2/E firmware beta release. Can the correction of division of kPa by 101.33 to get Bar please be corrected to division by 100 in the next MS2/E release?

Code: Select all

Line 5474:     boostbar = { (map - barometer) / 101.33}
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

OK, I managed to get out to the bike this evening and tested the AFRtgt1 conversion from Lambda.
My tests show that AFRtgt1 uses 14.7 as the multiplier regardless of what the stoichiometric AFR is set to. I still cannot find any trace of this conversion happening within mainController.ini. My suspicion is that this conversion happens within TS as the lambda value typed into the AFR target table auto-corrects to a number that when multiplied by 14.7 gives an AFR figure correct to one decimal place. i.e. 0.9 (13.23 AFR @ 14.7 stoich) gets corrected to 0.898 (13.2AFR @ 14.7 stoich). Perhaps this query is directed at Phil and EFI Analytics then?

This basically means that unless you are using a fuel with a stoichiometric ratio of 14.7:1, the Lambda project property is useless and only serves to provide incorrect information to the fuelling equation when using Incorporate AFR and also to provide incorrect feedback. I have to ask, has the Lambda property never been tested before? Surely I cannot be the only person preferring to use Lambda as opposed to AFR?

Can I please request that the Lambda property is either fixed so that it works as it should or else removed altogether?
SwedCharger-67
Experienced MS/Extra'er
Posts: 264
Joined: Sun Dec 23, 2012 2:20 pm
Location: Nordmaling, Sweden

Re: Lambda Calculation Error

Post by SwedCharger-67 »

I'm following this topic with great interest.
I've never used anything but Lambda with my E85 engine. However, I've only briefly switched on "include AFR target" and cannot say if it seems to function correctly with Lambda.
Martin, Sweden
Mopar 512 cui, 8.4 liters, high compression, fuel E85, full sequential control by MS3X, burning rubber just blipping the throttle... :D
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

SwedCharger-67 wrote:I'm following this topic with great interest.
I've never used anything but Lambda with my E85 engine. However, I've only briefly switched on "include AFR target" and cannot say if it seems to function correctly with Lambda.
I see you are running MS3 which looks like it at least calculates the lambda feedback correctly. I would be interested if you were able to do a test to find out if the lambda target in TS still uses 14.7 as the multiplier for AFRtgt. I just set the Lambda target table to 1.0, idled the engine and observed AFRtgt1. Then changed the lambda target to 0.95 and observed the change in AFRtgt1. It should be pretty obvious.

Is there any interest in this from the developers side? Can you confirm or deny any of the observations I have made so far?
Steven VanOrder
Helpful MS/Extra'er
Posts: 139
Joined: Mon Dec 07, 2015 2:38 pm

Re: Lambda Calculation Error

Post by Steven VanOrder »

I also have many questions in regard to this, Im running MS2 extra 3.4.2 and the latest version of MS ultra. have the car fully tuned using AFR and an assumed stoich value of 14.7... however all fuels in my area are at least E5, I noticed this exact issue when i decided to just tune in lambda.

project properties changed to lambda, calibrated my O2 in lambda. in the general settings i left the stoich value of my fuel at 14.7 and noticed no fueling change. I then changed the stoich value to 14.2 for E10 and noticed the fuel went 3-4% lean... this was as expected... however why cant I simply set the stoich value in general settings to 1??

maybe i am misunderstanding how the full fuel equation works or im misinterpreting the intent??? If i am what is the proper course of action? I cant calibrate my WB to output lambda*14.2 for E10
jsmcortina
Site Admin
Posts: 39585
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Lambda Calculation Error

Post by jsmcortina »

I'm pretty sure that the way it is with the firmware and the ini file for the tuning software, that only 14.7 gasoline AFR is supported. If you use a different fuel you still need to work in gasoline AFR numbers.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Steven VanOrder
Helpful MS/Extra'er
Posts: 139
Joined: Mon Dec 07, 2015 2:38 pm

Re: Lambda Calculation Error

Post by Steven VanOrder »

jsmcortina wrote:I'm pretty sure that the way it is with the firmware and the ini file for the tuning software, that only 14.7 gasoline AFR is supported. If you use a different fuel you still need to work in gasoline AFR numbers.

James
So then if i understand correctly to best deal with the varying ethonal blends in my area I should install a GM flex fuel sensor. this way it can add the 3-5% fuel so the EGO does not have to work all the time. I can get a decent baseline with a tank of non ethonal fuel if i must.
jsmcortina
Site Admin
Posts: 39585
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Lambda Calculation Error

Post by jsmcortina »

Steven VanOrder wrote:So then if i understand correctly to best deal with the varying ethonal blends in my area I should install a GM flex fuel sensor. this way it can add the 3-5% fuel so the EGO does not have to work all the time. I can get a decent baseline with a tank of non ethonal fuel if i must.
That's a different question.
With varying fuel compositions, a flex sensor is a good idea.

EGO control as-is will work also because it is effectively working in Lambda * 14.7. The displayed numbers won't be real AFRs for different fuels, but the function will still work just the same.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
motthomas
Helpful MS/Extra'er
Posts: 88
Joined: Wed Aug 24, 2011 2:06 am

Re: Lambda Calculation Error

Post by motthomas »

I am massively late getting back to this. Apologies.

I get what you are saying James and agree that the firmware works as it is when using a hard-coded 14.7 as a divisor. My problem with it though is that this isn't made clear when setting up TunerStudio. There is still a field to enter "Stoichiometric AFR" which is a bit misleading. I feel this field should be removed as it doesn't seem to actually do anything. Same in the EGO calibration window. I feel a note stating that the calibration should be entered as AFR based on 14.7 stoich no matter what fuel you are running would be useful and prevent users from making the same wrong assumptions I did.
Post Reply