コード例 #1
0
ファイル: __init__.py プロジェクト: slott56/HamCalc-2.1
def design_final( shape, **args ):
    """Given a shape (Square or Circle),
    and some parameters, final design.

    :param V: target volume
    :param N: given angle
    :param D: given size or diameter
    :param M: hopper height, larger than the minimum
    :returns: dict with design parameters added.
    """
    args= AttrDict( args )
    def height_from_h( H ):
        args.H = H
        shape.height( args )
        return args.K - args.M
    args.H = bisection( height_from_h, args.M, args.H-1 )
    return args
コード例 #2
0
ファイル: __init__.py プロジェクト: slott56/HamCalc-2.1
def design_hopper( shape, **args ):
    """Given a shape (Square or Circle),
    and some parameters, initial design with
    minimum height, H, for the hopper.

    :param V: target volume
    :param N: given angle
    :param D: given size or diameter
    :returns: dict with design parameters added.
    """
    args= AttrDict( args )
    def hopper_vol_from_h( H ):
        args.H = H
        shape.volume( args )
        return args.V - args.V_H
    # In principle, we should develop a rational upper limit.
    # The overall volume, though, is a good estimator for the
    # upper bound.
    args.H = bisection( hopper_vol_from_h, 0, args.V )
    return args