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

Gas mixture #493

Open
wants to merge 67 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
1861d86
fluids are defined for sources and ext_grids not for networks
Jan 18, 2022
38b8e0b
additional properties
Jan 28, 2022
2133d55
changes as result of mixture considerations
Jan 28, 2022
26f1297
mark xfailing test
Jan 28, 2022
57d03d1
bug in create_individual_fluid
Jan 28, 2022
351c476
InvalidIndexError added
Jan 28, 2022
70431fd
InvalidIndexError added
Jan 28, 2022
cc76a19
InvalidIndexError added
Jan 28, 2022
4c834c8
Changes in pandas considered
Jan 28, 2022
096294e
deprecating warning fix
Mar 30, 2022
64388bb
mixture implementations
Mar 30, 2022
fe6f59f
new controller
Mar 30, 2022
fa4fde7
test adaption and new tests for mixtures
Mar 30, 2022
093d5b2
remove damping factor
Apr 1, 2022
da1c957
adapting mixture tests
Apr 1, 2022
a6d8469
improving system matrix entries
Apr 1, 2022
cc63242
adapting pplog
Apr 20, 2022
8e2ee76
bugfixes mixture calculation
Apr 20, 2022
5570b18
cleanup
Apr 20, 2022
a48a573
colebrook bugfix
Apr 20, 2022
ed207aa
changes in write_to_net considered
Apr 20, 2022
b531995
progress bar changes considered
Apr 20, 2022
d173762
Merge remote-tracking branch 'origin/develop' into feature/mixture_co…
Apr 20, 2022
e15d21a
moving add new component to different toolbox
Apr 20, 2022
b381067
adapting pplog
Apr 20, 2022
5a93689
moving add new component to different toolbox
Apr 20, 2022
1a4746b
bugfix in pipe_component
Apr 20, 2022
3a2761e
removing std_type
Apr 20, 2022
2bca476
sign change in circ pump
Apr 20, 2022
2e7874f
implementation error in multinet controller
Apr 21, 2022
c0575cf
compressibility factor considered for p not T
Apr 21, 2022
0f11699
removing slacklike
Apr 21, 2022
f35b53a
considering fluid in sources
Apr 21, 2022
930f9b4
error of 10**-7 can be accepted
Apr 22, 2022
3c77c15
bugfix in multinet controller
Apr 22, 2022
1afce01
further cleanup
Apr 22, 2022
dcb92a0
further cleanup
Apr 22, 2022
554fca9
small bugfixes
May 3, 2022
6234f5d
rounding results junction
May 9, 2022
8f5568e
bugfix of a multiple sink/source net
May 16, 2022
de62d72
start of an example tutorial
Jun 23, 2022
155ef34
mass dummy increased due to inconsistencies
Jun 23, 2022
c280d75
bugfix in file_io in case of multinets
Jun 23, 2022
ff8dcc7
adding tolerances of mass and w in internal results
Jun 23, 2022
eb79067
remove additional sinks in mixture example
Jun 23, 2022
776c4d5
Merge remote-tracking branch 'origin/develop' into feature/mixture_co…
Jun 23, 2022
4d90fed
certain bugfixes
Jun 23, 2022
6a822d8
pump component changes due to problems with fluids not having a molar…
Jun 29, 2022
1538780
Merge remote-tracking branch 'origin/develop' into feature/mixture_co…
Jun 30, 2022
8238abd
problems not solved during merging
Jul 7, 2022
25a42fa
further improvements
Jul 7, 2022
46206c5
further bug corrections
Jul 7, 2022
3f02b33
further bugfixes
Jul 7, 2022
d748efc
integration of numba
Jul 7, 2022
a9e1ac4
last bugfixes in numba integration
Jul 7, 2022
be56ace
possible solution for type error
Jul 7, 2022
4ec1fc7
possible solution for type error
Jul 7, 2022
3b885fa
bugfix
Jul 7, 2022
da3aa5d
Merge branch 'develop' into feature/mixture_controller
SimonRubenDrauz Jul 8, 2022
509b60f
small bugfix in calculate temperature lift in case of pumps
Jul 8, 2022
b1c1309
Merge branch 'feature/mixture_controller' of https://github.com/Simon…
Jul 8, 2022
7f26ecc
additional network which is currently not working and needs to be sol…
Jul 11, 2022
7ac3081
additional network which is currently not working and needs tutorial …
Jul 11, 2022
e9cbfc7
test adaption and mixture tutorial
Jul 12, 2022
82df652
Merge remote-tracking branch 'origin/develop' into feature/mixture_co…
Jul 12, 2022
4a9f911
moving create_property_pit_branch/node_entries to adaption_before_der…
Jul 12, 2022
695ca77
move density derviative calculations to pf
Jul 19, 2022
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
Empty file added compressor_component.py
Empty file.
2 changes: 1 addition & 1 deletion pandapipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

