def char_map_eta_s_func_doc(self, label): r""" Get LaTeX equation for isentropic efficiency from characteristic map. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' r'X = &\sqrt{\frac{T_\mathrm{in,design}}{T_\mathrm{in}}}\\' '\n' r'Y = &\frac{\dot{m}_\mathrm{in} \cdot p_\mathrm{in,design}}' r'{\dot{m}_\mathrm{in,design} \cdot p_\mathrm{in} \cdot X}\\' '\n' r'\vec{Y} = &f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)' r'\\' + '\n' r'\vec{Z} = &' r'f\left(X,Y\right)\cdot\left(1-\frac{igva^2}{10000}\right)\\' '\n' r'0 = &\frac{\eta_\mathrm{s}}{\eta_\mathrm{s,design}} -' r'f\left(Y,\vec{Y},\vec{Z}\right)' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def darcy_func_doc(self, label): r""" Equation for pressure drop calculation from darcy friction factor. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0 = &p_\mathrm{in}-p_\mathrm{out}-' r'\frac{8\cdot|\dot{m}_\mathrm{in}| \cdot\dot{m}_\mathrm{in}' r'\cdot \frac{v_\mathrm{in}+v_\mathrm{out}}{2} \cdot L \cdot' r'\lambda\left(Re, ks, D\right)}{\pi^2 \cdot D^5}\\' + '\n' r'Re =&\frac{4 \cdot |\dot{m}_\mathrm{in}|}{\pi \cdot D \cdot' r'\frac{\eta_\mathrm{in}+\eta_\mathrm{out}}{2}}\\' + '\n' r'\end{split}' ) return generate_latex_eq(self, latex, label)
def dp_char_func_doc(self, label): r""" Equation for characteristic line of difference pressure to mass flow. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ p = self.dp_char.param expr = self.get_char_expr_doc(p, **self.dp_char.char_params) if not expr: msg = ('Please choose a valid parameter, you want to link the ' 'pressure drop to at component ' + self.label + '.') logging.error(msg) raise ValueError(msg) latex = ( r'0=p_\mathrm{in}-p_\mathrm{out}-f\left(' + expr + r'\right)') return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Equation for heat exchanger energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0 = &' + '\n' r'\dot{m}_\mathrm{in,1}\cdot\left(h_\mathrm{out,1}-' r'h_\mathrm{in,1}\right) \\' + '\n' r'&+ \dot{m}_\mathrm{in,2} \cdot \left(h_\mathrm{out,2} - ' r'h_\mathrm{in,2} \right)\\' + '\n' r'&+ \dot{m}_\mathrm{in,3} \cdot \left(h_\mathrm{out,3} - ' r'h_\mathrm{in,3} \right)' + '\n' r'\end{split}') return generate_latex_eq(self, latex, latex)
def energy_group_func_doc(self, label): r""" Equation for solar collector energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0 = & \dot{m}_\mathrm{in} \cdot \left( h_\mathrm{out} - ' r'h_\mathrm{in} \right)\\' + '\n' r'& - A \cdot \left[E \cdot \eta_\mathrm{opt} - \alpha_1 \cdot' r'\left(T_\mathrm{m} - T_\mathrm{amb} \right) - \alpha_2 \cdot' r'\left(T_\mathrm{m} -T_\mathrm{amb}\right)^2 \right]\\' + '\n' r'T_\mathrm{m}=&\frac{T_\mathrm{out}+T_\mathrm{in}}{2}\\' + '\n' r'\end{split}' ) return generate_latex_eq(self, latex, label)
def energy_group_func_doc(self, label): r""" Equation for solar collector energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'\begin{split}' + '\n' r'0 = & \dot{m}_\mathrm{in} \cdot \left( h_\mathrm{out} - ' r'h_\mathrm{in} \right)\\' + '\n' r'& - A \cdot \left[E \cdot \eta_\mathrm{opt} \cdot doc^{1.5}' r'\cdot iam \right. \\' + '\n' r'&\left. -c_1\cdot\left(T_\mathrm{m}-T_\mathrm{amb}\right) -' r'c_2 \cdot \left(T_\mathrm{m} - T_\mathrm{amb}\right)^2' r'\vphantom{\eta_\mathrm{opt}\cdot doc^{1.5}}\right]\\' + '\n' r'T_\mathrm{m}=&\frac{T_\mathrm{out}+T_\mathrm{in}}{2}\\' + '\n' r'iam = & 1 - iam_1 \cdot |aoi| - iam_2 \cdot aoi^2\\' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Calculate the residual in energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'\begin{split}' + '\n' r'0=&P + \dot{m}_\mathrm{in,2}\cdot\left(h_\mathrm{in,2}-' r'h_\mathrm{in,2,ref}\right)\\' + '\n' r'&-\dot{m}_\mathrm{in,1}\cdot\left( h_\mathrm{out,1} -' r'h_\mathrm{in,1} \right)\\' + '\n' r'& - \dot{m}_\mathrm{out,2} \cdot \left( h_\mathrm{out,2} -' r'h_\mathrm{out,2,ref} \right)\\' + '\n' r'& + \dot{m}_\mathrm{out,3} \cdot \left( h_\mathrm{out,3} -' r'h_\mathrm{out,3,ref} + e_0\right)\\' + '\n' r'&p_\mathrm{ref}=\unit[1]{bar},' r'\;T_\mathrm{ref}=\unit[25]{^\circ C}\\' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def combustion_pressure_func_doc(self, label): r""" Equations for reactor pressure balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ inl = self.inl[::-1][:2][::-1] outl = self.outl[::-1][0] idx_out = outl.source_id[:3] + ',' + outl.source_id[3:] idx_in1 = inl[0].target_id[:2] + ',' + inl[0].target_id[2:] idx_in2 = inl[1].target_id[:2] + ',' + inl[1].target_id[2:] latex = (r'\begin{split}' + '\n' r'0 = & p_\mathrm{' + idx_in1 + r'} - p_\mathrm{' + idx_out + r'}\\' + '\n' r'0 = & p_\mathrm{' + idx_in1 + r'} - p_\mathrm{' + idx_in2 + r'}\\' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Calculate the energy balance of the adiabatic combustion chamber. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0 = & \sum_i \dot{m}_{\mathrm{in,}i} \cdot\left( ' r'h_{\mathrm{in,}i} - h_{\mathrm{in,}i\mathrm{,ref}} \right) -' r'\dot{m}_\mathrm{out,1}\cdot\left( h_\mathrm{out,1}' r' - h_\mathrm{out,1,ref}\right)\\' + '\n' r'& + LHV_{fuel} \cdot \left(\sum_i \dot{m}_{\mathrm{in,}i} ' r'\cdot x_{fuel\mathrm{,in,}i} - \dot{m}_\mathrm{out,1} ' r'\cdot x_{fuel\mathrm{,out,1}} \right)\\' + '\n' r'& \forall i \in \text{inlets}\\' r'& T_\mathrm{ref}=\unit[298.15]{K}' r'\;p_\mathrm{ref}=\unit[10^5]{Pa}\\' '\n' + r'\end{split}') return generate_latex_eq(self, latex, label)
def zeta_func_doc(self, label, zeta='', inconn=0, outconn=0): r""" Calculate residual value of :math:`\zeta`-function. Parameters ---------- zeta : str Component parameter to evaluate the zeta_func on, e.g. :code:`zeta1`. inconn : int Connection index of inlet. outconn : int Connection index of outlet. Returns ------- residual : float Residual value of function. """ inl = r'_\mathrm{in,' + str(inconn + 1) + r'}' outl = r'_\mathrm{out,' + str(outconn + 1) + r'}' latex = ( r'0 = \begin{cases}' + '\n' + r'p' + inl + r'- p' + outl + r' & |\dot{m}' + inl + r'| < \unitfrac[0.0001]{kg}{s} \\' + '\n' + r'\frac{\zeta}{D^4}-\frac{(p' + inl + r'-p' + outl + r')' r'\cdot\pi^2}{8\cdot\dot{m}' + inl + r'\cdot|\dot{m}' + inl + r'|\cdot\frac{v' + inl + r' + v' + outl + r'}{2}}' + r'& |\dot{m}' + inl + r'| \geq \unitfrac[0.0001]{kg}{s}' + '\n' r'\end{cases}' ) return generate_latex_eq(self, latex, label)
def eta_char_func_doc(self, label): r""" Equation for given efficiency characteristic of a water electrolyzer. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ p = self.eta_char.param expr = self.get_char_expr_doc(p, **self.eta_char.char_params) if not expr: msg = ('Please choose a valid parameter, you want to link the ' 'efficiency to at component ' + self.label + '.') logging.error(msg) raise ValueError(msg) latex = (r'0=P-\dot{m}_\mathrm{H_2,out,3}\cdot\frac{e_0}' r'{\eta_\mathrm{design}\cdot f\left(X\right)}') return generate_latex_eq(self, latex, label)
def pr_func_doc(self, label, pr='', inconn=0, outconn=0): r""" Calculate residual value of pressure ratio function. Parameters ---------- pr : str Component parameter to evaluate the pr_func on, e.g. :code:`pr1`. inconn : int Connection index of inlet. outconn : int Connection index of outlet. Returns ------- residual : float Residual value of function. """ latex = ( r'0=p_\mathrm{in,' + str(inconn + 1) + r'}\cdot ' + pr + r' - p_\mathrm{out,' + str(outconn + 1) + r'}' ) return generate_latex_eq(self, latex, label)
def fluid_func_doc(self, label): r""" Equations for fluid composition. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'\begin{split}' + '\n' r'0 = &x_\mathrm{i,in,1} - x_\mathrm{i,out,1}\\' + '\n' r'0 = &\begin{cases}' + '\n' r'1 - x_\mathrm{i,in2} & \text{i=}H_{2}O\\' + '\n' r'x_\mathrm{i,in2} & \text{else}\\' + '\n' r'\end{cases}\\' + '\n' r'0 =&\begin{cases}' + '\n' r'1 - x_\mathrm{i,out,2} & \text{i=}O_{2}\\' + '\n' r'x_\mathrm{i,out,2} & \text{else}\\' + '\n' r'\end{cases}\\' + '\n' r'0 =&\begin{cases}' + '\n' r'1 - x_\mathrm{i,out,3} & \text{i=}H_{2}\\' + '\n' r'x_\mathrm{i,out,3} & \text{else}\\' + '\n' r'\end{cases}\\' + '\n' r'&\forall i \in \text{network fluids}' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def kA_char_func_doc(self, label): r""" Calculate heat transfer from heat transfer coefficient characteristic. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0 = & \dot{m}_\mathrm{in,1} \cdot \left( h_\mathrm{out,1} - ' r'h_\mathrm{in,1}\right)\\' + '\n' r'&+kA_\mathrm{design} \cdot ' r'f_\mathrm{kA} \cdot \frac{T_\mathrm{out,1} - T_\mathrm{in,2}' r' - T_\mathrm{in,1} + T_\mathrm{out,2}}{\ln{' r'\frac{T_\mathrm{out,1} - T_\mathrm{in,2}}{T_\mathrm{in,1} -' r' T_\mathrm{out,2}}}}\\' + '\n' r'f_\mathrm{kA}=&\frac{2}{\frac{1}{f\left(X_1\right)}+' r'\frac{1}{f\left(X_2\right)}}\\' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def kA_char_group_func_doc(self, label): r""" Calculate heat transfer from heat transfer coefficient characteristic. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = ( r'\begin{split}' + '\n' r'0=&\dot{m}_\mathrm{in}\cdot\left(h_\mathrm{out}-' r'h_\mathrm{in}\right)+kA_\mathrm{design} \cdot f_\mathrm{kA}' r' \cdot \Delta T_\mathrm{log}\\' + '\n' r'\Delta T_\mathrm{log} = &\begin{cases}' + '\n' r'\frac{T_\mathrm{in}-T_\mathrm{out}}{\ln{\frac{T_\mathrm{in}-' r'T_\mathrm{amb}}{T_\mathrm{out}-T_\mathrm{amb}}}} &' r' T_\mathrm{in} > T_\mathrm{out} \\' + '\n' r'\frac{T_\mathrm{out}-T_\mathrm{in}}{\ln{\frac{' r'T_\mathrm{out}-T_\mathrm{amb}}{T_\mathrm{in}-' r'T_\mathrm{amb}}}} & T_\mathrm{in} < T_\mathrm{out}\\' + '\n' r'0 & T_\mathrm{in} = T_\mathrm{out}' + '\n' r'\end{cases}\\' + '\n' r'f_{kA}=&\frac{2}{1 + \frac{1}{f\left(X\right)}}\\' + '\n' r'T_\mathrm{amb} =& \text{ambient temperature}' + '\n' r'\end{split}') return generate_latex_eq(self, latex, label)
def overheating_func_doc(self, label): r""" Equation for cold side outlet state. Parameters ---------- label : str Label for equation. """ latex = r'0=h_\mathrm{out,3} -h\left(p_\mathrm{out,3}, x=1 \right)' return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Calculate energy balance. Parameters ---------- label : str Label for equation. """ latex = r'0=h_{in}-h_{\mathrm{out,}j}\;\forall j \in\text{outlets}' return generate_latex_eq(self, latex, label)
def flow_char_func_doc(self, label): r""" Equation for given flow characteristic of a pump. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0=p_\mathrm{out}-p_\mathrm{in}-f\left(X\right)') return generate_latex_eq(self, latex, label)
def subcooling_func_doc(self, label): r""" Equation for steam side outlet state. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0=h_\mathrm{out,1} -h\left(p_\mathrm{out,1}, x=0 \right)' return generate_latex_eq(self, latex, label)
def saturated_gas_func_doc(self, label): r""" Calculate hot side outlet state. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0=h_\mathrm{out,1}-h\left(p_\mathrm{out,1}, x=1 \right)' return generate_latex_eq(self, latex, label)
def specific_energy_consumption_func_doc(self, label): r""" Equation for specific energy consumption. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0=P - \dot{m}_\mathrm{H_2,out3} \cdot e' return generate_latex_eq(self, latex, label)
def eta_func_doc(self, label): r""" Equation for electrolysis efficiency. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0 = P \cdot \eta - \dot{m}_\mathrm{H_2,out,3} \cdot e_0' return generate_latex_eq(self, latex, label)
def gas_temperature_func_doc(self, label): r""" Equation for temperature equality of product gases. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0 = T_\mathrm{out,2} - T_\mathrm{out,3}' return generate_latex_eq(self, latex, label)
def ttd_l_func_doc(self, label): r""" Equation for upper terminal temperature difference. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = r'0 = ttd_\mathrm{l} - T_\mathrm{out,1} + T_\mathrm{in,2}' return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Equation for pressure drop calculation. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0 = \dot{m}_\mathrm{in} \cdot \left(h_\mathrm{out} - ' r'h_\mathrm{in} \right) -\dot{Q}') return generate_latex_eq(self, latex, label)
def energy_balance_func_doc(self, label): r""" Calculate energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0= T_\mathrm{in} - T_{\mathrm{out,}j}' r'\; \forall j \in \text{outlets}') return generate_latex_eq(self, latex, label)
def mass_flow_func_doc(self, label): r""" Calculate the residual value for component's mass flow balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0=\dot{m}_\mathrm{in,1} + \dot{m}_\mathrm{in,2} - ' r'\dot{m}_\mathrm{out,1}') return generate_latex_eq(self, latex, label)
def eta_s_func_doc(self, label): r""" Equation for given isentropic efficiency of a turbine. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0=-\left(h_\mathrm{out}-h_\mathrm{in}\right)+\left(' r'h_\mathrm{out,s}-h_\mathrm{in}\right)\cdot\eta_\mathrm{s}') return generate_latex_eq(self, latex, label)
def heat_func_doc(self, label): r""" Equation for heat output. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0=\dot{Q}-\dot{m}_\mathrm{in,1}\cdot\left(h_\mathrm{in,1}-' r'h_\mathrm{out,1}\right)') return generate_latex_eq(self, latex, label)
def energy_balance_hot_func_doc(self, label): r""" Equation for hot side heat exchanger energy balance. Parameters ---------- label : str Label for equation. Returns ------- latex : str LaTeX code of equations applied. """ latex = (r'0 =\dot{m}_{in,1} \cdot \left(h_{out,1}-' r'h_{in,1}\right)-\dot{Q}') return generate_latex_eq(self, latex, label)