《材料力学上机大作业—梁的强度校核(28页).doc》由会员分享,可在线阅读,更多相关《材料力学上机大作业—梁的强度校核(28页).doc(28页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-材料力学上机作业题目五:梁的强度校核摘要本程序使用Microsoft Visual Basic编写,由输入梁的支撑条件,输入梁的受力状态,实现了梁危险截面的最大正应力计算与梁的强度校核。在校核结果为否定的情况下还可由许用应力值进行部分截面设计和许用载荷计算等功能。数学原理及数学模型材料力学公式有:1.梁弯曲正应力公式2.抗弯截面系数矩形截面 圆形截面 空心圆截面 , 式中 3.采用一定数量级上的穷举法计算出最大弯矩Mz。VB所做软件1. 软件部分窗体截图2. 程序结构图不安全安全开始选择支撑条件悬臂梁直接计算出各截面弯矩并找出最大值Mz外伸梁和简支梁根据受力情况求出支反力fa和fb,进而求M
2、z选择截面形状和输入尺寸计算抗弯截面系数矩形截面输入宽b和高h计算得Wz圆截面输入直径d计算得Wz空心截面输入内外直径D、d求得Wz工字钢直接查表输入Wz求出正应力并与许用应力比较结束进行截面设计和许用载荷计算输入受力情 况3. 应用实例1.验证新编材料力学书中P247例12-9 该题由正应力强度条件求得题中矩形截面悬臂梁许用载荷为q9.1kN/m,现加载q=8kN/m,看是否符合正应力强度要求。 已知左悬臂梁l=3m,=120Mpa,b=80mm,h=160mm,整个梁承受向下的均布载荷q解:1.运行程序进入主页面2.点击开始并选择支撑条件为左固定端悬臂梁,点击确定。如图3.选择梁的截面形状
3、并输入尺寸参数,点击确定。如图4.输入受力条件,点击确定进行计算。如图5.程序运行结果如图计算结果与实际运算结果相同2.求解新编材料力学P246例12-8。解: 1.运行程序计入主界面,点击开始。 2.选择支撑条件为右外伸梁,点击确定。 3.选择梁的截面形状并输入尺寸,点击确定。如图,(不妨先设b=10,h=30。注意,应避免b或h为零以防止出现除数为零的情况使程序出错) 4.输入受力情况及右支架位置并点击确定,如图(如果未能输入右支架位置,可能使程序出错) 5.得到计算结果 计算结果与答案b=30mm,h=60mm一致,不过以截面抗弯系数代替截面具体尺寸。其中小数点后的微量误差受穷举法所采用
4、数量级的影响。值得注意的是,由于本程序涉及的截面形状及载荷种类较多,而且载荷位置不固定,因此截面设计和许用载荷计算难以得到最终的具体结果。时间仓促,为减小工作量,本程序将许用载荷计算简化为梁截面所能承受的最大弯矩的计算。将截面设计略微简化为截面最小抗弯系数的设计。验证表明,计算结果同样精确。主要算法代码和部分窗体截图:部分窗体截图:Form9窗体内源代码:Private Sub Command1_Click() 进入实际工作界面Form0.ShowMe.HideEnd SubPrivate Sub Command2_Click() 若点击“结束”按钮则结束程序EndEnd SubForm0窗体
5、内源代码:Public l As Double 声明变量Public q As DoublePublic f1 As DoublePublic f2 As DoublePublic f As DoublePublic m1 As DoublePublic m2 As DoublePublic m As DoublePublic x As DoublePublic xa As DoublePublic xb As DoublePublic xq1 As DoublePublic xq2 As DoublePublic xf1 As DoublePublic xf2 As DoublePublic
6、 xm1 As DoublePublic xm2 As DoublePublic x1 As DoublePublic x2 As DoublePublic x3 As DoublePublic x4 As DoublePublic x5 As DoublePublic x6 As DoublePublic fa As DoublePublic fb As DoublePublic w As DoublePublic b As DoublePublic h As DoublePublic d1 As DoublePublic d2 As DoublePublic d3 As DoublePub
7、lic wz As DoublePublic syl As DoublePublic xyl As DoublePublic pi As DoublePublic zdzh As DoublePrivate Sub Command1_Click() 进入截面形状选择及尺寸参数输入界面Form7.ShowMe.HideEnd SubPrivate Sub Command2_Click() 若点击“结束”按钮则终止程序EndEnd SubPrivate Sub Form_Load() End SubPrivate Sub Option1_Click() 选择支撑条件Option1.Value =
8、TrueEnd SubPrivate Sub Option2_Click()Option2.Value = TrueEnd SubPrivate Sub Option3_Click()Option3.Value = TrueEnd SubPrivate Sub Option4_Click()Option4.Value = TrueEnd SubPrivate Sub Option5_Click()Option5.Value = TrueEnd SubPrivate Sub Option6_Click()Option6.Value = TrueEnd SubForm7窗体内源代码: 本窗体为截面
9、形状选择及尺寸输入界面Private Sub Command1_Click()If Form0.Option1.Value = True Then 根据用户选择的不同支撑条件调用不jz.Show 同窗体ElseIf Form0.Option2.Value = True Thenzxb.ShowElseIf Form0.Option3.Value = True Thenyxb.ShowElseIf Form0.Option4.Value = True Thenzws.ShowElseIf Form0.Option5.Value = True Thenyws.ShowElsesws.ShowEnd
10、 IfMe.HideEnd SubPrivate Sub Command2_Click()Form0.ShowMe.HideEnd SubPrivate Sub Form_Load()End SubPrivate Sub Option1_Click() 选择不同的截面形状Option1.Value = TrueEnd SubPrivate Sub Option2_Click()Option2.Value = TrueEnd SubPrivate Sub Option3_Click()Option3.Value = TrueEnd SubPrivate Sub Option4_Click()Op
11、tion4.Value = TrueEnd SubForm1(简支梁)窗体内源代码: 本窗体完成支撑条件简支梁部分计算Private Sub Command1_Click()Dim i As DoubleDim k As Doublepi = 3.1415926 给变量赋值l = Val(Form7.l.Text)If Form7.Option1.Value = True Then 计算截面抗弯系数b = Val(Form7.b.Text)h = Val(Form7.h.Text)wz = b * h 2 / 6ElseIf Form7.Option2.Value = True Thend1
12、= Val(Form7.d1.Text)wz = pi * d1 3 / 32ElseIf Form7.Option3.Value = True Thend2 = Val(Form7.d2.Text)d3 = Val(Form7.D.Text)wz = pi * d3 3 * (1 - d2 4 / d3 4) / 32ElseIf Form7.Option4.Value = True Thenwz = Val(Form7.wz.Text)End Iff1 = Val(f11.Text) 通过用户输入,给变量赋值f2 = Val(f21.Text)xf1 = Val(xf11.Text)xf2
13、 = Val(xf21.Text)m1 = Val(m11.Text)m2 = Val(m21.Text)xm1 = Val(xm11.Text)xm2 = Val(xm21.Text)q = Val(q1.Text)xq1 = Val(xq11.Text)xq2 = Val(xq21.Text)If xf1 xf2 Then 确定f1,f2的位置前后,便于后续计算k = f1f1 = f2f2 = kk = xf1xf1 = xf2xf2 = kEnd IfIf xm1 xm2 Then 确定m1,m2的位置前后,便于后续计算k = m1m1 = m2m2 = kk = xm1xm1 = x
14、m2xm2 = kEnd Ifl = l / 1000xf1 = xf1 / 1000xf2 = xf2 / 1000xm1 = xm1 / 1000xm2 = xm2 / 1000xq1 = xq1 / 1000xq2 = xq2 / 1000fb = (m1 + m2 + f1 * xf1 + f2 * xf2 + q * (xq2 - xq1) * (xq1 + xq2) / 2) / l 求支反力fa = f1 + f2 + q * (xq2 - xq1) - fbm = 0k = 0For i = 0 To l Step l / 1000000 该循环用于求截面最大弯矩m = fa
15、* iIf xf1 i Thenm = m - f1 * (i - xf1)End IfIf xf2 i Thenm = m - f2 * (i - xf2)End IfIf xm1 i Thenm = m + m1End IfIf xm2 i Thenm = m + m2End IfIf xq1 i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 k 2 Thenk = mEnd IfNext im = k 求得最大截面弯矩syl = m / wz 计算最大正应力syl = (syl 2) 0.5 * 10 3Form8.Label3.Caption
16、= 实际最大正应力为 & syl & Mpb 显示结果xyl = Val(Form7.xyl.Text) zdzh = wz * xyl / 10 3 许用载荷计算w = m / xyl 截面设计计算w = (w 2) 0.5If syl xyl ThenForm8.Label1.Caption = 由 & syl & & xyl & vbCrLf & vbclf & 实际应力大于许用应力,不安全。 & vbCrLf & vbCrLf & 可改变梁的载荷使梁截面上最大弯矩小于等于 & zdzh & N.m。 & vbCrLf & vbCrLf & 或者改变梁截面形状和尺寸,使其截面抗弯系数大于
17、等于 & w & cm3ElseForm8.Label1.Caption = 由 & syl & xf2 Thenk = f1f1 = f2f2 = kk = xf1xf1 = xf2xf2 = kEnd IfIf xm1 xm2 Thenk = m1m1 = m2m2 = kk = xm1xm1 = xm2xm2 = kEnd Ifl = l / 1000xf1 = xf1 / 1000xf2 = xf2 / 1000xm1 = xm1 / 1000xm2 = xm2 / 1000xq1 = xq1 / 1000xq2 = xq2 / 1000k = 0m = 0For i = 0 To l
18、 Step l / 1000000m = 0If (l - xf1) i Thenm = m - f1 * (i + xf1 - l)End IfIf (l - xf2) i Thenm = m - f2 * (i + xf2 - l)End IfIf (l - xm1) i Thenm = m + m1End IfIf (l - xm2) i Thenm = m + m2End IfIf (l - xq2) i Thenm = m - q * (i + xq2 - l) 2 / 2End IfIf (l - xq1) k 2 Thenk = mEnd IfNext im = ksyl = m
19、 / wzsyl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = 实际最大正应力为 & syl & Mpbxyl = Val(Form7.xyl.Text)zdzh = wz * xyl / 10 3w = m / xylw = (w 2) 0.5If syl xyl ThenForm8.Label1.Caption = 由 & syl & & xyl & vbCrLf & vbclf & 实际应力大于许用应力,不安全。 & vbCrLf & vbCrLf & 可改变梁的载荷使梁截面上最大弯矩小于等于 & zdzh & N.m。 & vbCrLf & vb
20、CrLf & 或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于 & w & cm3ElseForm8.Label1.Caption = 由 & syl & xf2 Thenk = f1f1 = f2f2 = kk = xf1xf1 = xf2xf2 = kEnd IfIf xm1 xm2 Thenk = m1m1 = m2m2 = kk = xm1xm1 = xm2xm2 = kEnd Ifl = l / 1000xf1 = xf1 / 1000xf2 = xf2 / 1000xm1 = xm1 / 1000xm2 = xm2 / 1000xq1 = xq1 / 1000xq2 = xq2
21、/ 1000k = 0For i = 0 To l Step l / 1000000m = 0If xf1 i Thenm = m - f1 * (i - xf1)End IfIf xq2 i Thenm = m - f2 * (i - xf2)End IfIf xm1 i Thenm = m + m1End IfIf xm2 i Thenm = m + m2End IfIf xq1 i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 k 2 Thenk = mEnd IfNext im = ksyl = m / wzsyl = (syl 2) 0.5
22、* 10 3Form8.Label3.Caption = 实际最大正应力为 & syl & Mpbxyl = Val(Form7.xyl.Text)zdzh = wz * xyl / 10 3w = m / xylw = (w 2) 0.5If syl xyl ThenForm8.Label1.Caption = 由 & syl & & xyl & vbCrLf & vbclf & 实际应力大于许用应力,不安全。 & vbCrLf & vbCrLf & 可改变梁的载荷使梁截面上最大弯矩小于等于 & zdzh & N.m。 & vbCrLf & vbCrLf & 或者改变梁截面形状和尺寸,使其截
23、面抗弯系数大于等于 & w & cm3ElseForm8.Label1.Caption = 由 & syl & xf2 Thenk = f1f1 = f2f2 = kk = xf1xf1 = xf2xf2 = kEnd IfIf xm1 xm2 Thenk = m1m1 = m2m2 = kk = xm1xm1 = xm2xm2 = kEnd Ifl = l / 1000xf1 = xf1 / 1000xf2 = xf2 / 1000xm1 = xm1 / 1000xm2 = xm2 / 1000xq1 = xq1 / 1000xq2 = xq2 / 1000xa = xa / 1000fa
24、= (-m1 - m2 + f1 * (l - xf1) + f2 * (l - xf2) + q * (xq2 - xq1) * (2 * l - xq1 - xq2) / 2) / (l - xa)fb = f1 + f2 + q * (xq2 - xq1) - fam = 0k = 0For i = 0 To l Step l / 1000000m = 0If xa i Thenm = m + fa * (i - xa)End IfIf xb i Thenm = m + fb * (i - xb)End IfIf xf1 i Thenm = m - f1 * (i - xf1)End I
25、fIf xq2 i Thenm = m - f2 * (i - xf2)End IfIf xm1 i Thenm = m + m1End IfIf xm2 i Thenm = m + m2End IfIf xq1 i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 k 2 Thenk = mEnd IfNext im = ksyl = m / wzsyl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = 实际最大正应力为 & syl & Mpbxyl = Val(Form7.xyl.Text)zdzh = wz * x
26、yl / 10 3w = m / xylw = (w 2) 0.5If syl xyl ThenForm8.Label1.Caption = 由 & syl & & xyl & vbCrLf & vbclf & 实际应力大于许用应力,不安全。 & vbCrLf & vbCrLf & 可改变梁的载荷使梁截面上最大弯矩小于等于 & zdzh & N.m。 & vbCrLf & vbCrLf & 或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于 & w & cm3ElseForm8.Label1.Caption = 由 & syl & xf2 Thenk = f1f1 = f2f2 = kk =
27、xf1xf1 = xf2xf2 = kEnd IfIf xm1 xm2 Thenk = m1m1 = m2m2 = kk = xm1xm1 = xm2xm2 = kEnd Ifl = l / 1000xf1 = xf1 / 1000xf2 = xf2 / 1000xm1 = xm1 / 1000xm2 = xm2 / 1000xq1 = xq1 / 1000xq2 = xq2 / 1000xb = xb / 1000fb = (f1 * xf1 + f2 * xf2 + q * (xq2 - xq1) * (xq1 + xq2) / 2 - m1 - m2) / xbfa = f1 + f2
28、+ q * (xq2 - xq1) - fbm = 0k = 0For i = 0 To l Step l / 1000000m = 0If xa i Thenm = m + fa * (i - xa)End IfIf xb i Thenm = m + fb * (i - xb)End IfIf xf1 i Thenm = m - f1 * (i - xf1)End IfIf xf2 i Thenm = m - f2 * (i - xf2)End IfIf xm1 i Thenm = m + m1End IfIf xm2 i Thenm = m + m2End IfIf xq1 i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 k 2 Thenk = m