__version__ = '0.6.1.dev_0'
__version__ = '0.6.1.dev_1'

import pandas as pd
import os
Expand Down
9 changes: 6 additions & 3 deletions pandapipes/component_models/abstract_models/base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pandapipes.component_models.component_toolbox import init_results_element

try:
import pplog as logging
from pandaplan.core import pplog as logging
except ImportError:
import logging

Expand Down Expand Up @@ -73,11 +73,11 @@ def get_result_table(cls, net):
raise NotImplementedError

@classmethod
def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lookups, options):
def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, branch_lookups, node_lookups, options):
pass

@classmethod
def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lookups, options):
def adaption_after_derivatives_hydraulic(cls, net, branch_pit, node_pit, branch_lookups, node_lookups, options):
pass

@classmethod
Expand Down Expand Up @@ -138,8 +138,10 @@ def create_pit_node_entries(cls, net, node_pit):
:type node_pit:
:return: No Output.
"""

pass


@classmethod
def create_pit_branch_entries(cls, net, branch_pit):
"""
Expand All @@ -153,6 +155,7 @@ def create_pit_branch_entries(cls, net, branch_pit):
"""
pass


@classmethod
def calculate_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lookups, options):
"""
Expand Down
102 changes: 67 additions & 35 deletions pandapipes/component_models/abstract_models/branch_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@
import numpy as np

from pandapipes.component_models.abstract_models.base_component import Component
from pandapipes.constants import NORMAL_PRESSURE, GRAVITATION_CONSTANT, NORMAL_TEMPERATURE, \
P_CONVERSION
from pandapipes.idx_branch import FROM_NODE, TO_NODE, LENGTH, D, TINIT, AREA, K, RHO, ETA, \
VINIT, RE, LAMBDA, LOAD_VEC_NODES, ALPHA, QEXT, TEXT, LOSS_COEFFICIENT as LC, branch_cols, \
T_OUT, CP, VINIT_T, FROM_NODE_T, PL, TL, \
JAC_DERIV_DP, JAC_DERIV_DP1, JAC_DERIV_DT, JAC_DERIV_DT1, JAC_DERIV_DT_NODE, JAC_DERIV_DV, \
JAC_DERIV_DV_NODE, LOAD_VEC_BRANCHES, LOAD_VEC_BRANCHES_T, LOAD_VEC_NODES_T
from pandapipes.idx_node import PINIT, HEIGHT, TINIT as TINIT_NODE, PAMB
from pandapipes.pf.derivative_calculation import calc_lambda, calc_der_lambda
from pandapipes.pf.pipeflow_setup import get_table_number, get_lookup
from pandapipes.properties.fluids import get_fluid
from pandapipes.properties.fluids import get_mixture_density, \
get_mixture_viscosity, get_mixture_heat_capacity
from pandapipes.pf.derivative_toolbox import \
get_derivative_density_diff, get_derivative_density_same

try:
import pplog as logging
from pandaplan.core import pplog as logging
except ImportError:
import logging

Expand Down Expand Up @@ -95,10 +89,37 @@ def create_pit_branch_entries(cls, net, branch_pit):
cls.get_connected_node_type().table_name()]
from_nodes = junction_idx_lookup[net[cls.table_name()]["from_junction"].values]
to_nodes = junction_idx_lookup[net[cls.table_name()]["to_junction"].values]
branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (branch_cols - 1))
branch_component_pit[:, VINIT] = 0.1
branch_component_pit[:, :] = np.array([branch_table_nr] + [0] * (net['_idx_branch']['branch_cols'] - 1))
branch_component_pit[:, net['_idx_branch']['VINIT']] = 0.1
return branch_component_pit, node_pit, from_nodes, to_nodes

