___ |_ | | | | | /\__/ / \____/
## ## #### ## #### ## ##
#### ## ## ## ## ## ## ####
###### ## ## ## ######
_ _ | \ | | | \| | | |\ | |_| \_|
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: '''Easytherm is a tool that helps making curves from a few calibration points for an NTC temperature sensor.''' The coolant and manifold air temperature sensors are (in 99.9% of cases) NTC type. The ExhaustGasTemp sensor can never be an NTC type. Easytherm files are located in the files section of the Megasquirt group at http://groups.yahoo.com/ or directly from [http://www.msefi.com/dload.php?action=category&cat_id=27 msefi.com] '''Steps:''' * if possible, 3 calibration points must be measured. Say, at sensor temperatures ** 95C warmed engine ** 20C cold engine ** and 0C (a cup of icy water before installing the sensor to the final location) * Check pullup resistor values, v3.2 has '''2.7k''' resistor instead of 2.49k used in megasquirt. If incorrect pullup value is used, there will be a few degrees error in the lower temperature range. * .inc file can be generated with easytherm, or other means. This is a very simple function, a few lines. * note: (AFAIK) MSToolsII can also be used to create .inc files * but: the upload function in MSToolsII is NOT compatible with GenBoard. GenBoard's has it's own firmware generation and upload procedure. '''The .inc files need a slight automatic formatting''' (into .c files) '''with the following commands, so that they will actually be used in the firmware build process''': * ''perl bin/inc2tbl NAME-OF-THE-MAT-INC-FILE > etc/airdenfactor.c'' * ''perl bin/inc2tbl NAME-OF-THE-CLT-INC-FILE > etc/thermfactor.c'' * See GenBoard/FirmWare for firmware compiling and uploading ---- '''Developer TODO''' - to make some of the above few simple steps automagic: * add makefile entries, so inc2tbl is automagically run if etc/airdenfactor.inc is newer than etc/airdenfactor.c * likewise for etc/thermfactor.c * generate etc/airdenfactor.inc from simple text-based etc/airdenfactor.cal textfile of a few calibration points (containing Celsius => whatever) * update the above steps to match Marcell started to write a '''small utility to make calibration table, in vems.hex snippet form''', for engines like MembersPage/NanassyPeter/Status Marcell found that fitting a 2nd order polynom (parabola) to 3 measured points over the whole temp-range (IIRC this is what easytherm does, I read it a long time ago, but I couldn't download to check) gives very poor fitting to the NTC curve. The proper way is: * DONE: use proper NTC calibration data (we found appr 20 points at elfa, and another pdf, see /svn/vems/chipdocs/...). Let's call this NTC_res[] * '''TODO:''' interpolate between these points. If we have 20 datapoints in NTC_res[0] to NTC_res[19] array, we can fit 18 2nd order poly (call it NTC_res_poly[1] to NTC_res_poly[18], index 0 is not used ) around index 1..18 : note that this is a short section, not on the whole curve! ** solving the equation is one way to do this, but simulated annealing can also be used (more cpu-clocks but this is a one time operation on PC). * '''TODO: (trivial)''' we blend between neighboring parabolas, for example between NTC_res[3] and NTC_res[4] we blend between NTC_res NTC_res_poly[3] and NTC_res_poly[4]. We call the result NTC_res_poly(). * the model we must use scales the NTC_res_poly() according to Rntc/Rpullup (call it Rratio) and aref. aref is appr 255, and is the open-circuit (Rntc=inf) adc reading (might be > 255, since it is theoretical). Also, not real ADC reading, but truncated to 8 bits. * We must find Rratio and aref that gives best fitting between user-specified datapoints (simulated annealing makes it possible to use any number of points!) and NTC_res_poly() ** we like the values where sum( err * err) is minimal ** DONE: in simulated_annealing(), needs only minor tweak so model() uses NTC_res_poly() and sum( err * err ) * using the found Rratio and aref, we can make a full curve, using NTC_res_poly() ** DONE: basically - see sub model - rather trivial, we just tweak the names * we must print it in vems.hex form, so any factory vems.hex can be easily changed to contain the new tables (0x100 .. 0x1FF, 0x200..0x2FF, 0x300..0x3FF for the 3 tables: airden, matfactor, thermfactor, check makefile for the exact order) I started to write in svn/firmware/firmware/trunk/bin/simulated_annealing (next to inc2tbl script, and prog.pl and patch_identity scripts that has method to calculate the simple checksum necessary for every vems.hex line) but svn/firmware/utilities might have been a better place (maybe svn move....). Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.