Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChargeMeter ¶
ChargeMeter is a replacement for a physical charge meter. It uses the charger's actual or max current to calculate power consumption.
func (*ChargeMeter) CurrentPower ¶
func (m *ChargeMeter) CurrentPower() (float64, error)
CurrentPower implements the api.Meter interface
func (*ChargeMeter) SetPower ¶
func (m *ChargeMeter) SetPower(power float64)
SetPower updates meter's current power
type ChargeRater ¶
ChargeRater is responsible for providing charged energy amount by implementing api.ChargeRater. It uses the charge meter's TotalEnergy or keeps track of consumed energy by regularly updating consumed power.
func NewChargeRater ¶
func NewChargeRater(log *util.Logger, meter api.Meter) *ChargeRater
NewChargeRater creates charge rater and initializes realtime clock
func (*ChargeRater) ChargedEnergy ¶
func (cr *ChargeRater) ChargedEnergy() (float64, error)
ChargedEnergy implements the ChargeRater interface. It returns energy consumption since charge start in kWh.
func (*ChargeRater) SetChargePower ¶
func (cr *ChargeRater) SetChargePower(power float64)
SetChargePower increments consumed energy by amount in kWh since last update
func (*ChargeRater) StartCharge ¶
func (cr *ChargeRater) StartCharge(continued bool)
StartCharge records meter start energy. If meter does not supply TotalEnergy, start time is recorded and charged energy set to zero.
func (*ChargeRater) StopCharge ¶
func (cr *ChargeRater) StopCharge()
StopCharge records meter stop energy. If meter does not supply TotalEnergy, stop time is recorded and accumulating energy though SetChargePower stopped.
type ChargeTimer ¶
ChargeTimer measures charging time between start and stop events
func NewChargeTimer ¶
func NewChargeTimer() *ChargeTimer
NewChargeTimer creates ChargeTimer for tracking duration between start and stop events
func (*ChargeTimer) ChargeDuration ¶
func (m *ChargeTimer) ChargeDuration() (time.Duration, error)
ChargeDuration implements the api.ChargeTimer interface
func (*ChargeTimer) StartCharge ¶
func (m *ChargeTimer) StartCharge(continued bool)
StartCharge signals charge timer start
func (*ChargeTimer) StopCharge ¶
func (m *ChargeTimer) StopCharge()
StopCharge signals charge timer stop