Documentation
¶
Index ¶
- Variables
- type ActionConfig
- type Health
- type LoadPoint
- func (lp *LoadPoint) GetChargePower() 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) GetStatus() api.ChargeStatus
- func (lp *LoadPoint) GetTargetSoC() int
- func (lp *LoadPoint) HasChargeMeter() bool
- func (lp *LoadPoint) Name() string
- func (lp *LoadPoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Event, lpChan chan<- *LoadPoint)
- func (lp *LoadPoint) RemoteControl(source string, demand RemoteDemand)
- func (lp *LoadPoint) SetMaxCurrent(current float64)
- func (lp *LoadPoint) SetMinCurrent(current float64)
- func (lp *LoadPoint) SetMinSoC(soc int) error
- func (lp *LoadPoint) SetMode(mode api.ChargeMode)
- func (lp *LoadPoint) SetPhases(phases int) error
- func (lp *LoadPoint) SetTargetCharge(finishAt time.Time, targetSoC int)
- func (lp *LoadPoint) SetTargetSoC(soc int) error
- func (lp *LoadPoint) Update(sitePower float64, cheap bool)
- type LoadPointAPI
- type LoadpointController
- type MetersConfig
- type PollConfig
- type RemoteDemand
- type Site
- func (site *Site) DumpConfig()
- func (site *Site) GetPrioritySoC() float64
- func (site *Site) LoadPoints() []LoadPointAPI
- 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) SetPrioritySoC(soc float64) error
- type SiteAPI
- type SoCConfig
- type ThresholdConfig
- type Updater
Constants ¶
This section is empty.
Variables ¶
var ( // Voltage global value Voltage float64 )
Functions ¶
This section is empty.
Types ¶
type ActionConfig ¶
type ActionConfig struct { Mode api.ChargeMode `mapstructure:"mode"` // Charge mode to apply when car disconnected TargetSoC int `mapstructure:"targetSoC"` // Target SoC to apply when car disconnected }
ActionConfig defines an action to take on event
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 Phases int64 `mapstructure:"phases"` // Charger enabled phases ChargerRef string `mapstructure:"charger"` // Charger reference VehicleRef string `mapstructure:"vehicle"` // Vehicle reference VehiclesRef []string `mapstructure:"vehicles"` // Vehicles reference Meters struct { ChargeMeterRef string `mapstructure:"charge"` // Charge meter reference } SoC SoCConfig OnDisconnect ActionConfig `mapstructure:"onDisconnect"` OnIdentify map[string]ActionConfig `mapstructure:"onIdentify"` Enable, Disable ThresholdConfig 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 ¶
func NewLoadPointFromConfig(log *util.Logger, cp configProvider, other map[string]interface{}) (*LoadPoint, error)
NewLoadPointFromConfig creates a new loadpoint
func (*LoadPoint) GetChargePower ¶
GetChargePower returns the current charge power
func (*LoadPoint) GetMaxCurrent ¶
GetMaxCurrent returns the max loadpoint current
func (*LoadPoint) GetMaxPower ¶
GetMaxPower returns the max loadpoint power taking active phases 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) GetStatus ¶
func (lp *LoadPoint) GetStatus() api.ChargeStatus
GetStatus returns the charging status
func (*LoadPoint) GetTargetSoC ¶
GetTargetSoC returns loadpoint charge target soc
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 RemoteDemand)
RemoteControl sets remote status demand
func (*LoadPoint) SetMaxCurrent ¶
SetMaxCurrent returns the max loadpoint current
func (*LoadPoint) SetMinCurrent ¶
SetMinCurrent returns the min loadpoint current
func (*LoadPoint) SetMode ¶
func (lp *LoadPoint) SetMode(mode api.ChargeMode)
SetMode sets loadpoint charge mode
func (*LoadPoint) SetTargetCharge ¶
SetTargetCharge sets loadpoint charge targetSoC
func (*LoadPoint) SetTargetSoC ¶
SetTargetSoC sets loadpoint charge target soc
type LoadPointAPI ¶
type LoadPointAPI interface { Name() string HasChargeMeter() bool // status GetStatus() api.ChargeStatus // settings GetMode() api.ChargeMode SetMode(api.ChargeMode) GetTargetSoC() int SetTargetSoC(int) error GetMinSoC() int SetMinSoC(int) error GetPhases() int SetPhases(int) error SetTargetCharge(time.Time, int) RemoteControl(string, RemoteDemand) // energy GetChargePower() float64 GetMinCurrent() float64 SetMinCurrent(float64) GetMaxCurrent() float64 SetMaxCurrent(float64) GetMinPower() float64 GetMaxPower() float64 }
LoadPointAPI is the external loadpoint API
type LoadpointController ¶
type LoadpointController interface {
LoadpointControl(LoadPointAPI)
}
LoadpointController gives access to loadpoint
type MetersConfig ¶
type MetersConfig struct { GridMeterRef string `mapstructure:"grid"` // Grid usage meter reference PVMeterRef string `mapstructure:"pv"` // PV generation meter reference BatteryMeterRef string `mapstructure:"battery"` // Battery charging meter reference }
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 RemoteDemand ¶
type RemoteDemand string
RemoteDemand defines external status demand
const ( RemoteEnable RemoteDemand = "" RemoteHardDisable RemoteDemand = "hard" RemoteSoftDisable RemoteDemand = "soft" )
remote status demand definition
func RemoteDemandString ¶
func RemoteDemandString(demand string) (RemoteDemand, error)
RemoteDemandString converts string to RemoteDemand
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 // contains filtered or unexported fields }
Site is the main configuration container. A site can host multiple loadpoints.
func NewSiteFromConfig ¶
func NewSiteFromConfig( log *util.Logger, cp configProvider, other map[string]interface{}, loadpoints []*LoadPoint, tariff api.Tariff, ) (*Site, error)
NewSiteFromConfig creates a new site
func (*Site) GetPrioritySoC ¶
GetPrioritySoC returns the PrioritySoC
func (*Site) LoadPoints ¶
func (site *Site) LoadPoints() []LoadPointAPI
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) SetPrioritySoC ¶
SetPrioritySoC sets the PrioritySoC
type SiteAPI ¶
type SiteAPI interface { Healthy() bool LoadPoints() []LoadPointAPI SetPrioritySoC(float64) error }
SiteAPI is the external site API
type SoCConfig ¶
type SoCConfig struct { Poll PollConfig `mapstructure:"poll"` AlwaysUpdate bool `mapstructure:"alwaysUpdate"` Estimate bool `mapstructure:"estimate"` Min int `mapstructure:"min"` // Default minimum SoC, guarded by mutex Target int `mapstructure:"target"` // Default target SoC, guarded by mutex Levels []int `mapstructure:"levels"` // deprecated }
SoCConfig defines soc settings, estimation and update behaviour
type ThresholdConfig ¶
ThresholdConfig defines enable/disable hysteresis parameters