Skip to content

Commit

Permalink
inputs added
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish-Khanra committed Nov 26, 2024
1 parent 16f3e29 commit dead787
Show file tree
Hide file tree
Showing 24 changed files with 36,143 additions and 12 deletions.
42 changes: 40 additions & 2 deletions assume/strategies/naive_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later


import matplotlib.pyplot as plt

from assume.common.base import BaseStrategy, SupportsMinMax
from assume.common.market_objects import MarketConfig, Order, Orderbook, Product

Expand Down Expand Up @@ -152,7 +154,8 @@ def calculate_bids(
**kwargs,
) -> Orderbook:
# calculate the optimal operation of the unit
unit.determine_optimal_operation_without_flex()
unit.determine_optimal_operation_with_flex()
self.plot_power_requirements(unit)

Check warning on line 158 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L157-L158

Added lines #L157 - L158 were not covered by tests

bids = []
for product in product_tuples:
Expand All @@ -163,7 +166,7 @@ def calculate_bids(
start = product[0]

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

Check warning on line 169 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L169

Added line #L169 was not covered by tests
bids.append(
{
"start_time": start,
Expand All @@ -178,6 +181,41 @@ def calculate_bids(

return bids

def plot_power_requirements(self, unit: SupportsMinMax):
"""
Plots the optimal power requirement and flexibility power requirement for comparison.
Args:
unit (SupportsMinMax): The unit containing power requirements.
"""
# Retrieve power requirements data
opt_power_requirement = unit.opt_power_requirement
flex_power_requirement = unit.flex_power_requirement

Check warning on line 193 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L192-L193

Added lines #L192 - L193 were not covered by tests

# Plotting
plt.figure(figsize=(10, 6))
plt.plot(

Check warning on line 197 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L196-L197

Added lines #L196 - L197 were not covered by tests
opt_power_requirement.index,
opt_power_requirement,
label="Optimal Power Requirement",
color="blue",
)
plt.plot(

Check warning on line 203 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L203

Added line #L203 was not covered by tests
flex_power_requirement.index,
flex_power_requirement,
label="Flex Power Requirement",
color="orange",
linestyle="--",
)

# Labels and title
plt.xlabel("Time")
plt.ylabel("Power Requirement (kW)")
plt.title("Comparison of Optimal and Flexible Power Requirements")
plt.legend()
plt.grid(True)
plt.show()

Check warning on line 217 in assume/strategies/naive_strategies.py

View check run for this annotation

Codecov / codecov/patch

assume/strategies/naive_strategies.py#L212-L217

Added lines #L212 - L217 were not covered by tests


class NaiveRedispatchSteelplantStrategy(BaseStrategy):
def calculate_bids(
Expand Down
17 changes: 8 additions & 9 deletions assume/units/steel_plant.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,14 @@ def __init__(

# Define a solver
solvers = check_available_solvers(*SOLVERS)
if len(solvers) < 1:
raise Exception(f"None of {SOLVERS} are available")

self.solver = SolverFactory(solvers[0])
self.solver_options = {
"output_flag": False,
"log_to_console": False,
"LogToConsole": 0,
}
solver = solvers[0]
if solver == "gurobi":
self.solver_options = {"LogToConsole": 0, "OutputFlag": 0}

Check warning on line 132 in assume/units/steel_plant.py

View check run for this annotation

Codecov / codecov/patch

assume/units/steel_plant.py#L132

Added line #L132 was not covered by tests
elif solver == "appsi_highs":
self.solver_options = {"output_flag": False, "log_to_console": False}
else:
self.solver_options = {}

Check warning on line 136 in assume/units/steel_plant.py

View check run for this annotation

Codecov / codecov/patch

assume/units/steel_plant.py#L136

Added line #L136 was not covered by tests
self.solver = SolverFactory(solver)

# Main Model part
self.model = pyo.ConcreteModel()
Expand Down
3 changes: 2 additions & 1 deletion examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
},
"large_2019_rl": {"scenario": "example_03a", "study_case": "base_case_2019"},
"large_2021_rl": {"scenario": "example_03b", "study_case": "base_case_2021"},
"experiment": {"scenario": "experiment", "study_case": "dst_flexibility_case"},
}


Expand All @@ -107,7 +108,7 @@
data_format = "local_db" # "local_db" or "timescale"

# select the example to run from the available examples above
example = "small"
example = "experiment"

if data_format == "local_db":
db_uri = "sqlite:///./examples/local_db/assume_db.db"
Expand Down
35,041 changes: 35,041 additions & 0 deletions examples/inputs/experiment/availability_df.csv

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions examples/inputs/experiment/availability_df.csv.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: ASSUME Developers

SPDX-License-Identifier: AGPL-3.0-or-later
5 changes: 5 additions & 0 deletions examples/inputs/experiment/buses.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name,v_nom,carrier,x,y
north,380,AC,9.598,53.5585
south,380,AC,13.607,51.0769
east,380,AC,10.02,12.16
west,380,AC,8.21,61.52
3 changes: 3 additions & 0 deletions examples/inputs/experiment/buses.csv.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: ASSUME Developers

SPDX-License-Identifier: AGPL-3.0-or-later
26 changes: 26 additions & 0 deletions examples/inputs/experiment/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: ASSUME Developers
#
# SPDX-License-Identifier: AGPL-3.0-or-later

dst_flexibility_case:
start_date: 2019-01-01 00:00
end_date: 2019-01-01 23:00
time_step: 1h
save_frequency_hours: 24
markets_config:
EOM:
start_date: 2019-01-01 00:00
operator: EOM_operator
product_type: energy
products:
- duration: 1h
count: 24
first_delivery: 24h
opening_frequency: 24h
opening_duration: 20h
volume_unit: MWh
maximum_bid_volume: 100000
maximum_bid_price: 3000
minimum_bid_price: -500
price_unit: EUR/MWh
market_mechanism: pay_as_clear
Loading

0 comments on commit dead787

Please sign in to comment.