Documentation ¶
Index ¶
- Constants
- Variables
- type EnergyMetrics
- func (em *EnergyMetrics) Co2PerKWh() *float64
- func (em *EnergyMetrics) Price() *float64
- func (em *EnergyMetrics) PricePerKWh() *float64
- func (em *EnergyMetrics) Publish(prefix string, p publisher)
- func (em *EnergyMetrics) Reset()
- func (em *EnergyMetrics) SetEnvironment(greenShare float64, effPrice, effCo2 *float64)
- func (em *EnergyMetrics) SolarPercentage() float64
- func (em *EnergyMetrics) TotalWh() float64
- func (em *EnergyMetrics) Update(chargedKWh float64) (float64, float64)
- type Health
- type Loadpoint
- func (lp *Loadpoint) GetChargePower() float64
- func (lp *Loadpoint) GetChargePowerFlexibility() float64
- func (lp *Loadpoint) GetDisableThreshold() float64
- func (lp *Loadpoint) GetEnableThreshold() float64
- func (lp *Loadpoint) GetMaxCurrent() float64
- func (lp *Loadpoint) GetMaxPower() float64
- func (lp *Loadpoint) GetMinCurrent() float64
- func (lp *Loadpoint) GetMinPower() float64
- func (lp *Loadpoint) GetMinSoc() int
- func (lp *Loadpoint) GetMode() api.ChargeMode
- func (lp *Loadpoint) GetPhases() int
- func (lp *Loadpoint) GetPlan(targetTime time.Time, maxPower float64) (time.Duration, api.Rates, error)
- func (lp *Loadpoint) GetPriority() int
- func (lp *Loadpoint) GetRemainingDuration() time.Duration
- func (lp *Loadpoint) GetRemainingEnergy() float64
- func (lp *Loadpoint) GetStatus() api.ChargeStatus
- func (lp *Loadpoint) GetTargetEnergy() float64
- func (lp *Loadpoint) GetTargetSoc() int
- func (lp *Loadpoint) GetTargetTime() time.Time
- func (lp *Loadpoint) GetVehicle() api.Vehicle
- func (lp *Loadpoint) HasChargeMeter() bool
- func (lp *Loadpoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Event, lpChan chan<- *Loadpoint)
- func (lp *Loadpoint) RemoteControl(source string, demand loadpoint.RemoteDemand)
- func (lp *Loadpoint) SetDisableThreshold(threshold float64)
- func (lp *Loadpoint) SetEnableThreshold(threshold float64)
- func (lp *Loadpoint) SetMaxCurrent(current float64)
- func (lp *Loadpoint) SetMinCurrent(current float64)
- func (lp *Loadpoint) SetMinSoc(soc int)
- func (lp *Loadpoint) SetMode(mode api.ChargeMode)
- func (lp *Loadpoint) SetPhases(phases int) error
- func (lp *Loadpoint) SetPriority(prio int)
- func (lp *Loadpoint) SetRemainingDuration(chargeRemainingDuration time.Duration)
- func (lp *Loadpoint) SetRemainingEnergy(chargeRemainingEnergy float64)
- func (lp *Loadpoint) SetTargetEnergy(energy float64)
- func (lp *Loadpoint) SetTargetSoc(soc int)
- func (lp *Loadpoint) SetTargetTime(finishAt time.Time) error
- func (lp *Loadpoint) SetVehicle(vehicle api.Vehicle)
- func (lp *Loadpoint) StartVehicleDetection()
- func (lp *Loadpoint) Title() string
- func (lp *Loadpoint) Update(sitePower float64, autoCharge, batteryBuffered, batteryStart bool, ...)
- func (lp *Loadpoint) UpdateChargePower()
- type MetersConfig
- type PollConfig
- type Progress
- type Site
- func (site *Site) DumpConfig()
- func (site *Site) GetBufferSoc() float64
- func (site *Site) GetBufferStartSoc() float64
- func (site *Site) GetPrioritySoc() float64
- func (site *Site) GetResidualPower() float64
- func (site *Site) GetSmartCostLimit() float64
- func (site *Site) GetTariff(tariff string) api.Tariff
- func (site *Site) GetVehicles() []api.Vehicle
- func (site *Site) Loadpoints() []loadpoint.API
- func (site *Site) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Event)
- func (site *Site) Run(stopC chan struct{}, interval time.Duration)
- func (site *Site) SetBufferSoc(soc float64) error
- func (site *Site) SetBufferStartSoc(soc float64) error
- func (site *Site) SetPrioritySoc(soc float64) error
- func (site *Site) SetResidualPower(power float64) error
- func (site *Site) SetSmartCostLimit(val float64) error
- type SocConfig
- type Stats
- type Task
- type ThresholdConfig
- type Timer
- type Updater
Constants ¶
const ( GridTariff = "grid" FeedinTariff = "feedin" PlannerTariff = "planner" )
Variables ¶
var ( // Voltage global value Voltage float64 )
Functions ¶
This section is empty.
Types ¶
type EnergyMetrics ¶
type EnergyMetrics struct {
// contains filtered or unexported fields
}
EnergyMetrics calculates stats about the charged energy and gives you details about price or co2s
func NewEnergyMetrics ¶
func NewEnergyMetrics() *EnergyMetrics
func (*EnergyMetrics) Co2PerKWh ¶
func (em *EnergyMetrics) Co2PerKWh() *float64
Co2PerKWh returns the average co2 emissions per kWh
func (*EnergyMetrics) Price ¶
func (em *EnergyMetrics) Price() *float64
Price returns the total energy price in Currency
func (*EnergyMetrics) PricePerKWh ¶
func (em *EnergyMetrics) PricePerKWh() *float64
PricePerKWh returns the average energy price in Currency
func (*EnergyMetrics) Publish ¶
func (em *EnergyMetrics) Publish(prefix string, p publisher)
Publish publishes metrics with a given prefix
func (*EnergyMetrics) Reset ¶
func (em *EnergyMetrics) Reset()
Reset sets all calculations to initial values
func (*EnergyMetrics) SetEnvironment ¶
func (em *EnergyMetrics) SetEnvironment(greenShare float64, effPrice, effCo2 *float64)
SetEnvironment updates site information like solar share, price, co2 for use in later calculations
func (*EnergyMetrics) SolarPercentage ¶
func (em *EnergyMetrics) SolarPercentage() float64
SolarPercentage returns the share of self-produced energy in percent
func (*EnergyMetrics) TotalWh ¶
func (em *EnergyMetrics) TotalWh() float64
TotalWh returns the total energy in Wh
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
Health is a health checker that needs regular updates to stay healthy
type Loadpoint ¶
type Loadpoint struct { // exposed public configuration sync.Mutex // guard status Mode api.ChargeMode `mapstructure:"mode"` // Charge mode, guarded by mutex Title_ string `mapstructure:"title"` // UI title Priority_ int `mapstructure:"priority"` // Priority ConfiguredPhases int `mapstructure:"phases"` // Charger configured phase mode 0/1/3 ChargerRef string `mapstructure:"charger"` // Charger reference VehicleRef string `mapstructure:"vehicle"` // Vehicle reference VehiclesRef_ []string `mapstructure:"vehicles"` // TODO deprecated MeterRef string `mapstructure:"meter"` // Charge meter reference Soc SocConfig Enable, Disable ThresholdConfig ResetOnDisconnect bool `mapstructure:"resetOnDisconnect"` MinCurrent float64 // PV mode: start current Min+PV mode: min current MaxCurrent float64 // Max allowed current. Physically ensured by the charger GuardDuration time.Duration // charger enable/disable minimum holding time // contains filtered or unexported fields }
Loadpoint is responsible for controlling charge depending on Soc needs and power availability.
func NewLoadpoint ¶
NewLoadpoint creates a Loadpoint with sane defaults
func NewLoadpointFromConfig ¶
NewLoadpointFromConfig creates a new loadpoint
func (*Loadpoint) GetChargePower ¶
GetChargePower returns the current charge power
func (*Loadpoint) GetChargePowerFlexibility ¶
GetChargePowerFlexibility returns the flexible amount of current charging power
func (*Loadpoint) GetDisableThreshold ¶
GetDisableThreshold gets the loadpoint enable threshold
func (*Loadpoint) GetEnableThreshold ¶
GetEnableThreshold gets the loadpoint enable threshold
func (*Loadpoint) GetMaxCurrent ¶
GetMaxCurrent returns the max loadpoint current
func (*Loadpoint) GetMaxPower ¶
GetMaxPower returns the max loadpoint power taking vehicle capabilities and phase scaling into account
func (*Loadpoint) GetMinCurrent ¶
GetMinCurrent returns the min loadpoint current
func (*Loadpoint) GetMinPower ¶
GetMinPower returns the min loadpoint power for a single phase
func (*Loadpoint) GetMode ¶
func (lp *Loadpoint) GetMode() api.ChargeMode
GetMode returns loadpoint charge mode
func (*Loadpoint) GetPlan ¶
func (lp *Loadpoint) GetPlan(targetTime time.Time, maxPower float64) (time.Duration, api.Rates, error)
GetPlan creates a charging plan
Results: - required total charging duration - actual charging plan as rate table
func (*Loadpoint) GetPriority ¶
GetPriority returns the loadpoint priority
func (*Loadpoint) GetRemainingDuration ¶
GetRemainingDuration is the estimated remaining charging duration
func (*Loadpoint) GetRemainingEnergy ¶
GetRemainingEnergy is the remaining charge energy in Wh
func (*Loadpoint) GetStatus ¶
func (lp *Loadpoint) GetStatus() api.ChargeStatus
GetStatus returns the charging status
func (*Loadpoint) GetTargetEnergy ¶
GetTargetEnergy returns loadpoint charge target energy
func (*Loadpoint) GetTargetSoc ¶
GetTargetSoc returns loadpoint charge target soc
func (*Loadpoint) GetTargetTime ¶
GetTargetTime returns the target time
func (*Loadpoint) GetVehicle ¶
GetVehicle gets the active vehicle
func (*Loadpoint) HasChargeMeter ¶
HasChargeMeter determines if a physical charge meter is attached
func (*Loadpoint) Prepare ¶
func (lp *Loadpoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Event, lpChan chan<- *Loadpoint)
Prepare loadpoint configuration by adding missing helper elements
func (*Loadpoint) RemoteControl ¶
func (lp *Loadpoint) RemoteControl(source string, demand loadpoint.RemoteDemand)
RemoteControl sets remote status demand
func (*Loadpoint) SetDisableThreshold ¶
SetDisableThreshold sets loadpoint disable threshold
func (*Loadpoint) SetEnableThreshold ¶
SetEnableThreshold sets loadpoint enable threshold
func (*Loadpoint) SetMaxCurrent ¶
SetMaxCurrent sets the max loadpoint current
func (*Loadpoint) SetMinCurrent ¶
SetMinCurrent sets the min loadpoint current
func (*Loadpoint) SetMode ¶
func (lp *Loadpoint) SetMode(mode api.ChargeMode)
SetMode sets loadpoint charge mode
func (*Loadpoint) SetPriority ¶
SetPriority sets the loadpoint priority
func (*Loadpoint) SetRemainingDuration ¶
SetRemainingDuration sets the estimated remaining charging duration
func (*Loadpoint) SetRemainingEnergy ¶
SetRemainingEnergy sets the remaining charge energy in Wh
func (*Loadpoint) SetTargetEnergy ¶
SetTargetEnergy sets loadpoint charge target energy
func (*Loadpoint) SetTargetSoc ¶
SetTargetSoc sets loadpoint charge target soc
func (*Loadpoint) SetTargetTime ¶
SetTargetTime sets the charge target time
func (*Loadpoint) SetVehicle ¶
SetVehicle sets the active vehicle
func (*Loadpoint) StartVehicleDetection ¶
func (lp *Loadpoint) StartVehicleDetection()
StartVehicleDetection allows triggering vehicle detection for debugging purposes
func (*Loadpoint) Update ¶
func (lp *Loadpoint) Update(sitePower float64, autoCharge, batteryBuffered, batteryStart bool, greenShare float64, effPrice, effCo2 *float64)
Update is the main control function. It reevaluates meters and charger state
func (*Loadpoint) UpdateChargePower ¶
func (lp *Loadpoint) UpdateChargePower()
UpdateChargePower updates charge meter power
type MetersConfig ¶
type MetersConfig struct { GridMeterRef string `mapstructure:"grid"` // Grid usage meter PVMetersRef []string `mapstructure:"pv"` // PV meter PVMetersRef_ []string `mapstructure:"pvs"` // TODO deprecated BatteryMetersRef []string `mapstructure:"battery"` // Battery charging meter BatteryMetersRef_ []string `mapstructure:"batteries"` // TODO deprecated AuxMetersRef []string `mapstructure:"aux"` // Auxiliary meters }
MetersConfig contains the loadpoint's meter configuration
type PollConfig ¶
type PollConfig struct { Mode string `mapstructure:"mode"` // polling mode charging (default), connected, always Interval time.Duration `mapstructure:"interval"` // interval when not charging }
PollConfig defines the vehicle polling mode and interval
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
type Site ¶
type Site struct { *Health sync.Mutex // configuration Title string `mapstructure:"title"` // UI title Voltage float64 `mapstructure:"voltage"` // Operating voltage. 230V for Germany. ResidualPower float64 `mapstructure:"residualPower"` // PV meter only: household usage. Grid meter: household safety margin Meters MetersConfig // Meter references PrioritySoc float64 `mapstructure:"prioritySoc"` // prefer battery up to this Soc BufferSoc float64 `mapstructure:"bufferSoc"` // continue charging on battery above this Soc BufferStartSoc float64 `mapstructure:"bufferStartSoc"` // start charging on battery above this Soc MaxGridSupplyWhileBatteryCharging float64 `mapstructure:"maxGridSupplyWhileBatteryCharging"` // ignore battery charging if AC consumption is above this value SmartCostLimit float64 `mapstructure:"smartCostLimit"` // always charge if cost is below this value // contains filtered or unexported fields }
Site is the main configuration container. A site can host multiple loadpoints.
func NewSiteFromConfig ¶
func NewSiteFromConfig( log *util.Logger, other map[string]interface{}, loadpoints []*Loadpoint, tariffs tariff.Tariffs, ) (*Site, error)
NewSiteFromConfig creates a new site
func (*Site) GetBufferSoc ¶
GetBufferSoc returns the BufferSoc
func (*Site) GetBufferStartSoc ¶
GetBufferStartSoc returns the BufferStartSoc
func (*Site) GetPrioritySoc ¶
GetPrioritySoc returns the PrioritySoc
func (*Site) GetResidualPower ¶
GetResidualPower returns the ResidualPower
func (*Site) GetSmartCostLimit ¶
GetSmartCostLimit returns the SmartCostLimit
func (*Site) GetVehicles ¶
GetVehicles is the list of vehicles
func (*Site) Loadpoints ¶
Loadpoints returns the array of associated loadpoints
func (*Site) Run ¶
Run is the main control loop. It reacts to trigger events by updating measurements and executing control logic.
func (*Site) SetBufferSoc ¶
SetBufferSoc sets the BufferSoc
func (*Site) SetBufferStartSoc ¶
SetBufferStartSoc sets the BufferStartSoc
func (*Site) SetPrioritySoc ¶
SetPrioritySoc sets the PrioritySoc
func (*Site) SetResidualPower ¶
SetResidualPower sets the ResidualPower
func (*Site) SetSmartCostLimit ¶
SetSmartCostLimit sets the SmartCostLimit
type SocConfig ¶
type SocConfig struct { Poll PollConfig `mapstructure:"poll"` Estimate *bool `mapstructure:"estimate"` Min_ int `mapstructure:"min"` // TODO deprecated Target_ int `mapstructure:"target"` // TODO deprecated // contains filtered or unexported fields }
SocConfig defines soc settings, estimation and update behaviour
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Publishes long term charging statistics
type ThresholdConfig ¶
ThresholdConfig defines enable/disable hysteresis parameters
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package loadpoint is a generated GoMock package.
|
Package loadpoint is a generated GoMock package. |