def get_Shear_center(cos_value,
                     profile_constant,
                     thickness=[],
                     basic_point=[0, 0]):

    bp = basic_point

    if not is_point_in(bp, cos_value):
        raise 'basic point not in profile,Choose another one'

    Tk = thickness
    Pc = profile_constant

    c_x = copy.copy(cos_value)
    k = profile_toolbox.if_clockwise(c_x)
    if k > 0:
        c_x.reverse()
    cc = Open_Profile(c_x, Pc, thickness=Tk, Qx=0, Qy=1)
    xx = get_Shear_center_x(cc, Shear_ST=cc.Shear_ST, basic_point=bp)

    ##--------------------------------------------------------------------------##

    c_y = copy.copy(cos_value)
    k = profile_toolbox.if_clockwise(c_y)
    if k < 0:
        c_y.reverse()

    dd = Open_Profile(c_y, Pc, thickness=Tk, Qx=1, Qy=0)
    yy = get_Shear_center_y(dd, Shear_ST=dd.Shear_ST, basic_point=bp)

    aa = (xx + basic_point[0]).round(4)
    bb = (yy + basic_point[1]).round(4)
    return [aa, bb]
def get_Shear_center_y(profile_constant,
                       cos_value=[],
                       Shear_ST=[],
                       basic_point=[0, 0]):
    y = 0
    Sy = profile_constant.Sy
    Iy = profile_constant.Iy

    update = 0

    Shear_flow = Shear_ST

    mcos_value = cos_value

    if mcos_value == []:
        mcos_value = profile_constant.cos_value

    k = profile_toolbox.if_clockwise(mcos_value)

    if k > 0:
        pass
    if k < 0:
        mcos_value.reverse()
        Shear_flow.reverse()
        update = 1

    if Shear_flow:
        for i in range(0, len(Shear_flow)):
            ys = mcos_value[i][1]
            ye = mcos_value[i + 1][1]
            xs = mcos_value[i][0]
            xe = mcos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)
            P_distance = dot_distance_line(mcos_value[i], mcos_value[i + 1],
                                           basic_point)
            Da = Shear_flow[i] * P_distance
            y = y + syp.integrate(Da, (s, 0, length))

        return y

    else:
        for i in range(0, len(Sy)):
            ys = cos_value[i][1]
            ye = cos_value[i + 1][1]
            xs = cos_value[i][0]
            xe = cos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)
            P_distance = dot_distance_line(cos_value[i], cos_value[i + 1],
                                           basic_point)
            Da = P_distance * Sy[i]
            y = y + syp.integrate(Da, (s, 0, length))
        return y / Iy * -1.0
Example #3
0
def close_Shear_center(cos_value,
                       profile_constant,
                       thickness=[],
                       basic_point=[0, 0]):
    '''
	Only used when the profile with only one closed cell
	'''
    bp = basic_point
    if not is_point_in(bp, cos_value):
        raise 'basic point not in profile,Choose another one'

    Pc = profile_constant

    c_x = copy.copy(cos_value)
    Tk1 = copy.copy(thickness)

    k = profile_toolbox.if_clockwise(c_x)
    if k > 0:
        c_x.reverse()
        Tk1.reverse()

    cc = open_profile.Open_Profile(c_x, Pc, thickness=Tk1, Qx=0, Qy=1)
    xx = close_Shear_center_x(cc,cos_value=c_x,Shear_ST = cc.Shear_ST,\
     thickness = Tk1,basic_point = bp)
    ##--------------------------------------------------------------------------##

    c_y = copy.copy(cos_value)
    Tk2 = copy.copy(thickness)

    k = profile_toolbox.if_clockwise(c_y)
    if k < 0:
        c_y.reverse()
        Tk2.reverse()

    dd = open_profile.Open_Profile(c_y, Pc, thickness=Tk2, Qx=1, Qy=0)

    yy = close_Shear_center_y(dd,cos_value = c_y,Shear_ST = dd.Shear_ST,\
       thickness = Tk2,basic_point = bp)

    aa = (xx + basic_point[0]).round(4)
    bb = (yy + basic_point[1]).round(4)
    return [aa, bb]
def get_Shear_center_x(profile_constant,
                       cos_value=[],
                       Shear_ST=[],
                       basic_point=[0, 0]):
    '''
	If the Ixy do not equal to 0,
	MUST use the shear flow to calculate
	'''
    x = 0
    Sx = profile_constant.Sx
    Ix = profile_constant.Ix
    update = 0

    Shear_flow = Shear_ST

    mcos_value = cos_value

    if mcos_value == []:
        mcos_value = profile_constant.cos_value

    k = profile_toolbox.if_clockwise(mcos_value)

    if k < 0:
        pass
    if k > 0:
        mcos_value.reverse()
        Shear_flow.reverse()
        update = 1

    if Shear_flow:
        for i in range(0, len(Shear_flow)):
            ys = mcos_value[i][1]
            ye = mcos_value[i + 1][1]
            xs = mcos_value[i][0]
            xe = mcos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)
            P_distance = dot_distance_line(mcos_value[i], mcos_value[i + 1],
                                           basic_point)
            Da = Shear_flow[i] * P_distance
            x = x + syp.integrate(Da, (s, 0, length))

        return x
##############################################################################3
    else:
        for i in range(0, len(Sx)):
            ys = cos_value[i][1]
            ye = cos_value[i + 1][1]
            xs = cos_value[i][0]
            xe = cos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)

            P_distance = dot_distance_line(cos_value[i], cos_value[i + 1],
                                           basic_point)
            Da = P_distance * Sx[i]

            x = x + syp.integrate(Da, (s, 0, length))

            # print('x--]]',Sx[i],'dis--]]',P_distance ,'[][][]',syp.integrate)(Da,(s,0,length))

        return x / Ix
