Storage AnalysisΒΆ

This notebook outlines the steps needed to plot the storage results obtained by solving the model. We can use this to analyse the state of the storages over the time span of the optimization.

[ ]:
from pyehub.energy_hub.ehub_model import EHubModel
from pyehub.outputter import plot_storages

First we load and run a model.

[ ]:
excel_file = (
    "test_file.xlsx"  # name of the excel file. [This must be in the current directory]
)
my_model = EHubModel(
    excel=excel_file
)  # instantiate our model. Nothing is solved at this point.
results = my_model.solve()  # solve the model and get back our results

The function plot_storages(...) plots storage variables for all the storages in the model. The parameters to be plotted can be passed as boolean values (see the docstring [TODO: Add a link to docstring after updating readthedocs.]). All parameters are plotted by default.

[ ]:
plot_storages(results)
  • You can also specify the size of the plot by passing size tuple [default value is (10,5)].
  • There is also an option to view the y-axis in percentage rather than kWh. Pass percentage = True during function call. [default units are kWh].
[ ]:
plot_storages(results, size=(12, 6), percentage=True)
[ ]: