Planner: adjust session energy by initial value plan (#25149)
This commit is contained in:
parent
2291b371e3
commit
da22c62073
3 changed files with 6 additions and 1 deletions
|
|
@ -148,6 +148,7 @@ type Loadpoint struct {
|
|||
planTime time.Time // time goal
|
||||
planPrecondition time.Duration // precondition duration
|
||||
planEnergy float64 // Plan charge energy in kWh (dumb vehicles)
|
||||
planEnergyOffset float64 // already charged energy in kWh when plan was set
|
||||
planSlotEnd time.Time // current plan slot end time
|
||||
planActive bool // charge plan exists and has a currently active slot
|
||||
|
||||
|
|
@ -514,6 +515,9 @@ func (lp *Loadpoint) evVehicleConnectHandler() {
|
|||
|
||||
// create charging session
|
||||
lp.createSession()
|
||||
|
||||
// reset energy-based charging plan offset
|
||||
lp.planEnergyOffset = 0
|
||||
}
|
||||
|
||||
// evVehicleDisconnectHandler sends external start event
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ func (lp *Loadpoint) setPlanEnergy(finishAt time.Time, precondition time.Duratio
|
|||
|
||||
lp.planTime = finishAt
|
||||
lp.planPrecondition = precondition
|
||||
lp.planEnergyOffset = lp.getChargedEnergy() / 1e3
|
||||
lp.publish(keys.PlanTime, finishAt)
|
||||
lp.publish(keys.PlanPrecondition, precondition)
|
||||
lp.settings.SetTime(keys.PlanTime, finishAt)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func (lp *Loadpoint) finishPlan() {
|
|||
|
||||
// remainingPlanEnergy returns missing energy amount in kWh
|
||||
func (lp *Loadpoint) remainingPlanEnergy(planEnergy float64) float64 {
|
||||
return max(0, planEnergy-lp.getChargedEnergy()/1e3)
|
||||
return max(0, planEnergy-(lp.getChargedEnergy()/1e3-lp.planEnergyOffset))
|
||||
}
|
||||
|
||||
// GetPlanRequiredDuration is the estimated total charging duration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue