-
Notifications
You must be signed in to change notification settings - Fork 1
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
code that needs to be reviewed to see what is causing errors #3
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I think the graph updates should actually go in a new ticket.
In addition to the inline comments, we'll want to update the output graphs. They still show load not met instead of the actual generator contribution. We should update those to show both the generator load and load not met. To do this:
- Add a column to the dispatch_df called "generator" which will either be load not met (for no existing generator) or the generator load (if there is an existing generator). In the size_single_generator function, add a new column "generator" which is a copy of "load not met". In calc_existing_generator_dispatch, the "generator" column will be the minimum of the load not met column and the generator capacity.
- Modify plot_dispatch() in microgrid_system to plot "generator" in addition to "load_not_met" if there is an existing generator and only "generator" if there is not an existing_generator (line 973). Then change all references to the legend to reflect this in microgrid_system and microgrid_optimizer.
@@ -99,7 +100,9 @@ def run_mcor(input_dict): | |||
optim.get_load_profiles() | |||
|
|||
# Run all simulations | |||
optim.run_sims_par() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should change this back.
@@ -597,7 +541,8 @@ def calculate_load_duration(grouped_load, validate=True): | |||
# Run the simulation | |||
sim.scale_power_profile() | |||
sim.calc_dispatch() | |||
sim.size_single_generator(generator_options, validate=False) | |||
# sim.size_single_generator(generator_options, validate=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these two lines needs to but uncommented for it to run, right?
# input_dict["existing_components_inputs"]["existing_components"] = {'pv': pv} | ||
# input_dict["existing_components_inputs"]["existing_components"] = {"pv": ["pv"]} | ||
|
||
input_dict["existing_components_inputs"]["existing_generator"] = Generator(existing=True, rated_power=500, num_units=1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll want to specify all of the parameters that are passed into the Generator object in the input_dict and then create the Generator object separately, probably in microgrid_optimizer.define_grid(). The code that will be creating the input_dict in gridpiq will not have access to the Generator class, only the run_mcor function.
We should also do the same for any existing PV or Battery objects.
microgrid_optimizer.py
Outdated
'{}%_smaller_gen_kWh_not_met_max'.format(perc), | ||
'{}%_smaller_gen_max_%_kW_not_met_average'.format(perc), | ||
'{}%_smaller_gen_max_%_kW_not_met_max'.format(perc)] | ||
if not self.existing_generator: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than duplicating most of the list here, you could just append the relevant elements that are unique to each conditional.
microgrid_optimizer.py
Outdated
else: | ||
# Re-order columns | ||
format_results = format_results[ | ||
['pv_capacity', 'battery_capacity', 'battery_power', 'fuel_tank_size_gal', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include "generator_power" after "battery_power"
microgrid_optimizer.py
Outdated
|
||
if not self.existing_generator: | ||
# Rename columns | ||
format_results.rename(columns= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can use the same code for both modes and it will just ignore any columns that aren't in the dataframe. You'll just have to add a line for "generator_power".
No description provided.