مکانیزم لنگ-لغزنده‬‎

در این مطلب نمونه کد نوشته شده Matlab برای تحلیل و طراحی مکانیزم مشهور لنگ-لغزنده را برای شما آماده کرده ام . در این کد اطلاعات اولیه مساله شامل طول بازوها، زاویه لنگ θ ، سرعت زاویه ای ورودی ω و فاصله نقطه دلخواه p از انتهای لنگ از کاربر گرفته شده و اطلاعاتی شامل زاویه بازوی رابط، سرعت زاویه ای و شتاب بازوی رابط، مختصات و مولفه های سرعت و شتاب نقطه p محاسبه و نمایش داده می شود. همچنین این برنامه امکان خطایابی داده های اولیه را دارا می باشد.

% Slider-crank mechanism analytics
% Insert crank and connector length & point "p" distance from "b" point & teta
% angle & input rotation speed
% Output is the displacement, velocity and acceleration of any point of
% connector and slider and connector angle "phi"
% Displacement unit is "mm", time unit is "s", angle unit is "degree"
% ---provided by Zahed.Fayhizadeh-www.kany.ir---
clc;
clear;
r=input('insert r= ');
while 0>r;
    r=input('"r" must be positive,r= ');
end
l=input('insert length link 3= ');
while 0>l;
    l=input('"l" must be positive,insert length link 3= ');
end
% "r" should be smallrt than "l"
while r>l;
    l=input('"l" is too short,insert length link 3= ');
end
d=input('insert "d" distance from "b"= ');
while 0>d;
    d=input('"d" must be positive,insert d= ');
end
while d>l;
    d=input('"d" must smaller than "l" ,insert d= ');
end
tr=input('insert teta angle(degree)= ');
te=tr*3.14/180;
om=input('insert rotation speed of link 2= ');
n=l/r;
m=d/l;
% Calculating angle, rotation speeed and acceleration of connector
phi=asin(sin(te)/n);
omega3=(om*sqrt(1-(sin(te))^2))/(sqrt((n^2)-(sin(te))^2));
alpha3=(om^2*sin(te)*(cos(te)^2)/((n^2-(sin(te))^2)^1.5))-((om^2*sin(te))/(sqrt(n*2-(sin(te))^2)));
% Displacement of point "p"
x=r*cos(te)+d*(n-(sin(te))^2/(2*n))/n;
y=(l-d)*sin(te)/n;
% Velocity of point "p"
vx=-r*om*(sin(te)+m*sin(2*te)/(2*n));
vy=r*om*(1-m)*cos(te);
% Acceleration of point "p"
ax=-r*om^2*(cos(te)+m*cos(2*te)/n);
ay=-r*om^2*(1-m)*sin(te);
% Displaying results
display(phi);
display(omega3);
display(alpha3);
display(x);
display(y);
display(vx);
display(vy);
display(ax);
display(ay);

همچنین برای رسم نمودارهای جابجایی و سرعت و شتاب در راستای x و y کد زیر آماده شده که می توانید از آن استفاده نمایید.

clc;
clear;
r=input('insert r= ');
while 0>r;
    r=input('"r" must be positive,r= ');
end
l=input('insert length link 3= ');
while 0>l;
    l=input('"l" must be positive,insert length link 3= ');
end
% "r" should be smallrt than "l"
while r>l;
    l=input('"l" is too short,insert length link 3= ');
end
d=input('insert "d" distance from "b"= ');
while 0>d;
    d=input('"d" must be positive,insert d= ');
end
while d>l;
    d=input('"d" must smaller than "l" ,insert d= ');
end

om=input('insert rotation speed of link 2= ');
n=l/r;
m=d/l;
 t=[0:0.01:2*pi];
    phi=asin(sin(t)./n);
omega3=(om.*sqrt(1-(sin(t)).^2))./(sqrt((n.^2)-(sin(t)).^2));
alpha3=(om.^2.*sin(t).*(cos(t).^2)./((n.^2-(sin(t)).^2).^1.5))-((om.^2.*sin(t))./(sqrt(n.*2-(sin(t)).^2)));
% Displacement of point "p"
x=r.*cos(t)+d.*(n-(sin(t)).^2./(2.*n))./n;
y=(l-d).*sin(t)./n;
% Velocity of point "p"
vx=-r.*om.*(sin(t)+m.*sin(2.*t)./(2.*n));
vy=r.*om.*(1-m).*cos(t);
% Acceleration of point "p"
ax=-r.*om.^2.*(cos(t)+m.*cos(2.*t)./n);
ay=-r.*om.^2.*(1-m).*sin(t);
plot(t,x,t,y,t,vx,t,vy,t,ax,t,ay)

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

8 + 11 =