Skip to content

Commit

Permalink
fixing construction year bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRubenDrauz committed May 27, 2024
1 parent e3af8e7 commit 56190db
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/pandapipes/converter/stanet/table_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def create_valve_and_pipe(net, stored_data, index_mapping, net_params, stanet_li
add_info = dict()
if add_layers:
add_info["stanet_layer"] = str(row.LAYER)
add_info["construction_year"] = int(row.BAUJAHR) if 'BAUJAHR' in row else np.nan
if stanet_like_valves:
create_valve_pipe_from_parameters(
net, node_mapping[from_stanet_nr], node_mapping[to_stanet_nr],
Expand All @@ -159,14 +160,13 @@ def create_valve_and_pipe(net, stored_data, index_mapping, net_params, stanet_li
text_k = 293
if hasattr(row, "TU"):
text_k = row.TU + 273.15
baujahr = int(row['BAUJAHR']) if 'BAUJAHR' in row else np.nan
pandapipes.create_pipe_from_parameters(
net, node_mapping[from_stanet_nr], j_aux, length_km=row.RORL / 1000,
diameter_m=float(row.DM / 1000), k_mm=row.RAU, loss_coefficient=row.ZETA,
name="pipe_%s_%s" % (str(row.ANFNAM), 'aux_' + str(row.ENDNAM)),
text_k=text_k, in_service=bool(row.ISACTIVE), stanet_nr=-999,
stanet_id='pipe_valve_' + str(row.STANETID), v_stanet=row.VM,
stanet_active=bool(row.ISACTIVE), stanet_valid=False, construction_year=baujahr, **add_info
stanet_active=bool(row.ISACTIVE), stanet_valid=False, **add_info
)
pandapipes.create_valve(
net, j_aux, node_mapping[to_stanet_nr], diameter_m=float(row.DM / 1000),
Expand Down Expand Up @@ -604,14 +604,14 @@ def create_geodata_sections(row):
add_info = dict()
if add_layers:
add_info["stanet_layer"] = pipes.LAYER.values.astype(str)
add_info["construction_year"] = pipes.BAUJAHR.values.astype(np.int32) if 'BAUJAHR' in pipes else np.nan
# TODO: v_stanet might have to be extended by house connections VMA and VMB
text_k = 293
if "TU" in pipes.columns:
text_k = pipes.TU.values.astype(np.float64) + 273.15
alpha = 0
if "WDZAHL" in pipes.columns:
alpha = pipes.WDZAHL.values.astype(np.float64)
baujahr = pipe_sections['BAUJAHR'].astype(np.int32) if 'BAUJAHR' in pipe_sections else np.nan
pandapipes.create_pipes_from_parameters(
net, pipe_sections.fj.values, pipe_sections.tj.values, pipe_sections.length.values / 1000,
pipes.DM.values.astype(float) / 1000, pipes.RAU.values.astype(float), pipes.ZETA.values.astype(float), type="main_pipe",
Expand All @@ -624,7 +624,6 @@ def create_geodata_sections(row):
stanet_system=CLIENT_TYPES_OF_PIPES[MAIN_PIPE_TYPE],
stanet_active=pipes.ISACTIVE.values.astype(np.bool_),
stanet_valid=~pipes.CALCBAD.values.astype(np.bool_),
construction_year=baujahr,
**add_info
)

Expand Down Expand Up @@ -738,13 +737,13 @@ def create_pipes_from_remaining_pipe_table(net, stored_data, connection_table, i
add_info = dict()
if add_layers:
add_info["stanet_layer"] = p_tbl.LAYER.values.astype(str)
add_info["construction_year"] = p_tbl.BAUJAHR.values.astype(np.int32) if 'BAUJAHR' in p_tbl else np.nan
text_k = 293
if "TU" in p_tbl.columns:
text_k = p_tbl.TU.values.astype(np.float64) + 273.15
alpha = 0
if "WDZAHL" in p_tbl.columns:
alpha = p_tbl.WDZAHL.values.astype(np.float64)
baujahr = p_tbl['BAUJAHR'].values.astype(np.int32) if 'BAUJAHR' in p_tbl else np.nan
pandapipes.create_pipes_from_parameters(
net, from_junctions, to_junctions, length_km=p_tbl.RORL.values.astype(np.float64) / 1000,
type="main_pipe", diameter_m=p_tbl.DM.values.astype(np.float64) / 1000,
Expand All @@ -756,7 +755,6 @@ def create_pipes_from_remaining_pipe_table(net, stored_data, connection_table, i
stanet_system=CLIENT_TYPES_OF_PIPES[MAIN_PIPE_TYPE],
stanet_active=p_tbl.ISACTIVE.values.astype(np.bool_),
stanet_valid=~p_tbl.CALCBAD.values.astype(np.bool_),
construction_year=baujahr,
**add_info
)

Expand Down Expand Up @@ -1061,14 +1059,14 @@ def create_geodata_sections(row):
add_info = dict()
if add_layers:
add_info["stanet_layer"] = hp_data.LAYER.values.astype(str)
add_info["construction_year"] = hp_data.BAUJAHR.values.astype(np.int32) if 'BAUJAHR' in hp_data else np.nan
# TODO: v_stanet might have to be extended by house connections VMA and VMB
text_k = 293
if "TU" in hp_data.columns:
text_k = hp_data.TU.values.astype(np.float64) + 273.15
alpha = 0
if "WDZAHL" in hp_data.columns:
alpha = hp_data.WDZAHL.values.astype(np.float64)
baujahr = hp_data['BAUJAHR'].values.astype(np.int32) if 'BAUJAHR' in hp_data else np.nan
pandapipes.create_pipes_from_parameters(
net, hp_data.fj.values, hp_data.tj.values, hp_data.length.values / 1000,
hp_data.DM.values / 1000, hp_data.RAU.values, hp_data.ZETA.values, type="house_pipe",
Expand All @@ -1079,7 +1077,7 @@ def create_geodata_sections(row):
stanet_std_type=hp_data.ROHRTYP.values, stanet_nr=hp_data.RECNO.values,
stanet_id=hp_data.STANETID.values, v_stanet=hp_data.VM.values,
stanet_active=hp_data.ISACTIVE.values.astype(np.bool_),
stanet_valid=houses_in_calculation, construction_year=baujahr, **add_info
stanet_valid=houses_in_calculation, **add_info
)


Expand Down

0 comments on commit 56190db

Please sign in to comment.