1、高速级大齿轮热处理mh(3):低速级小齿轮热处理mh(4):低速级大齿轮热处理 hb(4) As Integer hb(1):高速级小齿轮硬度 布氏硬度hb(2):高速级大齿轮硬度hb(3):低速级小齿轮硬度hb(4):低速级大齿轮硬度 rc(4) As Integer rc(1):高速级小齿轮硬度 洛氏硬度rc(2):rc(3):rc(4): End Type优化的数据和通过优化计算出的基本数据Type yh_data mn1 As Single 优化数据之1 x1 mn2 As Single 优化数据之3 x3 z1 As Single 优化数据之2 x2 z2 As Single z3
2、As Single 优化数据之4 x4 z4 As Single u1 As Single 优化数据之5 x5 u2 As Single bt As Single 优化数据之6 x6 n2 As SingleEnd TypeType yfys yf As Single 齿形系数 ys As Single 应力集中系数Type erkr er As Single 端面重合度 kr As Single 齿间载荷分配系数全局变量Public my_gear_data As gear_data 存放初始参数Public daa(4) As Single, dff(4) As Single scr文件引
3、用 齿顶圆 齿根圆直径Public b1 As Single, b2 As Single, b3 As Single, b4 As Single 最终的齿宽Public d1 As Single, d2 As Single, d3 As Single, d4 As Single 最终的分度圆直径Public m1 As Single, m2 As Single 圆整后的模数Public xp(21, 10) As Single 复合型法的顶点数组Public a(10) As Single, b(10) As Single 边界条件数组Public m(21) As Single, h(21)
4、 As Integer 选取最坏点数组Public c(13) As Single 约束条件数组Public f(21) As Single f(x) 目标函数Public rec As Integer 记录变量Public n As Integer, mm1 As Integer 初始参数Public e As Single, g As Single 复合形法子程序Public Sub fhx_optimum() Dim j As Integer, k As Integer 循环变量 Dim s As Integer 记数变量 Dim q As Boolean 判定tj_pd子程序的返回值的
5、临时变量 Dim mm As Integer, hh As Integer 最坏点 Dim bb As Boolean 收敛准则判定变量 Dim aa As Single 反射系数 Dim temp As Single 临时交换变量 Dim w As Single 临时变量 Dim u As Single Dim zxd1 As Boolean Dim ii As Integer Dim v1 As Single, v2 As Single, v3 As Single 求f(x)的临时变量 Dim pi As Single-读入初始数据添加代码 n = 6: e = 0.1: g = 0.5:
6、 mm1 = 7: pi = 3.14159265358边界条件 a(1) = 2: b(1) = 5 a(2) = 17: b(2) = 30 a(3) = 2.5: b(3) = 4 a(4) = 17: b(4) = 30 a(5) = 2.8: b(5) = 4.5 a(6) = 8 * pi / 180: b(6) = 15 * pi / 180Do Do For ii = 1 To 2 * n Call qd_cs_kxd(ii) 产生初始点 q = tj_pd(ii) 判定 Loop While q = False Next ii s = 2 * n Call qd_xx(s)
7、求形心 s = 0 q = tj_pd(s) rec = 1ppqq: zxd1 = True Do While zxd1 = True Call qd_fx 求f(x)- bb = True For k = 1 To 2 * n 收敛准则 If Abs(f(0) - f(k) 0.01 Then bb = False End If Next k If bb = True Then # Call qd_result 出口,打印优化结果 Exit Sub Else For j = 1 To 2 * n 确定最坏点,最好点,次坏点 m(j) = f(j) Next j For j = 1 To 2
8、 * n h(j) = j For j = 1 To 2 * n - 1 For k = j + 1 To 2 * n If m(j) m(k) Then Exit For Else temp = m(j): m(j) = m(k): m(k) = temp temp = h(j): h(j) = h(k): h(k) = temp mm = 1: hh = h(mm) 找出最坏点位置 For j = 1 To n 去除最坏点xp(h,j)求形心 xp(0, j) = (xp(0, j) * 2 * n - xp(hh, j) / (2 * n - 1) ii = 0 ?- q = tj_pd
9、(ii) If q = False Then w = h(2 * n) For j = 1 To n a(j) = xp(w, j): b(j) = xp(0, j) zxd1 = False 上下界重新调整,重新确定初始可行点 aa = 1.3 Call qd_fs1(aa, hh) ii = 2 * n + 1 If q = True Then f(2 * n + 1) = qd_every_fx(2 * n + 1) If f(2 * n + 1) f(hh) Then Exit Do If aa 2 Then Call qd_fs(j) 缩边生成新复合形 q = tj_pd(j) Ca
10、ll qd_xx(s) GoTo ppqq mm = mm + 1 hh = h(mm) aa = aa / 2 Loop- xp(hh, j) = xp(2 * n + 1, j) rec = rec + 1 u = 0 For k = 1 To 2 * n u = u + xp(k, j) xp(0, j) = u / (2 * n)-LoopEnd Sub条件判断Public Function tj_pd(iii As Integer) As BooleanDim j As Integer, k As Integer For j = 1 To n 边界条件判断 If xp(iii, j)
11、 b(j) ThenNext jCall cm_jc_plqd_sj(iii) 接触疲劳强度、弯曲疲劳强度计算For j = 1 To mm1 约束条件判断 If c(j) 0 Thentj_pd = TrueDebug.Print f(; 0; )= Int(f(0) * 1000 + 0.5) / 1000, rec= rec 显示每回结果End FunctionPublic Sub qd_cs_kxd(ii As Integer)Dim j As SingleFor j = 1 To nxp(ii, j) = a(j) + Rnd(1) * (b(j) - a(j)产生其余点Public
12、 Sub qd_qt_kxd()Dim j As IntegerDim k As IntegerFor j = 2 To 2 * n For k = 1 To n xp(j, k) = a(k) + Rnd(1) * (b(k) - a(k)Public Sub qd_xx(ss As Integer)Dim t As Single t = 0 For k = 1 To ss t = t + xp(k, j) xp(0, j) = t / ss向形心移动Public Sub qd_fs(ss As Integer) xp(ss + 1, j) = xp(0, j) + (xp(ss + 1,
13、j) - xp(0, j) / 2求f(x),2*n个Public Sub qd_fx()For k = 0 To 2 * n f(k) = qd_every_fx(k)Next k求每个f(x)Public Function qd_every_fx(i As Integer) As SingleDim y1 As Single, y2 As Single, y3 As Singley1 = xp(i, 1) * xp(i, 2) * (1 + xp(i, 5)y2 = xp(i, 3) * xp(i, 4) * (1 + my_gear_data.uu / xp(i, 5)y3 = 2 *
14、Cos(xp(i, 6)qd_every_fx = (y1 + y2) / y3再次反射Public Sub qd_fs1(aaa As Single, hhh As Integer) xp(2 * n + 1, j) = xp(0, j) + aaa * (xp(0, j) - xp(hhh, j) 反射输出优化结果Public Sub qd_result()Dim j As Integer, k As IntegerForm2.Visible = TrueForm2.Print no.of iteration= recFor j = 0 To 2 * n Form2.Print Int(1
15、000 * xp(j, k) + 0.5) / 1000; Tab(k * 10); Form2.Print f(j)斜齿圆柱齿轮(软、硬齿面)传动计算程序Public Sub cm_jc_plqd_sj(iiii As Integer)Dim aa1 As Single, aa2 As Single, aa3 As Single, aa4 As Single, aa5 As Single, aa6 As Single 中间变量Dim bb1 As Single, bb2 As Single Dim c7 As Integer Dim temp_yh_data As yh_dataDim t1
16、 As Single, t3 As Single 扭矩Dim sn(4) As Single 应力循环次数Dim ze1 As Single, ze2 As Single 弹性影响系数Dim er1 As Single, er2 As Single Dim kr1 As Single, kr2 As Single Dim bb As Single 基圆螺旋角Dim r As Single 齿轮分度圆压力角的角度数Dim rt As Single 端面压力角Dim zh As Single 节点区域系数Dim kh(4) As Single 齿轮接触疲劳寿命系数Dim kf(4) As Sing
17、le 齿轮弯曲疲劳寿命系数Dim ho(4) As Single 齿轮材料接触疲劳极限Dim fo(4) As Single 齿轮材料弯曲疲劳极限Dim hp(4) As Single 齿轮材料接触疲劳许用应力Dim fp(4) As Single 齿轮材料弯曲疲劳许用应力Dim zv(4) As Single 当量齿数Dim yf(4) As Single Dim ys(4) As Single Dim ss As Single 安全系数Dim eb1 As Single, eb2 As Single 轴向重合度Dim tb1 As Single, tb2 As Single temp_yh
18、_data.bt 的角度数Dim be1 As Single, be2 As SingleDim yb1 As Single, yb2 As Single 螺旋角影响系数按齿面接触疲劳强度设计相关参数temp_yh_data.z1 = xp(iiii, 2) 每次的优化结果temp_yh_data.z3 = xp(iiii, 4)temp_yh_data.u1 = xp(iiii, 5)temp_yh_data.bt = xp(iiii, 6)temp_yh_data.u2 = my_gear_data.uu / temp_yh_data.u1temp_yh_data.z2 = Int(tem
19、p_yh_data.z1 * temp_yh_data.u1)temp_yh_data.z4 = Int(temp_yh_data.z3 * temp_yh_data.u2)temp_yh_data.n2 = my_gear_data.n1 / temp_yh_data.u1t1 = 9550000! * my_gear_data.p / my_gear_data.n1 t3 = 9550000! * my_gear_data.p * my_gear_data.np / temp_yh_data.n2sn(1) = my_gear_data.n1 * my_gear_data.ly * my_
20、gear_data.wn * 144000!工作周数sn(2) = sn(1) / temp_yh_data.u1sn(3) = 60 * temp_yh_data.n2 * 1 * (my_gear_data.wn * 8 * 300 * my_gear_data.ly)sn(4) = sn(3) / temp_yh_data.u2ze1 = jh_ze(my_gear_data.gm(1), my_gear_data.gm(2)ze2 = jh_ze(my_gear_data.gm(3), my_gear_data.gm(4)er1 = jh_er_kr(temp_yh_data.z1,
21、temp_yh_data.z2, temp_yh_data.bt).er 重合度kr1 = jh_er_kr(temp_yh_data.z1, temp_yh_data.z2, temp_yh_data.bt).kr 载荷分配系数er2 = jh_er_kr(temp_yh_data.z3, temp_yh_data.z4, temp_yh_data.bt).erkr2 = jh_er_kr(temp_yh_data.z3, temp_yh_data.z4, temp_yh_data.bt).krr = 20 * 0.017453 压力角rt = Atn(Tan(r) / Cos(temp_y
22、h_data.bt) bb = Atn(Tan(temp_yh_data.bt) * Cos(rt) zh = Sqr(2 * Cos(bb) / Sin(rt) / Cos(rt)kh(1) = jh_khn(my_gear_data.gm(1), my_gear_data.mh(1), sn(1) kh(3) = jh_khn(my_gear_data.gm(3), my_gear_data.mh(3), sn(3)ho(1) = jh_ho(my_gear_data.gm(1), my_gear_data.mh(1), my_gear_data.hb(1), my_gear_data.r
23、c(1) 接触疲劳极限ho(3) = jh_ho(my_gear_data.gm(3), my_gear_data.mh(3), my_gear_data.hb(3), my_gear_data.rc(3)hp(1) = kh(1) * ho(1) 接触强度极限hp(3) = kh(3) * ho(3)按齿跟弯曲疲劳强度设计相关参数zv(1) = temp_yh_data.z1 / (Cos(temp_yh_data.bt) 3 zv(2) = temp_yh_data.z2 / (Cos(temp_yh_data.bt) 3zv(3) = temp_yh_data.z3 / (Cos(temp_yh_data.bt) 3
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1