@classmethod
def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, branch_lookups, node_lookups, options):
if len(net._fluid) != 1:
f, t = branch_lookups[cls.table_name()]
branch_component_pit = branch_pit[f:t, :]
create_v_node(net, branch_pit)
v_from_b = branch_component_pit[:, net['_idx_branch']['V_FROM_NODE']].astype(int)

w = get_lookup(net, 'node', 'w')
w_branch = get_lookup(net, 'branch', 'w')
mf = node_pit[:, w][v_from_b]
branch_component_pit[:, w_branch] = mf

branch_component_pit[:, net['_idx_branch']['RHO']] = \
get_mixture_density(net, branch_component_pit[:, net['_idx_branch']['TINIT']], mf)
branch_component_pit[:, net['_idx_branch']['ETA']] = \
get_mixture_viscosity(net, branch_component_pit[:, net['_idx_branch']['TINIT']], mf)
branch_component_pit[:, net['_idx_branch']['CP']] = \
get_mixture_heat_capacity(net, branch_component_pit[:, net['_idx_branch']['TINIT']], mf)

der_rho_same = get_lookup(net, 'branch', 'deriv_rho_same')
der_rho_diff = get_lookup(net, 'branch', 'deriv_rho_diff')
rho = get_lookup(net, 'branch', 'rho')
rl = branch_component_pit[:, rho]
branch_component_pit[:, der_rho_same] = get_derivative_density_same(mf, rl)
branch_component_pit[:, der_rho_diff] = get_derivative_density_diff(mf, rl)

@classmethod
def calculate_derivatives_thermal(cls, net, branch_pit, node_pit, idx_lookups, options):
"""
Expand All @@ -118,35 +139,33 @@ def calculate_derivatives_thermal(cls, net, branch_pit, node_pit, idx_lookups, o
"""
f, t = idx_lookups[cls.table_name()]
branch_component_pit = branch_pit[f:t, :]
cp = branch_component_pit[:, CP]
rho = branch_component_pit[:, RHO]
v_init = branch_component_pit[:, VINIT_T]
from_nodes = branch_component_pit[:, FROM_NODE_T].astype(np.int32)
t_init_i = node_pit[from_nodes, TINIT_NODE]
t_init_i1 = branch_component_pit[:, T_OUT]
t_amb = branch_component_pit[:, TEXT]
area = branch_component_pit[:, AREA]
length = branch_component_pit[:, LENGTH]
alpha = branch_component_pit[:, ALPHA] * np.pi * branch_component_pit[:, D]
cp = branch_component_pit[:, net['_idx_branch']['CP']]
rho = branch_component_pit[:, net['_idx_branch']['RHO']]
v_init = branch_component_pit[:, net['_idx_branch']['VINIT_T']]
from_nodes = branch_component_pit[:, net['_idx_branch']['FROM_NODE_T']].astype(np.int32)
t_init_i = node_pit[from_nodes, net['_idx_node']['TINIT']]
t_init_i1 = branch_component_pit[:, net['_idx_branch']['T_OUT']]
t_amb = branch_component_pit[:, net['_idx_branch']['TEXT']]
area = branch_component_pit[:, net['_idx_branch']['AREA']]
length = branch_component_pit[:, net['_idx_branch']['LENGTH']]
alpha = branch_component_pit[:, net['_idx_branch']['ALPHA']] * np.pi * branch_component_pit[:,
net['_idx_branch']['D']]
cls.calculate_temperature_lift(net, branch_component_pit, node_pit)
tl = branch_component_pit[:, TL]
qext = branch_component_pit[:, QEXT]
tl = branch_component_pit[:, net['_idx_branch']['TL']]
qext = branch_component_pit[:, net['_idx_branch']['QEXT']]
t_m = (t_init_i1 + t_init_i) / 2

