Skip to content

Commit

Permalink
pre-vacation progress upload. Lots of work left
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrguric96 committed Aug 16, 2024
1 parent 94e9523 commit 8a2ed52
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 203 deletions.
8 changes: 4 additions & 4 deletions Agents/prosumer_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def __init__(self, eid, forecasted_data, metrics):
Parameters
----------
eid : list
Something
???
forcasted_data : list
Something
???
metrics : list
Something
???
"""
self.eid = eid
self.time = []
Expand Down Expand Up @@ -309,7 +309,7 @@ def supply(self, ex_excess:list, metric:str) -> list:
Parameters
----------
ex_excess : list
The list of excess energy(?) in chronological order
The list of excess energy in chronological order (???)
metric : str
A 2 character string. Options:[MC, MB, MO, MR]
Expand Down
67 changes: 65 additions & 2 deletions Controllers/GPController/gpcontroller_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,70 @@


class gpcontroller_python:
def __init__(self, soc_min, soc_max, h2_soc_min, h2_soc_max, fc_eff):
def __init__(self, soc_min:int, soc_max:int, h2_soc_min:int, h2_soc_max:int, fc_eff:float):
"""
Constructor for the gpcontroller_python class
...
Parameters
----------
soc_min : int
???
soc_max : int
???
h2_soc_min : int
???
h2_soc_max : int
???
fc_eff : float
???
Attributes
----------
soc_max_b : int
= soc_max
soc_min_b : int
= soc_min
soc_max_h2 : int
= h2_soc_max
soc_min_h2 : int
= h2_soc_min
fc_eff : float
= fc_eff
net : int
= 0
deficit : int
= 0
excess : int
= 0
flow_b : list
= []
flow_e : int
= 0
fc_out : int
= 0
h_out : int
= 0
generators : pd.DataFrame()
Empty Dataframe
demands : pd.DataFrame()
Empty Dataframe
batteries : pd.DataFrame()
Empty Dataframe
h2_soc : list
Empty list
p_gen : list
Empty list
p_dem : list
Empty list
soc : list
Empty list
curtailment : Boolean
False bool
"""
self.soc_max_b = soc_max
self.soc_min_b = soc_min
self.soc_max_h2 = h2_soc_max
Expand All @@ -27,7 +90,7 @@ def __init__(self, soc_min, soc_max, h2_soc_min, h2_soc_max, fc_eff):
self.curtailment = False


def gpcontrol(self, generators, demands, batteries, curtail):#, fc_gen):
def gpcontrol(self, generators:pd.DataFrame, demands:pd.DataFrame, batteries:pd.DataFrame, curtail:int) -> dict:#, fc_gen):

self.generators = generators
self.demands = demands
Expand Down
97 changes: 0 additions & 97 deletions Result/GameCase/forecast.csv

Large diffs are not rendered by default.

97 changes: 0 additions & 97 deletions Result/GameCase/results.csv

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion configuration/bids/flex_trade.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
from datetime import datetime

def match_trades(supply_offers, demand_requests):
def match_trades(supply_offers, demand_requests) -> list:
"""
Unknown description.
Not used by any of the 5 test cases
...
Parameters
----------
supply_offers : list or dictionary (hard to tell)
???
demand_requests : list or dictionary (hard to tell)
???
Returns
-------
trades : list
Description
"""
trades = []

# Sort demand requests in descending order based on price
Expand Down Expand Up @@ -45,6 +63,7 @@ def match_trades(supply_offers, demand_requests):
return trades


## Hard coded values defined here.
# Usage
supply_offers = [('prosumer_0', ['2012-01-01 00:00:00', 17, 4]),
('prosumer_0', ['2012-01-01 00:30:00', 17, 4]),
Expand Down
39 changes: 38 additions & 1 deletion configuration/bids/make_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@

# Function to generate data
def generate_data(start_date, end_date, bid_range, num_bids_per_day, mc_range):
"""
Unknown description.
Not used by any of the 5 test cases
...
Parameters
----------
supply_offers : list or dictionary (hard to tell)
???
demand_requests : list or dictionary (hard to tell)
???
Returns
-------
trades : list
Description
"""
current_date = start_date
data = []
while current_date <= end_date:
Expand All @@ -28,7 +46,26 @@ def generate_data(start_date, end_date, bid_range, num_bids_per_day, mc_range):
# Generate your data
supply_bids = generate_data(start_date, end_date, supply_bid_range, supply_num_bids_per_day, mc_range)
demand_bids = generate_data(start_date, end_date, demand_bid_range, demand_num_bids_per_day, mb_range)
def write_data_to_file(data, bid_type, file):
def write_data_to_file(data, bid_type, file) -> None:
"""
Unknown description.
Not used by any of the 5 test cases
...
Parameters
----------
data : ???
???
bid_type : ???
???
file : ???
???
Returns
-------
None
"""
file.write(f"{bid_type} =")
file.write("[")
for i, bid in enumerate(data):
Expand Down
58 changes: 57 additions & 1 deletion configuration/bids/plot_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@


def find_accepted_bids(sorted_supply_bids, sorted_demand_bids, num_s_bid, num_d_bid):
"""
Unknown description.
Not used by any of the 5 test cases
...
Parameters
----------
sorted_supply_bids : ???
???
sorted_demand_bids : ???
???
num_s_bid : ???
???
num_d_bid : ???
???
Returns
-------
None
"""
accepted_supply_bids = []
for i in range(num_s_bid+1):
accepted_supply_bids.append(sorted_supply_bids[i])
Expand All @@ -16,6 +37,26 @@ def find_accepted_bids(sorted_supply_bids, sorted_demand_bids, num_s_bid, num_d_
return accepted_supply_bids, accepted_demand_bids

def clear(date_time, supply_bids, demand_bids):
"""
Unknown description.
Not used by any of the 5 test cases
...
Parameters
----------
date_time : ???
???
supply_bids : ???
???
demand_bids : ???
???
Returns
-------
None
"""
supply_bids_for_date_time = [bid for bid in supply_bids if bid[0] == date_time]
demand_bids_for_date_time = [bid for bid in demand_bids if bid[0] == date_time]

Expand Down Expand Up @@ -187,7 +228,22 @@ def clear(date_time, supply_bids, demand_bids):



def plot_bids(date_time):
def plot_bids(date_time) -> None:
"""
Filter bids for the chosen date and time and creates a plot.
Not used by any of the 5 test cases
...
Parameters
----------
date_time : ???
???
Returns
-------
None
"""
# Filter bids for the chosen date and time

market_quantity, market_price, clearing_bid, clearing_quantity =\
Expand Down
4 changes: 4 additions & 0 deletions simulation creator_DNcontrolCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# Incorrect format at position 1172 within the given csv
# ERROR 2:
# Could not import module controller
# !!! Error update
# When ran with environment given by alex, it runs until it receives the following error:
# mosaik.exceptions.SimulationError:
# "Loop ['Controller-0', 'Grid-0'] reached maximal iteration count of 100. Adjust `max_loop_iterations` in the scenario if needed"



Expand Down
2 changes: 2 additions & 0 deletions simulation creator_multienergyCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

# ERROR:
# mosaik.exceptions.ScenarioError: Simulator "HeatPump" could not be started: Could not import module: No module named 'Heat_Pump_Model' --> No module named 'Heat_Pump_Model'
# !!!UPDATE ON ERROR:
# With the environment yaml alex gave, this actually runs

outputfile='Result/MultienergyCase/results.csv'
sim_config_file="Cases/MultienergyCase/"
Expand Down

0 comments on commit 8a2ed52

Please sign in to comment.