-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPlanar_SCOIL_Gen.m
executable file
·95 lines (79 loc) · 2.9 KB
/
Planar_SCOIL_Gen.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
function [ok] = Planar_SCOIL_Gen(filename,Ncoils,Tports,Rports,Bports,Lports,Rad,Xpos,Ypos,Zpos,Len,Ssp,Wid,Gap,IniAngle,ShieldRad,ShieldLen)
%% Surface Planar Coil Array Generator
% _________________________________________________________________________
%
%
% Def.: Fucntion
%
% _________________________________________________________________________
%
%
%% INPUT
% filename - name of the geometry file to load data
% Ncoils - number of coils in array
% Tports - array with position of top ports
% Rports - array with position of right side ports
% Bports - array with position of bottom ports
% Lports - array with position of left side ports
% Rad - radius: the distance of the coil array to the center
% Xpos,Ypos,Zpos - position of the center of coil array
% Ssp - external span of each coil
% Len - external length in z direction of each coil
% Wid - width of the trace of the coil
% Gap - gap of the ports
% IniAngle - initial angle for the center of the first coil
%
%
%% OUTPUT
% ok
%
%
% -------------------------------------------------------------------------
%
% J. Fernandez Villena -- [email protected]
% A.G. Polimeridis -- [email protected]
% Computational Prototyping Group, RLE at MIT
%
% _________________________________________________________________________
% check values
if (Gap <= 0)
Gap = 1e-6;
end
if (Wid <= 0)
Wid = 5e-3;
end
if (Len <= 0)
Len = 0.12;
end
if (Ssp <= 0)
Ssp = 0.08;
end
% generate the name for the geometry file
geofilename = sprintf('%s.geo', filename);
fid = fopen(geofilename, 'w');
fprintf(fid, '\n\n\n // --------------------------------------------------------------- ');
fprintf(fid, '\n // --------------------------------------------------------------- ');
fprintf(fid, '\n // Planar COIL ARRAY with %d COILS', Ncoils);
fprintf(fid, '\n // geometry created using MARIE coil generator');
fprintf(fid, '\n // --------------------------------------------------------------- ');
fprintf(fid, '\n // --------------------------------------------------------------- ');
fclose(fid);
% loop on coils and call the coil generator
DeltaAngle = 360/Ncoils;
for ii = 1:Ncoils
Arot = ((ii-1)*DeltaAngle+IniAngle)*pi/180; % rotation angle
[ok] = gen_coil_planarpatches(geofilename,ii,Tports,Rports,Bports,Lports,Rad,Xpos,Ypos,Zpos,Arot,Len,Ssp,Wid,Gap);
end
% add Shield if exist
if (~isempty(ShieldRad)) && (~isempty(ShieldLen))
[ok] = Shield_SCOIL_Gen(geofilename,ShieldRad,Xpos,Ypos,Zpos,ShieldLen);
end
% call the gmsh
if ispc
command = sprintf('.\\src_generate\\src_scoil\\gmsh %s', geofilename);
else
if ismac
command = sprintf('./src_generate/src_scoil/gmsh.app/Contents/MacOS/gmsh %s', geofilename);
end
end
[ok, result] = system(command);