• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v5 Custom battery

euroastar350

Resource contributor
Messages
861
Country
us-delaware
Howdy,

I'm looking at doing a custom battery with charging, discharging, temperatures, voltage and amps and I've come up with a code using AI (got some successful code using this method). While I got a correct battery voltage, the electrical total amps is too high and the battery temperature seems very excessive using the following code. I'm sure it's full of errors (the cost of using AI). So my question is how to get a proper battery simulation? I'm recreating the battery logic for my AS350 Squirrel project. Battery is 24 volts, generator voltage should float around 28 volts and total generator amperage is 150. I don't have a GPU/APU coded yet, that'll be the next step. Any pointers is greatly appreciated.

Code:
<Element>
      <Select>
         <Value>
            (L:switch_generator, bool) if{ (L:Eng2N2Percent,enum) 0.01 * 150 * (>L:AS350_Gen_Output, amps) } els{ 0 (>L:AS350_Gen_Output, amps) }
        
            (L:gpu,bool) if{ 0 (>L:AS350_Battery_Amps, amps) }
            els{
            (L:AS350_Gen_Output, amps) (A:ELECTRICAL TOTAL LOAD AMPS, amps) - (>L:AS350_Battery_Amps, amps)
            }
         </Value>
      </Select>
   </Element>
   <Element>
      <Select>
         <Value>
            (L:AS350_Battery_SOC, percent) (L:AS350_Battery_Amps, amps) 0.0001 * + 100 min 0 max (>L:AS350_Battery_SOC, percent)
            (L:AS350_FirstRun, bool) ! if{ 95 (>L:AS350_Battery_SOC, percent) 1 (>L:AS350_FirstRun, bool) }
         </Value>
      </Select>
   </Element>
   <Element>
      <Select>
         <Value>
            24 (L:AS350_Battery_SOC, percent) 100 / 2 * + (>L:AS350_Base_Volts)
            (L:switch_generator, bool) if{ (L:AS350_Base_Volts) 2.5 + } els{ (L:AS350_Base_Volts) } (>L:AS350_Current_Volts)
        
            (L:AS350_Current_Volts) (A:ELECTRICAL TOTAL LOAD AMPS, amps) 0.02 * - (>L:AS350_Battery_Voltage_Disp, Volts)
         </Value>
      </Select>
   </Element>
   <Element>
      <Select>
         <Value>
            (L:AS350_Battery_Amps, amps) abs 2 pow 0.00005 * (>L:AS350_Heat_Generated)
        
            (L:AS350_Battery_Temp, Celsius) (A:AMBIENT TEMPERATURE, Celsius) - 0.001 * (>L:AS350_Cooling_Loss)
        
            (L:AS350_Battery_Temp, Celsius) (L:AS350_Heat_Generated) + (L:AS350_Cooling_Loss) - (>L:AS350_Battery_Temp, Celsius)

            (A:AMBIENT TEMPERATURE, Celsius) (>L:AS350_Battery_Temp, Celsius)
         </Value>
      </Select>
   </Element>
 
Back
Top