branch_component_pit[:, LOAD_VEC_BRANCHES_T] = \
branch_component_pit[:, net['_idx_branch']['LOAD_VEC_BRANCHES_T']] = \
-(rho * area * cp * v_init * (-t_init_i + t_init_i1 - tl)
- alpha * (t_amb - t_m) * length + qext)

branch_component_pit[:, JAC_DERIV_DT] = - rho * area * cp * v_init + alpha / 2 * length
branch_component_pit[:, JAC_DERIV_DT1] = rho * area * cp * v_init + alpha / 2 * length
branch_component_pit[:, net['_idx_branch']['JAC_DERIV_DT']] = - rho * area * cp * v_init + alpha / 2 * length
branch_component_pit[:, net['_idx_branch']['JAC_DERIV_DT1']] = rho * area * cp * v_init + alpha / 2 * length

branch_component_pit[:, JAC_DERIV_DT_NODE] = rho * v_init * branch_component_pit[:, AREA]
branch_component_pit[:, LOAD_VEC_NODES_T] = rho * v_init * branch_component_pit[:, AREA] \
* t_init_i1

@classmethod
def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, idx_lookups, options):
pass
branch_component_pit[:, net['_idx_branch']['JAC_DERIV_DT_NODE']] = \
rho * v_init * branch_component_pit[:, net['_idx_branch']['AREA']]
branch_component_pit[:, net['_idx_branch']['LOAD_VEC_NODES_T']] = \
rho * v_init * branch_component_pit[:, net['_idx_branch']['AREA']] * t_init_i1

@classmethod
def calculate_temperature_lift(cls, net, branch_pit, node_pit):
Expand All @@ -166,3 +185,16 @@ def calculate_temperature_lift(cls, net, branch_pit, node_pit):
@classmethod
def extract_results(cls, net, options, branch_results, nodes_connected, branches_connected):
raise NotImplementedError


def create_v_node(net, branch_pit):
v = branch_pit[:, net['_idx_branch']['VINIT']]
fn_w = branch_pit[v >= 0, net['_idx_branch']['FROM_NODE']]
tn_w = branch_pit[v < 0, net['_idx_branch']['TO_NODE']]
branch_pit[v >= 0, net['_idx_branch']['V_FROM_NODE']] = fn_w
branch_pit[v < 0, net['_idx_branch']['V_FROM_NODE']] = tn_w

tn_w = branch_pit[v >= 0, net['_idx_branch']['TO_NODE']]
fn_w = branch_pit[v < 0, net['_idx_branch']['FROM_NODE']]
branch_pit[v >= 0, net['_idx_branch']['V_TO_NODE']] = tn_w
branch_pit[v < 0, net['_idx_branch']['V_TO_NODE']] = fn_w
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

import numpy as np
from pandapipes.component_models.abstract_models.branch_models import BranchComponent
from pandapipes.component_models.component_toolbox import set_entry_check_repeat
from pandapipes.idx_branch import ACTIVE
from pandapipes.idx_branch import FROM_NODE, TO_NODE, TINIT, RHO, ETA, \
CP, ELEMENT_IDX
from pandapipes.idx_node import L, node_cols
from pandapipes.idx_node import TINIT as TINIT_NODE

from pandapipes.component_models.abstract_models.branch_models import BranchComponent
from pandapipes.pf.pipeflow_setup import add_table_lookup, get_lookup, get_table_number
from pandapipes.properties.fluids import get_fluid
from pandapipes.properties.fluids import get_fluid, get_mixture_density

try:
import pplog as logging
from pandaplan.core import pplog as logging
except ImportError:
import logging

