Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props norm #597

Merged
merged 46 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9427b6a
moved test data
SimonRubenDrauz Feb 23, 2024
603efc0
- working with mass
SimonRubenDrauz Feb 23, 2024
2402b20
bug in convert format
SimonRubenDrauz Feb 23, 2024
1466dac
changes in checking compatibility between different versions
SimonRubenDrauz Feb 23, 2024
797fcb6
changes in data path
SimonRubenDrauz Feb 23, 2024
070d683
result changes due to norm state
SimonRubenDrauz Feb 23, 2024
dff95f7
result changes due to norm state
SimonRubenDrauz Feb 23, 2024
7ea93b4
imporve readability and consider changes from v to m
SimonRubenDrauz Feb 23, 2024
56b6e5e
required for single values
SimonRubenDrauz Feb 23, 2024
0057c45
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
d3f2fc9
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
b5e3740
import error
SimonRubenDrauz Feb 23, 2024
3fb9cc0
increase number of iterations
SimonRubenDrauz Feb 23, 2024
faa7b49
still required todo
SimonRubenDrauz Feb 23, 2024
3db61c1
tol_v to tol_m
SimonRubenDrauz Feb 23, 2024
aa8501c
small adaptions for cleaner coding
SimonRubenDrauz Mar 4, 2024
3a9986d
handle also small masses
SimonRubenDrauz Mar 4, 2024
a9f038d
make sure to find tutorials folder
SimonRubenDrauz Mar 4, 2024
58fd7b5
nbmake bug due to pytest 8.1.0 upgrade
SimonRubenDrauz Mar 4, 2024
fa8e21b
bugfix
SimonRubenDrauz Mar 4, 2024
4cb50a7
remove unnecessary fluid call
SimonRubenDrauz Mar 4, 2024
f26a51a
scientific writing, improve readibility
SimonRubenDrauz Mar 4, 2024
7a16a7a
use correct density for volume flow
SimonRubenDrauz Mar 4, 2024
940bc79
removed unused import
SimonRubenDrauz Mar 4, 2024
e3ca2e3
use enumerate
SimonRubenDrauz Mar 4, 2024
357f5aa
renamed MINIT into MDOTINIT
SimonRubenDrauz Mar 4, 2024
ac54e41
solve WARNINGs
SimonRubenDrauz Mar 4, 2024
63b0877
remove TOUTINIT from heat_exchanger as not required
SimonRubenDrauz Mar 27, 2024
2cf7c1e
- adding max_iter_hyd and max_iter_therm instead of iter
SimonRubenDrauz Mar 27, 2024
3605844
- consider the max iter number correctly
SimonRubenDrauz Mar 27, 2024
5e0b8f4
max_iter_hydr in stanet comparison instead of iter
SimonRubenDrauz Mar 27, 2024
4988eb0
type np.int32 instead of int
SimonRubenDrauz Mar 27, 2024
09d12ba
take correct density in norm volume
SimonRubenDrauz Mar 27, 2024
0c60e92
replace iter by max_iter_hyd
SimonRubenDrauz Mar 27, 2024
f92fe68
correct derivations in the derivative toolbox, consideration of the n…
SimonRubenDrauz Apr 3, 2024
35c56e0
bugfix
SimonRubenDrauz Apr 3, 2024
77c83e5
- removed todo
SimonRubenDrauz Apr 4, 2024
dc106eb
- remove todo as obsolete
SimonRubenDrauz Apr 4, 2024
2968c25
use FROM_NODE_T and TO_NODE_T for density, eta and cp calculation dur…
SimonRubenDrauz Apr 8, 2024
155e9fe
Merge remote-tracking branch 'origin/develop' into props_norm
SimonRubenDrauz Apr 8, 2024
22f80a0
considering - for delta x and not in build_system_matrix.py in regard…
SimonRubenDrauz Apr 9, 2024
17735d2
differentiating between max_iter_hyd and max_iter_therm and iter. ite…
SimonRubenDrauz Apr 9, 2024
912137b
Merge remote-tracking branch 'origin/develop' into props_norm
SimonRubenDrauz Apr 9, 2024
3a9c5a2
in heat consumer considering change from vinit to minit
SimonRubenDrauz Apr 9, 2024
8ea8504
bugfix in tutorials
SimonRubenDrauz Apr 9, 2024
5b5547c
bugfix in tutorials
SimonRubenDrauz Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest nbmake pytest-xdist pytest-split igraph
python -m pip install pytest==8.0.2 nbmake pytest-xdist pytest-split igraph
if [${{ matrix.python-version != '3.11' }}]; then python -m pip install numba; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install git+https://github.com/e2nIEE/pandapower@develop#egg=pandapower
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest nbmake pytest-xdist pytest-split igraph
python -m pip install pytest==8.0.2 nbmake pytest-xdist pytest-split igraph
if [${{ matrix.python-version != '3.11' }}]; then python -m pip install numba; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install git+https://github.com/e2nIEE/pandapower@master#egg=pandapower
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

from pandapipes.component_models.abstract_models.base_component import Component
from pandapipes.idx_branch import VINIT, branch_cols
from pandapipes.idx_branch import MDOTINIT, branch_cols
from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup

try:
Expand Down Expand Up @@ -88,7 +88,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
from_nodes = junction_idx_lookup[net[cls.table_name()][fn_col].values]
to_nodes = junction_idx_lookup[net[cls.table_name()][tn_col].values]
branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (branch_cols - 1))
branch_component_pit[:, VINIT] = 0.1
branch_component_pit[:, MDOTINIT] = 0.1
return branch_component_pit, node_pit, from_nodes, to_nodes

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
from pandapipes.component_models.abstract_models.branch_models import BranchComponent
from pandapipes.component_models.component_toolbox import set_entry_check_repeat, vinterp, \
p_correction_height_air
from pandapipes.idx_branch import ACTIVE, FROM_NODE, TO_NODE, RHO, ETA, CP, ELEMENT_IDX, TOUTINIT
from pandapipes.idx_branch import ACTIVE, FROM_NODE, FROM_NODE_T, TO_NODE, TO_NODE_T, TOUTINIT, ELEMENT_IDX, TOUTINIT
from pandapipes.idx_node import (L, node_cols, TINIT as TINIT_NODE, HEIGHT, PINIT, PAMB,
ACTIVE as ACTIVE_ND)
from pandapipes.pf.pipeflow_setup import add_table_lookup, get_lookup, get_table_number
from pandapipes.properties.fluids import get_fluid

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -208,13 +207,10 @@ def create_pit_branch_entries(cls, net, branch_pit):
branch_w_internals_pit, ACTIVE, net[cls.table_name()][cls.active_identifier()].values,
internal_pipe_number, has_internals)
branch_w_internals_pit[:, FROM_NODE] = from_nodes
branch_w_internals_pit[:, FROM_NODE_T] = from_nodes
branch_w_internals_pit[:, TO_NODE] = to_nodes
branch_w_internals_pit[:, TO_NODE_T] = to_nodes
branch_w_internals_pit[:, TOUTINIT] = node_pit[to_nodes, TINIT_NODE]
tm = (node_pit[from_nodes, TINIT_NODE] + branch_w_internals_pit[:, TOUTINIT]) / 2
fluid = get_fluid(net)
branch_w_internals_pit[:, RHO] = fluid.get_density(tm)
branch_w_internals_pit[:, ETA] = fluid.get_viscosity(tm)
branch_w_internals_pit[:, CP] = fluid.get_heat_capacity(tm)
return branch_w_internals_pit, internal_pipe_number

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

from pandapipes.component_models.abstract_models.branch_models import BranchComponent

from pandapipes.idx_branch import FROM_NODE, TO_NODE, TOUTINIT, ELEMENT_IDX, RHO, ETA, CP, ACTIVE
from pandapipes.idx_branch import FROM_NODE, FROM_NODE_T, TO_NODE, TO_NODE_T, TOUTINIT, ELEMENT_IDX, ACTIVE
from pandapipes.idx_node import TINIT as TINIT_NODE

