Package com.playingwithfusion
Class BattFuelGauge
java.lang.Object
com.playingwithfusion.BattFuelGauge
- All Implemented Interfaces:
Sendable,AutoCloseable
CAN based Battery Fuel Gauge (BFG) sensor instance
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumBattery charge state enumerationstatic enumBattery manufacturer enumeration -
Constructor Summary
ConstructorsConstructorDescriptionBattFuelGauge(int sensorId) Create an instance of the CAN Battery Fuel Gauge sensor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Destroy the BattFuelGauge object and free any asscioated resourcesfloatGets the age of the battery.Determine the charge/discharge state of the batteryfloatGets the current estimated battery capacity.floatGets the current battery discharge current.floatReturns how long the battery was charging during the last full cycle.floatReturns how long the battery was discharging during the last full cycle.floatReturns the highest charging current seen in the last charge cycle.floatReturns the highest depth of discharge reached in the last charge cycle.floatReturns the highest energy discharged in the last charge cycle.floatReturns the highest voltage recorded during the last charge cycle.floatReturns the most negative (highest discharge) current from the last charge cycle.floatReturns the lowest depth of discharge reached in the last charge cycle.floatReturns the lowest energy discharged in the last charge cycle.floatReturns the lowest voltage recorded during the last charge cycle.floatReturns the RMS discharge current from the most recent full charge cycle.floatReturns the voltage at the start of the most recent charge cycle.floatgetDodAh()Gets the current depth of discharge in ampere-hours.floatgetDodWh()Gets the current depth of discharge energy.floatGets the effective (usable) capacity of the battery.longDetermine the sensor firmware versionGets the manufacturer identifier of the battery.floatReturns total charging time (if any) during the last robot match.floatReturns total discharging time during the last robot match.floatReturns the total duration of the last robot match.floatReturns the remaining charge at the end of the last robot match.floatReturns the remaining energy at the end of the last robot match.floatReturns the peak current (highest magnitude) during the last match.floatReturns the highest depth of discharge reached during the last match.floatReturns the highest voltage seen during the last robot match.floatReturns the most negative (highest discharge) current from the last match.floatReturns the lowest depth of discharge reached during the last match.floatReturns the lowest voltage seen during the last robot match.floatReturns the RMS discharge current observed during the last robot match.floatReturns the stored charge at the beginning of the last robot match.floatReturns the stored energy at the start of the last robot match.floatReturns the battery voltage at the beginning of the last robot match.Gets the user-defined nickname of this battery.intGets the total number of charge/discharge cycles experienced by the battery.floatGets the original rated capacity of the battery when new.floatGets the estimated remaining charge as a percentage.longDetermine the sensor hardware serial numberfloatGets the current battery terminal voltage.voidDispay 'Identification' page on the BFG OLED display to indicate the sensor asscioated with this instance of softwarevoidinitSendable(SendableBuilder builder) voidSets the battery manufacturervoidsetNickname(String newName) Sets the user-defined nickname of this battery.
-
Constructor Details
-
BattFuelGauge
public BattFuelGauge(int sensorId) Create an instance of the CAN Battery Fuel Gauge sensor. This is designed to support the Playing With Fusion (PWF) ROB-70001 battery fuel gauge sensor- Parameters:
sensorId- The 6-bit identifier used to select a particular sensor on the CAN bus. This identifier may be set through the PWF Device configuration page on the roboRIO.
-
-
Method Details
-
close
public void close()Destroy the BattFuelGauge object and free any asscioated resources- Specified by:
closein interfaceAutoCloseable
-
initSendable
- Specified by:
initSendablein interfaceSendable
-
identifySensor
public void identifySensor()Dispay 'Identification' page on the BFG OLED display to indicate the sensor asscioated with this instance of software -
getFirmwareVersion
public long getFirmwareVersion()Determine the sensor firmware version- Returns:
- The sensor firmware version
-
getSerialNumber
public long getSerialNumber()Determine the sensor hardware serial number- Returns:
- The sensor hardware serial number
-
getBatteryState
Determine the charge/discharge state of the battery- Returns:
- The charge/discharge state enumeration of the battery
-
getCurrent
public float getCurrent()Gets the current battery discharge current.- Returns:
- battery discharge current in Amps (A)
-
getVoltage
public float getVoltage()Gets the current battery terminal voltage.- Returns:
- battery voltage in Volts (V)
-
getDodAh
public float getDodAh()Gets the current depth of discharge in ampere-hours.- Returns:
- depth of discharge in Ah
-
getDodWh
public float getDodWh()Gets the current depth of discharge energy.- Returns:
- depth of discharge energy in Watt-hours (Wh)
-
getRemainingChargePct
public float getRemainingChargePct()Gets the estimated remaining charge as a percentage.- Returns:
- remaining charge in percent (typically 0–100)
-
getEffectiveCapacityAh
public float getEffectiveCapacityAh()Gets the effective (usable) capacity of the battery.- Returns:
- effective capacity in Ah
-
getBatteryAgeDays
public float getBatteryAgeDays()Gets the age of the battery.- Returns:
- battery age in days
-
getCapacityAh
public float getCapacityAh()Gets the current estimated battery capacity.- Returns:
- battery capacity in Ah
-
getRatedCapacityAh
public float getRatedCapacityAh()Gets the original rated capacity of the battery when new.- Returns:
- rated capacity in Ah
-
getNumCycles
public int getNumCycles()Gets the total number of charge/discharge cycles experienced by the battery.- Returns:
- number of charge/discharge cycles
-
getNickname
Gets the user-defined nickname of this battery.- Returns:
- battery nickname, or empty string if not set or unavailable
-
getManufacturer
Gets the manufacturer identifier of the battery.- Returns:
- Battery manufacturer reported by the BFG
-
setNickname
Sets the user-defined nickname of this battery.- Parameters:
newName- New battery nickname
-
setManufacturer
Sets the battery manufacturer- Parameters:
newMfg- New battery manufacturer
-
getCycleRmsDischargeCurrent
public float getCycleRmsDischargeCurrent()Returns the RMS discharge current from the most recent full charge cycle.- Returns:
- RMS discharge current in amperes (A)
-
getCycleMaxCurrent
public float getCycleMaxCurrent()Returns the highest charging current seen in the last charge cycle.- Returns:
- maximum charging current in amperes (A)
-
getCycleMinCurrent
public float getCycleMinCurrent()Returns the most negative (highest discharge) current from the last charge cycle.- Returns:
- minimum current in amperes (A)
-
getCycleMinVoltage
public float getCycleMinVoltage()Returns the lowest voltage recorded during the last charge cycle.- Returns:
- minimum voltage in volts (V)
-
getCycleMaxVoltage
public float getCycleMaxVoltage()Returns the highest voltage recorded during the last charge cycle.- Returns:
- maximum voltage in volts (V)
-
getCycleMinDodAh
public float getCycleMinDodAh()Returns the lowest depth of discharge reached in the last charge cycle.- Returns:
- minimum depth of discharge in ampere-hours (Ah)
-
getCycleMaxDodAh
public float getCycleMaxDodAh()Returns the highest depth of discharge reached in the last charge cycle.- Returns:
- maximum depth of discharge in ampere-hours (Ah)
-
getCycleMinDodWh
public float getCycleMinDodWh()Returns the lowest energy discharged in the last charge cycle.- Returns:
- minimum discharged energy in watt-hours (Wh)
-
getCycleMaxDodWh
public float getCycleMaxDodWh()Returns the highest energy discharged in the last charge cycle.- Returns:
- maximum discharged energy in watt-hours (Wh)
-
getCycleChargeTime
public float getCycleChargeTime()Returns how long the battery was charging during the last full cycle.- Returns:
- charging time in seconds
-
getCycleDischargeTime
public float getCycleDischargeTime()Returns how long the battery was discharging during the last full cycle.- Returns:
- discharging time in seconds
-
getCycleStartingVoltage
public float getCycleStartingVoltage()Returns the voltage at the start of the most recent charge cycle.- Returns:
- starting voltage in volts (V)
-
getMatchRmsDischargeCurrent
public float getMatchRmsDischargeCurrent()Returns the RMS discharge current observed during the last robot match.- Returns:
- RMS discharge current in amperes (A)
-
getMatchMaxCurrent
public float getMatchMaxCurrent()Returns the peak current (highest magnitude) during the last match.- Returns:
- maximum current in amperes (A)
-
getMatchMinCurrent
public float getMatchMinCurrent()Returns the most negative (highest discharge) current from the last match.- Returns:
- minimum current in amperes (A)
-
getMatchMinVoltage
public float getMatchMinVoltage()Returns the lowest voltage seen during the last robot match.- Returns:
- minimum voltage in volts (V)
-
getMatchMaxVoltage
public float getMatchMaxVoltage()Returns the highest voltage seen during the last robot match.- Returns:
- maximum voltage in volts (V)
-
getMatchMinDodAh
public float getMatchMinDodAh()Returns the lowest depth of discharge reached during the last match.- Returns:
- minimum depth of discharge in ampere-hours (Ah)
-
getMatchMaxDodAh
public float getMatchMaxDodAh()Returns the highest depth of discharge reached during the last match.- Returns:
- maximum depth of discharge in ampere-hours (Ah)
-
getMatchChargeTime
public float getMatchChargeTime()Returns total charging time (if any) during the last robot match.- Returns:
- charging time in seconds
-
getMatchDischargeTime
public float getMatchDischargeTime()Returns total discharging time during the last robot match.- Returns:
- discharging time in seconds
-
getMatchStartingVoltage
public float getMatchStartingVoltage()Returns the battery voltage at the beginning of the last robot match.- Returns:
- starting voltage in volts (V)
-
getMatchStartingEnergy
public float getMatchStartingEnergy()Returns the stored energy at the start of the last robot match.- Returns:
- starting energy in watt-hours (Wh)
-
getMatchEndingEnergy
public float getMatchEndingEnergy()Returns the remaining energy at the end of the last robot match.- Returns:
- ending energy in watt-hours (Wh)
-
getMatchStartingCharge
public float getMatchStartingCharge()Returns the stored charge at the beginning of the last robot match.- Returns:
- starting charge in ampere-hours (Ah)
-
getMatchEndingCharge
public float getMatchEndingCharge()Returns the remaining charge at the end of the last robot match.- Returns:
- ending charge in ampere-hours (Ah)
-
getMatchDuration
public float getMatchDuration()Returns the total duration of the last robot match.- Returns:
- match duration in seconds
-