Building multiasset extension#777
Conversation
…o building_multiasset_extension
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #777 +/- ##
==========================================
- Coverage 80.79% 80.49% -0.31%
==========================================
Files 56 56
Lines 8676 9004 +328
==========================================
+ Hits 7010 7248 +238
- Misses 1666 1756 +90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…o building_multiasset_extension
carl-wanninger
left a comment
There was a problem hiding this comment.
This is a review draft. Ask for second opinion.
| return m.total_power_input[t] == total_power | ||
|
|
||
| def define_constraints(self): | ||
| """ |
There was a problem hiding this comment.
What is the rationale behind getting rid of these docstrings?
There was a problem hiding this comment.
I have repased the old docstring with the new one becsue I thinnk the updated one can bring more elaboration to the users, in my perspective. What do you think about it?
| if technology in demand_side_technologies: | ||
| # Get the class from the dictionary mapping (adjust `demand_side_technologies` to hold classes) | ||
| component_class = demand_side_technologies[technology] | ||
| base_technology = next( |
There was a problem hiding this comment.
Gemini suggestion:
for tech in demand_side_technologies:
if technology.startswith(tech):
base_technology = tech
break
else:
raise ValueError(f"Unknown DSM component technology: {technology}")| Specific electricity consumption for driving. | ||
| Interpreted here as energy per unit of external_range. | ||
| Example: if external_range is km, mileage should be MWh/km. | ||
| power_flow_directionality : str, default "unidirectional" |
There was a problem hiding this comment.
I would find
bidirectional: boolean | False
simpler.
| @@ -6,763 +6,805 @@ | |||
| import pyomo.environ as pyo | |||
There was a problem hiding this comment.
To me it is a little confusing that there are ev tests in both test_building.py and test_ev.py .
| @@ -6,763 +6,805 @@ | |||
| import pyomo.environ as pyo | |||
There was a problem hiding this comment.
I think test section would heavily profit from testing optimization.
That is: Here is a price signal now let us check that our building/EV actually finds the optimal solution. ( For various lengths).
| ) | ||
|
|
||
| # Apply predefined charging profile constraints if provided | ||
| @model_block.Constraint(self.time_steps) |
There was a problem hiding this comment.
In our understanding, this constraint (no charging while driving and vice versa) should be handled in the input validation and not during runtime
…o building_multiasset_extension
carl-wanninger
left a comment
There was a problem hiding this comment.
Based on the provided tests and an additional test, the optimization seems to work as intended. Nice work!
We think two more things would be necessary for the code to be fully functional.
- Right now I can have an EV with availability [1, 1] and trip_distances [80, 80]. This is physically not possible and should raise a validation error.
Either:
Soft validation constraint trip_distance > 0 -> avalability must be smaller than one.
or:
Hard validation constraint: trip_distance > 0 -> availability must be 0.
- We again strongly encourage that instead of trip_distance + mileage as input, the model should directly take used_energy as input. The reasoning is that if a dataset provides mileage and trip distance, it is very simple to calculate used energy. However, if a dataset only provides used energy (such as synpro from Fraunhofer ISE), one does have to fingate trip distance, which is very cumbersome.
In a future extension it might be nice to have soc pivots where the EV is requested to have a certain SoC at certain points of time - but this has not to be handled by this PR.
|
Here is a test we constructed based on the provided tests to convince ourselves of the simultanoues arbitrage possiblity and trip distance handling. def test_ev_able_to_make_arbitrage_and_meet_demand(time_index): |
…o building_multiasset_extension
@carl-wanninger Included both the requests. |
Co-authored-by: Copilot <copilot@github.com>
carl-wanninger
left a comment
There was a problem hiding this comment.
We approve this PR.
Thank you for your good work, Manish!
Related Issue
If no issue exists, delete this line.
Description
This PR extends the building unit to support multi-asset configurations, with a particular focus on integrating multiple electric vehicles and charging stations into the building framework.
The main motivation is to move beyond the previous singleton-style setup in which only one asset of a given type could be connected to a building. With this change, buildings can now contain multiple EVs and multiple charging stations while preserving the existing building functionality for heat pumps, boilers, thermal storage, PV, and generic storage.
Main changes
Building, allowing multiple components such aselectric_vehicle_1,electric_vehicle_2,charging_station_1, etc.ChargingStationDSM component indst_components.pywith:ElectricVehicleDSM component with:DSMFlex.initialize_components()to support prefixed DSM component names and to pass EV-specific external range data during model constructionBuildingForecasterandloader_csv.pyto support:<building_id>_load_profileelectricity_price_flexfor use withelectricity_price_signalDSMFlex.switch_to_opt()so it no longer assumes that flexibility constraints exist for all flexibility measurestests/test_building.pyto cover both legacy building functionality and the new EV + charging-station integration logicScope of testing
The updated building tests cover:
Checklist
docfolder updates etc.)Additional Notes (optional)