Announcement

Collapse
No announcement yet.

An Engine Simulator is Born - Part 1

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • An Engine Simulator is Born - Part 1

    I've talked in the past about doing this and finally found some time to outline some half decent plans behind it. Let's start at the beginning though for completeness.

    OBJECTIVE - To create a repeatable system on the bench that can simulate the inputs and outputs from a running engine while connected to an ECU... In order to test corner cases and various scenarios with help of a real-time emulator.

    The complexity of this is moderate to high, but I have only dabbled on the edges of it it in the past as it would take some concerted effort to make such a beast. As such, I have decided to break it the project into two main parts and then carve it up from there - hopefully in a way where findings can be shared and that others can contribute their own expertise if they so wish. I know there aren't many 'ECU hackers' on this forum but hopefully there is enough that we can all get further down the path of knowledge more swiftly... I can only look at so much assembly code before my brain freezes up - I need a simulated environment where I can control load, rpm, air temp and such to do this properly.

    I came back to this project as part of some work I was doing a 20V conversion into a UR which had me poring my head into German schematics for digital dashboards, patrizia lipp autocheck modules and such as I was determined to make as complete a conversion possible with all of the UR's original instruments working. Then I got to realise how this work was complimentary to the engine simulator.


    Part 1 - Inputs & Outputs for the instrument cluster and autocheck

    The scope of this part is to build a box that simulates all the switches and sensors that feed into the various connectors on the cluster.

    These include -
    - Oil pressure switches
    - water temp / level alarms
    - coolant temperature
    - fuel level
    - rpm
    - speedometer
    etc

    This will serve two purposes -

    a. Serve as a bench test platform for clusters and such... I should really try to make this as modular as possible so as to accommodate the UR clusters (and maybe B3/B4 mini-check as well) but that would be a detail

    b. Serve as a means of having convenient instrumentation when elements of this are hooked up to the complete engine simulator in Part 2. This will require some connectivity between the two parts such as VSS & RPM for example.


    Part 2 - Inputs & Outputs for the ECU

    This has much greater scope, but in essence all that needs to be done is to provide the ECU with power, earth and valid inputs that make it think the engine is running. This boils down to G4, G28 and G40 but other inputs will have to be in range so as not to upset the ECU.

    I will need to build emulators for those three primary inputs and have them synchronised in such a way that the ECU is fooled into trying to light sparks and open fuel injectors... Flashing LEDs will be suffice for the purposes here !

    Ideally I would like to build one that is modular for RR/3B and AAN/ABY/ADU but that is a stretch goal. This part of the project will be broken down into a number of slices that focus in testing the key sub systems of interest... It is that area where some other folk may be able to help.

    That's the kick off to the idea floated at least... Coming later is the 1st forays into Part 1 and that G22 simulator.

    This thread is going to be really geeky so I apologise in advance !
    Paul Nugent
    Webmaster http://S2central.net
    Administrator http://S2forum.com

    1994 S2 Coupe ABY - aka Project Lazarus
    2001 A6 allroad 2.5TDi - family tank
    2003 S4 Avant 4.2 V8 - daily burble

    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

    There are only 10 kinds of people that understand binary - those that do, and those that don't

  • #2
    Part 1 kicks off -

    All of the signals coming into the cluster are straight-forward to emulate and pose little challenge for anyone electronically minded. Even RPM is quite simple - it is just a linear DC voltage in the range of 1-8 volts that comes from the ECU.

    The only one requiring some thought was the distance / speedo sensor (G22) from the gearbox. I couldn't find any documentation from Audi on this other than a statement that four pulses per axle rotation are involved. This sensor feeds directly into the speedometer. In turn the speedo then generates a vehicle speed signal (VSS) which gets distributed around the car to things like the ECU, cruise control, difflock module etc and I couldn't understand why they couldn't just use the raw G22 signal.

    I did some rough calculations based on approx 2m rolling radius and estimated the following - assuming a 50% duty cycle from G22.

    10mph --> 9Hz
    20mph --> 18Hz
    30mph --> 27Hz
    .
    .
    .
    170mph --> 153Hz

    I took my trusty breakout box and oscilloscope out on the road to get some readings at approx 20-25mph. The pic attached is a bit gnarly but you can just see the period is measured here at 46ms and that the shape is indeed ~50% duty. The input voltage is roughly 4V peak to peak.
    Attached Files
    Paul Nugent
    Webmaster http://S2central.net
    Administrator http://S2forum.com

    1994 S2 Coupe ABY - aka Project Lazarus
    2001 A6 allroad 2.5TDi - family tank
    2003 S4 Avant 4.2 V8 - daily burble

    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

    There are only 10 kinds of people that understand binary - those that do, and those that don't

    Comment


    • #3
      That signal stacks up to the theory pretty well for a speed of ~25mph.

      Next was to look at VSS. I could see this had a different shape with a much shorter -ve pulse. Even on a short road test it was possible to see this pulse width did not change.

      On a single channel scope it was not possible to see any correlation between VSS and its G22 raw input, but I could see that amplitude was nearer 10V peak to peak.

      I also discovered in this test phase that the ECU was perfectly happy to receive G22 as a raw input - presumably as it is triggering on edges that occur at the same rate as VSS and the actual voltage level is not a concern... This perplexed more about why VSS existed on the S2 and RS2 and beyond - especially as cruise control on a UR quattro was in fact the raw G22 input.
      Attached Files
      Paul Nugent
      Webmaster http://S2central.net
      Administrator http://S2forum.com

      1994 S2 Coupe ABY - aka Project Lazarus
      2001 A6 allroad 2.5TDi - family tank
      2003 S4 Avant 4.2 V8 - daily burble

      Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

      There are only 10 kinds of people that understand binary - those that do, and those that don't

      Comment


      • #4
        Next was to open up the speedometer module and see if I could learn anything about its internals. Sure enough there is one active chip in there - a curious looking one with heavily obfuscated letters but I was able to just about read it as UAF2115 which is a bespoke speedo chip from ITT.

        I am attaching the datasheet for completeness of the geekfest so far. In short this device has one input - our G22 distance sender, and three outputs thus :

        1 - stepper motor drive for the milometer
        2 - linear voltage output for a speedo (essentially a voltmeter)
        3 - an auxiliary out for things like a taxi meter - our VSS

        The clever thing about the 3rd output is that it is short circuit protected - so that a wiring fault or sub-systems failure elsewhere on the car (eg cruise module) does not hinder operation of the speedo - nice one...

        Sure enough the VSS output is designed to have a fixed pulse width of 2.5ms that is triggered by the -ve edge of the G22 input. This pulse width is set by an RC circuit that is attached to the speedo chip - all explained in the datasheet.
        Attached Files
        Paul Nugent
        Webmaster http://S2central.net
        Administrator http://S2forum.com

        1994 S2 Coupe ABY - aka Project Lazarus
        2001 A6 allroad 2.5TDi - family tank
        2003 S4 Avant 4.2 V8 - daily burble

        Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

        There are only 10 kinds of people that understand binary - those that do, and those that don't

        Comment


        • #5
          Originally posted by S2central.net View Post
          I also discovered in this test phase that the ECU was perfectly happy to receive G22 as a raw input - presumably as it is triggering on edges that occur at the same rate as VSS and the actual voltage level is not a concern... This perplexed more about why VSS existed on the S2 and RS2 and beyond - especially as cruise control on a UR quattro was in fact the raw G22 input.
          Did having a buffered VSS on S2 & RS2 have any link to the emergence of the "gala" signal on German cars for things like varying audio volume with speed and the then forthcoming navigation systems?

          John

          Comment


          • #6
            Now I had enough data to build a simple timer circuit that could emulate G22... I chose a good ol 555 timer - a common astable circuit that any O-level electronics student would be happy with.

            I chose RC values to get me in ~45mph range with a variable pot to give me some room for movement. I lashed it together from spare components and a scrap of veroboard as shown. There is something satisfying about building even trivial little things like this.

            It worked 1st time as can be seen from the nice square wave. I included another pot so that I could control the output level so as not to risk overloading the speedo input.
            Attached Files
            Paul Nugent
            Webmaster http://S2central.net
            Administrator http://S2forum.com

            1994 S2 Coupe ABY - aka Project Lazarus
            2001 A6 allroad 2.5TDi - family tank
            2003 S4 Avant 4.2 V8 - daily burble

            Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

            There are only 10 kinds of people that understand binary - those that do, and those that don't

            Comment


            • #7
              Originally posted by johne View Post
              Did having a buffered VSS on S2 & RS2 have any link to the emergence of the "gala" signal on German cars for things like varying audio volume with speed and the then forthcoming navigation systems?

              John
              It is indeed a common application for GALA on radios and such... guess with all these external systems using speed signal they had to protect it from failure.
              Paul Nugent
              Webmaster http://S2central.net
              Administrator http://S2forum.com

              1994 S2 Coupe ABY - aka Project Lazarus
              2001 A6 allroad 2.5TDi - family tank
              2003 S4 Avant 4.2 V8 - daily burble

              Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

              There are only 10 kinds of people that understand binary - those that do, and those that don't

              Comment


              • #8
                You implied in an earlier post that Motronic is only interested in speed when the engine is at idle. Is that so or is speed a parameter for it in other areas?

                Comment


                • #9
                  Next up... time to have the G22 emulator drive my speedo on the bench and put theory to the real test.

                  Bring out the breakout box again - thank goodness again for this brilliant bit of kit with a connector that works for the cluster, and lash up the G22 simulator. I set the bench supply to 13.7V and hit the juice... the speedo needle whips to ~30 mph - cool. I discovered that when G22 input dropped below 2.5V that the speedo stopped working so I set the level around 4V peak to peak.

                  On a dual channel scope it is now possible to see the relationship between the G22 input (on top) versus the VSS output below - easy to see the fixed width pulse that triggers on every -ve edge.

                  So then I started to test how G22 frequency affected the speedo position - all the while my milometer creeping along for some virtual driving

                  The prototype had a range of 30-60mph but I quickly saw that this also equates to 50-100kph and that the G22 frequency matched that pretty damn consistently 1:1 in that range. Makes sense I suppose to use such convenient units, but I predict it will be less accurate as speeds increase... normal practice is for such gauges to read high anyway.

                  I got to wondering about that fixed 2.5ms VSS pulse as there will be a point when the period of the G22 input is shorter than this - doing the math this equates to 400kph so I think this high enough not to worry us in an Audi S2.
                  Attached Files
                  Paul Nugent
                  Webmaster http://S2central.net
                  Administrator http://S2forum.com

                  1994 S2 Coupe ABY - aka Project Lazarus
                  2001 A6 allroad 2.5TDi - family tank
                  2003 S4 Avant 4.2 V8 - daily burble

                  Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                  There are only 10 kinds of people that understand binary - those that do, and those that don't

                  Comment


                  • #10
                    Originally posted by johne View Post
                    You implied in an earlier post that Motronic is only interested in speed when the engine is at idle. Is that so or is speed a parameter for it in other areas?
                    ABY & AAN use it to help idle air control, but the RS2 software can also use it to invoke a road speed limiter when a special coding plug was fitted. This is one area I would like to test for fun in the emulator - I have never looked for this in the code before.
                    Paul Nugent
                    Webmaster http://S2central.net
                    Administrator http://S2forum.com

                    1994 S2 Coupe ABY - aka Project Lazarus
                    2001 A6 allroad 2.5TDi - family tank
                    2003 S4 Avant 4.2 V8 - daily burble

                    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                    There are only 10 kinds of people that understand binary - those that do, and those that don't

                    Comment


                    • #11
                      And finally for this installment - a bijou movie of virtual 60mph... You can see the cogs moving. I was going to add my own soundtrack !

                      I just realised that if I am going to do a lot of these bench miles that I should get a spare cluster from somewhere or my mileage will be horrendous
                      Attached Files
                      Paul Nugent
                      Webmaster http://S2central.net
                      Administrator http://S2forum.com

                      1994 S2 Coupe ABY - aka Project Lazarus
                      2001 A6 allroad 2.5TDi - family tank
                      2003 S4 Avant 4.2 V8 - daily burble

                      Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                      There are only 10 kinds of people that understand binary - those that do, and those that don't

                      Comment


                      • #12
                        To complete Part 1, I plan on making a few of these G22 simulator for a range of speeds and have a selection switch. Then add a host of other small switches, pots and buttons to perform lamp tests and it is there.

                        I will also look to see if I can get a supplier for that ITT chip - would be a good trick for a UR conversion to generate a proper and robust VSS line for little cost - well I assume it would be a very high volume / low cost chip.
                        Paul Nugent
                        Webmaster http://S2central.net
                        Administrator http://S2forum.com

                        1994 S2 Coupe ABY - aka Project Lazarus
                        2001 A6 allroad 2.5TDi - family tank
                        2003 S4 Avant 4.2 V8 - daily burble

                        Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                        There are only 10 kinds of people that understand binary - those that do, and those that don't

                        Comment


                        • #13
                          Originally posted by S2central.net View Post
                          The complexity of this is moderate to high, but I have only dabbled on the edges of it it in the past as it would take some concerted effort to make such a beast.
                          But defniately worth it An ex-colleague of mine did something similar, but for his drag bike engine, in order to squeeze the last 100th of a second over the 1/4 mile. Will be following this thread with interest.
                          Shocked, exhausted, hosed, bushed, dumped, chipped, mounted, filtered, gauged, packed, intermittantly wiped and braked. I mean broken. Now, about the car...

                          Comment


                          • #14
                            Quick capture of the overall scope attached... More to come this week hopefully.
                            Attached Files
                            Paul Nugent
                            Webmaster http://S2central.net
                            Administrator http://S2forum.com

                            1994 S2 Coupe ABY - aka Project Lazarus
                            2001 A6 allroad 2.5TDi - family tank
                            2003 S4 Avant 4.2 V8 - daily burble

                            Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                            There are only 10 kinds of people that understand binary - those that do, and those that don't

                            Comment


                            • #15
                              Paul, you are a peculiar man I have to say

                              Where do you find the motivation to start all these projects?

                              Comment

                              Working...
                              X