Solved Powertrain device with two inputs

Discussion in 'Mod Support' started by aljowen, Jan 16, 2019.

  1. SebastianJDM

    SebastianJDM
    Expand Collapse

    Joined:
    Apr 9, 2017
    Messages:
    856
    check out the hybrid bus mod. copy the lua code (with permission) and modify it to support engaging/disengaging at certain wheelspeeds and engine loads. check out the Streams wiki page and scroll down to see the values you can use (like "M.values.wheelspeed" and "M.values.throttle" or "electrics.values.engineLoad").
    also, fantastic idea, you seem like quite the creative one lol. have you studied automotive engineering at all? :)
     
  2. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    I will need to take a proper look at it, I have had a quick try but its not immediately clear to me what effect it is having, or what it is doing.

    I haven't studied automotive engineering, I studied Games Computing (TLDR: programming games). But making cars is fun.
     
    • Like Like x 1
  3. Miura

    Miura
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    311
    I have a couple of vehicles that combine engine and electric motor powertrains using rotators. It's a bit complex, but I'll try to explain.

    On the electric motor side, there's a clutch (always engaged) after the motor, then a shaft connected to a rotator. The rotator has four nodes freely spinning around an axle, like a flywheel.

    The engine side of the powertrain is otherwise normal, but there's an extra locked differential after the gearbox. First output of the diff goes toward the wheels (rangebox in this case). Second output goes to a shaft, connected to another rotator. This rotator has the same node group as the first one, so it spins the same flywheel. This way, both sides can apply and receive torque.

    The engine uses normal vehicleController, and there's an auxiliary controller for electric motor throttle and charging. Regenerative braking works, and electric only mode if the engine is shut down.
     
    • Like Like x 2
    • Informative Informative x 1
  4. Blijo

    Blijo
    Expand Collapse

    Joined:
    Apr 27, 2016
    Messages:
    2,055
    If you want, or anyone else, I have an electric Offroader chassis like the Bollinger B1 for testing purposes. Just pm me if you want to use it as a testbed for something like you say :p
     
    • Like Like x 1
  5. DapperDan

    DapperDan
    Expand Collapse

    Joined:
    May 2, 2015
    Messages:
    1,249
    two inputs and one output, I have been trying to tackle this topic for a couple of months now, it can work, as stated earlier in the thread you can have two engines powering the front and rear wheels independently, I am not too sure with them powering say the rear wheels only
    here are some videos of the concept.


    in both instances, both vehicles run on the same independent setup, I must run some experiments to see if it is possible to have two inputs and one output.
     
    • Informative Informative x 1
  6. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    I am currently having an attempt at implementing this, do you know the syntax for attaching a rotator to a powertrain?

    Currently I have the following, but the mod crashes when throttle is applied. I can't find any documentation for Rotators on the wiki or forums either, so am a bit puzzled.
    Code:
    "rotators":
            [
                ["name","[group]:","node1:","node2:","nodeS","nodeArm:","wheelDir"],
                {"radius":0.450},
                {"brakeTorque":0},
                {"parkingTorque":1000},
                {"propulsed":1},
                ["M1", ["Motor1"], "rs1l2", "rs1r2", 9999, "ct3r",  1],
                ["M2", ["Motor1"], "rs1l2", "rs1r2", 9999, "ct3r", 1],
            ],
       
            "powertrain" : [
                ["type", "name", "inputName", "inputIndex"],
                ["differential", "differential_Mid", "gearbox", 1,{"diffType":"locked", "gearRatio": 1.0, "friction":8}],
                ["shaft", "diffToRot", "differential_Mid", 2,{"connectedWheel":"M1", "breakTriggerBeam":"axle_RR", "friction":0}],
                ["differential", "differential_R", "differential_Mid", 1,{"diffType":"locked", "gearRatio": 3.0, "lsdPreload":125, "lsdLockCoef":0.125, "lsdRevLockCoef":0.0625, "friction":8}],
                ["shaft", "wheelaxleRL", "differential_R", 1, {"connectedWheel":"RL", "breakTriggerBeam":"axle_RL", "friction":0}],
                ["shaft", "wheelaxleRR", "differential_R", 2, {"connectedWheel":"RR", "breakTriggerBeam":"axle_RR", "friction":0}],
            ],
    I also have the rotator nodes and node group defined elsewhere, with the beams to support them. The electric motor is also connected in a separate bit of code.

    Thanks :)


    EDIT:
    Spinning the rotator (via dragging the nodes) does seem to spin the drive wheels. So the differential part is clearly working. Its only when throttle is applied to the rotator via the engine or motor that the mod crashes.

    EDIT2:
    It seems to work at low speeds, so if around 5% throttle is applied it seems to work fine. Will continue to investigate...

    EDIT3:
    See below posts
     
    #26 aljowen, Jan 18, 2019
    Last edited: Jan 18, 2019
  7. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Rotators are used in large spinner I believe.

    They are kinda automatic you just set rotator and it automatically powers wheels if my memory serves me right.

    This one uses also Rotator:
    https://www.beamng.com/threads/drivable-ufo.55264/
     
  8. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    Managed to find the problem, the mod was crashing because the BeamNG ESC doesn't like this setup. From what I can tell, it seems to work with the ESC disabled.
     
    • Informative Informative x 1
  9. Miura

    Miura
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    311
    Try adding {"rotatorType":"rotator"} in the two rotator lines, so the game doesn't count them as wheels.
     
    • Informative Informative x 1
  10. aljowen

    aljowen
    Expand Collapse

    Joined:
    Oct 21, 2012
    Messages:
    1,677
    One thing that I am noticing is that the ICE engine doesn't seem to have any effect on the power output at the wheels.

    For example, if I change the ICE engine to have over 1000nm of torque, and put it into reverse, the 100nm electric motor still accelerates as normal in a forward direction despite everything being connected. If I then remove one of the shafts to disconnect the electric motor, the ICE engine accelerates as expected.

    Pretty sure that this is something to do with the stock controllers, but I am not sure. Not sure yet. Will need to do further testing with some custom lua I guess.


    Currently I have been using the manual gearbox, since that seems to power both motors. The automatic transmission only seems to simulate the ICE motor, then the electric one has no ability to add power to the rear wheels. Hence I think its probably the default controller that is running into issues.
     
  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