|
3 | 3 | # contributors (see AUTHORS file for details). All rights reserved.
|
4 | 4 |
|
5 | 5 | # This is the csv_pp_converter for the simbench project.
|
6 |
| -# pandapower 2.0.1 <-> simbench format (reasled status from 25.04.2019) |
| 6 | + |
| 7 | +# OPTIONAL IMPROVEMENTS for compatibility with future pandapower changes: constructing the |
| 8 | +# dataframes net[element_table] by using the create_buses(), create_lines(), ... functions |
| 9 | +# which where fast enough or not available at the time SimBench was developed. |
7 | 10 |
|
8 | 11 | import os
|
9 | 12 | import pandas as pd
|
|
28 | 31 | from simbench.converter.pp_net_manipulation import _extend_pandapower_net_columns, \
|
29 | 32 | _add_dspf_calc_type_and_phys_type_columns, _add_vm_va_setpoints_to_buses, \
|
30 | 33 | _prepare_res_bus_table, replace_branch_switches, create_branch_switches, _add_coordID, \
|
31 |
| - _set_vm_setpoint_to_trafos |
| 34 | + _set_vm_setpoint_to_trafos, _set_dependency_table_parameters |
32 | 35 | from simbench.converter.csv_data_manipulation import *
|
33 | 36 | from simbench.converter.csv_data_manipulation import _extend_coordinates_to_node_shape, \
|
34 | 37 | _sort_switch_nodes_and_prepare_element_and_et, \
|
@@ -127,6 +130,7 @@ def csv_data2pp(csv_data):
|
127 | 130 | create_branch_switches(net)
|
128 | 131 | net.bus.loc[net.bus.type == "multi_auxiliary", "type"] = "auxiliary"
|
129 | 132 | _set_vm_setpoint_to_trafos(net, csv_data)
|
| 133 | + _set_dependency_table_parameters(net) |
130 | 134 | _csv_types_to_pp2(net)
|
131 | 135 | ensure_bus_index_columns_as_int(net)
|
132 | 136 |
|
@@ -222,15 +226,20 @@ def pp2csv_data(net1, export_pp_std_types=False, drop_inactive_elements=True,
|
222 | 226 | csv_data = _init_csv_tables(['elements', 'profiles', 'types', 'res_elements'])
|
223 | 227 | aux_nodes_are_reserved = reserved_aux_node_names is not None
|
224 | 228 |
|
| 229 | + if ("step_dependency_table" in net1.trafo.columns and net1.trafo.step_dependency_table.any()) \ |
| 230 | + or \ |
| 231 | + ("step_dependency_table" in net1.shunt.columns and net1.shunt.step_dependency_table.any()): |
| 232 | + logger.warning("'step_dependency_table' is not supported in SimBench's csv data format.") |
| 233 | + |
225 | 234 | # --- net data preparation for converting
|
226 | 235 | _extend_pandapower_net_columns(net)
|
227 | 236 | if drop_inactive_elements:
|
228 | 237 | # attention: trafo3ws are not considered in current version of drop_inactive_elements()
|
229 | 238 | pp.drop_inactive_elements(net, respect_switches=False)
|
230 |
| - check_results = pp.deviation_from_std_type(net) |
231 |
| - if check_results: |
| 239 | + dev_from_std = pp.deviation_from_std_type(net) |
| 240 | + if dev_from_std: |
232 | 241 | logger.warning("There are deviations from standard types in elements: " +
|
233 |
| - str(["%s" % elm for elm in check_results.keys()]) + ". Only the standard " + |
| 242 | + str(["%s" % elm for elm in dev_from_std.keys()]) + ". Only the standard " + |
234 | 243 | "type values are converted to csv.")
|
235 | 244 | convert_parallel_branches(net)
|
236 | 245 | merge_busbar_coordinates(net, True)
|
|
0 commit comments