凸轮程序的设计
习题 4-1 凸轮轮廓曲线的程序设计
10 级机制班 丁林森 201000163021
1、C 语言程序
//
各字母含义 e 偏距、基圆半径 ro、滚子半径 rt、行程 h、推程运动角 phi1、远休止角 phis、
回程、运动角 phi_1,近休止角 phi_s
#include<stdio.h>
#include<math.h>
#define PI 3.1415926
void main()
{double e=10.0,ro=40.0,rt=10.0,h=20.0,phi1=150.0,phis=30.0,phi_1=120.0,phi_s=60;
double s, alp[73],x[73],y[73],x1,y1,xr[73],yr[73];
double ic,ic1,ic2,ic3,ic4,so,s1,cop,sip,phi,gam,bel,del=5.0,q,t;
int i;
gam=phi1+phis;
bel=phi1+phis+phi_1;
ic=(int)(360.0/del);
ic1=(int)(phi1/del);
ic2=(int)(gam/del);
ic3=(int)((phi1+phis+phi_1/2.0)/del);
ic4=(int)(bel/del);
so=sqrt(ro*ro-e*e);
printf(" No deg x/mm y/mm X/mm Y/mm rad");
for(i=0;i<=ic;i++) //
{
phi=i*del*PI/180.0;
cop=cos(phi);
sip=sin(phi);
if(i<=ic1)
{ s=h/2.0*(1.0-cos(180.0*phi/phi1));
s1=h*PI*sin(180.0*phi/phi1)/2.0/phi1;
x1=-(s+so)*sip+s1*cop-e*cop;
y1=(s+so)*cop+s1*sip-e*sip;
}
else if(i<=ic2)
{ s=h;
s1=0;
x1=-(s+so)*sip-e*cop;
y1=(so+s)*cop-e*sip;
}
else if(i<=ic3)