Skip to content

Commit

Permalink
Fix RE Notebook for Issue 200 (#211)
Browse files Browse the repository at this point in the history
* copy over to this branch

* update setup.py

* fix DoubleLoopOptimization.ipynb

* fix DoubleLoopOptimization.ipynb

* update

* Update test_RE_flowsheet.py

* add subscenario

* add steadystate optimization

* update results with steadystate surrogate

* notebook order

* notebook order

* update results

* update pysam version

* update ymls

* update ymls

* update ymls

* update ymls

* update ymls

* pull from git lfs

* update setup.py

* update notebooks

* add tests

* update test

* start tests

* add surrogate tests

* update

* update test_surrogate_opt

* add to tests

* fix DoubleLoopOptimization

---------

Co-authored-by: Keith Beattie <ksbeattie@lbl.gov>
Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
  • Loading branch information
3 people authored Jul 14, 2023
1 parent 688999d commit 5f38880
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@
],
"source": [
"fig, ax = plt.subplots(2, 1, figsize=(24, 10), sharex=True)\n",
"ax[0].plot(time_index, np.append([0] * 24, da_bidder_df[da_bidder_df['Horizon [hr]'] >= 24][da_bid_powers].sum(axis=1))[time_slice], color='b', alpha=0.4, label=\"48-Hr Ahead DA Bid\")\n",
"ax[0].plot(time_index, np.append([0] * 24, da_bidder_df[da_bidder_df['Horizon [hr]'] < 24][da_bid_powers].sum(axis=1))[time_slice], color='b', alpha=0.4, label=\"48-Hr Ahead DA Bid\")\n",
"ax[0].plot(time_index, da_bidder_df[da_bidder_df['Horizon [hr]'] < 24][da_bid_powers].sum(axis=1)[time_slice], color='b', alpha=1, label=\"24-Hr Ahead DA Bid\")\n",
"ax[0].plot(time_index, np.append([0] * 3, rt_bidder_df[rt_bidder_df['Horizon [hr]'] == 3][rt_bid_powers].sum(axis=1))[time_slice], color='g', alpha=0.2, label=\"3-Hr Ahead RT Bid\")\n",
"ax[0].plot(time_index, np.append([0] * 2, rt_bidder_df[rt_bidder_df['Horizon [hr]'] == 2][rt_bid_powers].sum(axis=1))[time_slice], color='g', alpha=0.3, label=\"2-Hr Ahead RT Bid\")\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from pyomo.util.infeasible import log_infeasible_constraints, log_infeasible_bounds, log_close_to_bounds
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import omlt
from omlt.neuralnet import NetworkDefinition, FullSpaceNNFormulation
from omlt.io import load_keras_sequential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

from dispatches.case_studies.renewables_case.RE_surrogate_optimization_steadystate import *


def load_model():
net_rev_defn, net_frequency_defn, dispatch_clusters_mean, pem_clusters_mean, resource_clusters_mean = load_surrogate_model(re_nn_dir)
assert len([l for l in net_rev_defn.layers]) == 4
Expand All @@ -26,14 +25,12 @@ def load_model():
assert pem_clusters_mean.mean() == pytest.approx(0.2215, rel=1e-3)
assert resource_clusters_mean.mean() == pytest.approx(0.5547, rel=1e-3)


def test_RE_surrogate_steady_state_fixed():
results = run_design(PEM_bid=30, PEM_size=200)
assert results['e_revenue'] == pytest.approx(-5989492, rel=1e-3)
assert results['h_revenue'] == pytest.approx(43656556, rel=1e-3)
assert results['NPV'] == pytest.approx(-1353268767, rel=1e-3)


def test_RE_surrogate_steady_state():
results = run_design()
assert results['pem_mw'] == pytest.approx(350.02, rel=1e-3)
Expand Down

0 comments on commit 5f38880

Please sign in to comment.