from pandapipes.pf.pipeflow_setup import add_table_lookup
from pandapipes.properties.fluids import get_fluid

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -81,13 +80,10 @@ def create_pit_branch_entries(cls, net, branch_pit):
= super().create_pit_branch_entries(net, branch_pit)
branch_wo_internals_pit[:, ELEMENT_IDX] = net[cls.table_name()].index.values
branch_wo_internals_pit[:, FROM_NODE] = from_nodes
branch_wo_internals_pit[:, FROM_NODE_T] = from_nodes
branch_wo_internals_pit[:, TO_NODE] = to_nodes
branch_wo_internals_pit[:, TO_NODE_T] = to_nodes
branch_wo_internals_pit[:, TOUTINIT] = node_pit[to_nodes, TINIT_NODE]
tm = (node_pit[from_nodes, TINIT_NODE] + branch_wo_internals_pit[:, TOUTINIT]) / 2
fluid = get_fluid(net)
branch_wo_internals_pit[:, RHO] = fluid.get_density(tm)
branch_wo_internals_pit[:, ETA] = fluid.get_viscosity(tm)
branch_wo_internals_pit[:, CP] = fluid.get_heat_capacity(tm)
branch_wo_internals_pit[:, ACTIVE] = net[cls.table_name()][cls.active_identifier()].values
return branch_wo_internals_pit

Expand Down
6 changes: 3 additions & 3 deletions src/pandapipes/component_models/compressor_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pandapipes.component_models.component_toolbox import get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.component_models.pump_component import Pump
from pandapipes.idx_branch import VINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_branch import MDOTINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_node import PINIT, PAMB


Expand Down Expand Up @@ -76,8 +76,8 @@ def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lo
p_to_calc = p_from * compressor_array[:, cls.PRESSURE_RATIO]
pl_abs = p_to_calc - p_from

v_mps = compressor_branch_pit[:, VINIT]
pl_abs[v_mps < 0] = 0 # force pressure lift = 0 for reverse flow
m_mps = compressor_branch_pit[:, MDOTINIT]
pl_abs[m_mps < 0] = 0 # force pressure lift = 0 for reverse flow

compressor_branch_pit[:, PL] = pl_abs

Expand Down
11 changes: 5 additions & 6 deletions src/pandapipes/component_models/flow_control_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import numpy as np
from numpy import dtype

from pandapipes.component_models.abstract_models import BranchWZeroLengthComponent, get_fluid
from pandapipes.component_models.abstract_models import BranchWZeroLengthComponent
from pandapipes.properties import get_fluid
from pandapipes.component_models.component_toolbox import \
standard_branch_wo_internals_result_lookup, get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import D, AREA, JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DV, VINIT, \
RHO, LOAD_VEC_BRANCHES
from pandapipes.idx_branch import D, AREA, JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, MDOTINIT, LOAD_VEC_BRANCHES
from pandapipes.pf.result_extraction import extract_branch_results_without_internals


