Exemple #1
0
def test_limit_input3():
    Beam = LPP / L_div_B
    DRAFT = Beam / BD

    lBK = LPP * 0.30
    bBK = Beam * 0.002
    OMEGA = OMEGAHAT / (np.sqrt(Beam / 2 / 9.81))
    OG = DRAFT * 0.25

    with pytest.raises(SimplifiedIkedaInputError):

        calculate_roll_damping(LPP, Beam, CB, CMID, OG, PHI, lBK, bBK, OMEGA,
                               DRAFT)

    calculate_roll_damping(LPP,
                           Beam,
                           CB,
                           CMID,
                           OG,
                           PHI,
                           lBK,
                           bBK,
                           OMEGA,
                           DRAFT,
                           limit_inputs=True)
Exemple #2
0
def test_peter_piehl_implementation():
    np.random.seed(seed=1)

    ikeda = rolldecayestimators.ikeda_simple.Ikeda()  # Peter Piehl

    for i in range(1000):
        r = random_values()
        B44HAT, BFHAT, BWHAT, BEHAT, BBKHAT, BLHAT = calculate_roll_damping(
            **r)

        # Peter Piehl:

        r2 = {}
        r2['CMID'] = r['CMID']
        r2['TW'] = (2 * np.pi) / r['OMEGA']
        r2['LPP'] = r['LPP']
        r2['BRTH'] = r['Beam']
        r2['DRAFT'] = r['DRAFT']
        r2['CB'] = r['CB']
        r2['OG'] = r['OG']
        r2['PHI'] = r['PHI']
        r2['BKCOMP'] = (r['BKL'] > 0)
        r2['BKL'] = r['BKL']
        r2['BKB'] = r['BKB']

        ikeda.setPara(r2)
        ikeda.ikedaMethod()

        assert_almost_equal(B44HAT, ikeda.B44HAT)
        assert_almost_equal(BFHAT, ikeda.BFHAT)
        assert_almost_equal(BWHAT, ikeda.BWHAT)
        assert_almost_equal(BEHAT, ikeda.BEHAT)
        assert_almost_equal(BBKHAT, ikeda.BBKHAT)
Exemple #3
0
    def calculate(self, **kwargs):

        B44HAT, BFHAT, BWHAT, BEHAT, BBKHAT, BLHAT = calculate_roll_damping(
            **self.ikeda_parameters, **kwargs)
        s = pd.Series()
        s['B_44_HAT'] = B44HAT
        s['B_F_HAT'] = BFHAT
        s['B_W_HAT'] = BWHAT
        s['B_E_HAT'] = BEHAT
        s['B_BK_HAT'] = BBKHAT
        s['B_L_HAT'] = BLHAT

        return s
Exemple #4
0
def test_calculate_roll_damping():

    Beam = LPP / L_div_B
    DRAFT = Beam / BD

    lBK = LPP * LBKL
    bBK = Beam * BBKB
    OMEGA = OMEGAHAT / (np.sqrt(Beam / 2 / 9.81))

    OG = DRAFT * OGD

    B44HAT, BFHAT, BWHAT, BEHAT, BBKHAT, BLHAT = calculate_roll_damping(
        LPP, Beam, CB, CMID, OG, PHI, lBK, bBK, OMEGA, DRAFT)
    assert_almost_equal(B44HAT, 0.010156148773301035)
def calculate(row,
              catch_error=False,
              limit_inputs=False,
              verify_input=True,
              **kwargs):
    LPP = row.lpp
    Beam = row.b
    DRAFT = row.DRAFT

    PHI = row.phi_max
    lBK = row.BKL
    bBK = row.BKB
    OMEGA = row.omega0
    OG = (-row.kg + DRAFT)
    CB = row.CB
    CMID = row.A0
    V = row.V

    s = pd.Series()
    try:
        B44HAT, BFHAT, BWHAT, BEHAT, BBKHAT, BLHAT = calculate_roll_damping(
            LPP,
            Beam,
            CB,
            CMID,
            OG,
            PHI,
            lBK,
            bBK,
            OMEGA,
            DRAFT,
            V=V,
            limit_inputs=limit_inputs,
            verify_input=verify_input,
            **kwargs)
    except SimplifiedIkedaInputError:
        if catch_error:
            return s
        else:
            raise

    s['B_44_hat'] = B44HAT
    s['B_F_hat'] = BFHAT
    s['B_W_hat'] = BWHAT
    s['B_E_hat'] = BEHAT
    s['B_BK_hat'] = BBKHAT
    s['B_L_hat'] = BLHAT
    return s
Exemple #6
0
def test_calculate_roll_damping_subfunction():

    Beam = BRTH = LPP / L_div_B
    DRAFT = Beam / BD

    lBK = LPP * LBKL
    bBK = Beam * BBKB
    OMEGA = OMEGAHAT / (np.sqrt(Beam / 2 / 9.81))

    OG = DRAFT * OGD
    TW = 2 * np.pi / OMEGA

    B44HAT, BFHAT, BWHAT, BEHAT, BBKHAT, BLHAT = calculate_roll_damping(
        LPP, Beam, CB, CMID, OG, PHI, lBK, bBK, OMEGA, DRAFT)
    B44HAT2, BFHAT2, BWHAT2, BEHAT2, BBKHAT2 = _calculate_roll_damping(
        LPP, BRTH, CB, CMID, OGD, PHI, LBKL, BBKB, OMEGA, DRAFT, BD, OMEGAHAT)

    assert B44HAT == B44HAT2
    assert BFHAT == BFHAT2
    assert BWHAT == BWHAT2
    assert BEHAT == BEHAT2
    assert BBKHAT == BBKHAT2
OGD = -0.2
OMEGAHAT = 0.6
LPP = 300

Beam = LPP / L_div_B
DRAFT = Beam / BD

lBK = LPP * LBKL
bBK = Beam * BBKB
OMEGA = OMEGAHAT / (np.sqrt(Beam / 2 / 9.81))

OG = DRAFT * OGD
kg = DRAFT - OG
volume = LPP * DRAFT * Beam * CB

B44HAT1, BFHAT1, BWHAT1, BEHAT1, BBKHAT1, BLHAT1 = calculate_roll_damping(
    LPP, Beam, CB, CMID, OG, PHI, lBK, bBK, OMEGA, DRAFT)
decimal = 5


def test_simplified_ikeda():

    si = SimplifiedIkeda(V=0,
                         w=OMEGA,
                         fi_a=np.deg2rad(PHI),
                         beam=Beam,
                         lpp=LPP,
                         kg=kg,
                         volume=volume,
                         draught=DRAFT,
                         A0=CMID,
                         BKL=lBK,