Results 1 to 9 of 9

Thread: The math behind the beast

  1. #1

    The math behind the beast

    I recall from the days of chip tuning my turbo GMC Typhoon, there was a GM document floating around detailing the control strategies and algorithms used in that system. Is there any sort of documentation like that available for the LS platforms?
    With HP Tuners we are given access to may variables, but we do not see the actual equations that these variables are used in. It would sure help my understanding of how these variables affect engine operation if I could actually see these equations and read what the control strategies actually are.
    Last edited by HRD; 10-11-2012 at 09:37 PM.

  2. #2
    Advanced Tuner gn2beatu's Avatar
    Join Date
    Sep 2011
    Location
    Germantown WI
    Posts
    414
    As big as these tunes are, that would be a huge undertaking doing a line by line breakdown of the code. But I know exactly what your reffering to. Bruce Plecan had line by line breakdown of the GN and the Typhoon ecm's on turbobuick.com. He was my teacher almost 20 years ago when I got started. Talking to him and Bob was almost always over my head back then. Brings back memories.

    On a side note, I wonder if GM writes thier code in some form of VB, then uses a compiler? Maybe an HPT coder can chime in....
    2000 Regal GS ~ 3.25 Pulley ~ Headers ~ 3"ex ~ 1.85 Rockers
    Sold 06 TBSS ~ Front Mount T88 ~ 0-30 in 1.17 ~ 0-60 in 3.0
    Wanted ~ Engine-less 95/Older 4x4 ~ Jeep/S-10/Ranger for TT Project

  3. #3
    If I remember right, the document I am thinking about was really detailing the control strategies on the Pontiac Sunfire Turbo, but it used the same EC and basically the same algorithms as the SYTY stuff. I think I found it on a SYTY website, but I can't find it now.

    For example: It would just be nice to be able to see exactly what is the algorithm used for referencing the idle and coastdown spark tables and what variables control when and how these tables are referenced.
    It would be nice to see exactly what equations and methods are used in the "Spark Smoothing"

    I just think that proper resources for obtaining knowledge could take some of the black magic out of tuning.

  4. #4
    Tuner in Training C Del's Avatar
    Join Date
    Oct 2012
    Posts
    44
    I'm a software developer, and it sounds like quite a headache to undertake something like that. It's possible that the PCM code is compiled from some higher-level language, but I would think it more likely that it was written in assembly, since it's an embedded system with relatively little room for inefficiencies in code. I'm sure the HPTuners programmers that work on the really low-level stuff (i.e. figuring out which tables are where in each OS) would have some information on this, but I'm also pretty sure their hands are full at all times, lol.

  5. #5
    Senior Tuner eficalibrator's Avatar
    Join Date
    Mar 2006
    Location
    Detroit
    Posts
    1,023
    Like almost any modern OEM, GM generates strategy using Matlab/Simulink and then generates the C code from there. (Sometimes this requires a human to manually massage it, other times it's straight ACG, or auto-code generation) There are literally hundreds (thousands?) of pages/layers to the ECU's Simulink diagrams and these are strictly proprietary to GM. I don't think you'll see these out in the wild.

    That said, a LOT of what they do follows physics and normal combustion control philosophy as seen in college textbooks and validated with empirical dynamometer testing. Their control logic follows, well, LOGIC. Each table is in the ECU for a specific reason and addresses a specific relationship or issue with how the engine runs in changing conditions. Fundamentally, they are doing the same general tasks as a Ford, Honda or BMW when it comes to air-fuel ratio or spark control. There are several good books out there on the material (not just mine), so if you're willing to invest the time and effort into learning there is an opportunity to get a better understanding.

  6. #6
    Tuner in Training C Del's Avatar
    Join Date
    Oct 2012
    Posts
    44
    I'm somewhat surprised automatically generated code is efficient enough to run these, but I forget from time to time just how good compilers can be these days.

    It would be neat to take a gander at the exact PCM logic, but Greg brings up a great point that the theory is the same behind all the different PCM OSes. The spark smoothing is a bit less determinate, but I doubt seeing the logic would help me all too much in tuning. Then again, I'm a noob, so who knows.

    Incidentally, I'm enjoying your first book, Greg. I didn't realize you were on these forums; it's cool to see the guy who wrote the book I'm learning from here.

  7. #7
    Quote Originally Posted by eficalibrator View Post
    Like almost any modern OEM, GM generates strategy using Matlab/Simulink and then generates the C code from there. (Sometimes this requires a human to manually massage it, other times it's straight ACG, or auto-code generation) There are literally hundreds (thousands?) of pages/layers to the ECU's Simulink diagrams and these are strictly proprietary to GM. I don't think you'll see these out in the wild.

    That said, a LOT of what they do follows physics and normal combustion control philosophy as seen in college textbooks and validated with empirical dynamometer testing. Their control logic follows, well, LOGIC. Each table is in the ECU for a specific reason and addresses a specific relationship or issue with how the engine runs in changing conditions. Fundamentally, they are doing the same general tasks as a Ford, Honda or BMW when it comes to air-fuel ratio or spark control. There are several good books out there on the material (not just mine), so if you're willing to invest the time and effort into learning there is an opportunity to get a better understanding.
    Lets just say that I am familiar with engine design and theory. I agree with you that it is all logic and lot of it is pretty intuitive such as understanding how things like the VE model is used to calculate airmass for a given displacement and air density, and how airmass and engine speed are used to lookup spark advance values in a table. What I am interested in is the more ambiguous sections of the tune such as for one example. How does "Fuel from Wall Stabilization" really (mathematically) affect the
    Transient fuel Transfer calculations? We're given a variable that can be set from 0.0 to 2.0 with not much of an explanation as to what that variable is or what its role is in the calculation. Is it a multiplier? If so, what does it multiply? If the equations were spelled out, there would be no guess work. That's just one example of many.

    BTW, your books are very helpful.

  8. #8
    Tuner
    Join Date
    Dec 2009
    Location
    Slave Ship
    Posts
    199
    Not exactly what you're looking for but I found this interesting

    http://www.scribd.com/doc/37543988/P...patent-5497329

  9. #9
    Quote Originally Posted by Nodnarb View Post
    Not exactly what you're looking for but I found this interesting

    http://www.scribd.com/doc/37543988/P...patent-5497329
    Interesting link. Thanks!