I need a little help with my electric pigeon addon

Discussion in 'Content Creation' started by Owiko7, Dec 22, 2019.

Tags:
  1. Owiko7

    Owiko7
    Expand Collapse

    Joined:
    Jun 8, 2015
    Messages:
    58
    Hi, I'm trying to make the Ibishu pigeon have a small simple electric motor, but I can't figure out how to get the motor to transmit power to the rear wheels of the car. I managed to get the battery and electric motor to show up in game, and when you put the pigeon in drive, the electric motor runs and works as expected, but no power goes to the wheels, and I can't figure out how to make it work.

    I used the eSBR jbeam files to figure out how the motor and battery work, but I just can't figure out how to make the engine power the wheels in the pigeon. I know that the eSBR uses a transaxle and that the pigeon uses a longitudinal setup for its powertrain, and so something must be missing, but I don't know what it is. Just to clarify, I'm using all the standard pigeon vehicle models to keep things simple at the moment.

    I currently have 3 jbeam files in the folder: "pigeon_differential_R_electric", "pigeon_battery", and "pigeon_engine_e"

    Here is a part of the pigeon_engine_e jbeam:

    Code:
    {
    "pigeon_engine_e": {
        "information":{
            "authors":"BeamNG",
            "name":"Electric motor",
            "value":300,
        }
        "slotType" : "pigeon_engine",
        "slots": [
            ["type", "default", "description"]
            ["pigeon_differential_R_electric","pigeon_differential_R_electric", "Rear Differential"],
        ],
        "powertrain": [
            ["type", "name", "inputName", "inputIndex"],
            ["electricMotor", "rearMotor", "dummy", 0],
        ],
        "rearMotor":{
            "torque":[
                ["rpm", "torque"],
                [0, 43],
                [500, 50],
                [1000, 50],
                [1500, 50],
                [2000, 45],
                [3000, 40],
                [4000, 35],
        
            ],
    
            "maxRPM":3600,
            "inertia":0.10,
            "friction":5,
            "dynamicFriction":0.0005,
            "electricalEfficiency":0.95,
            "torqueReactionNodes:":["rem1l","rem1r","rem4r"],
            "energyStorage": "mainBattery",
            "electricsThrottleFactorName": "throttleFactorRear",
    
            //node beam interface
            "torqueReactionNodes:":["e1l","e2l","e4r"],
            "waterDamage": {"[engineGroup]:":["engine_intake"]},
            "radiator": {"[engineGroup]:":["radiator"]},
            "engineBlock": {"[engineGroup]:":["engine_block"]},
            "breakTriggerBeam":"engine",
            "uiName":"Engine",
            "soundConfig": "soundConfig",
            "soundConfigExhaust": "soundConfigExhaust",
    
            "soundConfig": "soundConfigRear",
        },
        "soundConfigRear": {
            "sampleName": "ElectricMotor",
            "mainGain": -4,
            //"maxLoadMix": 0.65,
            //"minLoadMix": 0,
            //"onLoadGain":1,
            //"offLoadGain":0.65,
            //"eqLowGain": -15,
            //"eqLowFreq": 100,
            //"eqLowWidth": 0.05,
            //"eqHighGain": -5,
            //"eqHighFreq": 6000,
            //"eqHighWidth": 0.1,
            //"eqFundamentalGain": -5,
        },
        "vehicleController": {
            "shiftLogicName":"electricMotor",
            "motorNames": ["rearMotor", "frontMotor"],
            "topSpeedLimitReverse": 15,
        },
        "flexbodies": [
            ["mesh", "[group]:", "nonFlexMaterials"],
            ["pigeon_engine", "pigeon_engine"],
            {"deformGroup":"radtube_break", "deformMaterialBase":"pigeon", "deformMaterialDamaged":"invis"},
            ["pigeon_radtube", ["pigeon_engine","pigeon_radiator"]],
            {"deformGroup":""},
        ],
        "props": [
            ["func"      , "mesh"              , "idRef:", "idX:", "idY:"            , "baseRotation"        , "rotation"                 , "translation"        , "min", "max", "offset", "multiplier"]
            ["radiatorFanSpin"  , "pigeon_fan", "e2r","e2l","e4r",  {"x":0, "y":0, "z":0}, {"x":0, "y":1, "z":0}    , {"x":0, "y":0, "z":0}, -360, 360, 0, 1],
        ],
        "nodes": [
             ["id", "posX", "posY", "posZ"],
             //--658cc I3 Diesel Engine--
             {"selfCollision":false},
             {"collision":true}
             {"nodeMaterial":"|NM_METAL"},
             {"frictionCoef":0.5},
             {"group":"pigeon_engine"},
             {"nodeWeight":12},
             {"engineGroup":"engine_block"}
             {"chemEnergy":1000,"burnRate":0.39,"flashPoint":700,"specHeat": 0.2,"selfIgnitionCoef":false,"smokePoint":600,"baseTemp":"thermals","conductionRadius":0.15}
             ["e1r", -0.12, -0.37, 0.25],
             ["e1l", 0.12, -0.37, 0.25],
             ["e2r", -0.12, -0.69, 0.25],
             ["e2l", 0.12, -0.69, 0.25],
             {"chemEnergy":false,"burnRate":false,"flashPoint":false, "specHeat": false,"selfIgnitionCoef":false,"smokePoint":false,"baseTemp":false,"conductionRadius":false}
             {"nodeWeight":3.5},
             {"engineGroup":["engine_intake","engine_block"]}
             ["e3r", -0.10, -0.37, 0.68,],
             ["e3l", 0.10, -0.37, 0.68],
             ["e4r", -0.10, -0.69, 0.68],
             ["e4l", 0.10, -0.69, 0.68,{"isExhaust":"mainEngine"}],
             {"engineGroup":""}
             {"group":""},
        ],
        "beams": [
              ["id1:", "id2:"],
              {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
              {"beamSpring":8001000,"beamDamp":250},
              {"beamDeform":100000,"beamStrength":"FLT_MAX"},
              //engine
              ["e1r","e1l"],
              ["e2r","e2l"],
              ["e3r","e3l"],
              ["e4r","e4l"],
    
              ["e1r","e2r"],
              ["e1l","e2l"],
              ["e3r","e4r"],
              ["e3l","e4l"],
    
              ["e1r","e3r"],
              ["e1l","e3l"],
              ["e2r","e4r"],
              ["e2l","e4l"],
    
              ["e2r","e3r"],
              ["e2l","e3l"],
              ["e2r","e3l"],
              ["e2l","e3r"],
    
              ["e1r","e4r"],
              ["e1l","e4l"{"isExhaust":"mainEngine"}],
              ["e1r","e4l"],
              ["e1l","e4r"],
    
              ["e1r","e2l"],
              ["e1l","e2r"],
              ["e3r","e4l"],
              ["e3l","e4r"],
    
              ["e1r","e3l"],
              ["e1l","e3r"],
              ["e2r","e4l"],
              ["e2l","e4r"],
    
              //radhose break
              {"beamType":"|SUPPORT", "beamLongBound":1.0},
              {"beamSpring":21000,"beamDamp":10},
              {"beamDeform":1000,"beamStrength":"FLT_MAX"},
              {"deformGroup":"radtube_break","deformationTriggerRatio":0.1},
              ["e4l","f15rr"],
              ["e3r","f15rr"],
              {"deformGroup":""},
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
        ],
        "triangles": [
                ["id1:","id2:","id3:"],
                {"triangleType":"NONCOLLIDABLE"},
                ["e2r", "e1r", "e1l"],
                ["e1l", "e2l", "e2r"],
                {"triangleType":"NORMALTYPE"},
    And here is a line from the pigeon_differential_R_electric jbeam:

    Code:
    {
    "pigeon_differential_R_electric": {
        "information":{
            "authors":"BeamNG",
            "name":"Open Rear Differential Electric",
            "value":450,
        },
        "slotType" : "pigeon_differential_R_electric",
        "slots": [
            ["type", "default", "description"],
            ["pigeon_finaldrive_electric_R","pigeon_finaldrive_electric_R_76", "Rear Final Drive", {"coreSlot":true}],
        ],
        "powertrain" : [
            ["type", "name", "inputName", "inputIndex"],
            ["differential", "differential_R", "rearMotor", 1, {"diffType":"open", "friction":8, "uiName":"Rear Differential","defaultVirtualInertia":0.25}],
        ],
    I am a noob, but I hope I have provided enough information for this to make sense, and that I haven't melted anyone's brains with this. Thank you for in advance for taking the time to read this.
     
    • Like Like x 1
  2. Alex_Farmer557

    Alex_Farmer557
    Expand Collapse

    Joined:
    Dec 28, 2016
    Messages:
    3,541
    as your motor isn't a rear diff, you'll need to make a single speed gearbox for the motor to transmit power
     
  3. Owiko7

    Owiko7
    Expand Collapse

    Joined:
    Jun 8, 2015
    Messages:
    58
    Whenever I do that it breaks the car, and I get a vehicle error warning when I load the motor.

    Edit: I have deduced that any time the code looks like this:

    Code:
    "pigeon_engine_e": {
        "information":{
            "authors":"BeamNG",
            "name":"Electric motor",
            "value":300,
        }
        "slotType" : "pigeon_engine",
        "slots": [
            ["type", "default", "description"]
    The pigeon spawns up and I can equip the electric motor and it will run, but no power goes to the ground. But if the code looks anything like this:
    Code:
    {
    "pigeon_engine_e": {
        "information":{
            "authors":"BeamNG",
            "name":"Electric motor",
            "value":300,
        }
        "slotType" : "pigeon_engine",
        "slots": [
            ["type", "default", "description"]
            ["pigeon_transmission", "pigeon_transmission_E", "1 Speed Transmission"]
    Equipping the motor in the parts selector causes an error message to appear, and the parts selector goes blank. I did copy the code for the 3M transmission and make a 1 speed variant with the correct naming and all, but it doesn't seem to want to work no matter what I try.
     
    #3 Owiko7, Dec 23, 2019
    Last edited: Dec 23, 2019
  4. Alex_Farmer557

    Alex_Farmer557
    Expand Collapse

    Joined:
    Dec 28, 2016
    Messages:
    3,541
    pm me the jbeams and i'll take a look
     
  5. JType

    JType
    Expand Collapse

    Joined:
    Mar 21, 2020
    Messages:
    3
    Deepest apologies for the thread necromancy.

    I was working on a nearly identical project, yoinking the motor out of an eSBR and porting it to another vehicle, in this case one of my Automation exports.
    I thought I'd nailed it, the vehicle spawns in without crashing, but when I select the motor, transmission, and battery, I run into the same issue - the entire parts selector/vehicle tuning page goes completely blank, preventing me from even turning the car back to its original configuration.
    I'd like to know what mysteries, if any, you discovered possibly rectifying this issue, please and thank you!
     
  6. Owiko7

    Owiko7
    Expand Collapse

    Joined:
    Jun 8, 2015
    Messages:
    58
    It seemed to be a part of the esbr motor file that goes ""electricsThrottleFactorName": "throttleFactorRear"," I think it needed to be deleted, also make sure the "name" under "Powertrain" matches what the rest of the file knows the engine as. Most cars have the engine named as "mainEngine", but the esbr has it named as "rearMotor". You will have to make sure that the esbr motor is named under this convention correctly. I don't know If i'm explaining it correctly, but i'm not great at coding either. Here's come code for example
    Code:
    {
    "sbr_motor_electric_R_performance": {
        "information":{
            "authors":"BeamNG",
            "name":"Performance Rear Electric Motor",
            "value":4000,
        },
        "slotType" : "sbr_engine",
        "slots": [
            ["type", "default", "description"],
            ["sbr_differential_R_electric","sbr_differential_R_electric", "Rear Differential"],
        ],
        "powertrain": [
            ["type", "name", "inputName", "inputIndex"],
            ["electricMotor", "rearMotor", "dummy", 0],
        ],
        "rearMotor":{
            "torque":[
    ^^^^ this is the first bunch of lines from the esbr file

    Code:
    {
    "pigeon_engine_eL": {
        "information":{
            "authors":"BeamNG",
            "name":" Weak AC Induction motor",
            "value":300,
        }
        "slotType" : "pigeon_engine",
        "slots": [
            ["type", "default", "description"]
            ["pigeon_transmission_E", "pigeon_transmission_E3", "Transmission"],
            ["pigeon_motor_limiter", "pigeon_motor_limiter", "Motor speed controller"],
            ["pigeon_motor_bearings", "pigeon_motor_bearings_sleeve", "Bearings",],
            ["pigeon_motor_capacitor", "pigeon_motor_capacitor", "Induction Motor Startup Capacitor",],
        ],
        "powertrain": [
            ["type", "name", "inputName", "inputIndex"],
               ["electricMotor", "mainEngine", "dummy", 0],
        ],
        "mainEngine": {
            "torque":[
    ^^^^ this is a bit of the code that I am using in my electric pigeon. The Pigeon transmission is looking for the engine to be named as mainEngine, where as the eSBR is looking for the electric motor to be called "rearMotor". The eSBR motor will have to be named just like the engine was in your automation jbeam file.
     
  7. JType

    JType
    Expand Collapse

    Joined:
    Mar 21, 2020
    Messages:
    3
    This was a fantastic bit of help, thank you very much.
    I have the motor successfully loading into the game with no errors, the battery connects properly, I hit the throttle, the motor spools up, and...the car doesn't move. :(
    And I've tried it with both my purpose-built single-speed trans, and the original car trans. Both transmissions work with the original engine, but neither one works with the electric motor.
    I have the powertrain names/input indexes copied verbatim from the original engine, and did some reading on the wiki for how the powertrain tree is supposed to work, and it looks like I have it correct, and the single speed transmission is just the exact code from the original trans with only 2 gears instead of 8.

    If you have any ideas, I'd love to hear it, but I'm going to just keep banging my head against it regardless and see if something shakes loose.

    Thanks again!
     
  8. JType

    JType
    Expand Collapse

    Joined:
    Mar 21, 2020
    Messages:
    3
    Update: after some mild experimentation, including just changing the code in the default engine to make it act like an electric motor instead, I believe I've determined that the issue has something to do with the gearbox code itself, rather than with the electric motor output, as changing the original engine to "electricMotor" and adjusting the torque figures and energy type, without changing anything else, resulted in an identical outcome as all the previous work to load in the electric motor separately - the motor spins up, but the car doesn't move. Interestingly, changing from neutral to drive or reverse, with the engine spooled up, produces about a 25% drop in RPM as if the clutch had engaged, but then the engine spins back up and no motion takes place.
    Oh well, onward and upward
     
  9. Sithhy™

    Sithhy™
    Expand Collapse

    Joined:
    Apr 5, 2017
    Messages:
    3,343
    Not sure if I understood your posts correctly, but did you try using the CVT transmission from the electric car instead of a "regular" one?
     
  10. Owiko7

    Owiko7
    Expand Collapse

    Joined:
    Jun 8, 2015
    Messages:
    58
    There was something in the SBR code that was needed for making it so that the electric motor wouldn't spin up in park and such, and it was causing my pigeon to have issues. Alex Farmer knows more about it than I do.
     
  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