Package com.thegongoliers.input.power
Class CoulombCounter
- java.lang.Object
-
- com.thegongoliers.input.power.CoulombCounter
-
public class CoulombCounter extends java.lang.Object
A software sensor for measuring electric discharge
-
-
Constructor Summary
Constructors Constructor Description CoulombCounter(CurrentSensor sensor)
Default constructorCoulombCounter(CurrentSensor sensor, Clock clock)
Test constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getCurrentDischarge()
Get the current discharge in Amp-hours (Ah)double
getTotalDischarge()
Get the total discharge in Amp-hours (Ah)void
update()
Update the current and total amp-hours.
-
-
-
Constructor Detail
-
CoulombCounter
public CoulombCounter(CurrentSensor sensor)
Default constructor- Parameters:
sensor
- the current sensor which measures battery current
-
CoulombCounter
public CoulombCounter(CurrentSensor sensor, Clock clock)
Test constructor- Parameters:
sensor
- the current sensor which measures battery currentclock
- the clock to use
-
-
Method Detail
-
update
public void update()
Update the current and total amp-hours. Should be called regularly.
-
getCurrentDischarge
public double getCurrentDischarge()
Get the current discharge in Amp-hours (Ah)- Returns:
- the current electrical discharge
-
getTotalDischarge
public double getTotalDischarge()
Get the total discharge in Amp-hours (Ah)- Returns:
- the total electrical discharge
-
-