Torque converter physics

Discussion in 'Ideas and Suggestions' started by mcheijink, May 13, 2016.

  1. mcheijink

    mcheijink
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    23
    I like this game and I want it to get even better then it already is! That is why i wrote the explanation below about torque converters. It is more technical then most posts, but since i wrote it for the developers of this game i do not think that this fact really matters. TL DR, please implement a torque converter as a clutch in an automatic transmission, i attached some papers with differential equations describing what happens, so it should be easy to implement ;-).
    (But it isn't easy, i do not have a clue how to turn these equations into code, and i would be surprised if you devs know how to.)

    Torque Converter:

    There are roughly two types of clutches used, friction disks and a torque converter.

    Currently, BeamNG only seems to simulate the friction disk type of clutch. A plate connected to the engine and one connected to the gearbox will transfer torque. The amount of torque the clutch can transfer is based on the force pushing both plates together. This is basically the same principle as a tire transferring force to the road. When you want to disconnect the engine from the gearbox, you just release all the force from the plates. Off course this is extremely oversimplified, the performance of a real clutch changes with temperature and wear. (and maybe more I cant think of at this moment)

    For automatic gearboxes an algorithm will auto clutch and generally this is a good approach, the gears will shift and the car drives. However, most real automatic cars use a torque converter where the amount of torque transferred from the engine to the gearbox is dependent on the difference in speed between the engine and the gearbox. A torque converter is a vessel filled with oil. The engine drives a turbine which will pump the oil around. The gearbox is connected to an impeller, a pump in reverse, and is turned by the oil moving around in the vessel.

    To move a car, a force has to be transferred from the engine to the wheels, to counteract the force of air and rolling resistance. So in a car with a torque converter, there always would be slippage (difference in speed between the engine and gearbox) when the car is moving. So in a modern torque converter you also have a lock up clutch, so slip (and loss of energy) in higher gears would be eliminated. Lastly, a torque converter would contain a stator, a device to steer the oil. The purpose of the stator is to make engine braking possible (transfer of force from the gearbox back to the engine).

    I do not exactly know how you modelled the current clutch. I think it allows for slip between the engine and gearbox as long as torque-limit is lower then the amount of torque available for transfer. The torque-limit of the clutch seems to be bound by the percentage of clutch used. In a manual car the user will use the clutch pedal, and in an automatic car logic seems to take over. But the logic doesn't appear to be fast enough to negate the engine stalling on braking to a standstill.

    The reason I am explaining the torque converter has to do with my hobby in BeamNG, off-roading and rock crawling. I get annoyed by the stalling of the engine, and the fact that it cannot rev really high nor transfer that much of torque. My gut feeling says that a proper simulation of the torque converter would improve the rock crawling a lot. I also think that a torque converter makes it possible to transfer more torque to the gearbox then the engine is delivering. This could have its source in the engine delivering say 2 nm at 2 rpm, while the gearbox is moving at 0.1 rpm. Say the power is transferred, then the amount of force the gearbox would be receiving would be higher then the 2 nm. I think they call this the torque ratio. This fact would also be beneficial to rock crawling!

    My plan was to design and test some code in Matlab, and present that to you, but i simply do not have the time at this moment. So I am sharing this explanation and a couple of papers describing the functioning of a torque converter.

    Papers:
    Math-based Torque Converter Modelling to Evaluate Damping Characteristics and Reverse Flow Mode Operation
    Modeling Torque Converter Characteristics in Automatic Drivelines: Lock-up Clutch and Engine Braking Simulation
    Acausal Powertrain Modelling with Application to Model-based Powertrain Control
     
    • Like Like x 4
  2. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    I don't know when the devs are planning to implement a more realistic automatic transmission (W/ torque converters etc) simulation but...

    @StinchinStein Is trying to figure out how he can implement torque converter simulation and a more realistic automatic/manual transmission simulation overall into this MFM mod, its currently "low priority" but he should be able to pull something off as he pulled everything off that I asked him to see if he could implement x feature.

    https://trello.com/c/8ymGZlXz/6-transmission-system-7-9-or-later

    http://www.beamng.com/threads/more-...ne-ignition-horn-tire-wear-battery-sim.18246/
     
  3. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    Use arcade automatic. It performs like a torque converter.
     
  4. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,960
    no it doesn't
     
  5. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    At least it doesn't overheat the engine that easily.
     
  6. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,960
    now I have no idea what you are on about. Transmission doesnt effect overheating...
     
  7. Narwhal

    Narwhal
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    1,698
    i think he means the shiftpoints. it doesnt go as high a rpm thus not overheating the engine as fast. i dont know how true that is, im just interpreting what he said.
     
  8. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,960
    only at low throttle, in which case in manual you'd be shifting earlier anyway
     
  9. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    146
    You got it partly right. With arcade auto, the system doesn't let the engine rpm go too high by controlling the clutch.
    It's hard to explain in words, just add a front transfer case into the D series spawned by default, and make it climb a steep hill. The app which shows the how much throttle, brake, clutch and hand brake are applied will show how arcade auto controls the clutch to prevent engine from killing itself with heat.
     
  10. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,960
    it doesnt do that at all, it slips the clutch to prevent stalling....
     
  11. mcheijink

    mcheijink
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    23
    I have something working in BeamNG. @Josh, thanks for pointing me at the main.lua file, i didnt know BeamNG was this open sourced. In the drivetrain.lua file i could find and modify the code for the torque converter
    Stock automatic clutch

    Torque converter


    I used a static model out of one of the previous papers to model the torque transmission in BeamNG
    http://imgur.com/a/BUVdQ

    This is the code i used, i also
    Code:
    -- getting speed ratio
                if wheelBasedEngAV < 0 then
                speedratio = 0
                else
                speedratio = wheelBasedEngAV/M.engineAV
                end
             
                -- modeling torque ratio
                if speedratio < 0.9 then
                    torqueratio = 1.7 - ((0.7/0.9) * speedratio)
                else
                    torqueratio = 1 * speedratio
                end
             
                --modeling capacity factor
                if speedratio < 0.9 then
                    capacityfactor = 0.5+speedratio*2
                elseif speedratio < 1.0 then
                    capacityfactor = -60+speedratio*69
                else
                    capacityfactor = 9.20
                end
                capacityfactor = capacityfactor * viscousCoupling
             
                torquediff = math.abs(M.engineAV/capacityfactor)^2
             
                M.engineAV = max(M.engineAV + dt * (torque - torquediff - M.engFriction - M.brakingCoef * M.engineAV) * invEngInertia, 0)
    
                M.torque = torquediff
                M.torqueTransmission = torque * torqueratio * engine.gears[M.gear]
                axleAV = M.engineAV / engine.gears[M.gear]
    Would it be useful to implement this in a mod? You can use this code by replacing the drivetrain.lua from your Beamng\lua\vehicle folder with the attached file. I wrote the code in a couple of hours time, so bugs could still be plenty full. But, i made it so that you can switch to the torque converter with Q.
     

    Attached Files:

    #11 mcheijink, May 15, 2016
    Last edited: May 15, 2016
    • Like Like x 1
  12. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    @mcheijink

    Getting to the file (keep in mind these are bugs I found.)

    • it seems once you shift down (at a high enough speed and RPM) the engine usually over revs and and (sticks there even when stopped) and instantly kills it self, the coolant/oil/block temp etc sky rocket to temperatures I never have before seen in beam before.

    • when shifting down (at high RPM/speed), it likes to cause instabilities in the physics and crash the game :p.
    • The UI doesn't update when shifting though 1st and 2nd gear ranges it's stuck on D.
    • RPM stays sky high (like its slipping?) when cruising (600-700 rpm difference at the same speed compared to the standard "automatic")
    • "kickdown", does the same as shifting down manually (over revs,sticks to that rpm and blows.)
    (Other than those bugs, I like it)

    could you possibly, create a way to simulate torque converter stall?

    Is it possible have a adjustable setting to where we could adjust when it locks up (speed)?

    (Sorry I don't know nothing about coding, I wish I could help with this.)
     
    #12 Josh, May 16, 2016
    Last edited: May 16, 2016
  13. auntie

    auntie
    Expand Collapse

    Joined:
    Jul 17, 2014
    Messages:
    28
    Hi mcheijink,

    I'm glad you are working on this! This has been a pet project of mine for a little bit as well.

    I tried your code, and it worked well during acceleration, but it acts strangely when there is a car with a lot of driveline slop (like the LTD I'm working on), when in gear and stopped. I think something in the capacityfactor calculation is giving a negative torque under certain conditions when it shouldn't. Also, like Josh said, it has trouble simulating stall speed. I was working on something that also used a speedratio like yours, but didn't use the capacityfactor, and combined it with the clutch management of the standard automatic. The result is something that, while mathematically not quite right, yields a similar torque delivery to your original code, and simulates the stall characteristics of a torque converter. I don't know how accurate of a simulation it is, but it feels right, and is stable with every car I've tried it on in a variety of conditions, although it still doesn't update the gear selector beyond D in the UI.

    Here's what I got while playing with it, try it out and see what you think.

    Code:
    -- torque converter implementation
            if M.shifterMode == 4 then
                local speedratio
                local torqueratio
                local capacityfactor
                -- getting speed ratio
                if wheelBasedEngAV < 0 then
                speedratio = 0
                else
                speedratio = wheelBasedEngAV/M.engineAV
                end
               
                -- modeling torque ratio
                if speedratio < 0.9 then
                    torqueratio = 2.0 - ((1.0/0.9) * speedratio)
                elseif speedratio <= 1 then
                    torqueratio = 1 * speedratio
                    --add safety factor in case speedratio goes crazy to protect physics
                elseif speedratio > 15 then
                    torqueratio = -15
                else
                    torqueratio = -1 * speedratio
                end
                -- this seems to work
                -- skip modeling capacity factor, causing problems in sloppy drivetrains
                -- now add the standard automatic code (with torqueratio)
                torquediff = (M.engineAV - wheelBasedEngAV) * viscousCoupling
                if math.abs(torquediff) > clutchTorque then
                    torquediff = fsign(torquediff) * clutchTorque
                end
                torquediff = torquediff * internal_clutchRatio
                M.engineAV = max(M.engineAV + dt * (torque - torquediff - M.engFriction - M.brakingCoef * M.engineAV) * invEngInertia, 0)
    
                M.torque = torquediff
                M.torqueTransmission = torquediff * torqueratio * engine.gears[M.gear]
                axleAV = M.engineAV / engine.gears[M.gear]
    Thanks for sharing your work!
     
    • Like Like x 1
  14. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    Yes I forgot to mention thanks @mcheijink

    @auntie ill give yours a try, maybe you @mcheijink and @StinchinStein should get together on this.

    I bet you 3 guys can come up with some interesting stuff !

    Update​

    I got a question for you guys, with either code what is lockup based on?

    Would it be possible to base it on gear selection, throttle position and wheel speed?

    for example ​
    • 1-2 gears would be unlocked unless 40% throttle or more throttle is applied.
    • 3-4 and higher gears will be based on wheel speed + 40% or more throttle = locked up?
    • For example wheel speed for 3 and 4 lockup would be 40 mph or 64 kph?

    (Again if i'm totally off base, please excuse my lack of knowledge on code.)

    Thanks
     
    #14 Josh, May 16, 2016
    Last edited: May 16, 2016
  15. mcheijink

    mcheijink
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    23
    I tried to fix it a bit in my code.
    A typical torque converter has 3 modes in which it operates,
    1. torque from engine to transmission
    2. torque from transmission to engine (engine braking)
    3. lock-up

    In my code, only the first has been implemented, and it has been implemented in a weird way. I do not really know how to reference a lookup table within BeamNG, and because of this, i tried calculating the appropriate shape with different formulas. With a proper version, every gearbox should have its own torque converters with their own operating graphs.

    Stall speed, this is a result from the capacity factor curve and the amount of slip. At some point, the amount of slip will be high enough that the converter would transfer all the torque from the engine to the gearbox. With the brakes applied (transmission stopped), the engine RPM wouldn't be able to get higher.

    Lock-up is a mode in modern transmissions where an actual clutch in the torque converter gets engaged, locking the transmission to the engine. This should be easy to implement, but i am not familier with a good strategy for using lock-up. >2500 rpm in a gear above 3?
     

    Attached Files:

  16. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082

    You could use a wheel speed vs rpm strategy if you wanted/able to.

    or even throttle position vs wheel speed I would say 3 gear would be a good starting point.
     
  17. mcheijink

    mcheijink
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    23
    Thanks for the great feedback, I will try to share my knowledge on your points.

    I agree that the code is good while on power, but not so good while off power. I think I will try to mirror the code so that mode 2 will operate the same as mode 1. Not completely sure how to do this properly. In my latest code, I think i already improved on the engine braking.
    True, not really sure why it does that. I thought I went trough all the drivetrain code to add the torque converter as a fourth gearbox mode, but apparently the UI wont recognize the 1st and 2nd gear. I stopped looking, because its just a UI thing, and I want the stuff underneath the bonnet of BeamNG to work propperly

    Jep, that's how the torque converter works, and why cars with them used to not be economical. Although 600-700 rpm is a bit high, I think the capacity-factor needs a bit of tuning. This is also where mode 3 of the torque converter comes into play. I think I will try to implement that one day.

    I think you really need the capacityfactor, because this lets the torque converter get slip. The capacityfactor is used to calculate the amount of force being able to get transferred from the engine to the gearbox. So in a sense, it is some kind of clutch management, but better because it relies on physics and not a script calculating the clutch position.

    The code in my last post will run a bit better, I don't think I have the time today to work on this. I would however pay attention to the forum to answer questions.
     
  18. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    Here is what the pcm in fords, use when I tune vehicles (throttle position vs wheel speed).

    0 is no throttle and 1,020 is (wot).

    (this is 3rd gear).
     

    Attached Files:

    • Capture.PNG
  19. mcheijink

    mcheijink
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    23
    That is awesome!
    *Starting notepad++*
     
  20. Josh

    Josh
    Expand Collapse

    Joined:
    Jul 21, 2013
    Messages:
    1,082
    Glad I could help if you need any other tables let me know.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice