Output Streamer
- class pandapower.timeseries.output_streamer.OutputStreamer(net, time_steps=None, save_interval=0, output_path=None, output_file_type='.p', log_variables=None, csv_separator=';')
The OutputStreamer class is used to cyclically store and format specific outputs from a time series calculation.
For a detailed documentation, please refer to the parent OutputWriter class.
Currently only xls and csv format is supported.
- Parameters:
net – The pandapower format network
time_steps (list) – time_steps to calculate as a list (or range)
save_interval (int, 0) – Amount of time steps after which the data is stored cyclically.
output_path (string, None) – Path to a folder where the output is written to.
output_file_type (string, ".p") –
output filetype to use. Allowed file extensions: [.xls, .xlsx, .csv, .csv.*, .p, .json]
Note
XLS has a maximum number of 256 rows.
CSV files can be saved in a compressed format like .csv.zip.
csv_separator (string, ";") – The separator used when writing to a csv file
write_time (int, None) – Time to save periodically to disk in minutes. Deactivated by default
log_variables (list, None) – list of tuples with (table, column) values to be logged by output writer. Defaults are: res_bus.vm_pu and res_line.loading_percent. Additional variables can be added later on with ow.log_variable or removed with ow.remove_log_variable
Example
>>> from pandapower.timeseries.output_streamer import OutputStreamer >>> import pandapower.networks as nw >>> net = nw.simple_four_bus_system() >>> ow = OutputStreamer(net) # create an OutputStreamer >>> ow.log_variable('res_bus', 'vm_pu') # add logging for bus voltage magnitudes >>> ow.log_variable('res_line', 'loading_percent') # add logging for line loadings in percent >>> # Getting the cost function slope for each time step: >>> def cost_logging(result, n_columns=2): >>> return array([result[i][0][2] for i in range(len(result))]) >>> ow.log_variable("pwl_cost", "points", eval_function=cost_logging)
- save_results(net, time_step, pf_converged, ctrl_converged, recycle_options=None)
Saves the results of the current time step to a matrix and stores it to the disk in a after save_interval time steps.
- Parameters:
net (pandapowerNet) – The pandapower format network.
time_step (int) – Current time step.
pf_converged (bool) – Flag that checks if power flow is converged.
ctrl_converged (bool) – Flat that checks if controllers are converged.
recycle_options (dict, optional) – Recycle options used in OutputWriter. Defaults to None.