Skip to content

add static grid limit as load management restriction#31

Merged
andig merged 27 commits into
evcc-io:mainfrom
ekkea:23-add-static-grid-limit-as-load-management-restriction
Oct 18, 2025
Merged

add static grid limit as load management restriction#31
andig merged 27 commits into
evcc-io:mainfrom
ekkea:23-add-static-grid-limit-as-load-management-restriction

Conversation

@ekkea
Copy link
Copy Markdown
Contributor

@ekkea ekkea commented Oct 4, 2025

Fix #23

  • added optional limits for grid import and export to interface
  • added optional demand rate parameter for excess power beyond the import limit
  • both limits accept violation if there is no physical solution otherwise. See also discussion below.

TO BE DISCUSSED:

  • how shall we deal with cases where the import limit gets violated?
    • return infeasible
    • return a specific flag
    • return a time series of the excess power drawn
    • reduce demanded charging first, then one of the above options
  • how shall we handle the case that a given export limit gets violated (typically caused by high solar yield)
    • consider that in those cases the solar power is reduced to match the limit. Always return a time series giving the actual solar power produced (ft - p_exp_pen).
    • return infeasible
    • ???

@ekkea ekkea changed the title Fix #23 - add static grid limit as load management restriction add static grid limit as load management restriction Oct 4, 2025
@andig
Copy link
Copy Markdown
Member

andig commented Oct 6, 2025

how shall we deal with cases where the import limit gets violated

Imho that's infeasible?

how shall we handle the case that a given export limit gets violated (typically caused by high solar yield)
Always return a time series giving the actual solar power produced (ft - p_exp_pen).

Shouldn't we return grid feed-in series then? Or generally (as we already do) just return the grid series? Imho this should not be infeasible but rather best effort.

@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 7, 2025

how shall we deal with cases where the import limit gets violated?
Imho that's infeasible?

I agree in principle but from the user perspective, wouldn't it be good to get a feedback like "power demand 2.5kW above grid power limit at 12:15" rather than "infeasible"? If yes, we could return a specific status code for this kind of violation and additional data on time step and magnitude.

Shouldn't we return grid feed-in series then? Or generally (as we already do) just return the grid series? Imho this should not be infeasible but rather best effort.

Agree, it should be best effort, not infeasible. We can return whatever you prefer. I was thinking it may be valuable information for the user to see the lost solar potential from such power limits (solar forecast vs. usable solar power). But of course you can still compute that on the evcc end as well, as long as you have the computed grid power time series. You decide.

@andig
Copy link
Copy Markdown
Member

andig commented Oct 8, 2025

Good point. Add something like "grid limit violated"? We'd still need to make sure that the openapi spec supports that and it's treated as success. Maybe let's add this as result "hints" and keep the CBC optimizer result as-is?

@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 11, 2025

@andig, please have a look at what I added: the result now has flags whether limits were hit / exceeded and additional time series reporting the overshoot per timestep.

@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 11, 2025

Note: there is a bit more work to finalise this PR even if we all agree on the features added:

  • the option to consider a given demand rate beyond a certain input power will work correctly but the result returned will look like a limit violation.
  • the objective value is now loaded with penalties that can influence the value quite a bit if they kick in. If you actually use the value, I'll have to correct it before returning the result.

@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 13, 2025

I will do more testing, however, I think we are good for a review from evcc side whether the interface (specifically the result reporting) makes sense from the caller's perspective.
Let me know if there is need to improve ;-).

@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 16, 2025

@andig , I'm done with testing, fixing and cleaning up. Ready for merging from my point of view.

Comment thread cmd/client.go Outdated
Comment thread cmd/client.go Outdated
Comment thread cmd/client.go Outdated
@ekkea
Copy link
Copy Markdown
Contributor Author

ekkea commented Oct 18, 2025

I'll take care of the changes later tonight

@andig andig merged commit e371690 into evcc-io:main Oct 18, 2025
2 checks passed
Comment thread src/evopt/optimizer.py
if self.is_grid_demand_rate_active:
clean_objective += - self.grid.prc_p_exc_imp \
* pulp.value(self.variables['p_max_imp_exc'])
print(clean_objective)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekkea
Latest version of evopt prints quite some numbers in the log. Guess it is due to this print statement?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please propose removal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(clean_objective)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too late to do here. Needs PR!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#39

@ekkea ekkea deleted the 23-add-static-grid-limit-as-load-management-restriction branch March 15, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add static grid limit as load management restriction

3 participants