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

Add the new building DSM class #480

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
de69004
This commit add the new building DSM class
nick-harder Nov 12, 2024
ba1157d
-add release notes
nick-harder Nov 12, 2024
a4ea3ba
-adjust release notes
nick-harder Nov 12, 2024
8b0bed3
-remove duplicated code into a function
nick-harder Nov 13, 2024
d016573
Add household example
HafnerMichael Nov 15, 2024
2b97f39
Add index to pv power forecast
HafnerMichael Nov 15, 2024
638d6aa
Add missing licence files for example_01h
HafnerMichael Nov 15, 2024
5804bd3
restructured flex and inflex loops
Manish-Khanra Nov 20, 2024
27fbcf6
building unit test fixed
Manish-Khanra Nov 20, 2024
601d427
tests fixed
Manish-Khanra Nov 20, 2024
bef4e6e
test fixed
Manish-Khanra Nov 20, 2024
f676a97
fixed test
Manish-Khanra Nov 20, 2024
1377f50
text fixed
Manish-Khanra Nov 20, 2024
0155830
test fixed
Manish-Khanra Nov 20, 2024
7ebb00f
test fixed
Manish-Khanra Nov 20, 2024
d159f00
test fixed
Manish-Khanra Nov 20, 2024
ca94210
variables fixed
Manish-Khanra Nov 20, 2024
8b1b677
error fixed
Manish-Khanra Nov 20, 2024
a2c33e1
text fixed
Manish-Khanra Nov 20, 2024
1fe421e
dummy example pushed
Manish-Khanra Nov 21, 2024
f6c8cd7
Merge branch 'main' of https://github.com/assume-framework/assume int…
Manish-Khanra Dec 29, 2024
001f1cd
Prosumer as an attribute, varible naming, process sequence optimised
Manish-Khanra Dec 31, 2024
7ffbbdc
only cost based flex included
Manish-Khanra Jan 2, 2025
f35d191
Merge branch 'main' into add_building_class
nick-harder Jan 15, 2025
2a6a128
explroment folder removed
Manish-Khanra Jan 15, 2025
0a9285d
Merge branch 'main' into add_building_class
nick-harder Jan 15, 2025
5c279d7
Release Notes added
Manish-Khanra Jan 15, 2025
e1e36f0
-rename max_load_shift to cost_based_shift
nick-harder Jan 16, 2025
eabde86
-move marginal_cost calculation to base DSM class
nick-harder Jan 16, 2025
bbfe02d
fix notebook 10
nick-harder Jan 16, 2025
492cb2e
-adjust release notes
nick-harder Jan 16, 2025
526b678
-remove redundant forecasts loading
nick-harder Jan 17, 2025
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
8 changes: 7 additions & 1 deletion assume/common/units_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ def get_actual_dispatch(

# TODO: this needs to be fixed. For now it is consuming too much time and is deactivated
# unit.calculate_generation_cost(start, now, "energy")
valid_outputs = ["soc", "cashflow", "marginal_costs", "total_costs"]
valid_outputs = [
"soc",
"ev_soc",
"cashflow",
"marginal_costs",
"total_costs",
]

for key in unit.outputs.keys():
for output in valid_outputs:
Expand Down
16 changes: 16 additions & 0 deletions assume/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,19 @@
os.close(saved_stdout_fd)
os.close(saved_stderr_fd)
os.close(devnull)


def str_to_bool(val):
"""Convert a string representation of truth to True or False.

True values are 'y', 'yes', 't', 'true', 'on', and '1';
false values are 'n', 'no', 'f', 'false', 'off', and '0'.
Raises ValueError if 'val' is anything else.
"""
val = val.lower()
if val in {"y", "yes", "t", "true", "on", "1"}:
return True
elif val in {"n", "no", "f", "false", "off", "0"}:
return False
else:
raise ValueError(f"Invalid truth value: {val!r}")

Check warning on line 692 in assume/common/utils.py

View check run for this annotation

Codecov / codecov/patch

assume/common/utils.py#L692

Added line #L692 was not covered by tests
4 changes: 2 additions & 2 deletions assume/strategies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
flexablePosCRMStorage,
)
from assume.strategies.naive_strategies import (
NaiveDASteelplantStrategy,
NaiveNegReserveStrategy,
NaivePosReserveStrategy,
NaiveProfileStrategy,
NaiveRedispatchSteelplantStrategy,
NaiveRedispatchStrategy,
NaiveSingleBidStrategy,
NaiveDSMStrategy,
)
from assume.strategies.manual_strategies import SimpleManualTerminalStrategy
from assume.strategies.dmas_powerplant import DmasPowerplantStrategy
Expand All @@ -40,7 +40,7 @@
"flexable_neg_crm_storage": flexableNegCRMStorage,
"flexable_pos_crm_storage": flexablePosCRMStorage,
"naive_redispatch": NaiveRedispatchStrategy,
"naive_da_steelplant": NaiveDASteelplantStrategy,
"naive_dsm": NaiveDSMStrategy,
"naive_steel_redispatch": NaiveRedispatchSteelplantStrategy,
"manual_strategy": SimpleManualTerminalStrategy,
"dmas_powerplant": DmasPowerplantStrategy,
Expand Down
24 changes: 21 additions & 3 deletions assume/strategies/naive_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def calculate_bids(
end_all = product_tuples[-1][1]
previous_power = unit.get_output_before(start)
op_time = unit.get_operation_time(start)
min_power, max_power = unit.calculate_min_max_power(start, end_all)
_, max_power = unit.calculate_min_max_power(start, end_all)

current_power = unit.outputs["energy"].at[start]
marginal_cost = unit.calculate_marginal_cost(start, previous_power)
Expand All @@ -140,14 +140,32 @@ def calculate_bids(
return bids


class NaiveDASteelplantStrategy(BaseStrategy):
class NaiveDSMStrategy(BaseStrategy):
"""
A naive bidding strategy for Demand Side Management (DSM) units. It bids the marginal cost of the unit on the market
as bid price and the optimal power requirement as bid volume.
"""

def calculate_bids(
self,
unit: SupportsMinMax,
market_config: MarketConfig,
product_tuples: list[Product],
**kwargs,
) -> Orderbook:
"""
Takes information from a unit that the unit operator manages and
defines how it is dispatched to the market.

Args:
unit (SupportsMinMax): The unit to be dispatched.
market_config (MarketConfig): The market configuration.
product_tuples (list[Product]): The list of all products the unit can offer.

Returns:
Orderbook: The bids consisting of the start time, end time, only hours, price and volume.
"""

# calculate the optimal operation of the unit
unit.calculate_optimal_operation_if_needed()

nick-harder marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -158,9 +176,9 @@ def calculate_bids(
and the volume of the product. Dispatch the order to the market.
"""
start = product[0]

volume = unit.opt_power_requirement.loc[start]
marginal_price = unit.calculate_marginal_cost(start, volume)

bids.append(
{
nick-harder marked this conversation as resolved.
Show resolved Hide resolved
"start_time": product[0],
Expand Down
2 changes: 2 additions & 0 deletions assume/units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
from assume.units.powerplant import PowerPlant
from assume.units.storage import Storage
from assume.units.steel_plant import SteelPlant
from assume.units.building import Building
from assume.units.dst_components import demand_side_technologies

unit_types: dict[str, BaseUnit] = {
"power_plant": PowerPlant,
"demand": Demand,
"storage": Storage,
"steel_plant": SteelPlant,
"building": Building,
}
Loading