标签归档:python

Python之常用混凝土构件计算01

写在前面的话
最近在用Jupyter Notebook学习Python,顺便把以前fx-FD10Pro做的构件计算文件重写成Python的,就当做练习了。


程序说明:
【a】已知Asp,M,求As
x=h_0-\sqrt{h_0^2-\dfrac{2\left[\gamma_{RE}M-f_y^{\prime}A_s^{\prime}(h_0-a_s^{\prime}\right]}{\alpha_1f_cb}} \\should,\ x\le\xi_bh_0 \\if\ x\ge2a^{\prime},\ A_s=\dfrac{\alpha_1f_cbx+f_y^{\prime}A_s^{\prime}}{f_y} \\if\ x<2a^{\prime},\ A_s=\dfrac{\gamma_{RE}M}{f_y(h-a_s-a_s^{\prime})}
【b】已知As,Asp,求Mu
x=\dfrac{f_yA_s-f_y^{\prime}A_s^{\prime}}{\alpha_1f_cb} \\if\ ,x\ge2a^{\prime},\ M_u=[\alpha_1f_cbx(h_0-\dfrac{x}{2})+f_y^{\prime}A_s^{\prime}(h_0-a_s^{\prime})]/\gamma_{RE} \\if\ ,x<2a^{\prime},\ M_u=f_yA_s(h-a_s-a_s^{\prime})/\gamma_{RE}


#coding=utf-8
#钢筋混凝土参数
def c_hrb():
    global fcuk,HRB,Ec,fc,ft,ftk,Es,fy,fyp,fyk
    global a1,epsilon_cu
    fcuk=Ec=fc=ft=ftk=0.0
    HRB=Es=fy=fyp=fyk=0.0
    #矩形应力图系数a1,C50以下为1.0
    a1=1.0
    #正截面混凝土极限压应变epsilon_cu,C50以下为0.0033
    epsilon_cu=0.0033    
    fcuk=int(input("C?30/35/40"))
    if (fcuk==30):
        Ec=30000
        fc=14.3
        ft=1.43
        ftk=2.01
    elif (fcuk==35):
        Ec=31500
        fc=16.7
        ft=1.57
        ftk=2.2
    elif (fcuk==40):
        Ec=32500
        fc=19.1
        ft=1.71
        ftk=2.39
    HRB=int(input("HRB?300/400/500"))
    if (HRB==300):
        Es=210000
        fy=270
        fyp=270
        fyk=300
    elif (HRB==400):
        Es=200000
        fy=360
        fyp=360
        fyk=400
    elif (HRB==500):
        Es=200000
        fy=435
        fyp=410
        fyk=500
    print('fcuk=',fcuk)
    print('Ec=',Ec)
    print('fc=',fc)
    print('ft=',ft)
    print('ftk=',ftk)
    print('HRB=',HRB)
    print('Es=',Es)
    print('fy=',fy)
    print('fyp=',fyp)
    print('fyk=',fyk)
#函数结束

#1.受弯构件正截面
#矩形双筋(非抗震,gamma_RE=1.0;抗震,《混规》11.1.6,gamma_RE=0.75)
#【a】已知Asp,M,求As
def given_asp_m_solve_as():
    import math
    c_hrb()
    gamma_RE=float(input("抗震0.75,gamma_RE="))
    nsp=float(input("受压筋个数nsp="))
    dsp=float(input("受压筋直径dsp="))
    Asp=nsp*0.25*3.14*(dsp**2)
    M=float(input("kN*m,M="))
    h=float(input("mm,h="))
    b=float(input("mm,b="))
    ast=float(input("mm,受拉钢筋合力点至受拉边缘的距离ast="))
    asp=float(input("mm,受压钢筋合力点至受压边缘的距离asp="))
    h0=h-ast
    #界限受压区高度ksi_b
    ksi_b=round(0.8/(1 + fy / (Es*epsilon_cu)),3)
    #受压区高度x
    x=round(h0-math.sqrt(h0**2 - 2*(gamma_RE*M*(10**6) - fyp*Asp*(h0-asp)) / (a1*fc*b)),1)
    print('h0=',h0)
    print('ksi_b=',ksi_b)
    print('x=',x)
    if (x<=ksi_b*h0):
        #弯曲破坏时,截面的延性取决于受压区高度的大小,受压区高度越小,截面转动就越大,延性就越好
        print(x,"非抗震截面,<=ksi_b*h0",ksi_b*h0)
        print(x,"抗震端截面,一级x<=0.25h0",0.25*h0)
        print(x,"抗震端截面,二、三级x<=0.35h0",0.35*h0)        
    else:
        #超筋梁,脆性破坏
        print(x,">ksi_b*h0,截面过小!",ksi_b*h0)
    if (x>=2*asp):
        print(x,">=2*asp,混规6.2.10-4式",2*asp)
        As=(a1*fc*b*x+fyp*Asp)/fy
    else:
        print(x,"<2*asp,混规6.2.14条",2*asp)
        As=gamma_RE*M*(10**6) / (fy*(h - ast - asp))
    As=round(As,1)
    print('受拉筋面积As=',As)
    rho=round(As/(b*h)*100,3)
    print('另需满足最小配筋率;配筋率rho=',rho,'%')
#函数结束

#【b】已知As,Asp,求Mu
def given_as_asp_solve_mu():
    import math
    c_hrb()
    gamma_RE=float(input("抗震0.75,gamma_RE="))
    nst=float(input("受拉筋个数nst="))
    dst=float(input("受拉筋直径dst="))
    As=nst*0.25*3.14*(dst**2)
    nsp=float(input("受压筋个数nsp="))
    dsp=float(input("受压筋直径dsp="))
    Asp=nsp*0.25*3.14*(dsp**2)
    h=float(input("mm,h="))
    b=float(input("mm,b="))
    ast=float(input("mm,受拉钢筋合力点至受拉边缘的距离ast="))
    asp=float(input("mm,受压钢筋合力点至受压边缘的距离asp="))
    h0=h-ast
    #界限受压区高度ksi_b
    ksi_b=round(0.8/(1 + fy / (Es*epsilon_cu)),3)
    #受压区高度x
    x=(fy*As-fyp*Asp)/(a1*fc*b)
    print('h0=',h0)
    print('ksi_b=',ksi_b)
    print('x=',x)
    if (x<=ksi_b*h0):
        #弯曲破坏时,截面的延性取决于受压区高度的大小,受压区高度越小,截面转动就越大,延性就越好
        print(x,"非抗震截面,<=ksi_b*h0",ksi_b*h0)
        print(x,"抗震端截面,一级x<=0.25h0",0.25*h0)
        print(x,"抗震端截面,二、三级x<=0.35h0",0.35*h0)        
    else:
        x=ksi_b*h0
        print(x,"取x=ksi_b*h0",ksi_b*h0)
    if (x>=2*asp):
        print(x,">=2*asp,混规6.2.10-4式",2*asp)
        Mu=(a1*fc*b*x*(h0-x/2) + fyp*Asp*(h0-asp)) / gamma_RE/(10**6)
    else:
        print(x,"<2*asp,混规6.2.14条",2*asp)
        Mu=fy*As*(h - ast - asp) / gamma_RE/(10**6)
    Mu=round(Mu,3)
    print('极限抗弯承载力Mu=',Mu)
#函数结束