Skip to content

Commit

Permalink
more adjustments to printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
fwitte committed Aug 28, 2018
1 parent cbbc1a1 commit b2c0897
Showing 1 changed file with 31 additions and 113 deletions.
144 changes: 31 additions & 113 deletions tespy/components/components.py
Expand Up @@ -308,9 +308,6 @@ def initialise_target(self, c, key):
def calc_parameters(self, nw, mode):
return

def print_parameters(self, nw):
return

def initialise_fluids(self, nw):
return

Expand Down Expand Up @@ -1073,14 +1070,6 @@ def calc_parameters(self, nw, mode):
s_mix_ph(self.outl[0].to_flow()) -
s_mix_ph(self.inl[0].to_flow()))

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('P = ', self.P.val, 'W; '
'eta_s = ', self.eta_s.val, '; '
'pr = ', self.pr.val, '; '
'Sirr = ', self.Sirr.val, '; ')

# %%


Expand Down Expand Up @@ -1819,34 +1808,34 @@ def calc_parameters(self, nw, mode):
# print('Creating characteristics for component ', self)
# self.char_map.func = cmp_char.compressor()

def print_parameters(self, nw):

turbomachine.print_parameters(self, nw)

i1 = self.inl[0].to_flow()
o1 = self.outl[0].to_flow()

if self.char_map.is_set:
n = math.sqrt(T_mix_ph(self.i0)) / math.sqrt(T_mix_ph(i1))
m = (
(i1[0] * math.sqrt(T_mix_ph(i1)) / i1[1]) /
(self.i0[0] * math.sqrt(T_mix_ph(self.i0)) / self.i0[1])
)
vigv = self.char_map.func.get_vigv(n, m, (o1[1] * self.i0[1]) /
(i1[1] * self.o0[1]))
if abs(self.vigv.val - vigv) > err and nw.compwarn:
msg = ('##### WARNING #####\n'
'Selected inlet guide vane angle is not feasible.')
if self.vigv.val > vigv:
msg += ('calculated maximum angle: ' + str(vigv) +
' selected: ' + str(self.vigv.val))
else:
msg += ('calculated minimum angle: ' + str(vigv) +
' selected: ' + str(self.vigv.val))
print(msg)

else:
print('vigv =', self.vigv.val)
# def print_parameters(self, nw):
#
# turbomachine.print_parameters(self, nw)
#
# i1 = self.inl[0].to_flow()
# o1 = self.outl[0].to_flow()
#
# if self.char_map.is_set:
# n = math.sqrt(T_mix_ph(self.i0)) / math.sqrt(T_mix_ph(i1))
# m = (
# (i1[0] * math.sqrt(T_mix_ph(i1)) / i1[1]) /
# (self.i0[0] * math.sqrt(T_mix_ph(self.i0)) / self.i0[1])
# )
# vigv = self.char_map.func.get_vigv(n, m, (o1[1] * self.i0[1]) /
# (i1[1] * self.o0[1]))
# if abs(self.vigv.val - vigv) > err and nw.compwarn:
# msg = ('##### WARNING #####\n'
# 'Selected inlet guide vane angle is not feasible.')
# if self.vigv.val > vigv:
# msg += ('calculated maximum angle: ' + str(vigv) +
# ' selected: ' + str(self.vigv.val))
# else:
# msg += ('calculated minimum angle: ' + str(vigv) +
# ' selected: ' + str(self.vigv.val))
# print(msg)
#
# else:
# print('vigv =', self.vigv.val)

# %%

Expand Down Expand Up @@ -2416,21 +2405,7 @@ def initialise_target(self, c, key):
else:
return 0

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('m_in = ', self.inl[0].m.val_SI, 'kg / s; ')
i = 1
for o in self.outl:
print('m_out' + str(i) + ' = ', o.m.val_SI, 'kg / s; ')
i += 1
if isinstance(self, separator):
print('; fluid_in:', self.inl[0].fluid.val, '; ')
i = 1
for o in self.outl:
print('fluid_out' + str(i) + ' = ', o.fluid.val)
i += 1

# %%

class splitter(split):
"""
Expand All @@ -2456,6 +2431,8 @@ class splitter(split):
def component(self):
return 'splitter'

# %%


class separator(split):
"""
Expand Down Expand Up @@ -2666,15 +2643,6 @@ def initialise_target(self, c, key):
else:
return 0

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
j = 1
for i in self.inl:
print('m_in' + str(j) + ' = ', i.m.val_SI, 'kg / s; ')
j += 1
print('m_out = ', self.outl[0].m.val_SI, 'kg / s; ')

# %%


Expand Down Expand Up @@ -3446,18 +3414,6 @@ def calc_parameters(self, nw, mode):
self.lamb.val = n_oxygen / (n_fuel *
(self.n['C'] + self.n['H'] / 4))

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('thermal input = ', self.ti.val,
'lambda = ', self.lamb.val,
'S = ', self.S.val)
j = 1
for i in self.inl:
print('m_in' + str(j) + ' = ', i.m.val_SI, 'kg / s; ')
j += 1
print('m_out = ', self.outl[0].m.val_SI, 'kg / s; ')

# %%


Expand Down Expand Up @@ -4333,13 +4289,6 @@ def calc_parameters(self, nw, mode):
s_mix_ph(self.outl[0].to_flow()) -
s_mix_ph(self.inl[0].to_flow()))

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('pr = ', self.pr.val, '; '
'zeta = ', self.zeta.val, 'kg / m^4 * s ; '
'Sirr = ', self.Sirr.val, 'W / K')

# %%


Expand Down Expand Up @@ -4475,10 +4424,6 @@ def attr(self):
'SQ1': dc_cp(), 'SQ2': dc_cp(), 'Sirr': dc_cp(),
'hydro_group': dc_gcp(), 'kA_group': dc_gcp()}

def printouts(self):
return ['Q', 'pr', 'zeta', 'D', 'L', 'ks',
'kA', 'SQ1', 'SQ2', 'Sirr']

def default_design(self):
return ['pr']

Expand Down Expand Up @@ -5282,17 +5227,6 @@ def calc_parameters(self, nw, mode):
(v_mix_ph(self.inl[0].to_flow()) +
v_mix_ph(self.outl[0].to_flow())) / 2))

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('Q = ', self.Q.val, 'W; '
'pr = ', self.pr.val, '; '
'zeta = ', self.zeta.val, 'kg / m^4 * s; '
'SQ = ', self.SQ.val, 'W / K; ')
if self.energy_group.is_set:
print('E = ', self.E.val, 'W / m^2; '
'A = ', self.A.val, 'm^2')

# %%


Expand Down Expand Up @@ -6057,22 +5991,6 @@ def calc_parameters(self, nw, mode):
print(msg)
nw.errors += [self]

def print_parameters(self, nw):

print('##### ', self.label, ' #####')
print('Q = ', self.Q.val, 'W; '
'ttd_u = ', self.ttd_u.val, 'K; '
'ttd_l = ', self.ttd_l.val, 'K; '
'td_log = ', self.td_log.val, 'K; '
'kA = ', self.kA.val, 'W / K; '
'pr1 = ', self.pr1.val, '; '
'pr2 = ', self.pr2.val, '; '
'zeta1 = ', self.zeta1.val, '; '
'zeta2 = ', self.zeta2.val, '; '
'SQ1 = ', self.SQ1.val, 'W / K; '
'SQ2 = ', self.SQ2.val, 'W / K; '
'Sirr = ', self.Sirr.val, 'W / K; ')

# %%


Expand Down

0 comments on commit b2c0897

Please sign in to comment.