Skip to content

Commit

Permalink
Merge branch 'main' into no_port
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-harder authored Sep 25, 2023
2 parents 9a056c2 + 8ede6e7 commit e79a5b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def write_market_dispatch(self, data):
:type data: any
"""
df = pd.DataFrame(data, columns=["datetime", "power", "market_id", "unit_id"])
df["simulation"] = self.simulation_id
if not df.empty:
df["simulation"] = self.simulation_id
self.write_dfs["market_dispatch"].append(df)

def write_unit_dispatch(self, data):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ def test_output_market_dispatch():
meta = {"sender_id": None}
content = {"context": "write_results", "type": "market_dispatch", "data": []}
output_writer.handle_message(content, meta)
# empty dfs are discarded
assert len(output_writer.write_dfs["market_dispatch"]) == 0, "market_dispatch"

content = {
"context": "write_results",
"type": "market_dispatch",
"data": [[start, 90, "EOM", "TestUnit"]],
}
output_writer.handle_message(content, meta)
assert len(output_writer.write_dfs["market_dispatch"]) == 1, "market_dispatch"


Expand Down

0 comments on commit e79a5b4

Please sign in to comment.