Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultDemandPredictor(charger any) string
- func OptimizerAutomatic() string
- 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 Explanation
- type Loadpoint
- func (lp *Loadpoint) ActivePhases() int
- func (lp *Loadpoint) ClearPlanLock()
- func (lp *Loadpoint) EffectiveLimitSoc() int
- func (lp *Loadpoint) EffectiveMaxPower() float64
- func (lp *Loadpoint) EffectiveMinPower() float64
- func (lp *Loadpoint) EffectiveMinSoc() int
- func (lp *Loadpoint) EffectivePlan(planTime time.Time, requiredDuration time.Duration, strategy api.PlanStrategy) (api.Rates, float64, bool)
- func (lp *Loadpoint) EffectivePlanId() int
- func (lp *Loadpoint) EffectivePlanSoc() int
- func (lp *Loadpoint) EffectivePlanStrategy() api.PlanStrategy
- func (lp *Loadpoint) EffectivePlanTime() time.Time
- func (lp *Loadpoint) EffectivePriority() int
- func (lp *Loadpoint) EffectiveStepPower() float64
- func (lp *Loadpoint) GetAlwaysCharge() api.AlwaysCharge
- func (lp *Loadpoint) GetBatteryBoost() int
- func (lp *Loadpoint) GetBatteryBoostLimit() int
- func (lp *Loadpoint) GetChargePower() float64
- func (lp *Loadpoint) GetChargePowerFlexibility(rates api.Rates) float64
- func (lp *Loadpoint) GetChargedEnergy() float64
- func (lp *Loadpoint) GetChargerRef() string
- func (lp *Loadpoint) GetCircuit() api.Circuit
- func (lp *Loadpoint) GetCircuitRef() string
- func (lp *Loadpoint) GetDefaultMode() api.ChargeMode
- func (lp *Loadpoint) GetDefaultVehicleRef() string
- func (lp *Loadpoint) GetDemandPredictor() string
- func (lp *Loadpoint) GetDisableDelay() time.Duration
- func (lp *Loadpoint) GetDisableThreshold() float64
- func (lp *Loadpoint) GetEnableDelay() time.Duration
- func (lp *Loadpoint) GetEnableThreshold() float64
- func (lp *Loadpoint) GetLimitEnergy() float64
- func (lp *Loadpoint) GetLimitSoc() int
- func (lp *Loadpoint) GetMaxCurrent() float64
- func (lp *Loadpoint) GetMaxPhaseCurrent() float64
- func (lp *Loadpoint) GetMeasuredPhases() int
- func (lp *Loadpoint) GetMeterRef() string
- func (lp *Loadpoint) GetMinCurrent() float64
- func (lp *Loadpoint) GetMinSoc() int
- func (lp *Loadpoint) GetMode() api.ChargeMode
- func (lp *Loadpoint) GetPhases() int
- func (lp *Loadpoint) GetPhasesConfigured() int
- func (lp *Loadpoint) GetPlan(targetTime time.Time, requiredDuration, precondition time.Duration, ...) api.Rates
- func (lp *Loadpoint) GetPlanEnergy() (time.Time, float64)
- func (lp *Loadpoint) GetPlanGoal() (float64, bool)
- func (lp *Loadpoint) GetPlanRemainingEnergy() float64
- func (lp *Loadpoint) GetPlanRequiredDuration(goal, maxPower float64) time.Duration
- func (lp *Loadpoint) GetPlanStrategy() api.PlanStrategy
- func (lp *Loadpoint) GetPriority() int
- func (lp *Loadpoint) GetRemainingDuration() time.Duration
- func (lp *Loadpoint) GetRemainingEnergy() float64
- func (lp *Loadpoint) GetSmartCostLimit() *float64
- func (lp *Loadpoint) GetSmartFeedInPriorityLimit() *float64
- func (lp *Loadpoint) GetSoc() float64
- func (lp *Loadpoint) GetSocConfig() loadpoint.SocConfig
- func (lp *Loadpoint) GetSocPlanGoals() []loadpoint.PlanGoal
- func (lp *Loadpoint) GetSolarShare() float64
- func (lp *Loadpoint) GetStatus() api.ChargeStatus
- func (lp *Loadpoint) GetThresholds() loadpoint.ThresholdsConfig
- func (lp *Loadpoint) GetTitle() string
- func (lp *Loadpoint) GetUI() loadpoint.UIConfig
- func (lp *Loadpoint) GetVehicle() api.Vehicle
- func (lp *Loadpoint) HasChargeMeter() bool
- func (lp *Loadpoint) IsFastChargingActive() bool
- func (lp *Loadpoint) LimitEnergyReached() bool
- func (lp *Loadpoint) LimitSocReached() bool
- func (lp *Loadpoint) Lock()
- func (lp *Loadpoint) MaxActivePhases() int
- func (lp *Loadpoint) MinActivePhases() int
- func (lp *Loadpoint) OptimizerPlan(planTime time.Time) (api.Rates, float64)
- func (lp *Loadpoint) Prepare(site site.API, uiChan chan<- util.Param, pushChan chan<- messenger.Event, ...)
- func (lp *Loadpoint) PublishEffectiveValues()
- func (lp *Loadpoint) PvChargeStarting() bool
- func (lp *Loadpoint) RLock()
- func (lp *Loadpoint) RUnlock()
- func (lp *Loadpoint) RequestUpdate()
- func (lp *Loadpoint) ResetMeasuredPhases()
- func (lp *Loadpoint) SetAlwaysCharge(ac api.AlwaysCharge) error
- func (lp *Loadpoint) SetBatteryBoost(enable bool) error
- func (lp *Loadpoint) SetBatteryBoostLimit(limit int)
- func (lp *Loadpoint) SetChargerRef(ref string)
- func (lp *Loadpoint) SetCircuitRef(ref string)
- func (lp *Loadpoint) SetDefaultMode(mode api.ChargeMode)
- func (lp *Loadpoint) SetDefaultVehicleRef(ref string)
- func (lp *Loadpoint) SetDemandPredictor(predictor string)
- func (lp *Loadpoint) SetDisableDelay(delay time.Duration)
- func (lp *Loadpoint) SetDisableThreshold(threshold float64)
- func (lp *Loadpoint) SetEnableDelay(delay time.Duration)
- func (lp *Loadpoint) SetEnableThreshold(threshold float64)
- func (lp *Loadpoint) SetLimitEnergy(energy float64)
- func (lp *Loadpoint) SetLimitSoc(soc int)
- func (lp *Loadpoint) SetMaxCurrent(current float64) error
- func (lp *Loadpoint) SetMeterRef(ref string)
- func (lp *Loadpoint) SetMinCurrent(current float64) error
- func (lp *Loadpoint) SetMinSoc(soc int)
- func (lp *Loadpoint) SetMode(mode api.ChargeMode)
- func (lp *Loadpoint) SetPhases(phases int)
- func (lp *Loadpoint) SetPhasesConfigured(phases int) error
- func (lp *Loadpoint) SetPlanEnergy(finishAt time.Time, energy float64) error
- func (lp *Loadpoint) SetPlanStrategy(strategy api.PlanStrategy) error
- func (lp *Loadpoint) SetPriority(prio int)
- func (lp *Loadpoint) SetRemainingDuration(chargeRemainingDuration time.Duration)
- func (lp *Loadpoint) SetRemainingEnergy(chargeRemainingEnergy float64)
- func (lp *Loadpoint) SetSmartCostLimit(val *float64) error
- func (lp *Loadpoint) SetSmartFeedInPriorityLimit(val *float64) error
- func (lp *Loadpoint) SetSocConfig(soc loadpoint.SocConfig)
- func (lp *Loadpoint) SetSolarShare(val float64)
- func (lp *Loadpoint) SetThresholds(thresholds loadpoint.ThresholdsConfig)
- func (lp *Loadpoint) SetTitle(title string)
- func (lp *Loadpoint) SetUI(ui loadpoint.UIConfig)
- func (lp *Loadpoint) SetVehicle(vehicle api.Vehicle)
- func (lp *Loadpoint) SocBasedPlanning() bool
- func (lp *Loadpoint) StartVehicleDetection()
- func (lp *Loadpoint) Unlock()
- func (lp *Loadpoint) Update(sitePower, batteryPower float64, consumption, feedin api.Rates, ...)
- func (lp *Loadpoint) UpdateChargePowerAndCurrents() float64
- type MetersConfig
- type PlanLock
- type Progress
- type Site
- func (site *Site) ActiveLoadpoints() iter.Seq2[int, loadpoint.API]
- func (site *Site) Automatic() bool
- func (site *Site) AutomaticLoadpoints() bool
- func (site *Site) Boot(log *util.Logger, loadpoints []*Loadpoint, tariffs *tariff.Tariffs) error
- func (site *Site) DumpConfig()
- func (site *Site) ExplainFeedback(ctx context.Context, vote, comment string) error
- func (site *Site) ExplainOptimizerResult(ctx context.Context, language string) error
- func (site *Site) GetAuxMeterRefs() []string
- func (site *Site) GetBatteryDischargeControl() bool
- func (site *Site) GetBatteryGridChargeLimit() *float64
- func (site *Site) GetBatteryGridDischarge() bool
- func (site *Site) GetBatteryGridDischargeLimit() *float64
- func (site *Site) GetBatteryMaxDischargePower() *float64
- func (site *Site) GetBatteryMeterRefs() []string
- func (site *Site) GetBatteryMode() api.BatteryMode
- func (site *Site) GetBatteryModeExternal() api.BatteryMode
- func (site *Site) GetBatterySoc() float64
- func (site *Site) GetBufferSoc() float64
- func (site *Site) GetBufferStartSoc() float64
- func (site *Site) GetCircuit() api.Circuit
- func (site *Site) GetConsumerMeterRefs() []string
- func (site *Site) GetCountry() string
- func (site *Site) GetCurtailerRefs() []string
- func (site *Site) GetExtMeterRefs() []string
- func (site *Site) GetGridConnection() string
- func (site *Site) GetGridExportLimit() float64
- func (site *Site) GetGridMeterRef() string
- func (site *Site) GetGridPower() float64
- func (site *Site) GetOptimizerChargingStrategy() string
- func (site *Site) GetOptimizerRiskProfile() *api.RiskProfile
- func (site *Site) GetPVMeterRefs() []string
- func (site *Site) GetPrioritySoc() float64
- func (site *Site) GetProfilePercentile() *float64
- func (site *Site) GetResidualPower() float64
- func (site *Site) GetSolarAdjusted() bool
- func (site *Site) GetTariff(tariff api.TariffUsage) api.Tariff
- func (site *Site) GetTitle() string
- func (site *Site) IsConfigured() bool
- func (site *Site) Loadpoints() []loadpoint.API
- func (site *Site) Optimize()
- func (site *Site) Prepare(valueChan chan<- util.Param, pushChan chan<- messenger.Event)
- func (site *Site) Publish(key string, val any)
- func (site *Site) Run(stopC chan struct{}, interval time.Duration)
- func (site *Site) SetAuxMeterRefs(ref []string)
- func (site *Site) SetBatteryDischargeControl(val bool) error
- func (site *Site) SetBatteryGridChargeLimit(val *float64) error
- func (site *Site) SetBatteryGridDischarge(val bool) error
- func (site *Site) SetBatteryGridDischargeLimit(val *float64) error
- func (site *Site) SetBatteryMeterRefs(ref []string)
- func (site *Site) SetBatteryMode(batMode api.BatteryMode)
- func (site *Site) SetBatteryModeExternal(mode api.BatteryMode) error
- func (site *Site) SetBufferSoc(soc float64) error
- func (site *Site) SetBufferStartSoc(soc float64) error
- func (site *Site) SetConsumerMeterRefs(ref []string)
- func (site *Site) SetCountry(country string)
- func (site *Site) SetCurtailerRefs(ref []string)
- func (site *Site) SetExtMeterRefs(ref []string)
- func (site *Site) SetGridConnection(conn string)
- func (site *Site) SetGridExportLimit(power float64) error
- func (site *Site) SetGridMeterRef(ref string)
- func (site *Site) SetHEMS(hems api.HEMS)
- func (site *Site) SetOptimizerChargingStrategy(strategy string) error
- func (site *Site) SetOptimizerRiskProfile(profile *api.RiskProfile) error
- func (site *Site) SetPVMeterRefs(ref []string)
- func (site *Site) SetPrioritySoc(soc float64) error
- func (site *Site) SetProfilePercentile(percentile *float64) error
- func (site *Site) SetResidualPower(power float64) error
- func (site *Site) SetSolarAdjusted(val bool)
- func (site *Site) SetTitle(title string)
- func (site *Site) Vehicles() site.Vehicles
- type Stats
- type Task
- type Timer
- type WakeUpEvent
Constants ¶
const ( OptimizerAutomaticOff = "off" OptimizerAutomaticBattery = "battery" // home battery only OptimizerAutomaticFull = "full" // home battery and loadpoints )
optimizer automatic levels: what the optimizer controls instead of only advising
const (
OPTIMIZER_URI = "https://optimizer.evcc.io"
)
Variables ¶
var ( ErrBatteryNotConfigured = errors.New("battery not configured") ErrBatteryControlNotAvailable = errors.New("battery control not available") ErrBatteryGridDischargeNotAvailable = errors.New("battery grid discharge not available") // ErrOptimizerAutomatic marks settings the optimizer decides on its own ErrOptimizerAutomatic = errors.New("not available in automatic mode") )
var OptimizerAutomaticLevels = []string{OptimizerAutomaticOff, OptimizerAutomaticBattery, OptimizerAutomaticFull}
Functions ¶
func DefaultDemandPredictor ¶
DefaultDemandPredictor returns the demand predictor a heating charger declares via its predictor feature
func OptimizerAutomatic ¶
func OptimizerAutomatic() string
OptimizerAutomatic returns the configured optimizer automatic level
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 (*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 Explanation ¶
type Explanation struct {
Text string `json:"explanation"`
Created time.Time `json:"created"`
Plan time.Time `json:"plan"` // updated time of the explained plan
}
Explanation is a plan explanation, when the optimizer service wrote it and the plan it explains. It is published as evopt-explanation, so every client shows the last one.
func (Explanation) MarshalBytes ¶
func (e Explanation) MarshalBytes() ([]byte, error)
MarshalBytes publishes the explanation as one message, like evopt
type Loadpoint ¶
type Loadpoint struct {
sync.RWMutex // guard status
// exposed public configuration
CircuitRef string `mapstructure:"circuit"` // Circuit reference
ChargerRef string `mapstructure:"charger"` // Charger reference
VehicleRef string `mapstructure:"vehicle"` // Vehicle reference
MeterRef string `mapstructure:"meter"` // Charge meter reference
Soc loadpoint.SocConfig
Enable, Disable loadpoint.ThresholdConfig
Ui loadpoint.UIConfig // display-only, not used in control logic
// from yaml
DefaultMode api.ChargeMode `mapstructure:"mode"` // Default charge mode, used for disconnect
Title string `mapstructure:"title"` // UI title
Priority int `mapstructure:"priority"` // Priority
DemandPredictor string `mapstructure:"demandPredictor"` // Heating demand predictor, empty: charger default
// from yaml, deprecated
GuardDuration_ time.Duration `mapstructure:"guardduration"` // ignored, present for compatibility
Phases_ int `mapstructure:"phases"` // ignored, present for compatibility
MinCurrent_ float64 `mapstructure:"minCurrent"` // ignored, present for compatibility
MaxCurrent_ float64 `mapstructure:"maxCurrent"` // ignored, present for compatibility
// 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, settings settings.Settings, collector *metrics.Collector, other map[string]any) (*Loadpoint, error)
NewLoadpointFromConfig creates a new loadpoint
func (*Loadpoint) ActivePhases ¶
ActivePhases returns the number of expectedly active phases for the meter. If unknown for 1p3p chargers during startup it will assume 3p.
func (*Loadpoint) ClearPlanLock ¶
func (lp *Loadpoint) ClearPlanLock()
ClearPlanLock clears the locked plan goal
func (*Loadpoint) EffectiveLimitSoc ¶
EffectiveLimitSoc returns the effective session limit soc
func (*Loadpoint) EffectiveMaxPower ¶
EffectiveMaxPower returns the effective max power taking vehicle capabilities, phase scaling and load management power limits into account
func (*Loadpoint) EffectiveMinPower ¶
EffectiveMinPower returns the effective min power for the minimum active phases
func (*Loadpoint) EffectiveMinSoc ¶
EffectiveMinSoc returns the effective min soc (heating: min temperature)
func (*Loadpoint) EffectivePlan ¶
func (lp *Loadpoint) EffectivePlan(planTime time.Time, requiredDuration time.Duration, strategy api.PlanStrategy) (api.Rates, float64, bool)
EffectivePlan returns the charging plan in effect. While in control the optimizer schedules the plan itself, returned with its average power and true. Everything else is the planner's.
func (*Loadpoint) EffectivePlanId ¶
EffectivePlanId returns the id for the current plan
func (*Loadpoint) EffectivePlanSoc ¶
EffectivePlanSoc returns the soc target for the current plan
func (*Loadpoint) EffectivePlanStrategy ¶
func (lp *Loadpoint) EffectivePlanStrategy() api.PlanStrategy
EffectivePlanStrategy returns the effective plan strategy
func (*Loadpoint) EffectivePlanTime ¶
EffectivePlanTime returns the effective plan time
func (*Loadpoint) EffectivePriority ¶
EffectivePriority returns the effective priority
func (*Loadpoint) EffectiveStepPower ¶
EffectiveStepPower returns the effective step power for the currently active phases
func (*Loadpoint) GetAlwaysCharge ¶
func (lp *Loadpoint) GetAlwaysCharge() api.AlwaysCharge
GetAlwaysCharge returns the always charge state
func (*Loadpoint) GetBatteryBoost ¶
GetBatteryBoost returns the battery boost
func (*Loadpoint) GetBatteryBoostLimit ¶
GetBatteryBoostLimit returns the battery boost soc limit
func (*Loadpoint) GetChargePower ¶
GetChargePower returns the current charge power
func (*Loadpoint) GetChargePowerFlexibility ¶
GetChargePowerFlexibility returns the flexible amount of current charging power
func (*Loadpoint) GetChargedEnergy ¶
GetChargedEnergy returns session charge energy in Wh
func (*Loadpoint) GetChargerRef ¶
GetChargerRef returns the loadpoint charger
func (*Loadpoint) GetCircuit ¶
GetCircuit returns the assigned circuit
func (*Loadpoint) GetCircuitRef ¶
GetCircuitName returns the loadpoint circuit
func (*Loadpoint) GetDefaultMode ¶
func (lp *Loadpoint) GetDefaultMode() api.ChargeMode
GetDefaultMode returns the default charge mode
func (*Loadpoint) GetDefaultVehicleRef ¶
GetDefaultVehicleRef returns the loadpoint default vehicle
func (*Loadpoint) GetDemandPredictor ¶
GetDemandPredictor returns the configured demand predictor, empty for the charger default
func (*Loadpoint) GetDisableDelay ¶
GetDisableDelay gets the loadpoint enable delay
func (*Loadpoint) GetDisableThreshold ¶
GetDisableThreshold gets the loadpoint enable threshold
func (*Loadpoint) GetEnableDelay ¶
GetEnableDelay gets the loadpoint enable delay
func (*Loadpoint) GetEnableThreshold ¶
GetEnableThreshold gets the loadpoint enable threshold
func (*Loadpoint) GetLimitEnergy ¶
GetLimitEnergy returns the session limit energy
func (*Loadpoint) GetLimitSoc ¶
GetLimitSoc returns the session limit soc
func (*Loadpoint) GetMaxCurrent ¶
GetMaxCurrent returns the max loadpoint current
func (*Loadpoint) GetMaxPhaseCurrent ¶
GetMaxPhaseCurrent returns the maximum charge current per phase or- if not available- the offered current from either charger or charge meter
func (*Loadpoint) GetMeasuredPhases ¶
GetMeasuredPhases provides synchronized access to measuredPhases
func (*Loadpoint) GetMeterRef ¶
GetMeter returns the loadpoint meter
func (*Loadpoint) GetMinCurrent ¶
GetMinCurrent returns the min loadpoint current
func (*Loadpoint) GetMode ¶
func (lp *Loadpoint) GetMode() api.ChargeMode
GetMode returns loadpoint charge mode
func (*Loadpoint) GetPhasesConfigured ¶
GetPhasesConfigured returns the configured phases
func (*Loadpoint) GetPlan ¶
func (lp *Loadpoint) GetPlan(targetTime time.Time, requiredDuration, precondition time.Duration, continuous bool) api.Rates
GetPlan creates a charging plan for given time and duration The plan is sorted by time
func (*Loadpoint) GetPlanEnergy ¶
GetPlanEnergy returns plan target energy
func (*Loadpoint) GetPlanGoal ¶
GetPlanGoal returns the plan goal in %, true or kWh, false
func (*Loadpoint) GetPlanRemainingEnergy ¶
GetPlanRemainingEnergy returns the energy plan's missing energy in kWh
func (*Loadpoint) GetPlanRequiredDuration ¶
GetPlanRequiredDuration is the estimated total charging duration
func (*Loadpoint) GetPlanStrategy ¶
func (lp *Loadpoint) GetPlanStrategy() api.PlanStrategy
GetPlanStrategy returns the plan strategy
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 kWh
func (*Loadpoint) GetSmartCostLimit ¶
GetSmartCostLimit gets the smart cost limit. The optimizer replaces it in automatic mode, so it reads as unset and none of its consumers apply it.
func (*Loadpoint) GetSmartFeedInPriorityLimit ¶
GetSmartFeedInPriorityLimit gets the smart feed-in limit. The optimizer replaces it in automatic mode, so it reads as unset.
func (*Loadpoint) GetSocConfig ¶
GetSoc returns the PV mode threshold settings
func (*Loadpoint) GetSocPlanGoals ¶
GetSocPlanGoals returns the soc goals of all vehicle plans, repeating plans for each occurrence within a week. Unlike nextVehiclePlan it includes later and already reached plans.
func (*Loadpoint) GetSolarShare ¶
GetSolarShare gets the solar share
func (*Loadpoint) GetStatus ¶
func (lp *Loadpoint) GetStatus() api.ChargeStatus
GetStatus returns the charging status
func (*Loadpoint) GetThresholds ¶
func (lp *Loadpoint) GetThresholds() loadpoint.ThresholdsConfig
GetThresholds returns the PV mode threshold settings
func (*Loadpoint) GetVehicle ¶
GetVehicle gets the active vehicle
func (*Loadpoint) HasChargeMeter ¶
HasChargeMeter determines if a physical charge meter is attached
func (*Loadpoint) IsFastChargingActive ¶
IsFastChargingActive indicates if fast charging with maximum power is active
func (*Loadpoint) LimitEnergyReached ¶
LimitEnergyReached checks if target is configured and reached
func (*Loadpoint) LimitSocReached ¶
LimitSocReached returns true if the effective limit has been reached
func (*Loadpoint) MaxActivePhases ¶
MaxActivePhases returns the maximum number of active phases for the loadpoint.
func (*Loadpoint) MinActivePhases ¶
MinActivePhases returns the minimum number of active phases for the loadpoint.
func (*Loadpoint) OptimizerPlan ¶
OptimizerPlan returns the optimizer's remaining charging schedule up to the plan time and its average power, nil if the optimizer is not in charge. Later slots serve surplus, not the plan.
func (*Loadpoint) Prepare ¶
func (lp *Loadpoint) Prepare(site site.API, uiChan chan<- util.Param, pushChan chan<- messenger.Event, lpChan chan<- *Loadpoint)
Prepare loadpoint configuration by adding missing helper elements
func (*Loadpoint) PublishEffectiveValues ¶
func (lp *Loadpoint) PublishEffectiveValues()
PublishEffectiveValues publishes all effective values
func (*Loadpoint) PvChargeStarting ¶
PvChargeStarting reports a PV loadpoint that claimed surplus via a running enable timer but is not yet drawing it and has not reached its goal. See #31194, #31684.
func (*Loadpoint) RequestUpdate ¶
func (lp *Loadpoint) RequestUpdate()
RequestUpdate requests site to update this loadpoint
func (*Loadpoint) ResetMeasuredPhases ¶
func (lp *Loadpoint) ResetMeasuredPhases()
ResetMeasuredPhases resets measured phases to unknown on vehicle disconnect, phase switch or phase api call
func (*Loadpoint) SetAlwaysCharge ¶
func (lp *Loadpoint) SetAlwaysCharge(ac api.AlwaysCharge) error
SetAlwaysCharge sets the always charge state
func (*Loadpoint) SetBatteryBoost ¶
SetBatteryBoost sets the battery boost
func (*Loadpoint) SetBatteryBoostLimit ¶
SetBatteryBoostLimit sets the battery boost soc limit. Relaxing the limit resumes a boost held by it, 100 disables the feature and ends an active boost.
func (*Loadpoint) SetChargerRef ¶
SetChargerRef sets the loadpoint charger
func (*Loadpoint) SetCircuitRef ¶
SetCircuitRef sets the loadpoint circuit
func (*Loadpoint) SetDefaultMode ¶
func (lp *Loadpoint) SetDefaultMode(mode api.ChargeMode)
SetDefaultMode sets the default charge mode
func (*Loadpoint) SetDefaultVehicleRef ¶
SetDefaultVehicleRef returns the loadpoint default vehicle
func (*Loadpoint) SetDemandPredictor ¶
SetDemandPredictor sets the demand predictor ("daily", "weekday", "temperature" or empty for the charger default), other values are ignored
func (*Loadpoint) SetDisableDelay ¶
SetDisableDelay sets loadpoint disable delay
func (*Loadpoint) SetDisableThreshold ¶
SetDisableThreshold sets loadpoint disable threshold
func (*Loadpoint) SetEnableDelay ¶
SetEnableDelay sets loadpoint enable delay
func (*Loadpoint) SetEnableThreshold ¶
SetEnableThreshold sets loadpoint enable threshold
func (*Loadpoint) SetLimitEnergy ¶
SetLimitEnergy sets the session energy limit
func (*Loadpoint) SetLimitSoc ¶
SetLimitSoc sets the session soc limit
func (*Loadpoint) SetMaxCurrent ¶
SetMaxCurrent sets the max loadpoint current
func (*Loadpoint) SetMeterRef ¶
SetMeter sets the loadpoint meter
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) SetPhases ¶
SetPhases sets the number of enabled phases without modifying the charger
func (*Loadpoint) SetPhasesConfigured ¶
SetPhasesConfigured sets the configured phases
func (*Loadpoint) SetPlanEnergy ¶
SetPlanEnergy sets plan target energy
func (*Loadpoint) SetPlanStrategy ¶
func (lp *Loadpoint) SetPlanStrategy(strategy api.PlanStrategy) error
SetPlanStrategy sets the plan strategy
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 kWh
func (*Loadpoint) SetSmartCostLimit ¶
SetSmartCostLimit sets the smart cost limit
func (*Loadpoint) SetSmartFeedInPriorityLimit ¶
SetSmartFeedInPriorityLimit sets the smart cost feed-in
func (*Loadpoint) SetSocConfig ¶
SetSoc sets the PV mode threshold settings
func (*Loadpoint) SetSolarShare ¶
SetSolarShare sets the solar share
func (*Loadpoint) SetThresholds ¶
func (lp *Loadpoint) SetThresholds(thresholds loadpoint.ThresholdsConfig)
SetThresholds sets the PV mode threshold settings
func (*Loadpoint) SetVehicle ¶
SetVehicle sets the active vehicle
func (*Loadpoint) SocBasedPlanning ¶
SocBasedPlanning returns true if soc based planning is enabled
func (*Loadpoint) StartVehicleDetection ¶
func (lp *Loadpoint) StartVehicleDetection()
StartVehicleDetection allows triggering vehicle detection for debugging purposes
func (*Loadpoint) Update ¶
func (lp *Loadpoint) Update(sitePower, batteryPower float64, consumption, feedin api.Rates, batteryBuffered, batteryStart bool, greenShare float64, effPrice, effCo2 *float64, dim *bool)
Update is the main control function. It reevaluates meters and charger state
func (*Loadpoint) UpdateChargePowerAndCurrents ¶
UpdateChargePowerAndCurrents updates charge meter power and currents for load management
type MetersConfig ¶
type MetersConfig struct {
GridMeterRef string `mapstructure:"grid"` // Grid usage meter
PVMetersRef []string `mapstructure:"pv"` // PV meter
BatteryMetersRef []string `mapstructure:"battery"` // Battery charging meter
ExtMetersRef []string `mapstructure:"ext"` // Meters used only for monitoring
AuxMetersRef []string `mapstructure:"aux"` // Auxiliary meters
ConsumerMetersRef []string `mapstructure:"consumer"` // Consumer meters
}
MetersConfig contains the site's meter configuration
type PlanLock ¶
type PlanLock struct {
Time time.Time // target time (committed goal, persists during overrun)
Soc int // target soc
Id int // id (0=none, 1=static, 2+=repeating), needed to highlight the plan in ui
}
PlanLock contains information about a locked plan. It caches the goal a soc-based plan has committed to, so that an overrunning plan keeps charging towards that goal instead of jumping to the next plan. The lock must be dropped whenever the goal inputs change- plan time, plan soc or the set of plans itself.
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
type Site ¶
type Site struct {
sync.RWMutex
// configuration
Title string `mapstructure:"title"` // UI title
Voltage float64 `mapstructure:"voltage"` // Deprecated: ignored, the nominal voltage is fixed
ResidualPower float64 `mapstructure:"residualPower"` // PV meter only: household usage. Grid meter: household safety margin
Meters MetersConfig `mapstructure:"meters"` // Meter references
CurtailersRef []string `mapstructure:"curtailers"` // Curtailment device references
// contains filtered or unexported fields
}
Site is the main configuration container. A site can host multiple loadpoints.
func NewSiteFromConfig ¶
NewSiteFromConfig creates a new site
func (*Site) ActiveLoadpoints ¶
ActiveLoadpoints yields enabled loadpoints with their stable index
func (*Site) Automatic ¶
Automatic returns true if the optimizer controls the home battery instead of only advising
func (*Site) AutomaticLoadpoints ¶
AutomaticLoadpoints returns true if the optimizer controls the loadpoints as well
func (*Site) ExplainFeedback ¶
ExplainFeedback votes on the last explanation: up or down, with an optional comment. The plan and the explanation go along, the optimizer service stores nothing before a vote.
func (*Site) ExplainOptimizerResult ¶
ExplainOptimizerResult asks the optimizer service why the last plan looks the way it does. Repeated calls for the same plan and language return the previous explanation.
func (*Site) GetAuxMeterRefs ¶
GetAuxMeterRefs returns the AuxMeterRef
func (*Site) GetBatteryDischargeControl ¶
GetBatteryDischargeControl returns the battery control mode (no discharge only). The optimizer replaces it in automatic mode, so it reads as disabled.
func (*Site) GetBatteryGridChargeLimit ¶
The optimizer replaces the limit in automatic mode, so it reads as unset.
func (*Site) GetBatteryGridDischarge ¶
GetBatteryGridDischarge returns whether the battery may discharge to grid (experimental)
func (*Site) GetBatteryGridDischargeLimit ¶
func (*Site) GetBatteryMaxDischargePower ¶
GetBatteryMaxDischargePower returns the current battery max discharge power
func (*Site) GetBatteryMeterRefs ¶
GetBatteryMeterRefs returns the BatteryMeterRef
func (*Site) GetBatteryMode ¶
func (site *Site) GetBatteryMode() api.BatteryMode
GetBatteryMode returns the battery mode
func (*Site) GetBatteryModeExternal ¶
func (site *Site) GetBatteryModeExternal() api.BatteryMode
GetBatteryModeExternal returns the external battery mode
func (*Site) GetBatterySoc ¶
GetBatterySoc returns the current battery soc
func (*Site) GetBufferSoc ¶
GetBufferSoc returns the BufferSoc
func (*Site) GetBufferStartSoc ¶
GetBufferStartSoc returns the BufferStartSoc
func (*Site) GetCircuit ¶
GetCircuit returns the root circuit
func (*Site) GetConsumerMeterRefs ¶
GetConsumerMeterRefs returns the ConsumerMeterRef
func (*Site) GetCountry ¶
GetCountry returns the ISO 3166-1 alpha-2 country code
func (*Site) GetCurtailerRefs ¶
GetCurtailerRefs returns the curtailment device references
func (*Site) GetExtMeterRefs ¶
GetExtMeterRefs returns the ExtMeterRef
func (*Site) GetGridConnection ¶
GetGridConnection returns the grid connection, 3p4w (with neutral, default) or 3p3w (without neutral)
func (*Site) GetGridExportLimit ¶
GetGridExportLimit returns the static grid export power limit in W (0 = disabled)
func (*Site) GetGridMeterRef ¶
GetGridMeterRef returns the GridMeterRef
func (*Site) GetGridPower ¶
GetGridPower returns the most recent grid power reading in W (positive = import)
func (*Site) GetOptimizerChargingStrategy ¶
GetOptimizerChargingStrategy returns the optimizer grid charging strategy, falling back to the default when unset.
func (*Site) GetOptimizerRiskProfile ¶
func (site *Site) GetOptimizerRiskProfile() *api.RiskProfile
GetOptimizerRiskProfile returns the forecast uncertainty the optimizer hedges against, nil = none
func (*Site) GetPVMeterRefs ¶
GetPVMeterRefs returns the PvMeterRef
func (*Site) GetPrioritySoc ¶
GetPrioritySoc returns the PrioritySoc
func (*Site) GetProfilePercentile ¶
GetProfilePercentile returns the percentile of the historic energy profiles in %, nil = average
func (*Site) GetResidualPower ¶
GetResidualPower returns the ResidualPower
func (*Site) GetSolarAdjusted ¶
GetSolarAdjusted returns if the solar forecast is adjusted to real production data
func (*Site) GetTariff ¶
func (site *Site) GetTariff(tariff api.TariffUsage) api.Tariff
GetTariff returns the respective tariff if configured or nil
func (*Site) IsConfigured ¶
func (*Site) Loadpoints ¶
Loadpoints returns the loadpoints as api interfaces. Disabled loadpoints are returned as nil to keep indexes stable.
func (*Site) Run ¶
Run is the main control loop. It reacts to trigger events by updating measurements and executing control logic.
func (*Site) SetAuxMeterRefs ¶
SetAuxMeterRefs sets the AuxMeterRef
func (*Site) SetBatteryDischargeControl ¶
SetBatteryDischargeControl sets the battery control mode (no discharge only)
func (*Site) SetBatteryGridChargeLimit ¶
func (*Site) SetBatteryGridDischarge ¶
SetBatteryGridDischarge sets whether the battery may discharge to grid (experimental)
func (*Site) SetBatteryGridDischargeLimit ¶
func (*Site) SetBatteryMeterRefs ¶
SetBatteryMeterRefs sets the BatteryMeterRef
func (*Site) SetBatteryMode ¶
func (site *Site) SetBatteryMode(batMode api.BatteryMode)
SetBatteryMode sets the battery mode
func (*Site) SetBatteryModeExternal ¶
func (site *Site) SetBatteryModeExternal(mode api.BatteryMode) error
SetBatteryModeExternal sets the external battery mode
func (*Site) SetBufferSoc ¶
SetBufferSoc sets the BufferSoc
func (*Site) SetBufferStartSoc ¶
SetBufferStartSoc sets the BufferStartSoc
func (*Site) SetConsumerMeterRefs ¶
SetConsumerMeterRefs sets the ConsumerMeterRef
func (*Site) SetCountry ¶
SetCountry sets the ISO 3166-1 alpha-2 country code
func (*Site) SetCurtailerRefs ¶
SetCurtailerRefs sets the curtailment device references
func (*Site) SetExtMeterRefs ¶
SetExtMeterRefs sets the ExtMeterRef
func (*Site) SetGridConnection ¶
SetGridConnection sets the grid connection and applies it to the current to power conversion
func (*Site) SetGridExportLimit ¶
SetGridExportLimit sets the static grid export power limit in W (0 = disabled)
func (*Site) SetGridMeterRef ¶
SetGridMeterRef sets the GridMeterRef
func (*Site) SetOptimizerChargingStrategy ¶
SetOptimizerChargingStrategy validates and persists the optimizer grid charging strategy and re-runs the optimizer when it changes.
func (*Site) SetOptimizerRiskProfile ¶
func (site *Site) SetOptimizerRiskProfile(profile *api.RiskProfile) error
SetOptimizerRiskProfile sets the forecast uncertainty the optimizer hedges against, nil = none
func (*Site) SetPVMeterRefs ¶
SetPVMeterRefs sets the PvMeterRef
func (*Site) SetPrioritySoc ¶
SetPrioritySoc sets the PrioritySoc
func (*Site) SetProfilePercentile ¶
SetProfilePercentile sets the percentile of the historic energy profiles in %, nil = average
func (*Site) SetResidualPower ¶
SetResidualPower sets the ResidualPower
func (*Site) SetSolarAdjusted ¶
SetSolarAdjusted sets if the solar forecast is adjusted to real production data
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Publishes long term charging statistics
type Timer ¶
Timer measures active time between start and stop events
func (*Timer) Elapsed ¶
func (m *Timer) Elapsed() WakeUpEvent
Elapsed checks if the timer has elapsed and if resets its status
type WakeUpEvent ¶
type WakeUpEvent int
const ( WakeUpTimerInactive WakeUpEvent = iota WakeUpTimerElapsed WakeUpTimerFinished )
Source Files
¶
- energy_metrics.go
- helper.go
- loadpoint.go
- loadpoint_api.go
- loadpoint_charger.go
- loadpoint_effective.go
- loadpoint_load_predictor.go
- loadpoint_meter.go
- loadpoint_mutex.go
- loadpoint_optimizer.go
- loadpoint_phases.go
- loadpoint_plan.go
- loadpoint_session.go
- loadpoint_smartcost.go
- loadpoint_vehicle.go
- optimizer_schedule.go
- progress.go
- site.go
- site_api.go
- site_battery.go
- site_circuits.go
- site_load_predictor.go
- site_optimizer.go
- site_optimizer_explain.go
- site_optimizer_request.go
- site_optimizer_result.go
- site_optimizer_suggestions.go
- site_startup.go
- site_tariffs.go
- site_vehicles.go
- solar.go
- stats.go
- timer.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package loadpoint is a generated GoMock package.
|
Package loadpoint is a generated GoMock package. |
|
Package vehicle is a generated GoMock package.
|
Package vehicle is a generated GoMock package. |