View unanswered posts | View active topics It is currently Thu Sep 20, 2018 7:48 pm



Reply to topic  [ 70 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Coolant and Inlet Air Temps Transfer Required Accuracy?? 
Author Message
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
OK, I was thinking 8x2 table from ADC > multiplication factor using interpolation and curve fitting. I just looked at what Peter Siebold's aems555 has, and he has a 1:1 ADC > Temp value array 1024 elements long. Each ADC value has a particular temperature pre assigned to it. This seems like a horrendous waste of space, though I can see that it would be fast and simple as you can just use the raw ADC value to index the array and you have your value directly. On the other hand it uses 1024 x 16 bits of space = 2K of memory! I wonder will a transfer table and math code take up the same space or more space or less space? Will the math be too slow? Do we want to blow away 2K just like that? Are the errors that we will get from a mult factor transfer acceptable? What about if we use a direct ADC > Temp table with interpolation? How many cells do we need to use before we are "close enough to not care"? etc. Peter is a switched on guy though.

Please post your thoughts on this.

I might sit down and analyse the options at some point.

EDIT : MS2E does it the same way as Peter did.

Do we need to follow Peter's suit or can it be done more efficiently?

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Sun Jun 15, 2008 5:36 pm
Profile WWW
Post Whore!
User avatar

Joined: Sat Feb 16, 2008 12:11 am
Posts: 629
Location: Sunny San Diego
The coolant temps seem pretty easy going to me. There's "too hot", and "too cold" and some third order effects.

Air temps, well, if this seems like a pun, forgive me, but the trouble with approximating the air temps is that we first need to approximate the error.

The easiest place to start is this (then I have my follow up point):
Take the effect this variable will have: Coolant temps perhaps effect when the fans come on, maybe the timing.
Now multiply through the error. Figure out the effect of coolant_temp -> coolant_temp + 5, propagate it.

If it only moves timing by 0.4 degrees, then a 5 degree error is fine. Don't get hung up on how accurate it has to be, intrinsically. Get hung up on how wrong it can be before it has an effect you deem unexceptable.


Now, my follow up point:
For coolant sensors, I don't know about you, but everyone I know in the MS-world puts in three values, the rest is just a question of WHEN that calculation is done. MS-IIx does it before you even run the car. It generates those numbers and THEN burns the table. But just because it fills out 1024 of entries, doesn't mean there's more than a 1x3 table of information in it. two kilobytes be damned. And remember our moto: If it's good enough for megasquirt, it's good enough for Jesus.

So for both of them, I'd look carefully at propegating errors, figure out if it matters. My gut feeling is air needs some level of accuracy, and coolant comes down to how well you need it. Perpahs a 8 entry table will take a further hit on accuracy but be faster than the math involved from the more compliated 3 point curve fit.


One very last point. I know of probably 100 miata people using "values they got from someone else" because measuring 3 numbers is too much work. Who's going to measure 8 of them, or 16? :-) My own temps are way off, I just tweak one point until the fans come on before the motor overheats. Personally, I'd love a "measure at 8 places and interpolate", because measuring at 3 places doesn't work, somehow.


Sun Jun 15, 2008 6:25 pm
Profile ICQ YIM
LQFP112 - Up with the play

Joined: Thu May 01, 2008 6:30 pm
Posts: 135
Location: Ann Arbor, MI
If you are using GM sensor -
http://www.pe-ltd.com/downloads/coolant_temp.pdf


Sun Jun 15, 2008 7:20 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
8InchesFlacid wrote:
Take the effect this variable will have: Coolant temps perhaps effect when the fans come on, maybe the timing.
Now multiply through the error. Figure out the effect of coolant_temp -> coolant_temp + 5, propagate it.

If it only moves timing by 0.4 degrees, then a 5 degree error is fine. Don't get hung up on how accurate it has to be, intrinsically. Get hung up on how wrong it can be before it has an effect you deem unexceptable.
An excellent point, however, how much effect it has on a given tune will come down to the tuner and setup, not what I think :-)

The thing is, even if it's a bit wrong, as long as it's consistent and you get a different temperature for each ADC point, you can tune to it.
Quote:
But just because it fills out 1024 of entries, doesn't mean there's more than a 1x3 table of information in it. two kilobytes be damned.
Very true, this is another method, though that is probably slower still, and speed seems to me to be more important than space. I guess the thing is, where on the compromise spectrum of fast/big medium/medium slow/small we sit.
Quote:
And remember our moto: If it's good enough for megasquirt, it's good enough for Jesus.
ROFL :-) Nice moto!
Quote:
One very last point. I know of probably 100 miata people using "values they got from someone else" because measuring 3 numbers is too much work. Who's going to measure 8 of them, or 16? :-) My own temps are way off, I just tweak one point until the fans come on before the motor overheats.
Well, that shouldn't be an issue as we will have a data base of correct settings and resistor values for most available stuff. One person will have to provide data, and the rest use it. Others can tweak if they want, and those that don't care don't have to. EG, I've done the std NipponDenso one (older type than yours) and shameem has kindly posted the GM data, so thats by far and away most stuff covered just like that ;-)
Quote:
Personally, I'd love a "measure at 8 places and interpolate", because measuring at 3 places doesn't work, somehow.
It seemed like a good idea, BUT, maybe not. Hence this thread to figure that out in an OPEN way where everyone gets their say :-)

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Sun Jun 15, 2008 8:18 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
OK, I've been doing some digging :

