沈阳航空航天大学铰链四杆机构设计报告学院:机电工程学院班级:姓名:学号:Dima,b,c,d,e,f,l1,l2,l3,l4,w1,w2,w3,a2,a3#,p,m,dc,bjj,n%PrivateSubCommand1_Click()杆长赋值l1=Val(Text1(0).Text)l2=Val(Text1(1).Text)l3=Val(Text1(2).Text)l4=Val(Text1(3).Text)a=Val(Text3.Text)*3.14159265358979/180初始角度转弧度Callbj(bjj)Ifbjj=1ThenExitSubw1=0Calljsgw1=Val(Text2.Text)公式计算角速度,角加速度w2=-w1*l1*Sin(a-c)/(l3*Sin(b-c))w3=w1*l1*Sin(a-b)/(l2*Sin(c-b))Text4.Text=w2Text6.Text=w3a2=(l3*w3*w3-l1*w1*w1*Cos(a-c)-l2*w2*w2*Cos(b-c))/(l2*Sin(b-c))a3=(l2*w2*w2+l1*w1*w1*Cos(a-b)-l3*w3*w3*Cos(c-b))/(l3*Sin(c-b))Text5.Text=a2Text7.Text=a3EndSubFunctionjsg()Ifp=0Thenp=-1OnErrorGoToela=a+0.01*w1角度随时间增加d=l4-l1*Cos(a)e=-l1*Sin(a)f=(d^2+e^2+l3^2-l2^2)/(2*l3)c=2*Atn((e+Sqr(d^2+e^2-f^2)*p)/(d-f))b=Atn((e+l3*Sin(c))/(d+l3*Cos(c)))w1=-w1el:w1=-w1Line1(0).Y1=Picture1.Height/2定义各个线段端点的坐标Line1(0).X1=Picture1.Width/2Line1(0).X2=l1*Cos(a)+Line1(0).X1Line1(0).Y2=Line1(0).Y1-l1*Sin(a)Line1(3).X2=Line1(0).X1+l4Line1(3).Y2=Line1(0).Y1Line1(3).X1=Line1(0).X1Line1(3).Y1=Line1(0).Y1Line1(2).X1=Line1(3).X2+l3*Cos(c)Line1(2).Y1=Line1(3).Y2-l3*Sin(c)Line1(2).X2=Line1(3).X2Line1(2).Y2=Line1(3).Y2Line1(1).X1=Line1(0).X2Line1(1).Y1=Line1(0).Y2Line1(1).X2=Line1(2).X1Line1(1).Y2=Line1(2).Y1Shape1(i).Left=Line1(i).X1-50连接两杆转动副的中心坐标Shape1(i).Top=Line1(i).Y1-50NextiPicture1.PSet(Line1(1).X1,Line1(1).Y1),vbRed画出主动件和连架杆的轨迹Picture1.PSet(Line1(2).X1,Line1(2).Y1),vbGreenEndFunctionFunctionbj(x)杆长条件的判断x=0xld=Val(Text1(0).Text)xlx=Val(Text1(0).Text)Fori=1To3IfxldVal(Text1(i).Text)Thenxld=Val(Text1(i).Text)IfxlxVal(Text1(i).Text)Thenxlx=Val(Text1(i).Text)NextiFori=0To3zh=Val(Text1(i).Text)+zhNextiIf(xlx+xld)(zh-(xlx+xld))ThenMsgBox(不满足杆长要求)x=1EndIfEndFunction。。。Picture2.Scale(-8,4)-(8,-4)画出角速度w2函数图像Picture2.Line(-7.5,0)-(7.5,0)Picture2.Line(0,3.8)-(0,-3.8)Picture2.CurrentX=7.5:Picture2.CurrentY=0.2:Picture2.PrintxPicture2.CurrentX=0.3:Picture2.CurrentY=4:Picture2.PrintyFori=-7To7Picture2.Line(i,0)-(i,0.1)Picture2.CurrentX=i-0.1:Picture2.CurrentY=-0.01:Picture2.PrintiNextiFori=3.2To-3.2Step-0.2Ifi-0.01Andi0.01Theni=0Picture2.CurrentX=-0.3:Picture2.CurrentY=i+0.03:Picture2.PrintiPicture2.Line(0.3,i)-(0,i)NextiDima1,b1,c1,d1,e1,f1,w11#w11=0.001Forx=-6.283To6.283Step0.001Ifp=0Thenp=-1OnErrorGoToela1=a1+w11d1=l4-l1*Cos(a1)e1=-l1*Sin(a1)f1=(d1^2+e1^2+l3^2-l2^2)/(2*l3)c1=2*Atn((e1+Sqr(d1^2+e1^2-f1^2)*p)/(d1-f1))b1=Atn((e1+l3*Sin(c1))/(d1+l3*Cos(c1)))w11=-w11el:w11=-w11w111=Val(Text2.Text)w21=-w111*l1*Sin(a1-c1)/(l3*Sin(b1-c1))w31=w1*l1*Sin(a1-b1)/(l2*Sin(c1-b1))a21=(l3*w31*w31-l1*w111*w111*Cos(a1-c1)-l2*w21*w21*Cos(b1-c1))/(l2*Sin(b1-c1))a31=(l2*w21*w21+l1*w111*w111*Cos(a1-b1)-l3*w31*w31*Cos(c1-b1))/(l3*Sin(c1-b1))Picture2.PSet(x,w21)NextxEndIfEndSubPicture3.Scale(-8,3.5)-(8,-3.5)画出角速度w3函数图像Picture3.Line(-7.5,0)-(7.5,0)Picture3.Line(0,3.4)-(0,-3.4)Picture3.CurrentX=7.5:Picture3.CurrentY=0.2:Picture3.PrintxPicture3.CurrentX=0.3:Picture3.CurrentY=3.5:Picture3.PrintyFori=-7To7Picture3.Line(i,0)-(i,0.1)Picture3.CurrentX=i-0.1:Picture3.CurrentY=-0.01:Picture3.PrintiNextiFori=3.2To-3.2Step-0.2Ifi-0.01Andi0.01Theni=0Picture3.CurrentX=-0.3:Picture3.CurrentY=i+0.03:Picture3.PrintiPicture3.Line(0.3,i)-(0,i)NextiDima1,b1,c1,d1,e1,f1,w11#w11=0.001Forx=-6.283To6.283Step0.001Ifp=0Thenp=-1OnErrorGoToela1=a1+w11d1=l4-l1*Cos(a1)e1=-l1*Sin(a1)f1=(d1^2+e1^2+l3^2-l2^2)/(2*l3)c1=2*Atn((e1+Sqr(d1^2+e1^2-f1^2)*p)/(d1-f1))b1=Atn((e1+l3*Sin(c1))/(d1+l3*Cos(c1)))w11=-w11el:w11=-w11w111=Val(Text2.Text)w21=-w111*l1*Sin(a1-c1)/(l3*Sin(b1-c1))w31=w1*l1*Sin(a1-b1)/(l2*Sin(c1-b1))a21=(l3*w31*w31-l1*w111*w111*Cos(a1-c1)-l2*w21*w21*Cos(b1-c1))/(l2*Sin(b1-c1))a31=(l2*w21*w21+l1*w111*w111*Cos(a1-b1)-l3*w31*w31*Cos(c1-b1))/(l3*Sin(c1-b1))Picture3.PSet(x,w31)NextxEndIfEndSubPrivateSubPicture4_DblClick()画出角加速度a2Picture3.ClsdPicture4.Scale(-8,8)-(8,-8)Picture4.Line(-7.5,0)-(7.5,0)Picture4.Line(0,7.5)-(0,-7.5)Picture4.CurrentX=7.5:Picture4.CurrentY=0.2:Picture4.PrintxPicture4.CurrentX=0.3:Picture4.CurrentY=8:Picture4.PrintyFori=-7To7Picture4.Line(i,0)-(i,0.1)Picture4.CurrentX=i-0.1:Picture4.CurrentY=-0.01:Picture4.PrintiNextiFori=7To-7Step-0.5Ifi-0.01Andi0.01Theni=0Picture4.CurrentX=-0.3:Picture4.CurrentY=i+0.03:Picture4.PrintiPicture4.Line(0.3,i)-(0,i)NextiDima1,b1,c1,d1,e1,f1,w11#w11=0.001Forx=-6.283To6.283Step0.001Ifp=0Thenp=-1OnErrorGoToelell:a1=a1+w11d1=l4-l1*Cos(a1)IfIsEmpty(d1)ThenGoToelle1=-l1*Sin(a1)IfIsEmpty(e1)ThenGoToellf1=(d1^2+e1^2+l3^2-l2^2)/(2*l3)IfIsEmpty(f1)ThenGoToellc1=2*Atn((e1+Sqr(d1^2+e1^2-f1^2)*p)/(d1-f1))IfIsEmpty(c1)ThenGoToellEndIfb1=Atn((e1+l3*Sin(c1))/(d1+l3*Cos(c1)))IfIsEmpty(b1)ThenGoToellw11=-w11el:w11=-w11w111=Val(Text2.Text)Ifb1=NullThenGoToellw21=-w111*l1*Sin(a1-c1)/(l3*Sin(b1-c1))w31=w1*l1*Sin(a1-b1)/(l2*Sin(c1-b1))a21=(l3*w31*w31-l1*w111*w111*Cos(a1-c1)-l2*w21*w21*Cos(b1-c1))/(l2*Sin(b1-c1))a31=(l2*w21*w21+l1*w111*w111*Cos(a1-b1)-l3*w31*w31*Cos(c1-b1))/(l3*Sin(c1-b1))Picture4.PSet(x,a21)Picture5.Scale(-8,8)-(8,-8)画出角加速度a3Picture5.Line(-7.5,0)-(7.5,0)Picture5.Line(0,7.5)-(0,-7.5)Picture5.CurrentX=7.5:Picture5.CurrentY=0.2:Picture5.