Skip to content

Commit

Permalink
update grid tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrunik committed Aug 26, 2024
1 parent 278cac9 commit b4c67bd
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion tests/hopp/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def test_simulate_grid_connection(mock_simulate_power, site, subtests):
with subtests.test("follow desired schedule: curtailment"):
desired_schedule = np.repeat([3], site.n_timesteps)
site2 = create_default_site_info(
desired_schedule=desired_schedule
desired_schedule=desired_schedule,
curtailment_value_type = "desired_schedule"
)
config = GridConfig.from_dict({"interconnect_kw": interconnect_kw})
grid = Grid(site2, config=config)
Expand Down Expand Up @@ -128,3 +129,35 @@ def test_simulate_grid_connection(mock_simulate_power, site, subtests):

assert_array_equal(grid.schedule_curtailed, np.repeat([2000], timesteps))
assert_approx_equal(grid.schedule_curtailed_percentage, 2/3)

with subtests.test("follow desired schedule: curtailment interconnection"):
desired_schedule = np.repeat([3], site.n_timesteps)
site2 = create_default_site_info(
desired_schedule=desired_schedule,
)
config = GridConfig.from_dict({"interconnect_kw": interconnect_kw})
grid = Grid(site2, config=config)
grid.simulate_grid_connection(
hybrid_size_kw,
total_gen,
project_life,
lifetime_sim,
total_gen_max_feasible_year1
)

timesteps = site.n_timesteps * project_life
assert_array_equal(
grid.generation_profile,
np.repeat([5000], timesteps),
"gen profile should be reduced"
)

msg = "no load should be missed"
assert_array_equal(
grid.missed_load,
np.repeat([0], timesteps),
msg
)
assert grid.missed_load_percentage == 0., msg

assert_array_equal(grid.schedule_curtailed, np.repeat([0], timesteps))

0 comments on commit b4c67bd

Please sign in to comment.