Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
j-ti committed May 27, 2024
1 parent cd40468 commit 3ce1119
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def scenario(self):
0.087,
0.08]

cfg.config.nb_ts = NR_STEPS
scenario = Scenario(pn, None, buy_prices=np.tile(test_prices, 10), steps_per_hour=4,
sell_prices=round_prices_array(np.tile(test_prices, 10)*SELL_MULT))
scenario.add_market(Market(pn))
Expand Down
3 changes: 3 additions & 0 deletions tests/test_market_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def reset_config():
class TestMarketMaker:
cfg.Config("", "")
buy_prices = np.arange(1, 100, 1)
cfg.config.nb_ts = 100
scenario = Scenario(None, None, None)
env = scenario.environment

Expand Down Expand Up @@ -58,6 +59,7 @@ def test_energy_bought(self):
assert sum(market_maker.energy_sold) == 0
assert sum(market_maker.energy_bought) == 0
NR_TIME_STEPS = 10
# cfg.config.nb_ts = NR_TIME_STEPS
self.add_actor_w_constant_schedule("buy_actor", -1)
self.run_simply(NR_TIME_STEPS)
assert sum(market_maker.energy_sold) == 10
Expand All @@ -76,6 +78,7 @@ def run_simply(self, NR_TIME_STEPS):

def add_actor_w_constant_schedule(self, name, schedule_value):
actor = create_random(name)
actor.data = actor.data.reset_index(drop=True)
actor.data.load[:] = 0 + (schedule_value < 0) * abs(schedule_value)
actor.data.schedule[:] = schedule_value
actor.data.pv[:] = 0 + (schedule_value > 0) * schedule_value
Expand Down

0 comments on commit 3ce1119

Please sign in to comment.