# Path: proptools/turbopump.py
# def pump_power(dp, m_dot, rho, eta):
# def turbine_enthalpy(p_o, p_e, T_o, gamma, c_p):
# def turbine_spout_velocity(p_o, p_e, T_o, gamma, c_p):
# def trubine_power(p_o, p_e, m_dot, T_o, eta, gamma, c_p):
# def turbine_exit_temperature(p_o, p_te, T_o, eta, gamma, c_p):
# def gg_dump_isp(p_o, p_te, p_ne, T_o, eta, gamma, c_p, m_molar):
# def m_dot2gpm(m_dot, rho):
# def gpm2m_dot(gpm, rho):
# def dp2head(dp, rho):
# def radsec2rpm(radsec):
# def rpm2radsec(rpm):
# def pump_specific_speed_us(dp, m_dot, rho, N):
# def pump_efficiency(dp, m_dot, rho, N):
# def pump_efficiency_demo():
# def ssi_turbine_efficiency(uco):
# def turbine_efficiency_demo():
#     Q = m_dot2gpm(m_dot, rho)
#     H = dp2head(dp, rho)
#     Q = m_dot2gpm(m_dot, rho)
#     N = rpm2radsec(np.linspace(10e3, 400e3))


import unittest
from proptools import turbopump

class TestStringMethods(unittest.TestCase):

    def test_m_dot2gpm(self):
        # 100 kg s**-1, 1000 kg m**-3 --> 1584 gal min**-1
        self.assertAlmostEqual(1584, turbopump.m_dot2gpm(100, 1000), delta=2)


    def test_gpm_m_dot_inverse(self):
        for m_dot in [1, 100, 1000, 2434]:
            for rho in [1, 100, 1000, 2000]:
                self.assertAlmostEqual(m_dot, turbopump.gpm2m_dot(
                    turbopump.m_dot2gpm(m_dot, rho), rho))


    def test_rpm_radsec_inverse(self):
        for rpm in [1, 1e3, 1e6]:
            self.assertAlmostEqual(rpm, turbopump.radsec2rpm(
                turbopump.rpm2radsec(rpm)))

    def test_sample61(self):
        # Check against sample problem 6-1 from Huzel and Huang.
        rho_ox = 1143 # 71.38 lbm ft**-3
        rho_fuel = 808.1 # 50.45 lbm ft**-3
        dp_ox = 9.997e6 # 1450 psi
        dp_fuel = 11.55e6 # 1675 psi
        m_dot_ox = 894 # 1971 lbm s**-1
        m_dot_fuel = 405 # 892 lbm s**-1

# Path: proptools/turbopump.py
# def pump_power(dp, m_dot, rho, eta):
# def turbine_enthalpy(p_o, p_e, T_o, gamma, c_p):
# def turbine_spout_velocity(p_o, p_e, T_o, gamma, c_p):
# def trubine_power(p_o, p_e, m_dot, T_o, eta, gamma, c_p):
# def turbine_exit_temperature(p_o, p_te, T_o, eta, gamma, c_p):
# def gg_dump_isp(p_o, p_te, p_ne, T_o, eta, gamma, c_p, m_molar):
# def m_dot2gpm(m_dot, rho):
# def gpm2m_dot(gpm, rho):
# def dp2head(dp, rho):
# def radsec2rpm(radsec):
# def rpm2radsec(rpm):
# def pump_specific_speed_us(dp, m_dot, rho, N):
# def pump_efficiency(dp, m_dot, rho, N):
# def pump_efficiency_demo():
# def ssi_turbine_efficiency(uco):
# def turbine_efficiency_demo():
#     Q = m_dot2gpm(m_dot, rho)
#     H = dp2head(dp, rho)
#     Q = m_dot2gpm(m_dot, rho)
#     N = rpm2radsec(np.linspace(10e3, 400e3))


# Path: proptools/turbopump_test.py
import unittest
from proptools import turbopump


class TestStringMethods(unittest.TestCase):

    def test_m_dot2gpm(self):
        # 100 kg s**-1, 1000 kg m**-3 --> 1584 gal min**-1
        self.assertAlmostEqual(1584, turbopump.m_dot2gpm(100, 1000), delta=2)


    def test_gpm_m_dot_inverse(self):
        for m_dot in [1, 100, 1000, 2434]:
            for rho in [1, 100, 1000, 2000]:
                self.assertAlmostEqual(m_dot, turbopump.gpm2m_dot(
                    turbopump.m_dot2gpm(m_dot, rho), rho))


    def test_rpm_radsec_inverse(self):
        for rpm in [1, 1e3, 1e6]:
            self.assertAlmostEqual(rpm, turbopump.radsec2rpm(
                turbopump.rpm2radsec(rpm)))

    def test_sample61(self):
        # Check against sample problem 6-1 from Huzel and Huang.
        rho_ox = 1143 # 71.38 lbm ft**-3
        rho_fuel = 808.1 # 50.45 lbm ft**-3
        dp_ox = 9.997e6 # 1450 psi
        dp_fuel = 11.55e6 # 1675 psi
        m_dot_ox = 894 # 1971 lbm s**-1
        m_dot_fuel = 405 # 892 lbm s**-1

        N = turbopump.rpm2radsec(7000)