Example #5
0
def close_Shear_center_x(profile_constant,cos_value = [],Shear_ST=[],thickness = [], \
      basic_point = [0,0]):
    '''
	Attention that if without the Shear flow, the profile's Ixy must equal to ZERO 
	The Shear Flow used here is still the open-profile Shear Flow, NOT closed one.
	'''

    PSx = 0
    Sxt = 0
    Dst = 0
    x1 = 0
    x2 = 0
    x3 = 0

    mcos_value = cos_value

    if mcos_value == []:
        mcos_value = copy.copy(profile_constant.cos_value)

    if thickness == []:
        if len(mcos_value) == 2:
            thickness = [1]
        else:
            thickness = np.ones(len(mcos_value) - 1)
            thickness = thickness.tolist()

    A = open_profile.Surround_Area(mcos_value, basic_point)

    x_center = 0
    Sx = profile_constant.Sx
    Ix = profile_constant.Ix
    Shear_flow = Shear_ST

    k = profile_toolbox.if_clockwise(mcos_value)

    if k < 0:
        pass
    if k > 0:
        mcos_value.reverse()
        Shear_flow.reverse()
        thickness.reverse()
        # print('---xxx-----reverse---xxx---in line-')

    if Shear_flow:

        for i in range(0, len(Shear_flow)):
            ys = mcos_value[i][1]
            ye = mcos_value[i + 1][1]
            xs = mcos_value[i][0]
            xe = mcos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)
            P_distance = dot_distance_line(mcos_value[i], mcos_value[i + 1],
                                           basic_point)

            qpds = Shear_flow[i] * P_distance
            x1 = x1 + syp.integrate(qpds, (s, 0, length))

            qtds = Shear_flow[i] / thickness[i] * 1.0
            x2 = x2 + syp.integrate(qtds, (s, 0, length))

            tt = 1.0 / thickness[i]
            x3 = x3 + syp.integrate(tt, (s, 0, length))

        # print('x1,x2,x3',x1,'   ',x2,'   ',x3)
        x_center = x1 - 2 * A * x2 / x3
        return x_center

    else:
        for i in range(0, len(Sx)):
            ys = cos_value[i][1]
            ye = cos_value[i + 1][1]
            xs = cos_value[i][0]
            xe = cos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)

            P_distance = dot_distance_line(cos_value[i], cos_value[i + 1],
                                           basic_point)

            x1 = P_distance * Sx[i]
            PSx = PSx + syp.integrate(x1, (s, 0, length))

            x2 = Sx[i] / thickness[i] * 1.0
            Sxt = Sxt + syp.integrate(x2, (s, 0, length))

            x3 = 1.0 / thickness[i]
            Dst = Dst + syp.integrate(x3, (s, 0, length))

        x_center = (Psx - 2 * A * Sxt / Dst) / Ix
        return x_center
Example #6
0
def close_Shear_center_y(profile_constant,cos_value = [],Shear_ST=[],thickness = [], \
      basic_point = [0,0]):
    '''
	Attention that if without the Shear flow, the profile's Ixy must equal to ZERO 
	The Shear Flow used here is still the open-profile Shear Flow, NOT closed one.
	'''

    PSy = 0
    Syt = 0
    Dst = 0
    y1 = 0
    y2 = 0
    y3 = 0

    mcos_value = cos_value

    if mcos_value == []:
        mcos_value = profile_constant.cos_value

    if thickness == []:
        if len(mcos_value) == 2:
            thickness = [1]
        else:
            thickness = np.ones(len(mcos_value) - 1)
            thickness = thickness.tolist()

    A = open_profile.Surround_Area(mcos_value, basic_point)

    y_center = 0
    Sy = profile_constant.Sy
    Iy = profile_constant.Iy
    Shear_flow = Shear_ST

    # print(Shear_flow)
    k = profile_toolbox.if_clockwise(mcos_value)

    if k < 0:
        mcos_value.reverse()
        Shear_flow.reverse()
        # print('--yyy------reverse----yyy---in_line-')
        # print(mcos_value,'\n',Shear_flow)

    if k > 0:
        pass

    if Shear_flow:
        for i in range(0, len(Shear_flow)):
            ys = mcos_value[i][1]
            ye = mcos_value[i + 1][1]
            xs = mcos_value[i][0]
            xe = mcos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)
            P_distance = dot_distance_line(mcos_value[i], mcos_value[i + 1],
                                           basic_point)

            qpds = Shear_flow[i] * P_distance
            y1 = y1 + syp.integrate(qpds, (s, 0, length))

            qtds = Shear_flow[i] / thickness[i] * 1.0
            y2 = y2 + syp.integrate(qtds, (s, 0, length))

            tt = 1.0 / thickness[i]
            y3 = y3 + syp.integrate(tt, (s, 0, length))

        y_center = 2 * A * y2 / y3 - y1
        return -1 * y_center

    else:
        for i in range(0, len(Sy)):
            ys = cos_value[i][1]
            ye = cos_value[i + 1][1]
            xs = cos_value[i][0]
            xe = cos_value[i + 1][0]

            yy = ye - ys
            xx = xe - xs
            length = math.sqrt(yy**2 + xx**2)

            P_distance = dot_distance_line(cos_value[i], cos_value[i + 1],
                                           basic_point)

            y1 = P_distance * Sy[i]
            PSy = PSy + syp.integrate(y1, (s, 0, length))

            y2 = Sy[i] / thickness[i] * 1.0
            Syt = Syt + syp.integrate(y2, (s, 0, length))

            y3 = 1.0 / thickness[i]
            Dst = Dst + syp.integrate(y3, (s, 0, length))

        y_center = (2 * A * PSy / Dst - PSy) / Iy

        return y_center