Skip to content

Commit 5d2f6df

Browse files
committed
Fix recording the initial condition
The previous implementation incorrectly uses the simulation horizon for calculations. The correct parameter is using 24-hours since we do a rolling simulation to simulate day-ahead dispatch.
1 parent 7e38a55 commit 5d2f6df

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

scripts/run_pownet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
##### User inputs #####
1313
to_process_inputs = True
1414
sim_horizon = 24
15-
model_name = "RegionAB"
15+
model_name = "dummy"
1616
steps_to_run = 3 # Default is None
1717
do_plot = True
1818
#######################

src/pownet/core/record.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def _extract_vartype_data(df: pd.DataFrame, vartype: str) -> dict[str, float]:
7777
"""Extracts data for a specific 'vartype' from the DataFrame and converts it to a dictionary."""
7878
return (
7979
df[
80-
(df["vartype"] == vartype)
81-
& (df["timestep"] == self.inputs.sim_horizon)
80+
(df["vartype"] == vartype) & (df["timestep"] == 24)
8281
] # Only considers values of the last hour
8382
.drop("vartype", axis=1)
8483
.set_index(["node"]) # Assume generator names do not repeat
@@ -110,13 +109,13 @@ def _extract_vartype_data(df: pd.DataFrame, vartype: str) -> dict[str, float]:
110109
# Need to calculate the minimum time on/off
111110
self.current_min_on = calc_remaining_on_duration(
112111
current_node_vars,
113-
sim_horizon=self.inputs.sim_horizon,
112+
sim_horizon=24,
114113
thermal_units=self.inputs.thermal_units,
115114
TU=self.inputs.TU,
116115
)
117116
self.current_min_off = calc_remaining_off_duration(
118117
current_node_vars,
119-
sim_horizon=self.inputs.sim_horizon,
118+
sim_horizon=24,
120119
thermal_units=self.inputs.thermal_units,
121120
TD=self.inputs.TD,
122121
)

0 commit comments

Comments
 (0)