ME 405 Term Project
Loading...
Searching...
No Matches
battery_droop.Battery Class Reference

Public Member Functions

 __init__ (self, adc_pin)
 read_voltage (self)
 droop_gain (self, refresh=False)
 refresh (self)

Public Attributes

 adc = ADC(Pin(adc_pin))
tuple scale = (self.R_1_OHM + self.R_2_OHM) / self.R_2_OHM
bool warned = False

Static Public Attributes

float R_1_OHM = 9.98e3
float R_2_OHM = 4.712e3
float V_REF = 3.3
float V_NOM_SINGLE = 1.3
int V_NOM_TOTAL = 6*V_NOM_SINGLE
float LOW_BATT_THRESHOLD = 6.0

Protected Attributes

 _cached_voltage = None
float _cached_gain = None

Detailed Description

Reads raw battery voltage through a voltage divider and computes a
   gain (based on the measured voltage) to be used in the closed loop control to compensate the effort for battery droop.

Constructor & Destructor Documentation

◆ __init__()

battery_droop.Battery.__init__ ( self,
adc_pin )
Initializes the Battery object with ADC pin and voltage divider values.

Member Function Documentation

◆ droop_gain()

battery_droop.Battery.droop_gain ( self,
refresh = False )
Return droop gain, caching after first measurement. Set refresh=True to re-measure.

◆ read_voltage()

battery_droop.Battery.read_voltage ( self)
Reads the raw ADC value and computes the actual battery voltage.

◆ refresh()

battery_droop.Battery.refresh ( self)
Force a new calculation of droop gain.

Member Data Documentation

◆ _cached_gain

float battery_droop.Battery._cached_gain = None
protected

◆ _cached_voltage

battery_droop.Battery._cached_voltage = None
protected

◆ adc

battery_droop.Battery.adc = ADC(Pin(adc_pin))

◆ LOW_BATT_THRESHOLD

float battery_droop.Battery.LOW_BATT_THRESHOLD = 6.0
static

◆ R_1_OHM

float battery_droop.Battery.R_1_OHM = 9.98e3
static

◆ R_2_OHM

float battery_droop.Battery.R_2_OHM = 4.712e3
static

◆ scale

tuple battery_droop.Battery.scale = (self.R_1_OHM + self.R_2_OHM) / self.R_2_OHM

◆ V_NOM_SINGLE

float battery_droop.Battery.V_NOM_SINGLE = 1.3
static

◆ V_NOM_TOTAL

int battery_droop.Battery.V_NOM_TOTAL = 6*V_NOM_SINGLE
static

◆ V_REF

float battery_droop.Battery.V_REF = 3.3
static

◆ warned

bool battery_droop.Battery.warned = False

The documentation for this class was generated from the following file: