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

Plots #84

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Plots #84

wants to merge 14 commits into from

Conversation

jaredthomas68
Copy link
Collaborator

Include plotting functionality for greenheart output

This PR provides a few plotting options based on the energy_flows.csv data output from greenheart to visualize the electricity and hydrogen dispatch/flow/production independently and together. There are certainly better ways this could be done, but I'm not sure how far to go given the impending changes.

PR Checklist

  • CHANGELOG.md has been updated to describe the changes made in this PR
  • Documentation
    • Docstrings are up-to-date
    • [-] Related docs/ files are up-to-date, or added when necessary
    • [-] Documentation has been rebuilt successfully
    • Examples have been updated
  • Tests pass (If not, and this is expected, please elaborate in the tests section)
  • PR description thoroughly describes the new feature, bug fix, etc.

Related issues

Impacted areas of the software

  • examples/01-green-hydrogen.ipynb: add example of using the new plots
  • greenheart/tools/eco/utilities.py
    • visualize_plant: adjustments for slightly more automatic scaling and better looking plots for onshore and offshore
  • greenheart/tools/plot.py
    • get_hour_from_datetime
    • plot_hydrogen_flows: new function
    • plot_energy_flows: new function
    • plot_energy: new function

Additional supporting information

Test results, if applicable

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jaredthomas68 jaredthomas68 changed the base branch from main to develop February 12, 2025 22:50
@jaredthomas68 jaredthomas68 marked this pull request as ready for review February 13, 2025 17:58
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnjasa can you remind me, did you say something about not pushing results in Jupyters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are right @kbrunik. @RHammond2 I pushed these results since there were new figures in the example. What is the correct/accepted approach on this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right @kbrunik we discussed it, though for now we should keep the jupyter notebooks as-is and push results with them. In the future, we might avoid keeping results in the repo; see (and add to!) the discussion here: #75

@@ -419,7 +419,7 @@ def visualize_plant(
onshorex = 50
onshorey = 50

wind_buffer = np.min(turbine_x) - (onshorey + 2 * rotor_diameter + electrolyzer_side)
wind_buffer = np.min(turbine_x) - (onshorey + 3 * rotor_diameter + electrolyzer_side)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed a larger buffer so I called the buffer by an extra rotor diameter to avoid overlap in the wind/solar farms

@@ -889,10 +892,10 @@ def add_turbines(ax, turbine_x, turbine_y, radius, color):
i = 0
for x, y in zip(turbine_x, turbine_y):
if i == 0:
elable = "Electrolyzer"
elabel = "Electrolyzer"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we want to change this to "H$_2$ Electrolyzer" or "PEM Electrolyzer" since we are working on additional types of electrolysis (iron, alkaline, etc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've changed it to "H$_2$ Electrolyzer" in all instances for now but am open to further changes.

label="Solar Array",
hatch=solar_hatch,
)
if design_scenario["wind_location"] != "offshore":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an if statement for "pv_location"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there are different plots to add solar to depending on if wind is onshore or offshore. Convoluted and should be fixed, but I think that making this plot more clear/robust should wait for another PR.

Comment on lines +1250 to +1255
# ax[ax_index_wind_plant].autoscale()
ax[ax_index_wind_plant].set(aspect="equal")
# ax[ax_index_wind_plant].xaxis.set_major_locator(ticker.\
# MultipleLocator(np.round(point_range_x*0.5, decimals=-3)))
# ax[ax_index_wind_plant].yaxis.set_major_locator(ticker.\
# MultipleLocator(np.round(point_range_y*0.5, device_spacing=-3)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in a few spots below here, do you intend to keep these commented lines on purpose?

@johnjasa
Copy link
Collaborator

johnjasa commented Feb 17, 2025

Looking at the generated plots, I think there's a small error in the Electricity Output; it should probably be divided by 1e6 instead of multiplied by 1e6 somewhere. Okay, I've pushed up a fix directly to this branch, so no action needed for this point. The plots will be updated the next time you update the jupyter notebook itself.

Also, is the battery power in the correct units here? Seeing tens of GW spikes is throwing me off.

image

@johnjasa
Copy link
Collaborator

Non-blocking nitpick: at hour 0 there's a vertical line for net dispatch; is this meaningful or sort of a plotting artifact? is it easy to remove if it's spurious?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants