mirror of https://github.com/ArduPilot/ardupilot
SITL: improve IE24 simulated tank pressure
this is simply the inverse of what the flight code does
This commit is contained in:
parent
1391892406
commit
06e20761de
|
@ -79,9 +79,6 @@ void IntelligentEnergy24::update_send()
|
|||
// Simulate constant current charge/discharge of the battery
|
||||
float amps = discharge ? -20.0f : 20.0f;
|
||||
|
||||
// Simulate constant tank pressure. This isn't true in reality, but is good enough
|
||||
const int16_t tank_bar = 250;
|
||||
|
||||
// Update pack capacity remaining
|
||||
bat_capacity_mAh += amps*(now - last_sent_ms)/3600.0f;
|
||||
|
||||
|
@ -90,6 +87,11 @@ void IntelligentEnergy24::update_send()
|
|||
const float max_bat_vol = 50.4f;
|
||||
const float max_bat_capactiy_mAh = 3300;
|
||||
|
||||
// Simulate tank pressure
|
||||
// Scale tank pressure linearly to a percentage.
|
||||
// Min = 5 bar, max = 300 bar, PRESS_GRAD = 1/295.
|
||||
const int16_t tank_bar = linear_interpolate(5, 295, bat_capacity_mAh / max_bat_capactiy_mAh, 0, 1);
|
||||
|
||||
battery_voltage = bat_capacity_mAh / max_bat_capactiy_mAh * (max_bat_vol - min_bat_vol) + min_bat_vol;
|
||||
|
||||
// Decide if we need to charge or discharge the battery
|
||||
|
|
|
@ -20,11 +20,13 @@
|
|||
param set SERIAL5_PROTOCOL 30 # Generator
|
||||
param set SERIAL5_BAUD 115200
|
||||
param set GEN_TYPE 2 # IE24
|
||||
param set BATT2_MONITOR 17 # electrical
|
||||
param set BATT3_MONITOR 17 # electrical generator
|
||||
param set BATT2_MONITOR 18 # fuel-based generator
|
||||
param set SIM_IE24_ENABLE 1
|
||||
param fetch
|
||||
|
||||
graph BATTERY_STATUS.voltages[0]
|
||||
graph BATTERY_STATUS[0].voltages[0]/1000.0
|
||||
graph BATTERY_STATUS[1].voltages[0]/1000.0
|
||||
|
||||
reboot
|
||||
|
||||
|
|
Loading…
Reference in New Issue