コード例 #1
0
def test_windage_mast_ce_position():
    r"""Centre of effort position tests, with 30° of heel and 60° of heel

    y position of force application at 30° should be the same as z position
    of application at 60° of heel

    """
    force = windage_mast_with_sail(tws=10.,
                                   twa=45.,
                                   boatspeed=2.,
                                   heel_angle=30.,
                                   trim_angle=0.,
                                   mast_x=0.5,
                                   mast_z_bottom=0.07,
                                   mast_z_top=1.7,
                                   mast_front_area=0.017,
                                   mast_side_area=0.017)
    value = ((1.7 + 0.07) / 2.) / 2.
    assert value - 1e-6 <= force.py <= value + 1e-6

    force = windage_mast_with_sail(tws=10.,
                                   twa=45.,
                                   boatspeed=2.,
                                   heel_angle=60.,
                                   trim_angle=0.,
                                   mast_x=0.5,
                                   mast_z_bottom=0.07,
                                   mast_z_top=1.7,
                                   mast_front_area=0.017,
                                   mast_side_area=0.017)
    assert value - 1e-6 <= force.pz <= value + 1e-6
コード例 #2
0
def test_windage_mast_with_sail_port_upwind():
    r"""Upwind on port tack"""
    force = windage_mast_with_sail(tws=10.,
                                   twa=-45.,
                                   boatspeed=2.,
                                   heel_angle=10.,
                                   trim_angle=0.,
                                   mast_x=0.5,
                                   mast_z_bottom=0.07,
                                   mast_z_top=1.7,
                                   mast_front_area=0.017,
                                   mast_side_area=0.017)

    assert force.fx < 0
    assert force.fy < 0
    assert force.py < 0

    force_neg_heel = windage_mast_with_sail(tws=10.,
                                            twa=-45.,
                                            boatspeed=2.,
                                            heel_angle=-10.,
                                            trim_angle=0.,
                                            mast_x=0.5,
                                            mast_z_bottom=0.07,
                                            mast_z_top=1.7,
                                            mast_front_area=0.017,
                                            mast_side_area=0.017)
    assert force_neg_heel.py > 0
コード例 #3
0
def test_windage_mast_with_trim_angle():
    r"""Trim angle influence tests"""
    # bow up
    force_stb = windage_mast_with_sail(tws=10.,
                                       twa=45.,
                                       boatspeed=2.,
                                       heel_angle=30.,
                                       trim_angle=5.,
                                       mast_x=0.5,
                                       mast_z_bottom=0.07,
                                       mast_z_top=1.7,
                                       mast_front_area=0.017,
                                       mast_side_area=0.017)
    assert force_stb.fx < 0.5
    force_por = windage_mast_with_sail(tws=10.,
                                       twa=-45.,
                                       boatspeed=2.,
                                       heel_angle=30.,
                                       trim_angle=5.,
                                       mast_x=0.5,
                                       mast_z_bottom=0.07,
                                       mast_z_top=1.7,
                                       mast_front_area=0.017,
                                       mast_side_area=0.017)
    assert force_por.fx < 0.5

    # bow dow
    force_stb = windage_mast_with_sail(tws=10.,
                                       twa=45.,
                                       boatspeed=2.,
                                       heel_angle=30.,
                                       trim_angle=-5.,
                                       mast_x=0.5,
                                       mast_z_bottom=0.07,
                                       mast_z_top=1.7,
                                       mast_front_area=0.017,
                                       mast_side_area=0.017)
    assert force_stb.px > 0.5
    force_por = windage_mast_with_sail(tws=10.,
                                       twa=-45.,
                                       boatspeed=2.,
                                       heel_angle=30.,
                                       trim_angle=-5.,
                                       mast_x=0.5,
                                       mast_z_bottom=0.07,
                                       mast_z_top=1.7,
                                       mast_front_area=0.017,
                                       mast_side_area=0.017)
    assert force_por.px > 0.5
コード例 #4
0
def test_windage_mast_with_sail_port_downwind():
    r"""Downwind on port tack"""
    force = windage_mast_with_sail(tws=10.,
                                   twa=-165.,
                                   boatspeed=2.,
                                   heel_angle=0.,
                                   trim_angle=0.,
                                   mast_x=0.5,
                                   mast_z_bottom=0.07,
                                   mast_z_top=1.7,
                                   mast_front_area=0.017,
                                   mast_side_area=0.017)
    assert force.fx > 0
    assert force.fy < 0
コード例 #5
0
def test_windage_mast_with_sail_exceptions():
    r"""Wrong input cases"""
    with pytest.raises(ValueError):
        windage_mast_with_sail(tws=10.,
                               twa=45.,
                               boatspeed=2.,
                               heel_angle=10.,
                               trim_angle=0.,
                               mast_x=0.5,
                               mast_z_bottom=-0.07,
                               mast_z_top=1.7,
                               mast_front_area=0.017,
                               mast_side_area=0.017)
    with pytest.raises(ValueError):
        windage_mast_with_sail(tws=10.,
                               twa=45.,
                               boatspeed=2.,
                               heel_angle=10.,
                               trim_angle=0.,
                               mast_x=0.5,
                               mast_z_bottom=0.07,
                               mast_z_top=1.7,
                               mast_front_area=-0.017,
                               mast_side_area=0.017)