Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery electric vehicle meta facade #152

Open
wants to merge 28 commits into
base: feature/battery-electric-vehicle
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8a274ae
add individual mobility sector facade from example (commit 6383a86)
JonasJeckstadt Jan 16, 2024
e62800c
adjust parameters (WIP)
JonasJeckstadt Jan 16, 2024
1d8365f
work on test for mobility_facade.
JonasJeckstadt Jan 18, 2024
199ee82
remove pkm_demand from IndividualMobilitySector facade.
JonasJeckstadt Jan 18, 2024
dde0974
remove transport_commodity_bus definition within IndividualMobilitySe…
JonasJeckstadt Jan 18, 2024
3ceb07e
fix label for Bev within IndividualMobilitySectror facade
JonasJeckstadt Jan 18, 2024
2f4d818
adjust IndividualMobilitySector facade to run with mobility_facade test
JonasJeckstadt Jan 18, 2024
9e50cad
Fix errors in docstring of Bev().
JonasJeckstadt Jan 22, 2024
660ba2c
Adjust parameters in IndividualMobilitySector facade (WIP).
JonasJeckstadt Jan 24, 2024
741c8cf
Update docstring of IndividualMobilitySector facade.
JonasJeckstadt Jan 25, 2024
2b75daa
Fix error with calculation of storage capacity.
JonasJeckstadt Feb 5, 2024
619e59a
Add invest_c_rate selection function to Bev() component.
JonasJeckstadt Feb 5, 2024
2dfb14f
Test _invest_c_rate method and fix issues.
JonasJeckstadt Feb 6, 2024
9d0ec2f
Adjust parameter definition of Bev and IndividualMobilitySector facad…
JonasJeckstadt Feb 8, 2024
39aa985
Update mobility_facade test.
JonasJeckstadt Feb 8, 2024
ffbad2f
Remove unused parameters from Bev facade and improve docstring.
JonasJeckstadt Feb 14, 2024
f90d68b
Add parameter availability_flex and availability_inflex.
JonasJeckstadt Feb 15, 2024
9210969
Merge branch 'feature/battery-electric-vehicle' into feature/battery-…
nailend Feb 26, 2024
81656fb
Fix minor error.
JonasJeckstadt Feb 26, 2024
638de45
Change processing of capacity value so it is used for flex and inflex…
JonasJeckstadt Mar 4, 2024
e169c37
Rename Bev classes
nailend Mar 13, 2024
8cf7a93
Adhere to pep8
nailend Mar 13, 2024
90faf86
Adjust BevTech name
nailend Mar 13, 2024
de58761
Update typemap
nailend Mar 13, 2024
85d350b
Add new imports
nailend Mar 27, 2024
5684b35
Bulk commit all changes
nailend Mar 27, 2024
eec7361
Test BEV fleet
nailend Mar 27, 2024
88e268b
Update graph plotting
nailend Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add invest_c_rate selection function to Bev() component.
JonasJeckstadt committed Feb 5, 2024
commit 619e59a22c475edf93874d6652efaad1298586cb
70 changes: 59 additions & 11 deletions src/oemof/tabular/facades/experimental/battery_electric_vehicle.py
Original file line number Diff line number Diff line change
@@ -100,8 +100,13 @@ class Bev(GenericStorage, Facade):
Age of the existing fleet at the first investment period in years.

invest_c_rate: float
Invested storage capacity per power rate
(e.g. 60/20 = 3h charging/discharging time)
The rate of storage capacity invested per unit of charging power.
For example, if invest_c_rate is 3, it indicates that 3 units of storage
capacity are invested for every unit of charging/discharging power. If
invest_c_rate is not provided, it is calculated based on the ratio of
storage_capacity to charging_power. If invest_c_rate, storage_capacity, and
charging_power are provided, invest_c_rate is validated against the calculated
value and a warning is issued if they do not match.
bev_storage_capacity: int
Storage capacity of one vehicle in kWh.
todo: not used in code.
@@ -195,15 +200,15 @@ class Bev(GenericStorage, Facade):

commodity_bus: Bus = None

charging_power: float = 0
charging_power: float = None

minimum_charging_power: float = None

charging_potential: float = None

availability: Union[float, Sequence[float]] = 1

storage_capacity: float = 0
storage_capacity: float = None

minimum_storage_capacity: float = 0

@@ -271,6 +276,41 @@ def _converter_investment(self):
else:
return None

def _invest_c_rate(self):
"""Determines the investment rate (invest_c_rate) based on the passed
parameters:

- If no parameters are passed, the default value of 1 is assigned.
- If only invest_c_rate is passed, it is assigned directly.
- If only storage_capacity and charging_power are passed, the invest_c_rate is
calculated.
- If invest_c_rate, storage_capacity, and charging_power are passed, it ensures
that the calculated and passed invest_c_rate are equal. If not, the passed
value is assigned and a warning is issued.
"""
if self.invest_c_rate is None:
self.invest_c_rate = 1
elif (
self.storage_capacity is not None
and self.charging_power is not None
and self.invest_c_rate is None
):
self.invest_c_rate = self.storage_capacity / self.charging_power
elif (
self.invest_c_rate is not None
and self.storage_capacity is not None
and self.charging_power is not None
):
calculated_invest_c_rate = (
self.storage_capacity / self.charging_power
)
if calculated_invest_c_rate != self.invest_c_rate:
print(
f"Warning: The passed invest_c_rate ({self.invest_c_rate}) does not"
f" match the calculated value ({calculated_invest_c_rate})."
)
return self.invest_c_rate

def build_solph_components(self):
# use label as prefix for subnodes
self.facade_label = self.label
@@ -286,6 +326,9 @@ def build_solph_components(self):
self.bus = internal_bus
subnodes = [internal_bus]

# Calculate invest_c_rate
self.invest_c_rate = self._invest_c_rate()

if self.expandable:
self.investment = Investment(
ep_costs=0,
@@ -537,8 +580,13 @@ class IndividualMobilitySector(Facade):
age: int
Age of the existing fleet at the first investment period in years.
invest_c_rate: float
Invested storage capacity per power rate
(e.g. 60/20 = 3h charging/discharging time)
The rate of storage capacity invested per unit of charging power.
For example, if invest_c_rate is 3, it indicates that 3 units of storage
capacity are invested for every unit of charging/discharging power. If
invest_c_rate is not provided, it is calculated based on the ratio of
storage_capacity to charging_power. If invest_c_rate, storage_capacity, and
charging_power are provided, invest_c_rate is validated against the calculated
value and a warning is issued if they do not match.
bev_storage_capacity: int
Storage capacity of one vehicle in kWh.
bev_invest_costs: float, array of float
@@ -566,7 +614,7 @@ class IndividualMobilitySector(Facade):
"""

# TODO: match data formats with actual data
# Todo: wo müssen werte vorgegeben werden?
# Todo: wo müssen werte angegeben werden?

label: str

@@ -578,11 +626,11 @@ class IndividualMobilitySector(Facade):
0 # todo: auch in Bev, soll ausgerechnet werden
)

charging_power_g2v: float = 0
charging_power_g2v: float = None

charging_power_v2g: float = 0 # todo: zusammenlegen mit g2v
charging_power_v2g: float = None # todo: zusammenlegen mit g2v

charging_power_inflex: float = 0
charging_power_inflex: float = None

charging_potential: float = None

@@ -624,7 +672,7 @@ class IndividualMobilitySector(Facade):

age: int = 0

invest_c_rate: Sequence[float] = 1
invest_c_rate: Sequence[float] = None

bev_storage_capacity: int = (
0 # todo: not used in bev() -> average_storage_capacity