材料力学上机大作业—梁的强度校核(28页).doc
-
资源ID:36377908
资源大小:463.50KB
全文页数:28页
- 资源格式: DOC
下载积分:15金币
快捷下载
会员登录下载
微信登录下载
三方登录下载:
微信扫一扫登录
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
|
材料力学上机大作业—梁的强度校核(28页).doc
-材料力学上机作业题目五:梁的强度校核摘要本程序使用Microsoft Visual Basic编写,由输入梁的支撑条件,输入梁的受力状态,实现了梁危险截面的最大正应力计算与梁的强度校核。在校核结果为否定的情况下还可由许用应力值进行部分截面设计和许用载荷计算等功能。数学原理及数学模型材料力学公式有:1.梁弯曲正应力公式2.抗弯截面系数矩形截面 圆形截面 空心圆截面 , 式中 3.采用一定数量级上的穷举法计算出最大弯矩Mz。VB所做软件1. 软件部分窗体截图2. 程序结构图不安全安全开始选择支撑条件悬臂梁直接计算出各截面弯矩并找出最大值Mz外伸梁和简支梁根据受力情况求出支反力fa和fb,进而求Mz选择截面形状和输入尺寸计算抗弯截面系数矩形截面输入宽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.选择梁的截面形状并输入尺寸参数,点击确定。如图4.输入受力条件,点击确定进行计算。如图5.程序运行结果如图计算结果与实际运算结果相同2.求解新编材料力学P246例12-8。解: 1.运行程序计入主界面,点击开始。 2.选择支撑条件为右外伸梁,点击确定。 3.选择梁的截面形状并输入尺寸,点击确定。如图,(不妨先设b=10,h=30。注意,应避免b或h为零以防止出现除数为零的情况使程序出错) 4.输入受力情况及右支架位置并点击确定,如图(如果未能输入右支架位置,可能使程序出错) 5.得到计算结果 计算结果与答案b=30mm,h=60mm一致,不过以截面抗弯系数代替截面具体尺寸。其中小数点后的微量误差受穷举法所采用数量级的影响。值得注意的是,由于本程序涉及的截面形状及载荷种类较多,而且载荷位置不固定,因此截面设计和许用载荷计算难以得到最终的具体结果。时间仓促,为减小工作量,本程序将许用载荷计算简化为梁截面所能承受的最大弯矩的计算。将截面设计略微简化为截面最小抗弯系数的设计。验证表明,计算结果同样精确。主要算法代码和部分窗体截图:部分窗体截图:Form9窗体内源代码:Private Sub Command1_Click() 进入实际工作界面Form0.ShowMe.HideEnd SubPrivate Sub Command2_Click() 若点击“结束”按钮则结束程序EndEnd SubForm0窗体内源代码: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 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 DoublePublic 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 = 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窗体内源代码: 本窗体为截面形状选择及尺寸输入界面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 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()Option4.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 = 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 = 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 = xm2xm2 = 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 * 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 And xq2 > i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 < i Thenm = m - q * (xq2 - xq1) * (i - (xq2 + xq1) / 2)End IfIf m 2 > k 2 Thenk = mEnd IfNext im = k 求得最大截面弯矩syl = m / wz 计算最大正应力syl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = "实际最大正应力为" & 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 & "或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于" & w & "cm3"ElseForm8.Label1.Caption = "由" & syl & "<" & xyl & vbCrLf & vbCrLf & "实际应力小于许用应力,安全"End IfForm8.ShowMe.HideEnd Sub 显示结果,结束程序Private Sub Command2_Click() 完成“返回上一级”功能Form7.ShowMe.HideEnd Sub此后的代码与简支梁类似,仅有些许差别,因此不再注释Form2(左悬臂梁)窗体内源代码 Private Sub Label23_Click()End SubPrivate Sub Command1_Click()Dim i As DoubleDim k As Doublepi = 3.1415926l = Val(Form7.l.Text)If Form7.Option1.Value = True Thenb = Val(Form7.b.Text)h = Val(Form7.h.Text)wz = b * h 2 / 6ElseIf Form7.Option2.Value = True Thend1 = 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 Ifxa = 0xb = lf1 = Val(f11.Text)f2 = Val(f21.Text)xf1 = Val(xf11.Text)xf2 = 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 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 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 And (l - xq1) > i Thenm = m - q * (i + xq2 - l) 2 / 2End IfIf (l - xq1) < i Thenm = m - q * (xq2 - xq1) / 2 * (i - (2 * l - xq1 - xq2) / 2)End IfIf m 2 > k 2 Thenk = mEnd IfNext im = ksyl = m / wzsyl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = "实际最大正应力为" & syl & "Mpb"xyl = 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 & "或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于" & w & "cm3"ElseForm8.Label1.Caption = "由" & syl & "<" & xyl & vbCrLf & vbCrLf & "实际应力小于许用应力,安全"End IfForm8.ShowMe.HideEnd SubPrivate Sub Command2_Click()Form7.ShowMe.HideEnd SubForm3(右悬臂梁)窗体内源代码Private Sub Command1_Click()Dim i As DoubleDim k As Doublepi = 3.1415926l = Val(Form7.l.Text)If Form7.Option1.Value = True Thenb = Val(Form7.b.Text)h = Val(Form7.h.Text)wz = b * h 2 / 6ElseIf Form7.Option2.Value = True Thend1 = 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 Ifxa = 0xb = lf1 = Val(f11.Text)f2 = Val(f21.Text)xf1 = Val(xf11.Text)xf2 = 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 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 = 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 And xq2 > i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 < i Thenm = m - q * (xq2 - xq1) * (i - (xq2 + xq1) / 2)End IfIf m 2 > k 2 Thenk = mEnd IfNext im = ksyl = m / wzsyl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = "实际最大正应力为" & syl & "Mpb"xyl = 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 & "或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于" & w & "cm3"ElseForm8.Label1.Caption = "由" & syl & "<" & xyl & vbCrLf & vbCrLf & "实际应力小于许用应力,安全"End IfForm8.ShowMe.HideEnd SubPrivate Sub Command2_Click()Form7.ShowMe.HideEnd SubForm4(左外伸梁)窗体内源代码Private Sub Command1_Click()Dim i As DoubleDim k As Doublepi = 3.1415926l = Val(Form7.l.Text)If Form7.Option1.Value = True Thenb = Val(Form7.b.Text)h = Val(Form7.h.Text)wz = b * h 2 / 6ElseIf Form7.Option2.Value = True Thend1 = 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 Ifxa = Val(zws.xa1.Text)xb = lf1 = Val(f11.Text)f2 = Val(f21.Text)xf1 = Val(xf11.Text)xf2 = 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 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 = (-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 IfIf xq2 < i Thenm = m - f2 * (i - xf2)End IfIf xm1 < i Thenm = m + m1End IfIf xm2 < i Thenm = m + m2End IfIf xq1 < i And xq2 > i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 < i Thenm = m - q * (xq2 - xq1) * (i - (xq2 + xq1) / 2)End IfIf m 2 > k 2 Thenk = mEnd IfNext im = ksyl = m / wzsyl = (syl 2) 0.5 * 10 3Form8.Label3.Caption = "实际最大正应力为" & syl & "Mpb"xyl = 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 & "或者改变梁截面形状和尺寸,使其截面抗弯系数大于等于" & w & "cm3"ElseForm8.Label1.Caption = "由" & syl & "<" & xyl & vbCrLf & vbCrLf & "实际应力小于许用应力,安全"End IfForm8.ShowMe.HideEnd SubPrivate Sub Command2_Click()Form7.ShowMe.HideEnd SubForm5(右外伸梁)窗体内源代码:Private Sub Command1_Click()Dim i As DoubleDim k As Doublepi = 3.1415926l = Val(Form7.l.Text)If Form7.Option1.Value = True Thenb = Val(Form7.b.Text)h = Val(Form7.h.Text)wz = b * h 2 / 6ElseIf Form7.Option2.Value = True Thend1 = 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 Ifxa = 0xb = Val(yws.xb1.Text)f1 = Val(f11.Text)f2 = Val(f21.Text)xf1 = Val(xf11.Text)xf2 = 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 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 / 1000xb = xb / 1000fb = (f1 * xf1 + f2 * xf2 + q * (xq2 - xq1) * (xq1 + xq2) / 2 - m1 - m2) / xbfa = f1 + f2 + 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 And xq2 > i Thenm = m - q * (i - xq1) 2 / 2End IfIf xq2 < i Thenm = m - q * (xq2 - xq1) * (i - (xq2 + xq1) / 2)End IfIf m 2 > k 2 Thenk = m