http://en.wikipedia.org/wiki/Steinhart-Hart_equation

http://www.betatherm.com/stein.htm

So, the equation is :

T = 1 / ( A + B*ln(R) + C*((ln(R))^3) )

Image

Which looks like it will be slow as hell and probably generate a significantly sized piece of code too.

To get A, B, and C from 3 temperature resistance pairs you have to solve 3 simultaneous equations which is way out of our league :-)

EDITED THIS LINE : So then, 2k, perfect and FAST or < 2k, close and medium or < 2k, perfect and SLOW ?

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Sun Jun 15, 2008 10:27 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
http://www.unb.ca/civil/hydro/S-H%20coefficients.xls

Spread sheet to calculate the coefficients from three points!

Using the coefficients and the resistance voltage relationship with a given bias resistor you can then get all temps for all ADC values just like EasyTherm does.

NipponDenso :

A = 1.0904E-03
B = 3.0294E-04
C = -1.2420E-07

And the values it spits out work :-)

Perhaps we need a java/mono version of easytherm if we go with generated lookups from the three points?

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Sun Jun 15, 2008 10:55 pm
Profile WWW
LQFP112 - Up with the play

Joined: Thu May 01, 2008 6:30 pm
Posts: 135
Location: Ann Arbor, MI
If speed and memory are a concern - then the "calculation" could potentially be done in the hardware using a few op amps

http://www.play-hookey.com/analog/logar ... ifier.html

EDIT - cleaned up some stupid links and statements i posted b4 reading it closely.


Mon Jun 16, 2008 12:07 am
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
I modified that spread sheet a bunch and added a chart and error comparison with the rest of my readings. The ones with zero error are the three I used to generate the ABC coefficients. This is pretty close and the error was likely mine when measuring it. The error at the low end of the temp scale is definitely mine as there is a visible curve in the data when it should be straight.

Image

The more I think about this the more I think we should "waste" the 2k and just do the direct lookup for this. Speed will be a factor and we have heaps of flash anyway. I'm just slightly concerned about paging and what that means to where stuff is stored. I'll deal with that 32k wall when we hit it I guess.

Now to knock up a little (cross platform non-ms associated) utility to create the .inc/.h C arrays of temperature data :-)

Any takers? Shameem? Stu? Alex? Sean? Me?

Requirements :

Input :
  • 3 pairs of temp/resistance data (ohm, F/K/C x 3)
  • Bias resistor value - (in ohms)
  • ADC resolution in bits - (8,10)
  • Temp output data type - (unsigned short, unsigned long, unsigned char, signed char, signed short, signed long, float, double)
  • Temp output scaling/shifting - (*X, +Z)
  • Round or truncate? - (round/truncate)
  • Name of the array - (IATTransferTable etc)
  • Keywords to prefix with - (static, const, final, void, etc)
  • Textual comments to precede generated data - (GPL, author, date, time, comments, sensor type and name, original data, Steinhart-Hart coefficients, etc)
  • End of line type - (mac/*nix/win)
  • Tabs or spaces for identing - (t/s)
  • Indenting level - (0 - ?)
  • Elements per line - (1 - 1024)
  • Pad numbers with spaces? (yes/no)

Output :
  • One .h/.inc C file with a single array correctly formed to the spec provided.

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Mon Jun 16, 2008 9:08 am
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
I'd like to point out that MS uses the upper and lower bounds as error conditions with a default temperature.

To me that is a hack, so I'd like this tool to NOT include that option and the firmware to have a separate explicitly set set of error conditions for sensors that trigger some sort of alarm state and potentially behaviour.

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Mon Jun 16, 2008 10:34 am
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15181
Location: Home sweet home!
I've actually started working on this.

I'm using Glade and C# with mono as a learning experience. It seems Stu will use C# for any tools he creates, and Glade is used to create panels in MTX which may end up our tool of choice too. When I'm close to done I'll post some non functional screen shots of the tabs and windows :-)

I've completed 2 from 5 tabs so far.

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Mon Jun 16, 2008 4:08 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 70 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF. ColorizeIt.