Expand Down Expand Up @@ -51,8 +51,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
fc_branch_pit = super().create_pit_branch_entries(net, branch_pit)
fc_branch_pit[:, D] = net[cls.table_name()].diameter_m.values
fc_branch_pit[:, AREA] = fc_branch_pit[:, D] ** 2 * np.pi / 4
fc_branch_pit[:, VINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values / \
(fc_branch_pit[:, AREA] * fc_branch_pit[:, RHO])
fc_branch_pit[:, MDOTINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values

@classmethod
def create_component_array(cls, net, component_pits):
Expand Down Expand Up @@ -83,7 +82,7 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
active = fc_array[:, cls.CONTROL_ACTIVE].astype(np.bool_)
fc_branch_pit[active, JAC_DERIV_DP] = 0
fc_branch_pit[active, JAC_DERIV_DP1] = 0
fc_branch_pit[active, JAC_DERIV_DV] = 1
fc_branch_pit[active, JAC_DERIV_DM] = 1
fc_branch_pit[active, LOAD_VEC_BRANCHES] = 0

@classmethod
Expand Down
9 changes: 4 additions & 5 deletions src/pandapipes/component_models/heat_consumer_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from pandapipes.component_models import get_fluid, \
BranchWZeroLengthComponent, get_component_array, standard_branch_wo_internals_result_lookup
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import (D, AREA, VINIT, ALPHA, QEXT, RHO, TEXT, JAC_DERIV_DP1,
JAC_DERIV_DV, JAC_DERIV_DP, LOAD_VEC_BRANCHES)
from pandapipes.idx_branch import D, AREA, MDOTINIT, QEXT, JAC_DERIV_DP1, \
JAC_DERIV_DM, JAC_DERIV_DP, LOAD_VEC_BRANCHES
from pandapipes.pf.result_extraction import extract_branch_results_without_internals


Expand Down Expand Up @@ -68,8 +68,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
hs_pit = super().create_pit_branch_entries(net, branch_pit)
hs_pit[:, D] = net[cls.table_name()].diameter_m.values
hs_pit[:, AREA] = hs_pit[:, D] ** 2 * np.pi / 4
hs_pit[:, VINIT] = (net[cls.table_name()].controlled_mdot_kg_per_s.values /
(hs_pit[:, AREA] * hs_pit[:, RHO]))
hs_pit[:, MDOTINIT] = net[cls.table_name()].controlled_mdot_kg_per_s.values
hs_pit[:, QEXT] = net[cls.table_name()].qext_w.values
return hs_pit

Expand Down Expand Up @@ -127,7 +126,7 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
mdot_controlled = ~np.isnan(fc_array[:, cls.MASS])
fc_branch_pit[mdot_controlled, JAC_DERIV_DP] = 0
fc_branch_pit[mdot_controlled, JAC_DERIV_DP1] = 0
fc_branch_pit[mdot_controlled, JAC_DERIV_DV] = 1
fc_branch_pit[mdot_controlled, JAC_DERIV_DM] = 1
fc_branch_pit[mdot_controlled, LOAD_VEC_BRANCHES] = 0

# @classmethod
Expand Down
4 changes: 1 addition & 3 deletions src/pandapipes/component_models/junction_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from numpy import dtype
from pandapipes.component_models.abstract_models.node_models import NodeComponent
from pandapipes.component_models.component_toolbox import p_correction_height_air
from pandapipes.idx_node import L, ELEMENT_IDX, RHO, PINIT, node_cols, HEIGHT, TINIT, PAMB, \
from pandapipes.idx_node import L, ELEMENT_IDX, PINIT, node_cols, HEIGHT, TINIT, PAMB, \
ACTIVE as ACTIVE_ND
from pandapipes.pf.pipeflow_setup import add_table_lookup, get_table_number, \
get_lookup
from pandapipes.properties.fluids import get_fluid


class Junction(NodeComponent):
Expand Down Expand Up @@ -83,7 +82,6 @@ def create_pit_node_entries(cls, net, node_pit):
junction_pit[:, HEIGHT] = junctions.height_m.values
junction_pit[:, PINIT] = junctions.pn_bar.values
junction_pit[:, TINIT] = junctions.tfluid_k.values
junction_pit[:, RHO] = get_fluid(net).get_density(junction_pit[:, TINIT])
junction_pit[:, PAMB] = p_correction_height_air(junction_pit[:, HEIGHT])
junction_pit[:, ACTIVE_ND] = junctions.in_service.values

Expand Down
19 changes: 10 additions & 9 deletions src/pandapipes/component_models/pipe_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from pandapipes.component_models.component_toolbox import set_entry_check_repeat
from pandapipes.component_models.junction_component import Junction
from pandapipes.constants import NORMAL_TEMPERATURE, NORMAL_PRESSURE
from pandapipes.idx_branch import (FROM_NODE, TO_NODE, LENGTH, D, AREA, K, VINIT,
ALPHA, QEXT, TEXT, LOSS_COEFFICIENT as LC)
from pandapipes.idx_branch import FROM_NODE, TO_NODE, LENGTH, D, AREA, K, \
MDOTINIT, ALPHA, QEXT, TEXT, LOSS_COEFFICIENT as LC
from pandapipes.idx_node import PINIT, TINIT as TINIT_NODE, PAMB
from pandapipes.pf.pipeflow_setup import get_fluid, get_lookup
from pandapipes.pf.result_extraction import (extract_branch_results_with_internals,
extract_branch_results_without_internals)
from pandapipes.pf.result_extraction import extract_branch_results_with_internals, \
extract_branch_results_without_internals

try:
import pandaplan.core.pplog as logging
Expand Down Expand Up @@ -123,6 +123,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
pipe_pit, LC, net[tbl].loss_coefficient.values, internal_pipe_number, has_internals)

pipe_pit[:, AREA] = pipe_pit[:, D] ** 2 * np.pi / 4
pipe_pit[:, MDOTINIT] *= pipe_pit[:, AREA] * get_fluid(net).get_density(NORMAL_TEMPERATURE)

@classmethod
def extract_results(cls, net, options, branch_results, mode):
Expand Down Expand Up @@ -197,22 +198,22 @@ def get_internal_results(cls, net, pipe):
selected_indices_v_final = np.logical_or.reduce(selected_indices_v[:])

p_nodes = int_p_lookup[:, 1][selected_indices_p_final]
v_nodes = int_v_lookup[:, 1][selected_indices_v_final]
m_nodes = int_v_lookup[:, 1][selected_indices_v_final]

v_pipe_data = pipe_pit[v_nodes, VINIT]
v_pipe_data = pipe_pit[m_nodes, MDOTINIT] / fluid.get_density(NORMAL_TEMPERATURE) / pipe_pit[m_nodes, AREA]
p_node_data = node_pit[p_nodes, PINIT]
t_node_data = node_pit[p_nodes, TINIT_NODE]

gas_mode = fluid.is_gas

if gas_mode:
from_nodes = pipe_pit[v_nodes, FROM_NODE].astype(np.int32)
to_nodes = pipe_pit[v_nodes, TO_NODE].astype(np.int32)
from_nodes = pipe_pit[m_nodes, FROM_NODE].astype(np.int32)
to_nodes = pipe_pit[m_nodes, TO_NODE].astype(np.int32)
p_from = node_pit[from_nodes, PAMB] + node_pit[from_nodes, PINIT]
p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
p_mean = np.where(p_from == p_to, p_from,
2 / 3 * (p_from ** 3 - p_to ** 3) / (p_from ** 2 - p_to ** 2))
numerator = NORMAL_PRESSURE * node_pit[v_nodes, TINIT_NODE]
numerator = NORMAL_PRESSURE * node_pit[m_nodes, TINIT_NODE]
normfactor_mean = numerator * fluid.get_property("compressibility", p_mean) \
/ (p_mean * NORMAL_TEMPERATURE)
normfactor_from = numerator * fluid.get_property("compressibility", p_from) \
Expand Down
4 changes: 2 additions & 2 deletions src/pandapipes/component_models/pressure_control_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
BranchWZeroLengthComponent
from pandapipes.component_models.junction_component import Junction
from pandapipes.idx_branch import D, AREA, \
JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DV, BRANCH_TYPE, LOSS_COEFFICIENT as LC
JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DM, BRANCH_TYPE, LOSS_COEFFICIENT as LC
from pandapipes.idx_node import PINIT, NODE_TYPE, PC
from pandapipes.pf.pipeflow_setup import get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_without_internals
Expand Down Expand Up @@ -77,7 +77,7 @@ def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_loo
pc_branch = press_pit[:, BRANCH_TYPE] == PC
press_pit[pc_branch, JAC_DERIV_DP] = 0
press_pit[pc_branch, JAC_DERIV_DP1] = 0
press_pit[pc_branch, JAC_DERIV_DV] = 0
press_pit[pc_branch, JAC_DERIV_DM] = 0

@classmethod
def extract_results(cls, net, options, branch_results, mode):
Expand Down
8 changes: 4 additions & 4 deletions src/pandapipes/component_models/pump_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pandapipes.component_models.component_toolbox import get_component_array
from pandapipes.component_models.junction_component import Junction
from pandapipes.constants import NORMAL_TEMPERATURE, NORMAL_PRESSURE, R_UNIVERSAL, P_CONVERSION
from pandapipes.idx_branch import VINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_branch import MDOTINIT, D, AREA, LOSS_COEFFICIENT as LC, FROM_NODE, PL
from pandapipes.idx_node import PINIT, PAMB, TINIT as TINIT_NODE
from pandapipes.pf.pipeflow_setup import get_fluid, get_net_option, get_lookup
from pandapipes.pf.result_extraction import extract_branch_results_without_internals
Expand Down Expand Up @@ -104,7 +104,7 @@ def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lo
# p_to = node_pit[to_nodes, PAMB] + node_pit[to_nodes, PINIT]
t_from = node_pit[from_nodes, TINIT_NODE]
numerator_from = NORMAL_PRESSURE * t_from
v_mps = pump_branch_pit[:, VINIT]
v_mps = pump_branch_pit[:, MDOTINIT] / pump_branch_pit[:, AREA] / fluid.get_density(NORMAL_TEMPERATURE)
if fluid.is_gas:
# consider volume flow at inlet
normfactor_from = numerator_from * fluid.get_property("compressibility", p_from) \
Expand Down Expand Up @@ -179,11 +179,11 @@ def extract_results(cls, net, options, branch_results, mode):
w_real_isentr = (k / (k - 1)) * r_spec * compr * t0 * \
(np.divide(p_to, p_from) ** ((k - 1) / k) - 1)
res_table['compr_power_mw'].values[:] = \
w_real_isentr * np.abs(mf_sum_int) / 10 ** 6
w_real_isentr * np.abs(mf_sum_int) / 1e6
else:
vf_sum_int = branch_results["vf"][f:t]
pl = branch_results["pl"][f:t]
res_table['compr_power_mw'].values[:] = pl * P_CONVERSION * vf_sum_int / 10 ** 6
res_table['compr_power_mw'].values[:] = pl * P_CONVERSION * vf_sum_int / 1e6

@classmethod
def get_component_input(cls):
Expand Down
6 changes: 3 additions & 3 deletions src/pandapipes/converter/stanet/preparing_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def get_net_params(net, stored_data):
else:
pandapipes.set_user_pf_options(
net, friction_model=known_friction_models[net_params["friction_model"]],
iter=net_params["max_iterations"]
max_iter_hyd=net_params["max_iterations"], max_iter_therm=net_params["max_iterations"]
)
if net_params["compress_model"] != "linear":
logger.warning("The compressibility model %s is not implemented in pandapipes, which might "
Expand Down Expand Up @@ -422,11 +422,11 @@ def dist_on_line(row):
connections["line_geo"] = pd.Series("", index=connections.index, dtype=object)
main_connection = connections.CLIENTTYP == 2
if np.any(main_connection):
connections.line_geo.loc[main_connection] = \
connections.loc[main_connection, 'line_geo'] = \
pipe_geodata.loc[connections.SNUM.loc[main_connection].values].values
house_connection = connections.CLIENTTYP == 38
if np.any(house_connection):
connections.line_geo.loc[house_connection] = \
connections.loc[house_connection, 'line_geo'] = \
house_pipe_geodata.loc[connections.SNUM.loc[house_connection].values].values
connections["pos_on_line"] = connections.apply(dist_on_line, axis=1)
# connections = connections.sort_values(["type", "SNUM"])
Expand Down
Loading
Loading