Skip to content

Commit

Permalink
blk
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-a-a committed Oct 30, 2024
1 parent 892e555 commit a2c97c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def build_multiperiod_model(self, **kwargs):
raise ConfigurationError(
"Before invoking the build_multiperiod_model method, call the append_lmp_data method on PriceTakerModel class first."
)

self.mp_model = MultiPeriodModel(
n_time_points=self._n_time_points,
set_days=self.set_days,
Expand Down
20 changes: 11 additions & 9 deletions idaes/apps/grid_integration/multiperiod/tests/test_price_taker.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ def test_build_multiperiod_model_no_LMP_logger_message():
flowsheet_options={"sofc_design": None},
)


@pytest.mark.unit
def test_build_multiperiod_model_before_append_lmp_data_logger_messages():
m = PriceTakerModel()
Expand All @@ -1003,17 +1004,17 @@ def test_build_multiperiod_model_before_append_lmp_data_logger_messages():
linking_variable_func=None,
flowsheet_options={"sofc_design": None},
)

# Next exception that would arise relates to either set_years or set_days attributes not existing, indicating append_lmp_data method was not run first.
m1 = PriceTakerModel()
m1._n_time_points = 240
m1.set_days = None

with pytest.raises(
ConfigurationError,
match=(
"Before invoking the build_multiperiod_model method, call the append_lmp_data method on PriceTakerModel class first, which will assign the number of time points, n_time_points, to be used in the MultiPeriodModel."
),
ConfigurationError,
match=(
"Before invoking the build_multiperiod_model method, call the append_lmp_data method on PriceTakerModel class first, which will assign the number of time points, n_time_points, to be used in the MultiPeriodModel."
),
):
# Build the multiperiod model
m.build_multiperiod_model(
Expand All @@ -1027,10 +1028,10 @@ def test_build_multiperiod_model_before_append_lmp_data_logger_messages():
m2.set_years = None

with pytest.raises(
ConfigurationError,
match=(
"Before invoking the build_multiperiod_model method, call the append_lmp_data method on PriceTakerModel class first, which will assign the number of time points, n_time_points, to be used in the MultiPeriodModel."
),
ConfigurationError,
match=(
"Before invoking the build_multiperiod_model method, call the append_lmp_data method on PriceTakerModel class first, which will assign the number of time points, n_time_points, to be used in the MultiPeriodModel."
),
):
# Build the multiperiod model
m.build_multiperiod_model(
Expand All @@ -1039,6 +1040,7 @@ def test_build_multiperiod_model_before_append_lmp_data_logger_messages():
flowsheet_options={"sofc_design": None},
)


@pytest.mark.unit
def test_build_hourly_cashflow_logger_message_no_des_blks(excel_data, caplog):
# Tests building the model with startup/shutdown then ramping rate with LMP as a single year with all time points
Expand Down

0 comments on commit a2c97c4

Please sign in to comment.