Solved How to find gearbox RPM?

Discussion in 'Mod Support' started by Tsutarja495, Feb 16, 2018.

  1. Tsutarja495

    Tsutarja495
    Expand Collapse

    Joined:
    Mar 16, 2014
    Messages:
    820
    I know that a gearbox has its own distinct RPM value, but how can this value be obtained and used in lua?
     
  2. BombBoy4

    BombBoy4
    Expand Collapse

    Joined:
    May 16, 2015
    Messages:
    1,599
    Gearbox RPM is dependent on the gear and ratio I believe. It's the RPM that the transmission is rotating at, unlike engine RPM which is the RPM the crankshaft is rotating at.
     
  3. SebastianJDM

    SebastianJDM
    Expand Collapse

    Joined:
    Apr 9, 2017
    Messages:
    856
    pretty sure it's engine RPM/gearRatio
    wheel RPM would be gearbox RPM/finalDrive
     
  4. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,774
    Have you looked into steamapps\common\BeamNG.drive\ui\modules\apps\PowerTrainDebug\app.js ?

    That is responsible of showing gearbox rpm in powertrain app I believe.
     
  5. Tsutarja495

    Tsutarja495
    Expand Collapse

    Joined:
    Mar 16, 2014
    Messages:
    820
    This is what I found:
    Code:
            var textItems = []
            if(e && e.av) {
              textItems.push('RPM: ' + Math.round(e.av * 9.549296596425384)); // AV to RPM: 9.549296596425384
            }
    This is a general code, used for everything (engine, gearbox, and so on).

    I'm not sure how to directly obtain the RPM of the gearbox.
     
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,774
    Gearbox RPM, like output of TC or Clutch or RPM like Output?

    Sadly I don't know such, but writing dump(powertrain) to console gives me quite a lot of all kind of words and numbers, from log file one might be able to find some new things to try, maybe?
    Code:
     90.23708|A|libbeamng.lua.V.lua.utils|          maxCumulativeGearRatio = 8.2992,
     90.23709|A|libbeamng.lua.V.lua.utils|          maxGearIndex = 2,
     90.23709|A|libbeamng.lua.V.lua.utils|          maxGearRatio = 1.82,
     90.23711|A|libbeamng.lua.V.lua.utils|          maxParkClutchAngle = 1.992959234277,
     90.23712|A|libbeamng.lua.V.lua.utils|          minGearIndex = -1,
     90.23714|A|libbeamng.lua.V.lua.utils|          minGearRatio = 1,
     90.23715|A|libbeamng.lua.V.lua.utils|          minimumGearChangeTime = 0.5,
     90.23716|A|libbeamng.lua.V.lua.utils|          mode = "drive",
     90.23718|A|libbeamng.lua.V.lua.utils|          name = "gearbox",
     90.23720|A|libbeamng.lua.V.lua.utils|          oneWayTorqueSmoother = {
     90.23722|A|libbeamng.lua.V.lua.utils|            _startingValue = 0,
     90.23723|A|libbeamng.lua.V.lua.utils|            a = 0.04,
     90.23725|A|libbeamng.lua.V.lua.utils|            st = 0,
     90.23726|A|libbeamng.lua.V.lua.utils|            <metatable> = <table 3>
     90.23728|A|libbeamng.lua.V.lua.utils|          },
     90.23730|A|libbeamng.lua.V.lua.utils|          oneWayViscousCoef = 20,
     90.23732|A|libbeamng.lua.V.lua.utils|          oneWayViscousTorque = 500,
     90.23734|A|libbeamng.lua.V.lua.utils|          outputAV1 = 35.127011032104,
     90.23735|A|libbeamng.lua.V.lua.utils|          outputPorts = { true },
     90.23736|A|libbeamng.lua.V.lua.utils|          outputTorque1 = 6.3058717167529,
     90.23737|A|libbeamng.lua.V.lua.utils|          parent = <13>{
     90.23737|A|libbeamng.lua.V.lua.utils|            additionalEngineInertia = 0.11,
     90.23738|A|libbeamng.lua.V.lua.utils|            calculateInertia = <function 59>,
     90.23739|A|libbeamng.lua.V.lua.utils|            children = { <table 12> },
     90.23740|A|libbeamng.lua.V.lua.utils|            connectedChildrenCount = 1,
     90.23742|A|libbeamng.lua.V.lua.utils|            converterDiameter = 0.25,
     90.23742|A|libbeamng.lua.V.lua.utils|            converterStiffness = 7.5,
     90.23743|A|libbeamng.lua.V.lua.utils|            converterTorque = 210.88130942989,
     90.23744|A|libbeamng.lua.V.lua.utils|            couplingAVRatio = 0.87,
     90.23745|A|libbeamng.lua.V.lua.utils|            cumulativeGearRatio = 16.5984,
     90.23745|A|libbeamng.lua.V.lua.utils|            cumulativeInertia = 0.0060211969184375,
     90.23746|A|libbeamng.lua.V.lua.utils|            deviceCategories = {
     90.23747|A|libbeamng.lua.V.lua.utils|              clutchlike = true,
     90.23748|A|libbeamng.lua.V.lua.utils|              viscouscoupling = true
     90.23748|A|libbeamng.lua.V.lua.utils|            },
     90.23749|A|libbeamng.lua.V.lua.utils|            fluidDensity = 844,
     90.23750|A|libbeamng.lua.V.lua.utils|            gearRatio = 1,
     90.23750|A|libbeamng.lua.V.lua.utils|            inputAV = 73.813966487609,
     90.23751|A|libbeamng.lua.V.lua.utils|            inputIndex = 1,
     90.23752|A|libbeamng.lua.V.lua.utils|            inputName = "mainEngine",
     90.23753|A|libbeamng.lua.V.lua.utils|            isBroken = false,
     90.23753|A|libbeamng.lua.V.lua.utils|            isPhysicallyDisconnected = false,
     90.23754|A|libbeamng.lua.V.lua.utils|            isPropulsed = true,
     
  7. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,966
    Fairly easy to do:
    Code:
    powertrain.getDevice("gearbox").outputAV1
    Is where your gearbox angular velocity is in at any given point in time after init.
    If you want to convert that to RPM, you need to multiply with
    Code:
    9.549296596425384
     
  8. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,774
    So from dump above I can see:
    90.23718|A|libbeamng.lua.V.lua.utils| name = "gearbox",
    90.23734|A|libbeamng.lua.V.lua.utils| outputAV1 = 35.127011032104,

    I guess logic to get unknown is like this:
    powertrain.getDevice("gearbox").outputAV1

    So with same logic wanting to know torque of box would be:
    powertrain.getDevice("gearbox").outputTorque1

    Maybe that bit is useful for someone at sometime in a future.
     
  9. Tsutarja495

    Tsutarja495
    Expand Collapse

    Joined:
    Mar 16, 2014
    Messages:
    820
    Thanks for the help, it worked :)
     
  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