ardupilot/libraries/SITL/examples/EvaluateBatteryModel
Andrew Tridgell 7a4483b091 SITL: new XPlane backend
this makes use of DRefs to greatly improve XPlane support. It only
supports XPlane 11 and later

The key change is the use of a JSON file to map ArduPilot output
channels to DataRefs, and map raw joystick inputs to RC inputs

this gets rid of the awful throttle hack handling, and allows for
control of a much wider range of aircraft
2023-01-31 11:22:08 +11:00
..
Battery_example_plots.png
EvaluateBatteryModel.cpp
README.md
wscript SITL: new XPlane backend 2023-01-31 11:22:08 +11:00

README.md

Testing SITL battery model

This example allows the built in battery model to be evaluated. The battery is defined by the parameters in a json configuration file, such as this one.

The example only works with the linux target. Configure and build with:

./waf configure --board linux
./waf build --targets examples/EvaluateBatteryModel

The example can then be run, the first argument is the path to the json model definition. The second is the constant current draw to apply.

The command:

./build/linux/examples/EvaluateBatteryModel Tools/autotest/models/Callisto.json 50

Gives the output:

Loading model Tools/autotest/models/Callisto.json
Loaded model params from Tools/autotest/models/Callisto.json
Simulating 50.40v, 44.00 ah battery with resistance of 0.024000
Voltage from 50.40 to 35.28 with constant current draw of 50.00
time, voltage
0.00, 49.20
0.05, 49.20
0.10, 49.20
0.15, 49.20
0.20, 49.20
0.25, 49.20
0.30, 49.20
....
...

This can be output re-directed to a file with:

./build/linux/examples/EvaluateBatteryModel Tools/autotest/models/Callisto.json 50 >> battery_test.csv

The data can then be compared to real battery data and the model definition changed to better represent the vehicle being modelled.

Battery example plot