1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| import random import math from datetime import datetime import numpy as np import matplotlib.pyplot as plt
def fc1(fcuk): α_c1 = max((0.76+(0.82-0.76)*(fcuk-50)/(80-50)),0.76) α_c2 = min((1-(1-0.87)*(fcuk-40)/(80-40)),1.0) fck = 0.88*α_c1*α_c2*fcuk fc = fck/1.4 return fc
def α(fcuk): α1 = min(1.0-0.06*(fcuk-50)/3,1.0) return α1
def ε_cu(fcuk): ε_cu = min((0.0033-(fcuk-50)*10**-5,0.0033)) return ε_cu
def β1(fcuk): β1 = min(0.8-0.06*(fcuk-50)/30,0.8) return β1
def ξ_b(fcuk,fy1,Es): ε_cu1 = ε_cu(fcuk) β11 = β1(fcuk) ξ_b = β11/(1+fy1/(Es*ε_cu1)) return ξ_b
def Nu_Mu(fcuk,fy1,b,h,as1,As1,Es): as2 = as1 h0 = h-as1 fc = fc1(fcuk) α1 = α(fcuk) ξ_b1 = ξ_b(fcuk,fy1,Es) β11 = β1(fcuk) pp=[] mm=[]
fig = plt.figure(figsize=(5.7,4.6),facecolor="#f1f1f1") left,bottom,width,height = 0.1,0.1,0.85,0.8 fig.add_axes((left,bottom,width,height),facecolor="#f1f1f1") plt.rcParams['font.sans-serif'] = ['SimHei'] plt.title('对称配筋时Nu、Mu相关曲线') dot_num = 66
N0 = α1*fc*b*ξ_b1*h0 Numax = α1*fc*b*h+2*As1*fy1 for i in range(dot_num+1): Nu1=(i/dot_num)*Numax if Nu1<=Numax: if Nu1<=N0: Mu1 = -(Nu1**2)/(2*α1*fc*b)+Nu1*h/2+fy1*As1*(h0-as2) else: λ1=(β11-ξ_b1)/(α1*fc*b*h0*(β11-ξ_b1)+fy1*As1) λ2=(ξ_b1*fy1*As1)/(α1*fc*b*h0*(β11-ξ_b1)+fy1*As1) ξ=(λ1*Nu1+λ2)-0.5*(λ1*Nu1+λ2)*(λ1*Nu1+λ2) Mu1=α1*fc*b*h0*h0*ξ-(h/2-as1)*Nu1+fy1*As1*(h0-as1) pp.append(Nu1/1000) mm.append(Mu1/1e6) plt.plot(mm,pp,color='b',label='Nu、Mu相关曲线',linewidth=2,linestyle='-',marker='',alpha=1) makers = ['.','^','1','s','x','h','*','p','+','o','D','x','h','*','|','^','1','s','x','h','*','p'] for i,Nu,Mu in zip(makers,[5800,5200,1600,850,3500],[400,400,460,550,650]): plt.plot(Mu,Nu,color='r',label=f'N={Nu}、M={Mu} ',marker=i) plt.legend() plt.grid() plt.xlabel('Mu(kN·m)') plt.ylabel('Nu(kN)') plt.show() graph = '对称配筋时Nu_Mu相关曲线给定N_M值的判断' fig.savefig(graph,dpi=600,facecolor="f1f1f1") return 0
def main(): ''' fcuk,fy1,b,h,as1''' fcuk,fy1,b,h,as1,As1,Es = 30,360,500,600,35,1901,200000 Nu_Mu(fcuk,fy1,b,h,as1,As1,Es)
with open('result.txt', 'w') as f: dot_num = 66 for i in range(dot_num+1): f.write('{0:u.2f}'.format(pp[i])+','+'{0:.5e}\n'.format(mm[i]))
dt = datetime.now() localtime = dt.strftime('%Y-%m-%d %H:%M:%S') print('-'*many) print("本图形生成时间 :", localtime)
if __name__ == "__main__": many=45 print('='*many) main() print('='*many)
|