@@ -139,17 +139,16 @@ def run(
139139 for step_k in range (1 , steps_to_run + 1 ):
140140 # Build or update the model
141141 if step_k == 1 :
142- model = model_builder .build (
142+ power_system_model = model_builder .build (
143143 step_k = step_k ,
144144 init_conds = init_conditions ,
145145 )
146146 else :
147- model = model_builder .update (
147+ power_system_model = model_builder .update (
148148 step_k = step_k ,
149149 init_conds = init_conditions ,
150150 )
151151 # Optimization
152- power_system_model = PowerSystemModel (model )
153152 power_system_model .optimize (
154153 solver = solver ,
155154 log_to_console = log_to_console ,
@@ -190,22 +189,16 @@ def write_results(self, output_folder: str) -> None:
190189 """Write the simulation results to files"""
191190 self .system_record .write_simulation_results (output_folder )
192191
193- def plot_fuelmix (
194- self , chart_type : str , output_folder : str , save_plot : bool = True
195- ) -> None :
192+ def plot_fuelmix (self , chart_type : str , output_folder : str = None ) -> None :
196193 """Plot the fuel mix of the power system
197194
198195 Args:
199196 chart_type (str): The type of chart to plot. Choose between 'bar' and 'area'.
200197 output_folder (str): The folder to save the plot.
201- save_plot (bool): Whether to save the plot.
202198
203199 Returns:
204200 None
205201 """
206- if save_plot and (output_folder is None ):
207- raise ValueError ("Please provide an output folder to save the plot." )
208-
209202 if chart_type not in ["bar" , "area" ]:
210203 raise ValueError (
211204 "Invalid chart type. Choose between 'fuelmix' and 'fuelmix_area'."
@@ -217,77 +210,59 @@ def plot_fuelmix(
217210 node_var_df = self .system_record .get_node_variables ()
218211 output_processor .load_from_dataframe (node_var_df )
219212
220- visualizer = Visualizer (
221- model_id = self .inputs .model_id , output_folder = output_folder
222- )
213+ visualizer = Visualizer (model_id = self .inputs .model_id )
223214
224215 if chart_type == "bar" :
225216 visualizer .plot_fuelmix_bar (
226217 dispatch = output_processor .get_hourly_dispatch (),
227218 demand = output_processor .get_hourly_demand (),
228- to_save = save_plot ,
219+ output_folder = output_folder ,
229220 )
230221 elif chart_type == "area" :
231222 visualizer .plot_fuelmix_area (
232223 dispatch = output_processor .get_hourly_dispatch (),
233224 demand = output_processor .get_hourly_demand (),
234- to_save = save_plot ,
225+ output_folder = output_folder ,
235226 )
236227
237- def plot_unit_status (
238- self , output_folder : str = None , save_plot : bool = True
239- ) -> None :
228+ def plot_unit_status (self , output_folder : str = None ) -> None :
240229 """Plot the status of the thermal units
241230
242231 Args:
243232 output_folder (str): The folder to save the plot.
244- save_plot (bool): Whether to save the plot.
245233
246234 Returns:
247235 None
248236 """
249- if save_plot and (output_folder is None ):
250- raise ValueError ("Please provide an output folder to save the plot." )
251-
252237 output_processor = OutputProcessor (
253238 inputs = self .inputs ,
254239 )
255240 output_processor .load_from_dataframe (self .system_record .get_node_variables ())
256- visualizer = Visualizer (
257- model_id = self .inputs .model_id ,
258- output_folder = output_folder ,
259- )
241+ visualizer = Visualizer (model_id = self .inputs .model_id )
260242 visualizer .plot_thermal_units (
261243 unit_status = output_processor .get_unit_status (),
262244 thermal_dispatch = output_processor .get_hourly_thermal_dispatch (),
263245 thermal_rated_capacity = self .inputs .thermal_rated_capacity ,
264- to_save = save_plot ,
246+ output_folder = output_folder ,
265247 )
266248
267- def plot_lmp (self , output_folder : str = None , save_plot : bool = True ) -> None :
249+ def plot_lmp (self , output_folder : str = None ) -> None :
268250 """Plot the locational marginal prices
269251
270252 Args:
271253 output_folder (str): The folder to save the plot.
272- save_plot (bool): Whether to save the plot.
273254
274255 Returns:
275256 None
276257 """
277- if save_plot and (output_folder is None ):
278- raise ValueError ("Please provide an output folder to save the plot." )
279-
280258 output_processor = OutputProcessor (
281259 inputs = self .inputs ,
282260 )
283261 output_processor .load_from_dataframe (self .system_record .get_node_variables ())
284- visualizer = Visualizer (
285- model_id = self .inputs .model_id ,
286- output_folder = output_folder ,
287- )
262+ visualizer = Visualizer (model_id = self .inputs .model_id )
288263 visualizer .plot_lmp (
289264 lmp_df = self .system_record .get_lmp (),
290- to_save = save_plot ,
265+ output_folder = output_folder ,
291266 )
292267
293268 # def reoperate(
0 commit comments