Expand Down Expand Up @@ -97,7 +93,7 @@ def create_node_lookups(cls, net, ft_lookups, table_lookup, idx_lookups, current
add_table_lookup(table_lookup, cls.internal_node_name(), current_table)
ft_lookups[cls.internal_node_name()] = (current_start, end)
return end, current_table + 1, internal_nodes, internal_pipes, int_nodes_num, \
int_pipes_num
int_pipes_num
else:
return end, current_table + 1, 0, 0, 0, 0

Expand Down Expand Up @@ -142,14 +138,15 @@ def create_pit_node_entries(cls, net, node_pit):
table_nr = get_table_number(table_lookup, cls.internal_node_name())
if table_nr is None:
return None, 0, 0, None, None, None
# TODO: should be from_to_active
ft_lookup = get_lookup(net, "node", "from_to")
f, t = ft_lookup[cls.internal_node_name()]

int_node_pit = node_pit[f:t, :]
int_node_pit[:, :] = np.array([table_nr, 0, L] + [0] * (node_cols - 3))
int_node_pit[:, :] = np.array([table_nr, 0, net['_idx_node']['L']] + [0] * (net['_idx_node']['node_cols'] - 3))
int_node_number = cls.get_internal_pipe_number(net) - 1

int_node_pit[:, ELEMENT_IDX] = np.arange(t - f)
int_node_pit[:, net['_idx_node']['ELEMENT_IDX']] = np.arange(t - f)

junction_table_name = cls.get_connected_node_type().table_name()
fj_name, tj_name = "from_" + junction_table_name, "to_" + junction_table_name
Expand Down Expand Up @@ -191,22 +188,42 @@ def create_pit_branch_entries(cls, net, branch_pit):
to_nodes = np.insert(to_nodes, insert_places, pipe_nodes_idx)

set_entry_check_repeat(
branch_w_internals_pit, ELEMENT_IDX, net[cls.table_name()].index.values,
branch_w_internals_pit, net['_idx_branch']['ELEMENT_IDX'], net[cls.table_name()].index.values,
internal_pipe_number, has_internals)
set_entry_check_repeat(
branch_w_internals_pit, ACTIVE, net[cls.table_name()][cls.active_identifier()].values,
branch_w_internals_pit, net['_idx_branch']['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[:, TO_NODE] = to_nodes
branch_w_internals_pit[:, TINIT] = (node_pit[from_nodes, TINIT_NODE] + node_pit[
to_nodes, TINIT_NODE]) / 2
fluid = get_fluid(net)
branch_w_internals_pit[:, RHO] = fluid.get_density(branch_w_internals_pit[:, TINIT])
branch_w_internals_pit[:, ETA] = fluid.get_viscosity(branch_w_internals_pit[:, TINIT])
branch_w_internals_pit[:, CP] = fluid.get_heat_capacity(branch_w_internals_pit[:, TINIT])
branch_w_internals_pit[:, net['_idx_branch']['FROM_NODE']] = from_nodes
branch_w_internals_pit[:, net['_idx_branch']['TO_NODE']] = to_nodes
branch_w_internals_pit[:, net['_idx_branch']['TINIT']] = \
(node_pit[from_nodes, net['_idx_node']['TINIT']] + node_pit[to_nodes, net['_idx_node']['TINIT']]) / 2

if len(net._fluid) == 1:
branch_w_internals_pit[:, net['_idx_branch']['RHO']] = \
get_fluid(net, net._fluid[0]).get_density(branch_w_internals_pit[:, net['_idx_branch']['TINIT']])
branch_w_internals_pit[:, net['_idx_branch']['ETA']] = \
get_fluid(net, net._fluid[0]).get_viscosity(branch_w_internals_pit[:, net['_idx_branch']['TINIT']])
branch_w_internals_pit[:, net['_idx_branch']['CP']] = \
get_fluid(net, net._fluid[0]).get_heat_capacity(branch_w_internals_pit[:, net['_idx_branch']['TINIT']])
else:
for fluid in net._fluid:
branch_w_internals_pit[:, net['_idx_branch'][fluid + '_RHO']] = \
get_fluid(net, fluid).get_density(branch_w_internals_pit[:, net['_idx_branch']['TINIT']])

return branch_w_internals_pit, internal_pipe_number

@classmethod
def adaption_before_derivatives_hydraulic(cls, net, branch_pit, node_pit, branch_lookups, node_lookups, options):
super().adaption_before_derivatives_hydraulic(net, branch_pit, node_pit, branch_lookups, node_lookups, options)
internal_nodes = cls.get_internal_pipe_number(net) - 1
if len(net._fluid) != 1 and np.any(internal_nodes) > 0:
f, t = node_lookups[cls.internal_node_name()]
junction_pit = node_pit[f:t, :]
w = get_lookup(net, 'node', 'w')
mass_fraction = junction_pit[:, w]
junction_pit[:, net['_idx_node']['RHO']] = \
get_mixture_density(net, junction_pit[:, net['_idx_node']['TINIT']], mass_fraction=mass_fraction)

@classmethod
def get_internal_pipe_number(cls, net):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

from pandapipes.component_models.abstract_models.branch_models import BranchComponent

from pandapipes.idx_branch import FROM_NODE, TO_NODE, TINIT, ELEMENT_IDX, RHO, ETA, CP, 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 pplog as logging
from pandaplan.core import pplog as logging
except ImportError:
import logging

Expand Down Expand Up @@ -79,16 +76,23 @@ def create_pit_branch_entries(cls, net, branch_pit):
"""
branch_wo_internals_pit, node_pit, from_nodes, to_nodes \
= 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[:, TO_NODE] = to_nodes
branch_wo_internals_pit[:, TINIT] = (node_pit[from_nodes, TINIT_NODE]
+ node_pit[to_nodes, TINIT_NODE]) / 2
fluid = get_fluid(net)
branch_wo_internals_pit[:, RHO] = fluid.get_density(branch_wo_internals_pit[:, TINIT])
branch_wo_internals_pit[:, ETA] = fluid.get_viscosity(branch_wo_internals_pit[:, TINIT])
branch_wo_internals_pit[:, CP] = fluid.get_heat_capacity(branch_wo_internals_pit[:, TINIT])
branch_wo_internals_pit[:, ACTIVE] = net[cls.table_name()][cls.active_identifier()].values
branch_wo_internals_pit[:, net['_idx_branch']['ELEMENT_IDX']] = net[cls.table_name()].index.values
branch_wo_internals_pit[:, net['_idx_branch']['FROM_NODE']] = from_nodes
branch_wo_internals_pit[:, net['_idx_branch']['TO_NODE']] = to_nodes
branch_wo_internals_pit[:, net['_idx_branch']['TINIT']] = (node_pit[from_nodes, net['_idx_node']['TINIT']]
+ node_pit[to_nodes, net['_idx_node']['TINIT']]) / 2
branch_wo_internals_pit[:, net['_idx_branch']['ACTIVE']] = net[cls.table_name()][cls.active_identifier()].values
if len(net._fluid) == 1:
branch_wo_internals_pit[:, net['_idx_branch']['RHO']] = \
get_fluid(net, net._fluid[0]).get_density(branch_wo_internals_pit[:, net['_idx_branch']['TINIT']])
branch_wo_internals_pit[:, net['_idx_branch']['ETA']] = \
get_fluid(net, net._fluid[0]).get_viscosity(branch_wo_internals_pit[:, net['_idx_branch']['TINIT']])
branch_wo_internals_pit[:, net['_idx_branch']['CP']] = \
get_fluid(net, net._fluid[0]).get_heat_capacity(branch_wo_internals_pit[:, net['_idx_branch']['TINIT']])
else:
for fluid in net._fluid:
branch_wo_internals_pit[:, net['_idx_branch'][fluid + '_RHO']] = \
get_fluid(net, fluid).get_density(branch_wo_internals_pit[:, net['_idx_branch']['TINIT']])
return branch_wo_internals_pit

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

from pandapipes.component_models.abstract_models.branch_wo_internals_models import \
BranchWOInternalsComponent
from pandapipes.idx_branch import LENGTH, K

try:
import pplog as logging
from pandaplan.core import pplog as logging
except ImportError:
import logging

Expand Down Expand Up @@ -56,8 +55,8 @@ def create_pit_branch_entries(cls, net, branch_pit):
"""
branch_wizerolength_pit = \
super().create_pit_branch_entries(net, branch_pit)
branch_wizerolength_pit[:, LENGTH] = 0
branch_wizerolength_pit[:, K] = 1000
branch_wizerolength_pit[:, net['_idx_branch']['LENGTH']] = 0
branch_wizerolength_pit[:, net['_idx_branch']['K']] = 1000
return branch_wizerolength_pit

@classmethod
Expand Down
Loading