NACA four digit matlab code
Old instructions in Icelandic Wind tunnel test stand airfoil code A driver file for ReplicatorG
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
%
|
||||
% Tveggja NACAmptt prófíla-reiknir sem táknbreytir ferlum yfir
|
||||
%
|
||||
% í G-kóða fyrir frauðplastskera sem staðsettur er í vindgangarými
|
||||
%
|
||||
% Háskólans í Reykjavík.
|
||||
%
|
||||
%
|
||||
%
|
||||
% Innlagsbreytur: m, p, t, c, b, TEo, TEv, inc, n, filename
|
||||
%
|
||||
% Hver innlagsbreyta fyrir sig er útskýrð þar sem hún kemur fyrir í
|
||||
%
|
||||
% kóðanum
|
||||
%
|
||||
%
|
||||
%
|
||||
% Úttaksbreyta: G-kóði sem skrifaður er í skránna 'filename.gcode'
|
||||
%
|
||||
%
|
||||
%
|
||||
% Höfundur: Kristján Orri Magnússon, Háskólinn í Reykjavík, Haust 2011
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
clear all
|
||||
% Nafn úttaksskráar. Endingin skal vera .gcode.
|
||||
filename=['NACA0015test.gcode']
|
||||
%One digit max camber as % of chord, m2 er prófíllinn sem að A-B plan
|
||||
%frauðplastskerans teiknar og m er fyrir X-Y planið.
|
||||
m=0
|
||||
m2=0
|
||||
%One digit describing the distance of maximum camber from the airfoil
|
||||
%leading edge in tens of percents of the chord. p->X-Y plan, p2->A-B plan
|
||||
p=0
|
||||
p2=0
|
||||
%Two digits describing maximum thickness of the airfoil as percent of the
|
||||
%chord. t-> X-Y plan, t2-> A-B plan
|
||||
t=15
|
||||
t2=15
|
||||
%chord length (mm). c ->X-Y plan c2->A-B plan
|
||||
c=130
|
||||
c2=130
|
||||
% Span length(mm). Vænghaf vængs sem skera á út.
|
||||
b=500
|
||||
%T/E horizontal offset (mm). Lárétt hliðrun trailing edge milli prófíla í
|
||||
%XY og AB vængsniðum.
|
||||
TEo=10
|
||||
%T/E vertical offset (mm). Lóðrétt hliðrun trailing edge milli prófíla í
|
||||
%XY og AB vængsniðum.
|
||||
TEv=30
|
||||
%Incline(rad). Vindingur, horn milli vænglína sitt hvors prófíls.
|
||||
inc=20*pi/180
|
||||
%number of points (80 is minimum for L/E precision)
|
||||
n=80
|
||||
|
||||
%Total span (mm). Hornrétt vegalengd milli XY og AB plana, fasti.
|
||||
tsp=935
|
||||
%Scale up for shorter than tsp wings
|
||||
inc=inc*tsp/b;
|
||||
c2=c-(c-c2)*tsp/b;
|
||||
TEo=TEo*tsp/b;
|
||||
TEv=TEv*tsp/b;
|
||||
%scaling for machine units
|
||||
c=c*8.889;
|
||||
c2=c2*8.889;
|
||||
TEo=TEo*8.889; TEv=TEv*8.889;
|
||||
%dx þarf að ganga upp í c til að loka prófílnum
|
||||
dx=c/n;
|
||||
dx2=c2/n;
|
||||
%Scaling for equations m=m/100;
|
||||
m2=m2/100;
|
||||
p=p/10;
|
||||
p2=p2/10;
|
||||
t=t/100;
|
||||
t2=t2/100;
|
||||
x=0:dx:c; %Lárétt staðsetning miðað við vænglínu í XY plani
|
||||
x2=0:dx2:c2;%Lóðrétt staðsetning miðað við vænglínu í XY plani
|
||||
%symmetrical airfoil generator
|
||||
yt=(t*c/0.2).*(0.2969.*(x./c).^0.5-0.1281.*(x./c)- 0.3516.*(x./c).^2+0.2843.*(x./c).^3-0.1015.*(x./c).^4);
|
||||
yt2=(t2*c2/0.2).*(0.2969.*(x2./c2).^0.5-0.1281.*(x2./c2)- 0.3516.*(x2./c2).^2+0.2843.*(x2./c2).^3-0.1015.*(x2./c2).^4);
|
||||
%camber line 1 (XY plan)
|
||||
for i=1:length(x)
|
||||
if x(i)<p*c
|
||||
yc(i)=m.*(x(i)./p^2).*(2*p-x(i)./c)
|
||||
else
|
||||
yc(i)=m.*(c-x(i))./(1-p)^2.*(1+x(i)./c-2*p);
|
||||
end
|
||||
end
|
||||
th(1)=1;
|
||||
for i=2:length(x)
|
||||
th(i)=atan((yc(i)-yc(i-1))/dx); %Snertilhorn camber line (XY)
|
||||
end
|
||||
%camber line 2 (AB plan)
|
||||
for i=1:length(x2)
|
||||
if x2(i)<p2*c2
|
||||
yc2(i)=m2.*(x2(i)./p2^2).*(2*p2-x2(i)./c2);
|
||||
else
|
||||
yc2(i)=m2.*(c2-x2(i))./(1-p2)^2.*(1+x2(i)./c2-2*p2);
|
||||
end
|
||||
end
|
||||
th2(1)=1;
|
||||
for i=2:length(x2)
|
||||
th2(i)=atan((yc2(i)-yc2(i-1))/dx); %Snertilhorn camber line (AB)
|
||||
end
|
||||
%points for profile 1 (XY)
|
||||
xu=x-yt.*sin(th); % X upper
|
||||
xl=x+yt.*sin(th); % X lower
|
||||
yu=yc+yt.*cos(th); % Y upper
|
||||
yl=yc-yt.*cos(th); % Y lower
|
||||
xu=fliplr(xu); %Snúið við til að fá samfella hreyfingu yfir prófílinn
|
||||
yu=fliplr(yu);
|
||||
|
||||
%points for profile 2 (AB)
|
||||
xu2=x2-yt2.*sin(th2)+100000; %A upper (án vindings)
|
||||
xl2=x2+yt2.*sin(th2)+100000; %A lower (án vindings)
|
||||
yu2=yc2+yt2.*cos(th2); %B upper
|
||||
yl2=yc2-yt2.*cos(th2); %B lower
|
||||
fu=atan(yu2./xu2); %Vænglínu AB prófíls snúið um hornið inc
|
||||
fl=atan(yl2./xl2);
|
||||
yu2=xu2.*sin(fu+inc)-100000*sin(inc);
|
||||
yl2=xl2.*sin(fl+inc)-100000*sin(inc);
|
||||
xu2=xu2.*cos(fu+inc)-100000*cos(inc);
|
||||
xl2=xl2.*cos(fl+inc)-100000*cos(inc);
|
||||
yu2=yu2-yu2(end)+TEv; %Hliðrun A upper í lárétta stefnu
|
||||
yl2=yl2-yl2(end)+TEv; %Hliðrun A lower í lárétta stefnu
|
||||
xu2=xu2+c-xu2(end)-TEo;%Hliðrun B upper í lóðrétta stefnu
|
||||
xl2=xl2+c-xl2(end)-TEo;
|
||||
%Hliðrn B lower í lóðrétta stefnu
|
||||
xu2=fliplr(xu2); %Snúið við til að fá samfella hreyfingu yfir prófílinn
|
||||
yu2=fliplr(yu2);
|
||||
|
||||
%Wing plotted in 3D for visualization
|
||||
z11=zeros(length(xu))
|
||||
z12=zeros(length(xl))
|
||||
z21=zeros(length(xu2))
|
||||
z22=zeros(length(xl2))
|
||||
z21=z21+tsp*8.889
|
||||
z22=z22+tsp*8.889
|
||||
figure(1)
|
||||
hold on
|
||||
plot3(xu,yu,z11,'r',xl,yl,z12,'r')
|
||||
plot3(xu2,yu2,z21,'r',xl2,yl2,z22,'r')
|
||||
for i=1:10:length(xu)
|
||||
plot3([xu(i) xu2(i)],[yu(i) yu2(i)],[z11(i) z21(i)])
|
||||
plot3([xl(i) xl2(i)],[yl(i) yl2(i)],[z11(i) z21(i)])
|
||||
end
|
||||
axis equal
|
||||
%grid on
|
||||
hold off
|
||||
|
||||
|
||||
|
||||
% GCODE táknbreytir -> breytir línuvigrum í færslulínur G-kóða.
|
||||
% Fyrst er vigrum breytt úr staðsetningarvigrum yfir í færsuvigra
|
||||
for i=1:n
|
||||
xx(i)=xu(i+1)-xu(i);
|
||||
yy(i)=yu(i+1)-yu(i);
|
||||
|
||||
xx(i+length(x))=xl(i+1)-xl(i);
|
||||
yy(i+length(x))=yl(i+1)-yl(i);
|
||||
end
|
||||
|
||||
for i=1:n
|
||||
aa(i)=xu2(i+1)-xu2(i);
|
||||
bb(i)=-1*(yu2(i+1)-yu2(i));
|
||||
aa(i+length(x2))=xl2(i+1)-xl2(i);
|
||||
bb(i+length(x2))=-1*(yl2(i+1)-yl2(i));
|
||||
end
|
||||
%Svo er skráin opnuð
|
||||
fid=fopen(filename,'wt');
|
||||
%Og g-kóðinn skrifaður í hana
|
||||
fprintf(fid,['G1 A' num2str(-TEo) ' B' num2str(-TEv) ' F3500\n'])
|
||||
%Hliðrun
|
||||
for i=1: 2*n+1
|
||||
fprintf(fid,['G1 X' num2str(xx(i)) ' Y' num2str(yy(i)) ' F4000\n']);
|
||||
fprintf(fid,['G1 A' num2str(aa(i)) ' B' num2str(bb(i)) ' F4000\n']);
|
||||
|
||||
end
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,341 @@
|
||||
%
|
||||
% Tveggja NACAmptt prófíla-reiknir sem táknbreytir ferlum yfir
|
||||
%
|
||||
% í G-kóða fyrir frauðplastskera sem staðsettur er í vindgangarými
|
||||
%
|
||||
% Háskólans í Reykjavík.
|
||||
%
|
||||
%
|
||||
%
|
||||
% Innlagsbreytur: m, p, t, c, b, TEo, TEv, inc, n, filename
|
||||
%
|
||||
% Hver innlagsbreyta fyrir sig er útskýrð þar sem hún kemur fyrir í
|
||||
%
|
||||
% kóðanum
|
||||
%
|
||||
%
|
||||
%
|
||||
% Úttaksbreyta: G-kóði sem skrifaður er í skránna 'filename.gcode'
|
||||
%
|
||||
%
|
||||
%
|
||||
% Höfundur: Kristján Orri Magnússon, Háskólinn í Reykjavík, Haust 2011
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
clc; close all; clear
|
||||
% Nafn úttaksskráar. Endingin skal vera .gcode.
|
||||
filename=['IMJ_NACA0015_ALLT.gcode']
|
||||
%One digit max camber as % of chord, m2 er prófíllinn sem að A-B plan
|
||||
%frauðplastskerans teiknar og m er fyrir X-Y planið.
|
||||
m=0
|
||||
m2=0
|
||||
%One digit describing the distance of maximum camber from the airfoil
|
||||
%leading edge in tens of percents of the chord. p->X-Y plan, p2->A-B plan
|
||||
%% var 45, set í 35
|
||||
p=0
|
||||
p2=0
|
||||
%Two digits describing maximum thickness of the airfoil as percent of the
|
||||
%chord. t-> X-Y plan, t2-> A-B plan
|
||||
t=15
|
||||
t2=15
|
||||
%chord length (mm). c ->X-Y plan c2->A-B plan
|
||||
c=290
|
||||
c2=290
|
||||
% Span length(mm). Vænghaf vængs sem skera á út.
|
||||
b=500
|
||||
%T/E horizontal offset (mm). Lárétt hliðrun trailing edge milli prófíla í
|
||||
%XY og AB vængsniðum.
|
||||
TEo=0
|
||||
%T/E vertical offset (mm). Lóðrétt hliðrun trailing edge milli prófíla í
|
||||
%XY og AB vængsniðum.
|
||||
TEv=0
|
||||
%Incline(rad). Vindingur, horn milli vænglína sitt hvors prófíls.
|
||||
inc=0 %20*pi/180
|
||||
%number of points (80 is minimum for L/E precision)
|
||||
n=300
|
||||
|
||||
%Total span (mm). Hornrétt vegalengd milli XY og AB plana, fasti.
|
||||
tsp=935
|
||||
%Scale up for shorter than tsp wings
|
||||
inc=inc*tsp/b;
|
||||
c2=c-(c-c2)*tsp/b;
|
||||
TEo=TEo*tsp/b;
|
||||
TEv=TEv*tsp/b;
|
||||
%scaling for machine units
|
||||
c=c*8.889;
|
||||
c2=c2*8.889;
|
||||
TEo=TEo*8.889; TEv=TEv*8.889;
|
||||
%dx þarf að ganga upp í c til að loka prófílnum
|
||||
dx=c/n;
|
||||
dx2=c2/n;
|
||||
%Scaling for equations m=m/100;
|
||||
m2=m2/100;
|
||||
p=p/10;
|
||||
p2=p2/10;
|
||||
t=t/100;
|
||||
t2=t2/100;
|
||||
x=0:dx:c; %Lárétt staðsetning miðað við vænglínu í XY plani
|
||||
x2=0:dx2:c2;%Lóðrétt staðsetning miðað við vænglínu í XY plani
|
||||
%symmetrical airfoil generator
|
||||
yt=(t*c/0.2).*(0.2969.*(x./c).^0.5-0.1281.*(x./c)- 0.3516.*(x./c).^2+0.2843.*(x./c).^3-0.1015.*(x./c).^4);
|
||||
yt2=(t2*c2/0.2).*(0.2969.*(x2./c2).^0.5-0.1281.*(x2./c2)- 0.3516.*(x2./c2).^2+0.2843.*(x2./c2).^3-0.1015.*(x2./c2).^4);
|
||||
%camber line 1 (XY plan)
|
||||
for i=1:length(x)
|
||||
if x(i)<p*c
|
||||
yc(i)=m.*(x(i)./p^2).*(2*p-x(i)./c)
|
||||
else
|
||||
yc(i)=m.*(c-x(i))./(1-p)^2.*(1+x(i)./c-2*p);
|
||||
end
|
||||
end
|
||||
th(1)=1;
|
||||
for i=2:length(x)
|
||||
th(i)=atan((yc(i)-yc(i-1))/dx); %Snertilhorn camber line (XY)
|
||||
end
|
||||
%camber line 2 (AB plan)
|
||||
for i=1:length(x2)
|
||||
if x2(i)<p2*c2
|
||||
yc2(i)=m2.*(x2(i)./p2^2).*(2*p2-x2(i)./c2);
|
||||
else
|
||||
yc2(i)=m2.*(c2-x2(i))./(1-p2)^2.*(1+x2(i)./c2-2*p2);
|
||||
end
|
||||
end
|
||||
th2(1)=1;
|
||||
for i=2:length(x2)
|
||||
th2(i)=atan((yc2(i)-yc2(i-1))/dx); %Snertilhorn camber line (AB)
|
||||
end
|
||||
%points for profile 1 (XY)
|
||||
xu=x-yt.*sin(th); % X upper
|
||||
xl=x+yt.*sin(th); % X lower
|
||||
yu=yc+yt.*cos(th); % Y upper
|
||||
yl=yc-yt.*cos(th); % Y lower
|
||||
xu=fliplr(xu); %Snúið við til að fá samfella hreyfingu yfir prófílinn
|
||||
yu=fliplr(yu);
|
||||
|
||||
%points for profile 2 (AB)
|
||||
xu2=x2-yt2.*sin(th2)+100000; %A upper (án vindings)
|
||||
xl2=x2+yt2.*sin(th2)+100000; %A lower (án vindings)
|
||||
yu2=yc2+yt2.*cos(th2); %B upper
|
||||
yl2=yc2-yt2.*cos(th2); %B lower
|
||||
fu=atan(yu2./xu2); %Vænglínu AB prófíls snúið um hornið inc
|
||||
fl=atan(yl2./xl2);
|
||||
yu2=xu2.*sin(fu+inc)-100000*sin(inc);
|
||||
yl2=xl2.*sin(fl+inc)-100000*sin(inc);
|
||||
xu2=xu2.*cos(fu+inc)-100000*cos(inc);
|
||||
xl2=xl2.*cos(fl+inc)-100000*cos(inc);
|
||||
yu2=yu2-yu2(end)+TEv; %Hliðrun A upper í lárétta stefnu
|
||||
yl2=yl2-yl2(end)+TEv; %Hliðrun A lower í lárétta stefnu
|
||||
xu2=xu2+c-xu2(end)-TEo;%Hliðrun B upper í lóðrétta stefnu
|
||||
xl2=xl2+c-xl2(end)-TEo;
|
||||
%Hliðrn B lower í lóðrétta stefnu
|
||||
xu2=fliplr(xu2); %Snúið við til að fá samfella hreyfingu yfir prófílinn
|
||||
yu2=fliplr(yu2);
|
||||
|
||||
%Wing plotted in 3D for visualization
|
||||
z11=zeros(length(xu))
|
||||
z12=zeros(length(xl))
|
||||
z21=zeros(length(xu2))
|
||||
z22=zeros(length(xl2))
|
||||
z21=z21+tsp*8.889
|
||||
z22=z22+tsp*8.889
|
||||
% figure(1)
|
||||
% hold on
|
||||
% plot3(xu,yu,z11,'r',xl,yl,z12,'r')
|
||||
% plot3(xu2,yu2,z21,'r',xl2,yl2,z22,'r')
|
||||
% for i=1:10:length(xu)
|
||||
% plot3([xu(i) xu2(i)],[yu(i) yu2(i)],[z11(i) z21(i)],'*')
|
||||
% plot3([xl(i) xl2(i)],[yl(i) yl2(i)],[z11(i) z21(i)],'*')
|
||||
% end
|
||||
% axis equal
|
||||
% %grid on
|
||||
% hold off
|
||||
|
||||
%% IMJ taka úr fyrir prífíl innan úr væng
|
||||
|
||||
%bein lína frá TE að enda gats fyrir prófíl, y fasti
|
||||
%xl_ad=linspace(xl(length(xl)),xl(length(xl))- (0.75*xl(end)-(350/2)) ,50);
|
||||
% xl_adII=linspace(xl(length(xl)), (0.15*xl(length(xl))+(350/2)+300)/2 ,15);
|
||||
xl_adII=linspace(xl(length(xl)), (0.15*xl(length(xl))+(350/2)+300)*2-200 ,15);
|
||||
yl_adII=linspace(yl(length(yl)),yl(length(yl)),15);
|
||||
|
||||
%% Taka úr fyrir hringjum
|
||||
% á miðri leið
|
||||
|
||||
%hringurinn
|
||||
r=50
|
||||
x_hring=xl_adII(length(xl_adII));
|
||||
y_hring=yl_adII(length(yl_adII));
|
||||
|
||||
th = 0:pi/10:2*pi;
|
||||
xun = r * cos(th)% + x;
|
||||
yunit = r * sin(th)% + y;
|
||||
xunit=xun+x_hring
|
||||
|
||||
% að næsta hring á LE
|
||||
|
||||
xl_n_hring=linspace(xl_adII(length(xl_adII)), 250 ,15);
|
||||
yl_n_hring=linspace(yl(length(yl)),yl(length(yl)),15);
|
||||
|
||||
% hringurinn
|
||||
|
||||
x_hringII = xl_n_hring(length(xl_n_hring))
|
||||
y_hringII = yl_n_hring(length(yl_n_hring))
|
||||
xunitII = xun+x_hringII
|
||||
%%
|
||||
|
||||
%klára línuna að prófíl gati;
|
||||
% xl_adI=linspace(xl_adII(length(xl_adII)), (0.15*xl(length(xl))+(350/2)+300) ,15);
|
||||
xl_adI=linspace(xunitII(length(xunitII)), (0.15*xl(length(xl))+(350/2)+300) ,15);
|
||||
yl_adI=linspace(yl(length(yl)),yl(length(yl)),15);
|
||||
|
||||
|
||||
% lína niður frá miðjum prófil í horn 1 niðri hægra megin, x fasti
|
||||
xl_horn_I=linspace(xl_adI(length(xl_adI)),xl_adI(length(xl_adI)),10);
|
||||
yl_horn_I=linspace(yl_adI(length(yl_adI)),yl_adI(length(yl_adI))-140,10);
|
||||
|
||||
% lína til vinstri frá neðra hægra horni að neðra vinstra horni, y fasti
|
||||
xl_horn_II=linspace(xl_horn_I(length(xl_horn_I)),xl_horn_I(length(xl_horn_I))-280,10);
|
||||
yl_horn_II=linspace(yl_horn_I(length(yl_horn_I)),yl_horn_I(length(yl_horn_I)),10);
|
||||
|
||||
% lína frá neðra vinstra horni að efra vinstra horni, x fasti
|
||||
xl_horn_III=linspace(xl_horn_II(length(xl_horn_II)),xl_horn_II(length(xl_horn_II)),10);
|
||||
yl_horn_III=linspace(yl_horn_II(length(yl_horn_II)),yl_horn_II(length(yl_horn_II))+280,10);
|
||||
|
||||
% lína frá efra vinstra horni að efra hægri horni, y fast
|
||||
xl_horn_IIII=linspace(xl_horn_III(length(xl_horn_III)),xl_horn_III(length(xl_horn_III))+280,10);
|
||||
yl_horn_IIII=linspace(yl_horn_III(length(yl_horn_III)),yl_horn_III(length(yl_horn_III)),10);
|
||||
|
||||
% lína frá efra hægra horni og niður í miðjan prófíl, x fasti
|
||||
xl_ad_lok=linspace(xl_horn_IIII(length(xl_horn_IIII)),xl_horn_IIII(length(xl_horn_IIII)),10);
|
||||
%yl_ad_lok=linspace(yl_horn_IIII(length(yl_horn_IIII)),yl_horn_IIII(length(yl_horn_IIII))-125,10);
|
||||
yl_ad_lok=linspace(yl_horn_IIII(length(yl_horn_IIII)),0,10);
|
||||
|
||||
%% Taka úr fyrir snúru
|
||||
|
||||
% upp um nokkra milla í horn uppi vinstra, x fasti
|
||||
xl_snura_UV=linspace(xl_ad_lok(length(xl_ad_lok)),xl_ad_lok(length(xl_ad_lok)),10);
|
||||
yl_snura_UV=linspace(yl_ad_lok(length(yl_ad_lok)),yl_ad_lok(length(yl_ad_lok))+70,10);
|
||||
|
||||
% horn uppi hægra, y fasti
|
||||
xl_snura_UH=linspace(xl_snura_UV(length(xl_snura_UV)),xl_snura_UV(length(xl_snura_UV))+400,10);
|
||||
yl_snura_UH=linspace(yl_snura_UV(length(yl_snura_UV)),yl_snura_UV(length(yl_snura_UV)),10);
|
||||
|
||||
% upp um nokkra milla í hornuppi vinstra, x fasti
|
||||
xl_snura_NH=linspace(xl_snura_UH(length(xl_snura_UH)),xl_snura_UH(length(xl_snura_UH)),10);
|
||||
yl_snura_NH=linspace(yl_snura_UH(length(yl_snura_UH)),yl_snura_UH(length(yl_snura_UH))-(2*70),10);
|
||||
|
||||
% horn niðri vinstra , y fasti
|
||||
xl_snura_NV=linspace(xl_snura_NH(length(xl_snura_NH)),xl_snura_NH(length(xl_snura_NH))-400,10);
|
||||
yl_snura_NV=linspace(yl_snura_NH(length(yl_snura_NH)),yl_snura_NH(length(yl_snura_NH)),10);
|
||||
|
||||
% upp um nokkra milla í hornuppi vinstra, x fasti
|
||||
xl_snura_mid=linspace(xl_snura_NV(length(xl_snura_NV)),xl_snura_NV(length(xl_snura_NV)),10);
|
||||
yl_snura_mid=linspace(yl_snura_NV(length(yl_snura_NV)),yl_snura_NV(length(yl_snura_NV))+70,10);
|
||||
|
||||
%%
|
||||
|
||||
% til baka á TE, y fasti
|
||||
xl_til_baka=linspace(xl_ad_lok(length(xl_ad_lok)),xl(length(xl)),29);
|
||||
%yl_til_baka=linspace(yl_ad_lok(length(yl_ad_lok)),yl(length(yl)),29);
|
||||
yl_til_baka=linspace(0,0,29);
|
||||
|
||||
figure(11)
|
||||
plot(xl_adII,yl_adII,'k')
|
||||
hold on
|
||||
plot(xunit,yunit,'c*')
|
||||
plot(xl_n_hring,yl_n_hring,'r')
|
||||
plot(xunitII,yunit,'c*')
|
||||
plot(xl_adI,yl_adI,'r')
|
||||
plot(xl_horn_I,yl_horn_I,'g')
|
||||
plot(xl_horn_II,yl_horn_II)
|
||||
plot(xl_horn_III,yl_horn_III)
|
||||
plot(xl_horn_IIII,yl_horn_IIII)
|
||||
plot(xl_ad_lok,yl_ad_lok)
|
||||
|
||||
plot(xl_snura_UV,yl_snura_UV)
|
||||
plot(xl_snura_UH,yl_snura_UH)
|
||||
plot(xl_snura_NH,yl_snura_NH)
|
||||
plot(xl_snura_NV,yl_snura_NV)
|
||||
plot(xl_snura_mid,yl_snura_mid)
|
||||
|
||||
plot(xl_til_baka,yl_til_baka)
|
||||
|
||||
% setja saman í einn vigur
|
||||
|
||||
x_box=horzcat(xl_adII, xunit, xl_n_hring, xunitII, xl_adI, xl_horn_I, xl_horn_II, xl_horn_III, xl_horn_IIII, xl_ad_lok, xl_snura_UV, xl_snura_UH, xl_snura_NH, xl_snura_NV, xl_snura_mid, xl_til_baka)
|
||||
y_box=horzcat(yl_adII, yunit, yl_n_hring, yunit, yl_adII, yl_horn_I, yl_horn_II, yl_horn_III, yl_horn_IIII, yl_ad_lok, yl_snura_UV, yl_snura_UH, yl_snura_NH, yl_snura_NV, yl_snura_mid, yl_til_baka)
|
||||
|
||||
% setja inn í réttan vigur xl og yl
|
||||
|
||||
xl=horzcat( xl)
|
||||
yl=horzcat( yl)
|
||||
|
||||
figure(13)
|
||||
plot(xl,yl)
|
||||
|
||||
|
||||
%%
|
||||
%
|
||||
for i=1:length(x_box)-1
|
||||
%if i <= n
|
||||
xb(i)=x_box(i+1)-x_box(i);
|
||||
yb(i)=y_box(i+1)-y_box(i);
|
||||
% end
|
||||
% xb(i+length(x))=xl(i+1)-xl(i);
|
||||
% yb(i+length(x))=yl(i+1)-yl(i);
|
||||
|
||||
end
|
||||
|
||||
% GCODE táknbreytir -> breytir línuvigrum í færslulínur G-kóða.
|
||||
% Fyrst er vigrum breytt úr staðsetningarvigrum yfir í færsuvigra
|
||||
for i=1:n%+166
|
||||
%if i <= n
|
||||
xx(i)=xu(i+1)-xu(i);
|
||||
yy(i)=yu(i+1)-yu(i);
|
||||
%end
|
||||
xx(i+length(x))=xl(i+1)-xl(i);
|
||||
yy(i+length(x))=yl(i+1)-yl(i);
|
||||
|
||||
end
|
||||
|
||||
|
||||
% for i=1:n
|
||||
% aa(i)=xu2(i+1)-xu2(i);
|
||||
% bb(i)=-1*(yu2(i+1)-yu2(i));
|
||||
% aa(i+length(x2))=xl2(i+1)-xl2(i);
|
||||
% bb(i+length(x2))=-1*(yl2(i+1)-yl2(i));
|
||||
% end
|
||||
|
||||
xx=horzcat(xb, xx)
|
||||
yy=horzcat(yb, yy)
|
||||
|
||||
ll=0
|
||||
l=0
|
||||
figure(10)
|
||||
for k=1:length(xx)
|
||||
l=l+xx(k)
|
||||
ll=ll+yy(k)
|
||||
plot(l,ll,'-*r')
|
||||
hold on
|
||||
|
||||
end
|
||||
|
||||
|
||||
aa=xx
|
||||
bb=yy*(-1)
|
||||
|
||||
|
||||
|
||||
%Svo er skráin opnuð
|
||||
fid=fopen(filename,'wt');
|
||||
%Og g-kóðinn skrifaður í hana
|
||||
fprintf(fid,['G1 A' num2str(-TEo) ' B' num2str(-TEv) ' F3500\n'])
|
||||
%Hliðrun
|
||||
for i=1: 2*n+length(xb)
|
||||
|
||||
fprintf(fid,['G1 X' num2str(xx(i)) ' Y' num2str(yy(i)) ' F4000\n']);
|
||||
|
||||
fprintf(fid,['G1 A' num2str(aa(i)) ' B' num2str(bb(i)) ' F4000\n']);
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.1" encoding="utf-8"?>
|
||||
<machines>
|
||||
<machine>
|
||||
<name>Thingomatic w/ Automated Build Platform</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="200" endstops="max"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Plastruder MK5" type="extruder" material="abs" motor="true" automatedplatform="true" heatedplatform="true" heater="true" uses_relay="false"/>
|
||||
</tools>
|
||||
<clamps></clamps>
|
||||
<driver name="sanguino3g">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
|
||||
<machine>
|
||||
<name>Thingomatic w/ Heated Build Platform</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="200" endstops="max"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Plastruder MK5" type="extruder" material="abs"
|
||||
motor="true" fan="true" heatedplatform="true" heater="true" uses_relay="false"/>
|
||||
</tools>
|
||||
<clamps></clamps>
|
||||
<driver name="sanguino3g">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
<machine>
|
||||
<name>Thingomatic w/ HBP and Stepstruder MK6</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="200" endstops="max"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
|
||||
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Stepstruder MK6" type="extruder" material="abs" motor="true" fan="true" heatedplatform="true" motor_steps="1600" default_rpm="1.98" heater="true" stepper_axis="a"/>
|
||||
</tools>
|
||||
<clamps></clamps>
|
||||
<driver name="makerbot4ga">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
<machine>
|
||||
<name>Thingomatic w/ ABP and Stepstruder MK6</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="200" endstops="max"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
|
||||
<axis id="a" length="100000" maxfeedrate="1600" stepspermm="50.235478806907409" endstops="none"/> <!-- stepspermm is incoming filament length, 127 is ca. 4 RPM, 1600 ca. 50 RPM -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Stepstruder MK6" type="extruder" material="abs" motor="true" heatedplatform="true" automatedplatform="true" motor_steps="1600" default_rpm="1.98" heater="true" stepper_axis="a"/>
|
||||
</tools>
|
||||
<clamps></clamps>
|
||||
<driver name="makerbot4ga">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
|
||||
<machine>
|
||||
<name>Thingomatic w/ Frostruder</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="47.069852" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="z" length="106" maxfeedrate="1000" homingfeedrate="500" stepspermm="200" endstops="max"/> <!-- TR-8x8 Z axis = 1/(8/1600) -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Frostruder v1.0" type="extruder" material="abs" motor="false" fan="true" valve="true" heater="false">
|
||||
<remap port="fan" name="Pressure Valve" actuated="open"/>
|
||||
<remap port="valve" name="Relief Valve" actuated="open"/>
|
||||
</tool>
|
||||
</tools>
|
||||
<clamps></clamps>[]
|
||||
<driver name="sanguino3g">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
|
||||
<machine experimental="0">
|
||||
<name>EXPERIMENTAL - Thingomatic - 4 axes</name>
|
||||
<geometry type="cartesian">
|
||||
<!-- different pulleys on X and Y axii -->
|
||||
<axis id="x" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="50" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="y" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="50" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="a" length="106" maxfeedrate="4000" homingfeedrate="500" stepspermm="50" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
<axis id="b" length="120" maxfeedrate="4000" homingfeedrate="500" stepspermm="50" endstops="min"/> <!-- Pulley dia: 10.82mm / 1/8 step = 1/(10.82 * pi / 1600) -->
|
||||
</geometry>
|
||||
<tools>
|
||||
<tool name="Plastruder MK5" type="extruder" material="abs" motor="true" fan="true" heatedplatform="true" heater="true"/>
|
||||
</tools>
|
||||
<clamps></clamps>
|
||||
<driver name="makerbot4g">
|
||||
<!-- optional: <portname>COM1</portname> -->
|
||||
<rate>115200</rate>
|
||||
</driver>
|
||||
<warmup>
|
||||
</warmup>
|
||||
<cooldown>
|
||||
(Turn off steppers after a build.)
|
||||
M18
|
||||
</cooldown>
|
||||
</machine>
|
||||
</machines>
|
||||
Reference in New Issue
Block a user