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:
180
Instructions Matlab Codes and diver file/Foamcutter.m
Normal file
180
Instructions Matlab Codes and diver file/Foamcutter.m
Normal file
@@ -0,0 +1,180 @@
|
||||
%
|
||||
% Tveggja NACAmptt pr<EFBFBD>f<EFBFBD>la-reiknir sem t<EFBFBD>knbreytir ferlum yfir
|
||||
%
|
||||
% <EFBFBD> G-k<EFBFBD><EFBFBD>a fyrir frau<EFBFBD>plastskera sem sta<EFBFBD>settur er <EFBFBD> vindgangar<EFBFBD>mi
|
||||
%
|
||||
% H<EFBFBD>sk<EFBFBD>lans <EFBFBD> Reykjav<EFBFBD>k.
|
||||
%
|
||||
%
|
||||
%
|
||||
% Innlagsbreytur: m, p, t, c, b, TEo, TEv, inc, n, filename
|
||||
%
|
||||
% Hver innlagsbreyta fyrir sig er <EFBFBD>tsk<EFBFBD>r<EFBFBD> <EFBFBD>ar sem h<EFBFBD>n kemur fyrir <EFBFBD>
|
||||
%
|
||||
% k<EFBFBD><EFBFBD>anum
|
||||
%
|
||||
%
|
||||
%
|
||||
% <EFBFBD>ttaksbreyta: G-k<EFBFBD><EFBFBD>i sem skrifa<EFBFBD>ur er <EFBFBD> skr<EFBFBD>nna 'filename.gcode'
|
||||
%
|
||||
%
|
||||
%
|
||||
% H<EFBFBD>fundur: Kristj<EFBFBD>n Orri Magn<EFBFBD>sson, H<EFBFBD>sk<EFBFBD>linn <EFBFBD> Reykjav<EFBFBD>k, Haust 2011
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
clear all
|
||||
% Nafn <EFBFBD>ttaksskr<EFBFBD>ar. Endingin skal vera .gcode.
|
||||
filename=['NACA0015test.gcode']
|
||||
%One digit max camber as % of chord, m2 er pr<EFBFBD>f<EFBFBD>llinn sem a<EFBFBD> A-B plan
|
||||
%frau<EFBFBD>plastskerans teiknar og m er fyrir X-Y plani<EFBFBD>.
|
||||
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<EFBFBD>nghaf v<EFBFBD>ngs sem skera <EFBFBD> <EFBFBD>t.
|
||||
b=500
|
||||
%T/E horizontal offset (mm). L<EFBFBD>r<EFBFBD>tt hli<EFBFBD>run trailing edge milli pr<EFBFBD>f<EFBFBD>la <EFBFBD>
|
||||
%XY og AB v<EFBFBD>ngsni<EFBFBD>um.
|
||||
TEo=10
|
||||
%T/E vertical offset (mm). L<EFBFBD><EFBFBD>r<EFBFBD>tt hli<EFBFBD>run trailing edge milli pr<EFBFBD>f<EFBFBD>la <EFBFBD>
|
||||
%XY og AB v<EFBFBD>ngsni<EFBFBD>um.
|
||||
TEv=30
|
||||
%Incline(rad). Vindingur, horn milli v<EFBFBD>ngl<EFBFBD>na sitt hvors pr<EFBFBD>f<EFBFBD>ls.
|
||||
inc=20*pi/180
|
||||
%number of points (80 is minimum for L/E precision)
|
||||
n=80
|
||||
|
||||
%Total span (mm). Hornr<EFBFBD>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 <EFBFBD>arf a<EFBFBD> ganga upp <EFBFBD> c til a<EFBFBD> loka pr<EFBFBD>f<EFBFBD>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<EFBFBD>r<EFBFBD>tt sta<EFBFBD>setning mi<EFBFBD>a<EFBFBD> vi<EFBFBD> v<EFBFBD>ngl<EFBFBD>nu <EFBFBD> XY plani
|
||||
x2=0:dx2:c2;%L<EFBFBD><EFBFBD>r<EFBFBD>tt sta<EFBFBD>setning mi<EFBFBD>a<EFBFBD> vi<EFBFBD> v<EFBFBD>ngl<EFBFBD>nu <EFBFBD> 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<EFBFBD>i<EFBFBD> vi<EFBFBD> til a<EFBFBD> f<EFBFBD> samfella hreyfingu yfir pr<EFBFBD>f<EFBFBD>linn
|
||||
yu=fliplr(yu);
|
||||
|
||||
%points for profile 2 (AB)
|
||||
xu2=x2-yt2.*sin(th2)+100000; %A upper (<EFBFBD>n vindings)
|
||||
xl2=x2+yt2.*sin(th2)+100000; %A lower (<EFBFBD>n vindings)
|
||||
yu2=yc2+yt2.*cos(th2); %B upper
|
||||
yl2=yc2-yt2.*cos(th2); %B lower
|
||||
fu=atan(yu2./xu2); %V<EFBFBD>ngl<EFBFBD>nu AB pr<EFBFBD>f<EFBFBD>ls sn<EFBFBD>i<EFBFBD> um horni<EFBFBD> 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<EFBFBD>run A upper <EFBFBD> l<EFBFBD>r<EFBFBD>tta stefnu
|
||||
yl2=yl2-yl2(end)+TEv; %Hli<EFBFBD>run A lower <EFBFBD> l<EFBFBD>r<EFBFBD>tta stefnu
|
||||
xu2=xu2+c-xu2(end)-TEo;%Hli<EFBFBD>run B upper <EFBFBD> l<EFBFBD><EFBFBD>r<EFBFBD>tta stefnu
|
||||
xl2=xl2+c-xl2(end)-TEo;
|
||||
%Hli<EFBFBD>rn B lower <EFBFBD> l<EFBFBD><EFBFBD>r<EFBFBD>tta stefnu
|
||||
xu2=fliplr(xu2); %Sn<EFBFBD>i<EFBFBD> vi<EFBFBD> til a<EFBFBD> f<EFBFBD> samfella hreyfingu yfir pr<EFBFBD>f<EFBFBD>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<EFBFBD>knbreytir -> breytir l<EFBFBD>nuvigrum <EFBFBD> f<EFBFBD>rslul<EFBFBD>nur G-k<EFBFBD><EFBFBD>a.
|
||||
% Fyrst er vigrum breytt <EFBFBD>r sta<EFBFBD>setningarvigrum yfir <EFBFBD> f<EFBFBD>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<EFBFBD>in opnu<EFBFBD>
|
||||
fid=fopen(filename,'wt');
|
||||
%Og g-k<EFBFBD><EFBFBD>inn skrifa<EFBFBD>ur <EFBFBD> hana
|
||||
fprintf(fid,['G1 A' num2str(-TEo) ' B' num2str(-TEv) ' F3500\n'])
|
||||
%Hli<EFBFBD>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<EFBFBD>f<EFBFBD>la-reiknir sem t<EFBFBD>knbreytir ferlum yfir
|
||||
%
|
||||
% <EFBFBD> G-k<EFBFBD><EFBFBD>a fyrir frau<EFBFBD>plastskera sem sta<EFBFBD>settur er <EFBFBD> vindgangar<EFBFBD>mi
|
||||
%
|
||||
% H<EFBFBD>sk<EFBFBD>lans <EFBFBD> Reykjav<EFBFBD>k.
|
||||
%
|
||||
%
|
||||
%
|
||||
% Innlagsbreytur: m, p, t, c, b, TEo, TEv, inc, n, filename
|
||||
%
|
||||
% Hver innlagsbreyta fyrir sig er <EFBFBD>tsk<EFBFBD>r<EFBFBD> <EFBFBD>ar sem h<EFBFBD>n kemur fyrir <EFBFBD>
|
||||
%
|
||||
% k<EFBFBD><EFBFBD>anum
|
||||
%
|
||||
%
|
||||
%
|
||||
% <EFBFBD>ttaksbreyta: G-k<EFBFBD><EFBFBD>i sem skrifa<EFBFBD>ur er <EFBFBD> skr<EFBFBD>nna 'filename.gcode'
|
||||
%
|
||||
%
|
||||
%
|
||||
% H<EFBFBD>fundur: Kristj<EFBFBD>n Orri Magn<EFBFBD>sson, H<EFBFBD>sk<EFBFBD>linn <EFBFBD> Reykjav<EFBFBD>k, Haust 2011
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
clc; close all; clear
|
||||
% Nafn <EFBFBD>ttaksskr<EFBFBD>ar. Endingin skal vera .gcode.
|
||||
filename=['IMJ_NACA0015_ALLT.gcode']
|
||||
%One digit max camber as % of chord, m2 er pr<EFBFBD>f<EFBFBD>llinn sem a<EFBFBD> A-B plan
|
||||
%frau<EFBFBD>plastskerans teiknar og m er fyrir X-Y plani<EFBFBD>.
|
||||
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 <EFBFBD> 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<EFBFBD>nghaf v<EFBFBD>ngs sem skera <EFBFBD> <EFBFBD>t.
|
||||
b=500
|
||||
%T/E horizontal offset (mm). L<EFBFBD>r<EFBFBD>tt hli<EFBFBD>run trailing edge milli pr<EFBFBD>f<EFBFBD>la <EFBFBD>
|
||||
%XY og AB v<EFBFBD>ngsni<EFBFBD>um.
|
||||
TEo=0
|
||||
%T/E vertical offset (mm). L<EFBFBD><EFBFBD>r<EFBFBD>tt hli<EFBFBD>run trailing edge milli pr<EFBFBD>f<EFBFBD>la <EFBFBD>
|
||||
%XY og AB v<EFBFBD>ngsni<EFBFBD>um.
|
||||
TEv=0
|
||||
%Incline(rad). Vindingur, horn milli v<EFBFBD>ngl<EFBFBD>na sitt hvors pr<EFBFBD>f<EFBFBD>ls.
|
||||
inc=0 %20*pi/180
|
||||
%number of points (80 is minimum for L/E precision)
|
||||
n=300
|
||||
|
||||
%Total span (mm). Hornr<EFBFBD>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 <EFBFBD>arf a<EFBFBD> ganga upp <EFBFBD> c til a<EFBFBD> loka pr<EFBFBD>f<EFBFBD>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<EFBFBD>r<EFBFBD>tt sta<EFBFBD>setning mi<EFBFBD>a<EFBFBD> vi<EFBFBD> v<EFBFBD>ngl<EFBFBD>nu <EFBFBD> XY plani
|
||||
x2=0:dx2:c2;%L<EFBFBD><EFBFBD>r<EFBFBD>tt sta<EFBFBD>setning mi<EFBFBD>a<EFBFBD> vi<EFBFBD> v<EFBFBD>ngl<EFBFBD>nu <EFBFBD> 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<EFBFBD>i<EFBFBD> vi<EFBFBD> til a<EFBFBD> f<EFBFBD> samfella hreyfingu yfir pr<EFBFBD>f<EFBFBD>linn
|
||||
yu=fliplr(yu);
|
||||
|
||||
%points for profile 2 (AB)
|
||||
xu2=x2-yt2.*sin(th2)+100000; %A upper (<EFBFBD>n vindings)
|
||||
xl2=x2+yt2.*sin(th2)+100000; %A lower (<EFBFBD>n vindings)
|
||||
yu2=yc2+yt2.*cos(th2); %B upper
|
||||
yl2=yc2-yt2.*cos(th2); %B lower
|
||||
fu=atan(yu2./xu2); %V<EFBFBD>ngl<EFBFBD>nu AB pr<EFBFBD>f<EFBFBD>ls sn<EFBFBD>i<EFBFBD> um horni<EFBFBD> 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<EFBFBD>run A upper <EFBFBD> l<EFBFBD>r<EFBFBD>tta stefnu
|
||||
yl2=yl2-yl2(end)+TEv; %Hli<EFBFBD>run A lower <EFBFBD> l<EFBFBD>r<EFBFBD>tta stefnu
|
||||
xu2=xu2+c-xu2(end)-TEo;%Hli<EFBFBD>run B upper <EFBFBD> l<EFBFBD><EFBFBD>r<EFBFBD>tta stefnu
|
||||
xl2=xl2+c-xl2(end)-TEo;
|
||||
%Hli<EFBFBD>rn B lower <EFBFBD> l<EFBFBD><EFBFBD>r<EFBFBD>tta stefnu
|
||||
xu2=fliplr(xu2); %Sn<EFBFBD>i<EFBFBD> vi<EFBFBD> til a<EFBFBD> f<EFBFBD> samfella hreyfingu yfir pr<EFBFBD>f<EFBFBD>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 <EFBFBD>r fyrir pr<EFBFBD>f<EFBFBD>l innan <EFBFBD>r v<EFBFBD>ng
|
||||
|
||||
%bein l<EFBFBD>na fr<EFBFBD> TE a<EFBFBD> enda gats fyrir pr<EFBFBD>f<EFBFBD>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 <EFBFBD>r fyrir hringjum
|
||||
% <EFBFBD> mi<EFBFBD>ri lei<EFBFBD>
|
||||
|
||||
%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<EFBFBD> n<EFBFBD>sta hring <EFBFBD> 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<EFBFBD>ra l<EFBFBD>nuna a<EFBFBD> pr<EFBFBD>f<EFBFBD>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<EFBFBD>na ni<EFBFBD>ur fr<EFBFBD> mi<EFBFBD>jum pr<EFBFBD>fil <EFBFBD> horn 1 ni<EFBFBD>ri h<EFBFBD>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<EFBFBD>na til vinstri fr<EFBFBD> ne<EFBFBD>ra h<EFBFBD>gra horni a<EFBFBD> ne<EFBFBD>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<EFBFBD>na fr<EFBFBD> ne<EFBFBD>ra vinstra horni a<EFBFBD> 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<EFBFBD>na fr<EFBFBD> efra vinstra horni a<EFBFBD> efra h<EFBFBD>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<EFBFBD>na fr<EFBFBD> efra h<EFBFBD>gra horni og ni<EFBFBD>ur <EFBFBD> mi<EFBFBD>jan pr<EFBFBD>f<EFBFBD>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 <EFBFBD>r fyrir sn<EFBFBD>ru
|
||||
|
||||
% upp um nokkra milla <EFBFBD> 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<EFBFBD>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 <EFBFBD> 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<EFBFBD>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 <EFBFBD> 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 <EFBFBD> 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 <EFBFBD> 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 <EFBFBD> r<EFBFBD>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<EFBFBD>knbreytir -> breytir l<EFBFBD>nuvigrum <EFBFBD> f<EFBFBD>rslul<EFBFBD>nur G-k<EFBFBD><EFBFBD>a.
|
||||
% Fyrst er vigrum breytt <EFBFBD>r sta<EFBFBD>setningarvigrum yfir <EFBFBD> f<EFBFBD>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<EFBFBD>in opnu<EFBFBD>
|
||||
fid=fopen(filename,'wt');
|
||||
%Og g-k<EFBFBD><EFBFBD>inn skrifa<EFBFBD>ur <EFBFBD> hana
|
||||
fprintf(fid,['G1 A' num2str(-TEo) ' B' num2str(-TEv) ' F3500\n'])
|
||||
%Hli<EFBFBD>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
|
||||
|
||||
151
Instructions Matlab Codes and diver file/thingomatic.txt
Normal file
151
Instructions Matlab Codes and diver file/thingomatic.txt
Normal file
@@ -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