Getting & Manipulating turbocharger wastegate limits

Discussion in 'Programming' started by SixSixSevenSeven, Dec 20, 2015.

  1. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,968
    I've been wanting to manipulate the wastegate limits of the turbocharger systems based on the current gear the car is in with lua, yet having taken a fiddle with some lua cant for the life of me work out how to actually set or retrieve the values.

    Code:
    local M = {}
    
    
    local function onInit()
    end
    
    local function updateGFX(dt)
        turbo = v.data.turbocharger
        if drivetrain.gear == 1 then
            print "Gear 1"
            turbo.wastegateStart
            --print v.data.turbocharger.wastegateStart
        end
        if turbo ~= nil then
            print "We Have TURBO!!!"
        end
    end
    
    -- public interface
    M.onInit      = onInit
    M.updateGFX = updateGFX
    
    return M
    
    commenting out turbo.wastegateStart allows the script to run, uncommenting it, spams the console with errors about a reference to drivetrain. I'm lost now.
    All I really wanted to do was halve the allowed wastegate pressures when in gears 1 and 2
     
  2. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,715
    this is a little beyond me with the language used, you need a general understanding of coding I know that much but I would have to read the code and understand it first and that takes a few days for information like that to sink in...
     
  3. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,968
    I practically have a degree in programming, this is nothing to do with the language or my lack of skill for programming in general (for reference, plenty of lua experience thanks...) but a question of how the specific API works.
     
    • Like Like x 1
  4. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,715
    Ahh I dont have that skills that you do I have more hardware related skills myself and I have built and maintained a server and done far more with that with software, oh I didnt realise man but APIs are a bit of a niggle for me but I will work on it :)
     
  5. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,968
    Considering how blindly you answer peoples hardware questions, I couldnt call you a hardware guy either...

    The blind answering to questions is at best simple annoying spam and at worst outright malicious
     
  6. Scepheo

    Scepheo
    Expand Collapse

    Joined:
    Feb 10, 2015
    Messages:
    602
    The drivetrain is a part of the vehicle lua. Something like scenetree.thePlayer:queueLuaCommand('drivetrain.gear = 1;') might work. I don't think it's currently possible to make any of your own scripts part of the vehicle lua without changing game files.
     
  7. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,968
    drivetrain.gear works fine, absolutely fine

    Its literally just the turbo causing issues
     
  8. Scepheo

    Scepheo
    Expand Collapse

    Joined:
    Feb 10, 2015
    Messages:
    602
    I'm not sure why you're getting errors about the drivetrain then. Still, the wastegateStart variable isn't actually part of the public interface of the turbocharger module, and as such isn't accessible from other scripts.
     
  9. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,619
    @SixSixSevenSeven
    1. A little OT, but is what you are trying to do realistic?
    2. What are you doing on line 10? Do you mean to be doing print(turbo.wastegateStart) ? Is this some sort of lua thing where mentioning a variable should print/echo it or what?
    3. It looks like you declare turbo as a global variable rather than local. Am I misunderstanding? I don't think you should be doing that.
     
  10. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Engineering
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,701
    Just now saw this. At this point it's not possible to change the turbo related parameters on the fly, such an API simply does not exist.
    Why would you want to do this?
     
  11. Neidjel

    Neidjel
    Expand Collapse

    Joined:
    Aug 4, 2013
    Messages:
    332
    Of course I can't answer for 6677 but I think he would like to reduce boost in first and second gear to reduce wheelspin and improve drivability of high horsepower turbocharged cars like some (modified) cars do IRL as well.
     
  12. amarks240

    amarks240
    Expand Collapse
    Guest

    look up something called boost by gear for a tuning solution called hondata. it helps make only the power you can effectively put down only letting you get full boost in the upper gears. if you have a 500whp honda its a big help.
     
  13. SixSixSevenSeven

    SixSixSevenSeven
    Expand Collapse

    Joined:
    Sep 13, 2013
    Messages:
    6,968
    hondata aren't the only ones. Just about every aftermarket standalone ecu offers such a facility.

    but yes. Was after boost per gear which can be a great aid to dumping large amounts of horsepower in certain vehicles. The mcm daisy build is one example
     
  14. amarks240

    amarks240
    Expand Collapse
    Guest

    Hondata is merely what I have personal experience with. They also have an after market traction control with a knob that allows you to actually dial on how much wheel spin you want to allow. Considering it isn't a true stand alone unit like the AEM ems, it's probably one of the best bangs for the buck possible. You can also wire your wide band and boost Guage to it and data log and adjust fuel and boost maps on the fly. Not bad for a solder in board installed for 500 usd. Boost by gear, because your LSD isn't enough. It even has Bluetooth for android or laptop.
     
  15. Max98

    Max98
    Expand Collapse

    Joined:
    Aug 18, 2012
    Messages:
    43
    As I'm the guy who coded most of the turbo code, I believe that it's not possible to change data on the fly for the moment. I'm planing to work on updating parameters on the fly in the future for the same situations as you have. E.g: Changing engine modes, from normal to sport, wastegate real time update depending on the user input and stuff like that...
     
    • Like Like x 7
  16. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,477
    Well in that regard, good work so far!
     
  17. Jurrunio

    Jurrunio
    Expand Collapse

    Joined:
    Sep 23, 2015
    Messages:
    147
    How about limiting max throttle in low gears?
     
  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