Documentation
¶
Index ¶
- Variables
- type Health
- type LoadPoint
- func (lp *LoadPoint) GetMaxCurrent() int64
- func (lp *LoadPoint) GetMaxPower() int64
- func (lp *LoadPoint) GetMinCurrent() int64
- func (lp *LoadPoint) GetMinPower() int64
- func (lp *LoadPoint) GetMinSoC() int
- func (lp *LoadPoint) GetMode() api.ChargeMode
- 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) SetMinSoC(soc int) error
- func (lp *LoadPoint) SetMode(mode api.ChargeMode)
- func (lp *LoadPoint) SetPhases(phases int64) error
- func (lp *LoadPoint) SetTargetCharge(finishAt time.Time, targetSoC int)
- func (lp *LoadPoint) SetTargetSoC(soc int) error
- func (lp *LoadPoint) Update(sitePower float64)
- type LoadPointAPI
- type MetersConfig
- type PollConfig
- type RemoteDemand
- type Site
- func (site *Site) DumpConfig()
- func (site *Site) GetHasSunny5Menu() bool
- func (site *Site) GetMinSoC() int
- func (site *Site) GetPrioritySoC() float64
- func (site *Site) GetResidualPower() 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) SetMinSoC(soc int) error
- func (site *Site) SetPrioritySoC(soc float64) error
- func (site *Site) SetResidualPower(power 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 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
ForeignEV bool // Status to determine if a non configured car is connected
NextPVCheck bool // Determine next, delayed charger adjustment for pv mode
Title string `mapstructure:"title"` // UI title
Phases int64 `mapstructure:"phases"` // Phases- required for converting power and current
IntervalPV time.Duration `mapstructure:"intervalPV"` // interval when not charging
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 struct {
Mode api.ChargeMode `mapstructure:"mode"` // Charge mode to apply when car disconnected
TargetSoC int `mapstructure:"targetSoC"` // Target SoC to apply when car disconnected
}
Enable, Disable ThresholdConfig
MinCurrent int64 // PV mode: start current Min+PV mode: min current
MaxCurrent int64 // 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) GetMaxCurrent ¶
GetMaxCurrent returns the minimal loadpoint current
func (*LoadPoint) GetMaxPower ¶
GetMaxPower returns the minimal loadpoint power taking active phases into account
func (*LoadPoint) GetMinCurrent ¶
GetMinCurrent returns the minimal loadpoint current
func (*LoadPoint) GetMinPower ¶
GetMinPower returns the minimal loadpoint power for a single phase
func (*LoadPoint) GetMode ¶
func (lp *LoadPoint) GetMode() api.ChargeMode
GetMode returns loadpoint charge mode
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, site *Site)
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) 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
// settings
GetMode() api.ChargeMode
SetMode(api.ChargeMode)
GetTargetSoC() int
SetTargetSoC(int) error
SetPhases(int64) error
GetMinSoC() int
SetMinSoC(int) error
SetTargetCharge(time.Time, int)
RemoteControl(string, RemoteDemand)
// energy
GetMinCurrent() int64
GetMaxCurrent() int64
GetMinPower() int64
GetMaxPower() int64
}
LoadPointAPI is the external loadpoint API
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
ConsumptionMeterRef string `mapstructure:"consumption"` // Home consumption 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
MaxCurrent float64 `mapstructure:"maxcurrent"` // MaxCurrent limit accross all loadpoints
HasSunny5Menu bool `mapstructure:"hasSunny5Menu"` // Enable the extended Sunny5 menu
BoostAllowed bool `mapstructure:"boostAllowed"` // Allow boost with second pv system
EnableContactorWellness bool `mapstructure:"enableContactorWellness"` // MaxCurrent limit accross all loadpoints
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, ) (*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
func (*Site) SetResidualPower ¶
SetResidualPower
type SiteAPI ¶
type SiteAPI interface {
Healthy() bool
GetHasSunny5Menu() bool
LoadPoints() []LoadPointAPI
GetResidualPower() float64
SetResidualPower(float64) error
GetPrioritySoC() float64
SetPrioritySoC(float64) error
GetMinSoC() int
SetMinSoC(int) error
}
SiteAPI is the external site API
type SoCConfig ¶
type SoCConfig struct {
Poll PollConfig `mapstructure:"poll"`
AlwaysUpdate bool `mapstructure:"alwaysUpdate"`
Levels []int `mapstructure:"levels"`
Estimate bool `mapstructure:"estimate"`
Min int `mapstructure:"min"` // Default minimum SoC, guarded by mutex
Target int `mapstructure:"target"` // Default target SoC, guarded by mutex
}
SoCConfig defines soc settings, estimation and update behaviour
type ThresholdConfig ¶
ThresholdConfig defines enable/disable hysteresis parameters