You are on page 1of 48

Coil.

java

1
2 public class Coil
3{
4 static int i,j;//point to location of grid of Ba and We values
5 static Separator sep;
6 static String coreType;
7 static int nPole;
8 static double minCl;//minimum clearance between uninsulated coils
9 static double depth,width;//depth value
10 static double Ba,EWC;//bulge allowance and ewc values
11 static double[][] B={{0.8,1,1,1,1,1.5,1.5,1.6,1.7,1.8,1.9},
12 {1,1.2,1.2,1.2,1.2,1.7,1.7,1.9,2.0,2.1,2.3},
13 {.3,1.6,1.6,1.6,1.6,2,2,2,2.6,2.7,3.0}};//bulge allowance value matrix
14 static double[][] E={{0,0,0,1,1,3,3,3,4,4,6},
15 {1,1,1,2,2,4,4,4,5,5,7},
16 {2,2,2,3,3,5,5,5,6,6,8}};//end winding clearance value matrix
17 static void indices(double w,double d,int nP)
18 {
19 coreType=EDS.coreType;
20 depth=d;
21 width=w;
22 if(d<40)
23 i=0;
24 else if(d<60)
25 i=1;
26 else
27 i=2;
28 j=EDS.j;
29 nPole=nP;
30 }
31
32 static double fitEWCToData()//returns EWC that matches old EDS clearance values by brute
force
33 {
34 if((nPole==2)||(nPole==4))
35 {
36 if(j==1)
37 return 2.56;
38 return 4.26;
39 }
40 else if ((nPole==8)||(nPole==10))
41 {
42 if(j==1)
43 return 5.56;
44 return 6.46;
45 }
46 else if (nPole==12)
47 {
48 if(j==1)
49 return 7.56;
50 return 8.66;
51 }
52 else if (nPole==6)
53 {
54 if((j==1))
55 {
56 if(coreType.equals("UNIPAK"))

Page 1
Coil.java

57 return 3.56;
58 return 2.56;
59 }
60 if((width>11.5)||(width<10))
61 return 4.26;
62 return 4.43;
63 }
64 return 2.56;
65 }
66
67 static void calculate(double w,double d,int nP,double insT)//calculate the parameters
68 {
69 indices(w,d,nP);
70 Ba=B[i][j];
71 EWC=E[i][j];//change this to match EDS values
72 minCl=fitEWCToData();
73 if(j==1||j==4)
74 EWC=minCl-Ba-0.8*insT;//subtract insulation thickness from EWC
75 if((j==4)&&(EWC<1.1))
76 EWC=1.1;
77 sep=new Separator(j);
78 MLT.B_a=Ba;
79 MLT.EWC=EWC;
80 MLT.tsep=sep.tSep;
81 }
82 }
83

Page 2
CoppCover.java

1 public class CoppCover


2{
3 static int[] mica= {0,700};//700=length per roll
4 static int[] prtape= {0,1000};//1000=length per roll
5 private static int higherMultiple(double x,int y)//first multiple of y that is higher
than x
6 {
7 return ((int)(x/y)+1)*y;
8 }
9
10 static double tapeWidth()
11 {
12 double x;
13 if(EDS.width<4)
14 {
15 x=8;
16 }
17 else if (EDS.width==4)
18 {
19 if(EDS.depth<=2.5&&EDS.depth1<=2.5)
20 x=8;
21 else
22 x=12;
23 }
24 else
25 x=12;
26 return x;
27 }
28
29 private static double covering()
30 {
31 return 2*(EDS.depth+EDS.width)*
(EDS.nSlots*EDS.nWide*EDS.nDeep*EDS.nTurns*2)*MLT.MLT/(1000*tapeWidth());
32 }
33
34 private static double coveringMixed()//applicable to mixed windings
35 {
36 return 0.5*EDS.nSlots*((EDS.depth+EDS.width)*
(EDS.nWide*EDS.nDeep*EDS.nTurns*2)*MLT.MLT+(EDS.depth1+EDS.width)*
(EDS.nWide*EDS.nDeep*EDS.nTurns1*2)*MLT.MLT)/(1000*tapeWidth());
37 }
38
39 static void calculate(boolean x)//false if mixed wdg
40 {
41 if(x)
42 {
43 mica[0]=higherMultiple(covering(),mica[1]);
44 prtape[0]=higherMultiple(covering(),prtape[1]);
45 }
46 else
47 {
48 mica[0]=higherMultiple(coveringMixed(),mica[1]);
49 prtape[0]=higherMultiple(coveringMixed(),prtape[1]);
50 }
51 }
52 }
53

Page 1
CoronaShield.java

1 public class CoronaShield


2{
3 boolean req;//whether required or not
4 double t;//thickness
5 String type;//type
6 CoronaShield(String spec)
7 {
8 int n=Integer.parseInt(spec.substring(6,spec.length()-2));//IS740F3C3-->3
9 if (n<=4)
10 req=false;
11 else if (n<=10)
12 {
13 req=true;
14 type="MM1465";
15 t=0.22;
16 }
17 else
18 {
19 req=true;
20 type="MM1465";
21 t=0.44;
22 }
23 }
24 }
25

Page 1
EDS.java

1 import java.io.BufferedReader;
5 class EDS
6{
7 static final String FILE="Data.txt";
8 static int impak;//for impak core, 12 mm extra for rotor spider
9 static double cableAr;//area of cross-section of cable
10 static String cableType;//cable insulation material
11 static int nRTD;//no. of RTDS reqd;
12 static String s;//contains read data
13 static String so;//shop order no.
14 static String coreType;//uni or flow
15 static String stConn;//stator connection
16 static String conType;//conductor type
17 static String revno;//revision number of drawing
18 public static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
19 static int vLevel;//voltage spec
20 static int nLeads;
21 static int nWide, nDeep;//no. of conductors making up a coil, width wise and depth wise
22 static String spec;//insulation spec
23 static int nTurns,nTurns1;//no. of turns per coil(1 applicable for mixed wdg)
24 static int SERSEC;//whether spl. wdg.
25 static double depth,depth1,width;//of bare copper (1 applicable for mixed wdg)
26 static double coreLen;//length of core
27 static double boreDia;//diameter of bore
28 static double sDepth;//slot depth
29 static double sWidth;//slot width
30 static int nSlots,nCoil;//no. of stator slots and stator coils
31 static int cPitch;//coil pitch
32 static int pcts;//parallel circuits
33 static int j;//F1-->0,F3-->1 etc
34 static double bDepth;//bridge depth
35 static double Ep,Ep1,Ep2;//average pullout pin diameter,pin 1 dia,pin 2 dia
36 static int nPole;//no. of poles
37 static String data[];
38 static String insOR="";//insulation override for manual insulation definition
39 static int x;//CPS
40 static int cspb;//coil sides per phase belt
41 static double clearance;//clearance between insulated coils
42 static int[] longTop=new int[2], longBot=new int[2],std=new int[2];//stores information
about coil leads
43 private static int higherTens(double d)
44 {
45 return (int)(10*Math.ceil(d/10));
46 }
47
48 private static void findLeads()//finds number and types of leads required
49 {
50 if(nTurns1==0)//ordinary winding
51 {
52 longTop[0]=longBot[0]=nPole*3;//number of distinct phase belts
53 std[0]=nCoil-longTop[0]*2;
54 }
55 else//mixed winding
56 {
57 cspb=nSlots/(nPole*3);
58 if(cspb%2==0)
59 {

Page 1
EDS.java

60 longTop[0]=longBot[0]=(nPole*3);
61 std[0]=nCoil-longTop[0];
62 }
63 else
64 {
65 longTop[0]=longBot[0]=(nPole*3)/2;
66 std[0]=nCoil-2*longTop[0];
67 }
68 }
69 longTop[1]=higherTens(Math.PI*(boreDia+sDepth)/(2*nPole)+50);//refer ISK10308
70 longBot[1]=longTop[1]+30;
71 std[1]=100;
72 }
73
74 private static double getClearance(int p, int v)
75 {
76 switch(p)
77 {
78 case 2:
79 if(vLevel==3300)
80 return 1;
81 return 1.1;
82 case 4:
83 if(vLevel==3300)
84 return 1;
85 return 1.1;
86 case 6:
87 if(vLevel==3300)
88 return 2;
89 return 1.3;
90 case 8:
91 if(vLevel==3300)
92 return 4;
93 return 3.3;
94 case 10:
95 if(vLevel==3300)
96 return 6;
97 return 5.5;
98 case 12:
99 if(vLevel==3300)
100 return 6;
101 return 5.5;
102 }
103 return 0;
104 }
105
106 private static double empND()//empirical nose drop factor in terms of depth of coil
side,subjected to a lot of blind experimentation
107 {
108 double factor=boreDia*cPitch/nSlots;
109 if(nPole==2)
110 {
111 if (boreDia>400)
112 return 0.9;
113 return 0.5;
114 }
115 else if (nPole==4)

Page 2
EDS.java

116 {
117 if (boreDia>400)
118 return 0.7;
119 if(j==1)
120 return 0.01429*factor-0.724;
121 else if (j==4)
122
123 return 0.34+0.0005*factor;
124 }//rough univariate first approximation for nd
125 else if(nPole==6)
126 {
127 if (boreDia>400)
128 return 0.65;
129 if (cPitch<10)
130 return 0.25;
131 else
132 return 0.25;
133 }
134 else if(nPole==8)
135 return 0.4;//
136 else if(nPole==10)
137 return 0.05;
138 return 0;
139 }
140
141 private static double pullOutDia(double d)
142 {
143 if(coreType.equals("FLOWPAK"))//flowpak
144 {
145 if(nPole==2||nPole==4||nPole==6)
146 {
147 if(vLevel==3300)
148 {
149 if(d>=2.5)
150 return 15;
151 return 13.5;
152 }
153 if(d>=2.5)
154 return 23;
155 return 21.5;
156 }
157 if(vLevel==3300)
158 return 15;
159 return 21.5;
160 }
161 //if not returned, must be unipak
162 if(nPole==8)
163 {
164 if(vLevel==3300)
165 {
166 if(d>=2.5)
167 return 15;
168 return 13.5;
169 }
170 if(d>=2.5)
171 return 23;
172 return 21.5;

Page 3
EDS.java

173 }
174 if(vLevel==3300)//other pole number
175 {
176 if(d>=2.5)
177 return 15;
178 return 13.5;
179 }
180 if(d>=2.5)
181 return 23;
182 return 21.5;
183 }
184
185 private static void read(String s1/*String file,int i*/)throws FileNotFoundException
,IOException//file input of data,will not work now
186 {
187 //BufferedReader b=new BufferedReader(new FileReader(file));
188 //int j=1;
189 //while(j++<i)
190 //b.readLine();
191 data=/*b.readLine()XL.makeString*/s1.split("\\s");
192 vLevel=(int)(1000*Double.parseDouble(data[0]));
193 coreLen=Double.parseDouble(data[1]);
194 MLT.L_top=coreLen+50+impak;//L_top for MLT
195 MLT.L_bottom=coreLen+30+impak;//L_bottom for MLT
196 boreDia=Double.parseDouble(data[2]);
197 MLT.Dg=boreDia;//Dg for MLT
198 depth=Double.parseDouble(data[3]);
199 depth1=Double.parseDouble(data[4]);
200 width=Double.parseDouble(data[5]);
201 if(width>7.5)//see ISK 15146
202 MLT.E=35;
203 else
204 MLT.E=25;
205 nWide=Integer.parseInt(data[6]);
206 nDeep=Integer.parseInt(data[7])/nWide;
207 int x=Integer.parseInt(data[8]);
208 //x/=(nWide*nDeep);//divide CPS by PWires to get turns
209 if(x%2==0)//even no. of cps
210 {
211 nTurns=x/2;
212 nTurns1=0;
213 }
214 else
215 {
216 nTurns1=x/2;//less
217 nTurns=x-nTurns1;//more
218 if(depth1<depth)//high disparity between widths of two coil types
219 {
220 int y=nTurns;//
221 nTurns=nTurns1;//swap nTurns and nTurns1 to reduce disparity
222 nTurns1=y;//
223 }
224 }
225 SERSEC=Integer.parseInt(data[9]);
226 nSlots=Integer.parseInt(data[10]);
227 MLT.S=nSlots;//S for MLT
228 if(nTurns1!=0)

Page 4
EDS.java

229 nCoil=nSlots/2;
230 else
231 nCoil=nSlots;
232 sDepth=Double.parseDouble(data[11]);
233 MLT.ds=sDepth;//ds for MLT
234 bDepth=Double.parseDouble(data[12]);
235 MLT.d2=2.4;
236 MLT.d3=bDepth-2.4;//d2 and d3 for MLT
237 cPitch=Integer.parseInt(data[13]);
238 MLT.Pc=cPitch;//Pc for MLT
239 nPole=Integer.parseInt(data[14]);
240 System.out.println("Read successful");
241 Ep=pullOutDia(Math.max(depth,depth1));
242 makePullOutDia();//decide Ep1 and Ep2
243 MLT.Ep=Ep;
244 clearance=getClearance(nPole,vLevel);
245 so=data[15];
246 pcts=Integer.parseInt(data[16]);
247 nRTD=Integer.parseInt(data[17]);
248 MLT.slw=sWidth;
249 }
250
251 private static void makePullOutDia()
252 {
253 if(Ep==13.5)
254 {
255 Ep1=12;
256 Ep2=15;
257 }
258 else if(Ep==15)
259 {
260 Ep1=12;
261 Ep2=18;
262 }
263 else if(Ep==21.5)
264 {
265 Ep1=20;
266 Ep2=23;
267 }
268 else if(Ep==23)
269 {
270 Ep1=20;
271 Ep2=26;
272 }
273 else if(Ep==28)
274 {
275 Ep1=25;
276 Ep2=31;
277 }
278 }
279
280 private static void insSpec()//deciding insulation specification code
281 {
282 if(insOR.equals(""))
283 {
284 spec="IS740F";
285 if(vLevel<=1000)

Page 5
EDS.java

286 {
287 spec+="1Q2";
288 j=0;
289 }
290 else if(vLevel<=3600)
291 {
292 spec+="3C3";
293 j=1;
294 }
295 else if(vLevel<=4500)
296 {
297 spec+="4C3";
298 j=2;
299 }
300 else if(vLevel<=5500)
301 {
302 spec+="5C3";
303 j=3;
304 }
305 else if(vLevel<=7500)
306 {
307 spec+="6C3";
308 j=4;
309 }
310 else if(vLevel<=10500)
311 {
312 spec+="10C4";
313 j=5;
314 }
315 else if(vLevel<=11500)
316 {
317 spec+="11C4";
318 j=6;
319 }
320 else if(vLevel<=12500)
321 {
322 spec+="12C4";
323 j=7;
324 }
325 else if(vLevel<13500)
326 {
327 spec+="13C4";
328 j=8;
329 }
330 else if(vLevel<=14500)
331 {
332 spec+="14C4";
333 j=9;
334 }
335 else
336 {
337 spec+="15C4";
338 j=10;
339 }
340 }
341 else
342 {

Page 6
EDS.java

343 spec=insOR;
344 j=1;
345 }
346 }
347
348
349 private static void display()
350 {
351 System.out.println("INSULATION SPECIFICATION:"+spec);
352 }
353
354
355 private static void build(SlotCoil s,EndCoil e)//assigns coil values to MLT variables
356 {
357 MLT.dcs=s.y;//dcs for MLT
358 MLT.Wst=s.x;
359 MLT.W_e=e.x;//W_e for MLT
360 MLT.de=e.y;//assumption
361 MLT.dtt=e.y;//depth of turn taping
362 MLT.nosedrop=empND()*e.y;//assumption
363 MLT.de_=1.0*(nTurns-1)*e.y/nTurns;//de and de_ for MLT assumption
364 }
365
366 private static void build1(SlotCoil s,EndCoil e)//assigns coil values to MLT variables
367 {
368 MLT.dcs1=s.y;//dcs for MLT
369 MLT.Wst=s.x;
370 MLT.W_e=e.x;//W_e for MLT
371 MLT.de1=e.y;//assumption
372 MLT.dtt1=e.y;//depth of turn taping
373 MLT.nosedrop=empND()*e.y;//assumption
374 MLT.de_1=1.0*(nTurns1-1)*e.y/nTurns1;//de and de_ for MLT assumption
375 }
376
377 public static void run()throws IOException,Exception
378 {
379 //accept();
380 //insOR=iOR;
381 //System.out.print("S/O No.:");
382 //so=br.readLine();
383 System.out.println("Inside run");
384 read(s);
385 insSpec();
386 SlotCoil s=new SlotCoil(spec,depth,width,nWide,nDeep,nTurns);
387 conType=s.sc.type;
388 EndCoil e=new EndCoil(spec,depth,width,nWide,nDeep,nTurns);
389 display();
390 System.out.println(nCoil+" COILS x "+nWide+" WIDE x "+nDeep+" DEEP x "+nTurns+"
TURNS.");//display coil details
391 s.displayDim();
392 Coil.calculate(e.width,e.calcDim(),nPole,e.mi.t);
393 if((sDepth-bDepth-Coil.sep.tSep)>=72)
394 {
395 MLT.Ep=Ep=28;
396 makePullOutDia();
397 }
398 e.displayDim();

Page 7
EDS.java

399 build(s,e);
400 Img.makePic2();
401 if(nTurns1!=0)
402 {
403 SlotCoil s1=new SlotCoil(spec,depth1,width,nWide,nDeep,nTurns1);
404 EndCoil e1=new EndCoil(spec,depth1,width,nWide,nDeep,nTurns1);
405 System.out.println(nCoil+" COILS x "+nWide+" WIDE x "+nDeep+" DEEP x "+nTurns1+"
TURNS.");//display coil details
406 s1.displayDim();
407 Coil.calculate(e1.width,e1.calcDim(),nPole,e.mi.t);
408 e1.displayDim();
409 build1(s1,e1);
410 Img.makePic3();
411 }
412 else
413 {
414 MLT.dcs1=MLT.dtt1=MLT.de1=MLT.de_1=0;
415 }
416 MLT.findLength();
417 MLT.display();
418 findLeads();
419 Img.makePic();
420 //end of MLT calculation
421 //begin bill of materials calculation
422 CoppCover.calculate(nTurns1==0);
423 InsBill.printBill();
424 ExcelWriter.main();
425 }
426 }

Page 8
EndCoil.java

1 class EndCoil
2{
3 EndConductor ec;//end winding
4 MainIns mi;//main insulation
5 CoronaShield cs;//corona shield
6 double depth;//depth of bare copper
7 double width;//width of bare copper
8 double sb;//stack binder
9 double ft;//finishing tape
10 int nTurns,nTurns1;//no. of conductors
11 int nWide,nDeep;//no. of conductors width wise and depth wise in a turn
12 double x,y;//stores incremented width and dpeth at each step
13 static double fix(double x)//two decimal place roundoff
14 {
15 return (Math.round(100*x))/100.0;
16 }
17 EndCoil(String spec,double d, double w,int nw,int nd,int n)
18 {
19 ec=new EndConductor(spec);
20 mi=new MainIns(spec);
21 cs=new CoronaShield(spec);
22 depth=d;
23 width=w;
24 nWide=nw;
25 nDeep=nd;
26 nTurns=n;
27 sb=1.04;
28 ft=0.36;
29 }
30 public double calcDim()//display end wdg dimension;return coil depth for bulge allowance
and EWC calc
31 {
32 double cDepth=nTurns*nDeep*(depth+ec.t);//excluding main wall insulation
33 x=nWide*(width+ec.t)+mi.t+/*sb*/+ft;//stack binding not applicable
34 //MLT.W_e=x;//W_e for MLT
35 y=nTurns*nDeep*(depth+ec.t)+mi.t/*+sb*/+ft;
36 //MLT.de=y;//assumption
37 //MLT.nosedrop=1.7*y;//assumption
38 //MLT.de_=1.0*(nTurns-1)*y/nTurns;//de and de_ for MLT assumption
39 return cDepth;
40 }
41 public void displayDim()
42 {
43 x+=Coil.Ba;
44 System.out.println("INSULATED ENDWINDING\t\t"+fix(x)+"\t\t"+fix(y));
45 Img.dimensions[11]=fix(x);
46 Img.dimensions[12]=fix(y);
47 }
48 }
49

Page 1
EndConductor.java

1
2 public class EndConductor
3{
4 String type;//type
5 String des;//designation
6 double t;//thickness
7 EndConductor(String spec)
8 {
9 des=spec.substring(spec.length()-2,spec.length());//extract last two chars containing
designation
10 if(des.equals("Q2"))
11 {
12 type="MM9262";
13 t=0.38;
14 }
15 else if(des.equals("C3"))
16 {
17 type="MM9331";
18 t=0.52;
19 }
20 else if(des.equals("C4"))
21 {
22 type="MM9332";
23 t=0.72;
24 }
25 }
26 }
27

Page 1
ExcelWriter.java

1 import java.io.File;
12 public class ExcelWriter
13 {
14 public static void main() throws Exception
15 {
16 String[] headings={"MM No.","Material Description","Contract Requirement","Roll/size
each","Number reqd."};
17 Workbook workbook=new HSSFWorkbook();
18 Sheet sheet = workbook.createSheet("Employee");
19
20 Font headerFont = workbook.createFont();
21 headerFont.setBold(true);
22 headerFont.setFontHeightInPoints((short) 11);
23 headerFont.setColor(IndexedColors.BLACK.getIndex());
24
25 Font bodyFont = workbook.createFont();
26 bodyFont.setFontHeightInPoints((short) 10);
27 bodyFont.setColor(IndexedColors.BLACK.getIndex());
28
29 CellStyle headerCellStyle = workbook.createCellStyle();
30 headerCellStyle.setFont(headerFont);
31 headerCellStyle.setShrinkToFit(false);
32
33 CellStyle bodyCellStyle = workbook.createCellStyle();
34 bodyCellStyle.setFont(bodyFont);
35 bodyCellStyle.setShrinkToFit(false);
36
37 Row headerRow = sheet.createRow(0);
38 for(int i = 0; i < 5; i++)
39 {
40 Cell cell = headerRow.createCell(i);
41 cell.setCellValue(headings[i]);
42 cell.setCellStyle(headerCellStyle);
43 }
44
45 Tape[] tapeArr=InsBill.returnTapes();
46 //System.out.println("Array returned successfully");
47 for(int i=1;i<tapeArr.length+1;i++)
48 {
49 Row row=sheet.createRow(i);
50 Cell cell = row.createCell(0);
51 cell.setCellValue(tapeArr[i-1].code);
52 cell.setCellStyle(bodyCellStyle);
53 cell=row.createCell(1);
54 cell.setCellValue(tapeArr[i-1].name+" "+tapeArr[i-1].t+ " x "+tapeArr[i-1].w+"
mm");
55 cell.setCellStyle(bodyCellStyle);
56 cell=row.createCell(2);
57 cell.setCellValue(Img.fix0(tapeArr[i-1].l)+" METRES");
58 cell.setCellStyle(bodyCellStyle);
59 cell=row.createCell(3);
60 cell.setCellValue(Img.fix0(tapeArr[i-1].rollSize));
61 cell.setCellStyle(bodyCellStyle);
62 cell=row.createCell(4);
63 cell.setCellValue(Img.fix2(tapeArr[i-1].l/tapeArr[i-1].rollSize));
64 cell.setCellStyle(bodyCellStyle);
65 }

Page 1
ExcelWriter.java

66 for(int i = 0; i < 5; i++)


67 sheet.autoSizeColumn(i);
68 File file=new File("C:\\JavaDir\\"+Img.sanitize(EDS.so)+".xls");
69 file.createNewFile();
70 FileOutputStream fileOut = new FileOutputStream(file,false);
71 workbook.write(fileOut);
72 fileOut.close();
73 workbook.close();
74 }
75 }
76

Page 2
Img.java

1 import java.awt.Color;
12 class Img
13 {
14 static double dimensions[]=new double[13];
15 static String fix0(double x)//two decimal place roundoff
16 {
17 return Math.round(x)+"";
18 }
19
20 static String fix1(double x)//two decimal place roundoff
21 {
22 return (Math.round(10*x))/10.0+"";
23 }
24
25 static String fix2(double x)//two decimal place roundoff
26 {
27 return (Math.round(100*x))/100.0+"";
28 }
29
30 static String sanitize(String str)
31 {
32 while(str.indexOf('/')!=-1)
33 str=(str.substring(0,
str.indexOf('/'))+"_"+str.substring(str.indexOf('/')+1,str.length()));
34 return str;
35 }
36
37 public static void makePic() throws Exception
38 {
39 final BufferedImage image = ImageIO.read(new File("C:\\JavaDir\\res\\test1.jpg"));
40 Graphics g = image.getGraphics();
41 g.setFont(g.getFont().deriveFont(11f));
42 g.setColor(Color.BLACK);
43 //Graphics2D g2d = (Graphics2D)g;
44 //AffineTransform at = new AffineTransform();
45 g.drawString("Insulation Specification "+EDS.spec,746,97);//print total length to pic
46 g.drawString(fix0(MLT.totL),201,177);//print total length to pic
47 g.drawString(fix2(Coil.minCl), 350,202);//print minimum clearanCe on pic
48 g.drawString(fix0(EDS.coreLen), 203,339);//print core length
49 g.drawString(fix0(MLT.L_bottom), 203,433);//print top coil side length
50 g.drawString(fix0(MLT.L_top), 203,200);//print bottom coil side length
51 g.drawString(fix1(2*MLT.phi),475,320);//print angular spread
52 g.drawString("15",687,345);//print angle of twist
53 g.drawString(fix0(MLT.spread),522,345);//print linear coil spread
54 g.drawString(fix0(MLT.tht),576,406);//print table height
55 g.drawString(fix1(EDS.boreDia),677,141);//print bore diameter
56 g.drawString(fix0(EDS.cPitch),647,157);//print coil pitch (slot)
57 g.drawString(fix0(MLT.MLT),679,173);
58 g.drawString(fix0(EDS.Ep1),32,388);
59 g.drawString(fix0(EDS.Ep2),403,405);
60 g.drawString(fix0(MLT.E),277,358);
61 g.drawString(fix0(MLT.E),41,293);
62 g.drawString(fix1(EDS.clearance),596,465);
63 //at.setToRotation(7*Math.PI / 4.0);//set angle of rotated text
64 //g2d.setTransform(at);//'' ''
65 //g2d.drawString(fix0(EDS.Ep1),-100,200);
66 //g2d.dispose();

Page 1
Img.java

67 if(EDS.nTurns1==0)
68 SSLeads(g);
69 else
70 MLeads(g);
71
72 g.drawString("Angle Gauge Settings",346,510);
73 g.drawString("TOP ANGLE ="+fix1(Math.toDegrees(MLT.tA))+" BOTTOM ANGLE =
"+fix1(Math.toDegrees(MLT.bA)),346,525);
74 g.drawString("GAUGE LENGTH = "+fix0(MLT.aGL),346,540);
75 g.drawString("Radius Gauge Settings",346,555);
76
77 g.drawString("SO No."+EDS.so, 821, 387);
78 g.drawString("CPS="+(EDS.nTurns+EDS.nTurns1)*EDS.nWide*EDS.nDeep, 751, 402);
79 g.drawString("|| paths="+EDS.pcts, 821, 402);
80 g.drawString("Pitch=(1-"+(EDS.cPitch+1)+")", 886, 402);
81 g.drawString("CL="+EDS.coreLen, 751, 417);
82 g.drawString("Number of Slots="+EDS.nSlots, 821, 417);
83 g.drawString("St. Cu.:"+EDS.nWide*EDS.nDeep+"("+EDS.width+"x"+EDS.depth+") ", 751,
432);
84 if(EDS.depth1!=0)
85 g.drawString("St. Cu.:"+EDS.nWide*EDS.nDeep+"("+EDS.width+"x"+EDS.depth1+") ",
840, 432);
86 g.drawString("Connxn:"+EDS.stConn, 751, 447);
87 g.drawString("No. of leads="+EDS.nLeads, 861, 447);
88 g.drawString("Cable = "+fix0(EDS.cableAr)+ "sq. mm, "+EDS.cableType, 751, 462);
89 g.drawString(EDS.nRTD+" no.s RTD required", 751, 477);
90
91 g.drawString(fix0(MLT.a), 131, 9);
92 g.drawString(fix0(MLT.b), 156, 38);
93 g.drawString(fix0(MLT.ef), 62, 79);
94 g.drawString(fix0(MLT.ef1), 314, 79);
95 g.drawString(fix0(MLT.d), 165, 99);
96
97 DateFormat df=new SimpleDateFormat("dd/MM/yy HH:mm:ss");
98 Date date=new Date();
99 g.drawString(df.format(date), 9, 619);
100 g.drawString("Rev No. "+EDS.revno, 135, 617);
101
102 g.dispose();
103 ImageIO.write(dropAlphaChannel(image), "jpg", new File("C:\\JavaDir\
\"+sanitize(EDS.so)+".jpg"));
104 ImageIcon icon = new ImageIcon();
105 icon.setImage(image);
106 JOptionPane.showMessageDialog(null, icon);
107 }
108
109 static void makePic2()throws Exception
110 {
111 final BufferedImage image = ImageIO.read(new File("C:\\JavaDir\\res\
\outputsheet.png"));
112 Graphics g = image.getGraphics();
113 g.setFont(g.getFont().deriveFont(11f));
114 g.setColor(Color.BLACK);
115 g.drawString(EDS.nCoil+" COILS x "+EDS.nWide+" WIDE x "+EDS.nDeep+" DEEP x
"+EDS.nTurns+" TURNS.",745,117);
116 g.drawString("SLOT",746,132);
117 g.drawString("WIDTH",900,132);

Page 2
Img.java

118 g.drawString("DEPTH",960,132);
119 g.drawString("Copper size, bare",746,147);
120 g.drawString(fix2(dimensions[0]),900,147);
121 g.drawString(fix2(dimensions[1]),960,147);
122 g.drawString("Covered Conductor "+EDS.conType,746,162);
123 g.drawString(fix2(dimensions[2]),900,162);
124 g.drawString(fix2(dimensions[3]),960,162);
125 g.drawString("Consolidated stack (nominal)",746,177);
126 g.drawString(fix2(dimensions[4]),900,177);
127 g.drawString(fix2(dimensions[5]),960,177);
128 g.drawString("Insulated coil size (nominal)",746,192);
129 g.drawString(fix2(dimensions[6]),900,192);
130 g.drawString(fix2(dimensions[7]),960,192);
131 if(dimensions[8]==0)
132 g.drawString("NO CORONA SHIELD",746,207);
133 else
134 {
135 g.drawString("Corona shield",746,207);
136 g.drawString(fix2(dimensions[8]),900,207);
137 g.drawString(fix2(dimensions[9]),960,207);
138 }
139 g.drawString("Stack pressing strip",746,222);
140 g.drawString("12.7 x "+fix1(dimensions[10])+" x 0",910,222);
141 g.drawString("INSULATED ENDWINDING",746,237);
142 g.drawString(fix2(dimensions[11]),900,237);
143 g.drawString(fix2(dimensions[12]),960,237);
144 g.dispose();
145 ImageIO.write(dropAlphaChannel(image), "jpg", new File("C:\\JavaDir\\res\
\test1.jpg"));
146 //ImageIcon icon = new ImageIcon();
147 //icon.setImage(image);
148 //JOptionPane.showMessageDialog(null, icon);
149 }
150
151 static void makePic3()throws Exception
152 {
153 final BufferedImage image = ImageIO.read(new File("C:\\JavaDir\\res\\test1.jpg"));
154 Graphics g = image.getGraphics();
155 g.setFont(g.getFont().deriveFont(11f));
156 g.setColor(Color.BLACK);
157 g.drawString(EDS.nCoil+" COILS x "+EDS.nWide+" WIDE x "+EDS.nDeep+" DEEP x
"+EDS.nTurns1+" TURNS.",745,252);
158 g.drawString("SLOT",746,267);
159 g.drawString("WIDTH",900,267);
160 g.drawString("DEPTH",960,267);
161 g.drawString("Copper size, bare",746,282);
162 g.drawString(fix2(dimensions[0]),900,282);
163 g.drawString(fix2(dimensions[1]),960,282);
164 g.drawString("Covered Conductor "+EDS.conType,746,297);
165 g.drawString(fix2(dimensions[2]),900,297);
166 g.drawString(fix2(dimensions[3]),960,297);
167 g.drawString("Consolidated stack (nominal)",746,312);
168 g.drawString(fix2(dimensions[4]),900,312);
169 g.drawString(fix2(dimensions[5]),960,312);
170 g.drawString("Insulated coil size (nominal)",746,327);
171 g.drawString(fix2(dimensions[6]),900,327);
172 g.drawString(fix2(dimensions[7]),960,327);

Page 3
Img.java

173 if(dimensions[8]==0)
174 g.drawString("NO CORONA SHIELD",746,342);
175 else
176 {
177 g.drawString("Corona shield",746,342);
178 g.drawString(fix2(dimensions[8]),900,342);
179 g.drawString(fix2(dimensions[9]),960,342);
180 }
181 g.drawString("Stack pressing strip",746,357);
182 g.drawString("12.7 x "+fix1(dimensions[10])+" x 0",910,357);
183 g.drawString("INSULATED ENDWINDING",746,372);
184 g.drawString(fix2(dimensions[11]),900,372);
185 g.drawString(fix2(dimensions[12]),960,372);
186 g.dispose();
187 ImageIO.write(dropAlphaChannel(image), "jpg", new File("C:\\JavaDir\\res\
\test1.jpg"));
188 //ImageIcon icon = new ImageIcon();
189 //icon.setImage(image);
190 //JOptionPane.showMessageDialog(null, icon);
191 }
192
193 private static void SSLeads(Graphics g)throws Exception//single section ordinary coil
194 {
195 g.drawString(EDS.nCoil+"-"+EDS.nTurns+" TURN COILS",528,13);
196 g.drawString(EDS.longBot[0]+" - Long leads (Bottom) length = "+EDS.longBot[1],550,26);
197 g.drawString(EDS.longTop[0]+" - Long leads (Top) length = "+EDS.longTop[1],550,39);
198 g.drawString(EDS.std[0]+" - Standard leads length = "+EDS.std[1],550,52);
199 }
200
201 private static void MLeads(Graphics g)throws Exception//single section ordinary coil
202 {
203 if(EDS.cspb%2!=0)
204 {
205 g.drawString(EDS.nCoil+"-"+EDS.nTurns1+" TURN COILS",528,13);
206 g.drawString(EDS.longBot[0]+" - Long leads (Bottom) length =
"+EDS.longBot[1],550,26);
207 g.drawString(EDS.longTop[0]+" - Long leads (Top) length =
"+EDS.longTop[1],550,39);
208 g.drawString(EDS.std[0]+" - Standard leads length = "+EDS.std[1],550,52);
209 g.drawString(EDS.nCoil+"-"+EDS.nTurns+" TURN COILS",528,65);
210 g.drawString(EDS.longBot[0]+" - Long leads (Bottom) length =
"+EDS.longBot[1],550,78);
211 g.drawString(EDS.longTop[0]+" - Long leads (Top) length =
"+EDS.longTop[1],550,91);
212 g.drawString(EDS.std[0]+" - Standard leads length = "+EDS.std[1],550,104);
213 }
214 else
215 {
216 g.drawString(EDS.nCoil+"-"+EDS.nTurns1+" TURN COILS",528,15);
217 g.drawString(EDS.longBot[0]+" - Long leads (Bottom) length =
"+EDS.longBot[1],550,30);
218 g.drawString(EDS.std[0]+" - Standard leads length = "+EDS.std[1],550,45);
219 g.drawString(EDS.nCoil+"-"+EDS.nTurns+" TURN COILS",528,60);
220 g.drawString(EDS.longTop[0]+" - Long leads (Top) length =
"+EDS.longTop[1],550,75);
221 g.drawString(EDS.std[0]+" - Standard leads length = "+EDS.std[1],550,90);
222 }

Page 4
Img.java

223 }
224
225 public static BufferedImage dropAlphaChannel(BufferedImage src)
226 {
227 BufferedImage convertedImg = new BufferedImage(src.getWidth(), src.getHeight(),
BufferedImage.TYPE_INT_RGB);
228 convertedImg.getGraphics().drawImage(src, 0, 0, null);
229 return convertedImg;
230 }
231 }

Page 5
InsBill.java

1 import java.io.*;
2 public class InsBill
3{
4 static Tape
mm1417,mm1870,mm1419,mm1422,mm1455,mm1462,mm1465,mm1460,mm1985,mm1622,mm1622_,mm1940;
5 static double increment=0;
6 static double slot[]=new double[2];//depth, width of slot portion
7 static double bend[]=new double[2];//depth, width of slot bend portion
8 static double ew[]=new double[2];//depth, width of endwinding portion
9
10 private static int mainInsLayers()
11 {
12 switch(EDS.j)
13 {
14 case 1: return 2;
15 case 4: return 5;
16 }
17 return 0;
18 }
19
20 private static int semiCondLayers()
21 {
22 if(EDS.j<4)
23 return 0;
24 if(EDS.j>7)
25 return 2;
26 return 1;
27 }
28
29 private static int coronaLayers()
30 {
31 if(EDS.j<4)
32 return 0;
33 return 1;
34 }
35
36 private static void init()//initialise tape dimensions
37 {
38 mm1417=new Tape("MICA PAPER TAPE","MM1417",0.08,CoppCover.tapeWidth(),1,0.5,700);
39 mm1870=new Tape("PR.FILM","MM1870",0.023,CoppCover.tapeWidth(),1,0.5,1000);
40 mm1419=new Tape("MICA PAPER TAPE","MM1419",0.12,20,mainInsLayers(),0.5,70);
41 mm1422=new Tape("MICA PAPER TAPE","MM1422",0.17,20,mainInsLayers(),0.5,25);
42 mm1455=new Tape("E/W SEALING TAPE","MM1455",0.09,20,1,0.5,50);
43 mm1460=new Tape("ADHESIVE TAPE","MM1460",0.09,20,1,0,60);
44 mm1462=new Tape("SEMI-CONDUCTING TAPE","MM1462",0.28,20,semiCondLayers(),0.5,25);
45 mm1465=new Tape("GRAPHITE IMP. PR. TAPE","MM1465",0.11,30,coronaLayers(),0.5,50);
46 mm1622=new Tape("SACRIFICE TAPE","MM1622",0.33,25,1,0,33);//thickness not considered
as tape removed later
47 mm1622_=new Tape("SACRIFICE TAPE","MM1622",0.38,25,1,0,33);
48 }
49
50 private static void calcLengths(double d,double w,int nw,int nd,int nt)
51 {
52 slot[0]=(d+0.38)*nt*nd;//initialise all dimensions
53 slot[1]=(w+0.38)*nw;
54 bend[0]=slot[0];
55 bend[1]=slot[1];

Page 1
InsBill.java

56 ew[0]=slot[0];
57 ew[1]=slot[1];
58
59 increment=mm1622.findLengthMetres (slot[0],slot[1],MLT.MLT-
(2*EDS.coreLen+160),EDS.nCoil);
60 increment=mm1622_.findLengthMetres (slot[0],slot[1],2*EDS.coreLen+160,EDS.nCoil);
61
62 increment=mm1419.findLengthMetres (slot[0],slot[1],2*EDS.coreLen+320,EDS.nCoil);
63 slot[0]+=increment;
64 slot[1]+=increment;//1419 wound on slot and bend ac. to SA
65 bend[0]+=increment;
66 bend[1]+=increment;
67
68 increment=mm1422.findLengthMetres (ew[0],ew[1],MLT.MLT-2*EDS.coreLen-320,EDS.nCoil);
69 ew[0]+=increment;
70 ew[1]+=increment;//1422 tape on ew portion
71
72 increment=mm1465.findLengthMetres (slot[0],slot[1],2*EDS.coreLen+320,EDS.nCoil);
73 slot[0]+=increment;
74 slot[1]+=increment;
75
76 increment=mm1462.findLengthMetres (bend[0],bend[1],280,EDS.nCoil);
77 bend[0]+=increment;
78 bend[1]+=increment;
79
80 increment=mm1455.findLengthMetres (ew[0],ew[1],MLT.MLT-2*(EDS.coreLen+20),EDS.nCoil);
81 ew[0]+=increment;
82 ew[1]+=increment;
83
84 increment=mm1460.findLengthMetres (ew[0],ew[1],4*mm1460.w,EDS.nCoil);
85 mm1460.l*=1.2;//assumption to fit data; a 20% overlap for adh tape
86
87 mm1417.l=CoppCover.mica[0];
88 mm1870.l=CoppCover.prtape[0];
89 }
90
91 private static void display()throws Exception
92 {
93 File file=new File("C:\\JavaDir\\"+Img.sanitize(EDS.so)+".txt");
94 if(!file.exists())
95 file.createNewFile();
96 BufferedWriter br=new BufferedWriter(new FileWriter(file,false));
97 br.write("MM1417 length =
"+Img.fix0(CoppCover.mica[0])+"\t"+Img.fix0(CoppCover.mica[0]/700)+" ROLLS\n");
98 br.write("MM1870 length =
"+Img.fix0(CoppCover.prtape[0])+"\t"+Img.fix0(CoppCover.prtape[0]/1000)+" ROLLS\n");
99 br.write("MM1419 length =
"+Img.fix0(mm1419.l)+"\t"+Img.fix2(mm1419.l/mm1419.rollSize)+" ROLLS\n");
100 br.write("MM1422 length =
"+Img.fix0(mm1422.l)+"\t"+Img.fix2(mm1422.l/mm1422.rollSize)+" ROLLS\n");
101 br.write("MM1622 length =
"+Img.fix0(mm1622.l)+"\t"+Img.fix2(mm1622.l/mm1622.rollSize)+" ROLLS\n");
102 br.write("MM1622 length =
"+Img.fix0(mm1622_.l)+"\t"+Img.fix2(mm1622_.l/mm1622_.rollSize)+" ROLLS\n");
103 br.write("MM1465 length =
"+Img.fix0(mm1465.l)+"\t"+Img.fix2(mm1465.l/mm1465.rollSize)+" ROLLS\n");
104 br.write("MM1460 length =

Page 2
InsBill.java

"+Img.fix0(mm1460.l)+"\t"+Img.fix2(mm1460.l/mm1460.rollSize)+" ROLLS\n");
105 br.write("MM1462 length =
"+Img.fix0(mm1462.l)+"\t"+Img.fix2(mm1462.l/mm1462.rollSize)+" ROLLS\n");
106 br.write("MM1455 length =
"+Img.fix0(mm1455.l)+"\t"+Img.fix2(mm1455.l/mm1455.rollSize)+" ROLLS\n");
107 br.close();
108 }
109
110 static Tape[] returnTapes()
111 {
112 int l;
113 if(mm1462.l==0)//less tape items if no semicond/graphite tape
114 l=8;
115 else
116 l=10;
117 int k=0;
118 Tape[] tapeArr=new Tape[l];
119 tapeArr[k++]=mm1417;
120 tapeArr[k++]=mm1870;
121 tapeArr[k++]=mm1419;
122 tapeArr[k++]=mm1422;
123 tapeArr[k++]=mm1622;
124 tapeArr[k++]=mm1622_;
125 if(l==10)
126 tapeArr[k++]=mm1465;
127 tapeArr[k++]=mm1460;
128 if(l==10)
129 tapeArr[k++]=mm1462;
130 tapeArr[k++]=mm1455;
131 return tapeArr;
132 }
133 public static void printBill()throws Exception
134 {
135 init();
136 calcLengths(EDS.depth,EDS.width,EDS.nWide,EDS.nDeep,EDS.nTurns);
137 if(EDS.nTurns1!=0)
138 {
139 calcLengths(EDS.depth1,EDS.width,EDS.nWide,EDS.nDeep,EDS.nTurns1);
140 }
141 //display();
142 }
143 }
144

Page 3
MainIns.java

1
2 public class MainIns
3{
4 String type;//ins type
5 double t;//thickness
6 MainIns(String spec)
7 {
8 int n=Integer.parseInt(spec.substring(6,spec.length()-2));//IS740F3C3-->3
9 switch(n)
10 {
11 case 1:
12 t=0.68;
13 break;
14 case 3:
15 t=1.2;
16 break;
17 case 4:
18 t=1.6;
19 break;
20 case 5:
21 t=2.4;
22 break;
23 case 6:
24 t=2.8;
25 break;
26 case 10:
27 t=4.4;
28 break;
29 case 11:
30 t=4.8;
31 break;
32 case 12:
33 t=5.6;
34 break;
35 case 13:
36 t=6;
37 break;
38 case 14:
39 t=6.4;
40 break;
41 case 15:
42 t=6.8;
43 break;
44 }
45 type=(n==1)?"MM1422":"MM1419";//1419 for all except F1
46 }
47
48 }
49

Page 1
MLT.java

1 public class MLT


2{
3 //ALL DIMENSIONS IN MM
4 static double W_e=0;//coil width of end winding
5 static double B_a=0;//bulge allowance
6 static double EWC=0;//end winding clearance
7 static int S=0;//number of slots
8 static double Pc=0;//coil pitch
9 static double Dg=0;//gap diameter
10 static double d2=0;//wedge depth
11 static double d3=0;//bridge depth
12 static double dcs=0,dcs1=0;//depth of coil side (dcs1 applicable only in case of mixed
winding)
13 static double Wst=0;//total width of stack
14 static double dtt=0,dtt1=0;//depth of coil over turn taping
15 static double Ep=0;//pull-out pin diameter
16 static double theta_t=Math.toRadians(15);//angle of twist,=15 degrees?
17 static double tsep=0;//thickness of separator between top and bottom sides in same slot
18 static double ds=0;//punched slot depth
19 static double slw=0;//slot width
20 static double de=0,de1=0;//depth of end winding over armouring tape at connected end
21 static double de_=0,de_1=0;//depth of end winding over non-connected end
22 static double A=0;//distance between centrelines of top two adjacent coil arms at the
surface near the bore
23 static double D2_=0;//diameter at the top of the top coil side
24 static double theta_1=0;//angle of bottom coil arm to the core
25 static double theta_2=0;//angle of top coil arm to the core
26 static double P1=0;//arc of the bottom coil from the centre of the coil in the slot to the
centre line of the nose
27 static double P2=0;//arc of the top coil from the centre of the coil in the slot to the
centre line of the nose
28 static double D1=0;//diameter of arc P1
29 static double D2=0;//diameter of arc P2
30 static double E=0;//radius at the coil bend to the coil stack
31 static double F=0;//radius at the coil bend to the coil centre
32 static double L_top=0;//length of the top coil side
33 static double L_bottom=0;//length of the bottom coil side
34 static double L_=0;//half of the length difference between the two coil sides
35 static double Z2=0;//straight length from the corner from the start of the curve bend
36 static double W2=0;//top coil arm projection
37 static double C=0;//one-fourth of the coil pitch angle in radians
38 static double phi=0;//half the coil pitch angle in degrees
39 static double phi_=0;
40 static double beta_1=0;//small angle of bottom coil at the end of the straight portion
41 static double beta_2=0;//small angle of top coil at the end of the straight portion
42 static double K=0;//effective diameter calculation factor
43 static double D=0;//effective dameter
44 static double H1=0;//average depth of end winding nose portion
45 static double N=0;//half width of twisted nose projetion on the plane
46 static double G1=0;//arm length of bottom coil
47 static double G2=0;//arm length of top coil
48 static double J=0;//mean length of nose portion
49 static double R1=0;//radius from bore centre to the top coil centre in the slot
50 static double R1_=0;//radius from bore centre to the top coil top in the slot
51 static double R2=0;//radius from bore centre to the top coil arm centre before the nose
band
52 static double R2_=0;//radius from bore centre to the top coil arm top before the nose band

Page 1
MLT.java

53 static double R3=0;//radius from bore centre to the bottom coil centre after the nose band
54 static double R3_=0;//radius from bore centre to the bottom coil top after the nose band
55 static double R4=0;//radius from bore centre to the bottom coil centre in the slot
56 static double R4_=0;//radius from bore centre to the bottom coil top in the slot
57 static double MLT=0;//mean length of turn
58 static double nosedrop=0;//NOSE DROP of coil
59 static double totL=0;//total length of coil
60 static double aGL=0;//angle gauge length
61 static double ccd=0;//coil side centreline distance
62 static double tA=0,bA=0;//top angle and bottom angle of angle gauge
63 static double spread;//linear coil spread dimension
64 static double tht;//table height
65
66 static double a=0;//length over flat former pins
67 static double b=0;//length over parallel part of flat former
68 static double c=0;
69 static double d=0;//flat former width
70 static double ef=0,ef1=0;//flat former width at non-conn and conn ends respectively
71 static double l=0;//avg length of coil straight part
72 static double g=0;
73 static double x=0;
74 static double qr=0;
75 static double pq=0;
76 static double gamma=0;
77 static double delta=0;
78 static double pn=0;
79 static double mll=0;//mean loop length for crosscheck
80
81 private static double tableHeight(int n)
82 {
83 double x=R1;
84 double y=R3;
85 if(n==1)
86 {
87 y+=dtt/2;
88 x-=dcs/2;
89 }
90 else
91 {
92 y+=dtt1/2;
93 x-=dcs1/2;
94 }
95 return y*Math.sin(tA+Math.toRadians(phi_))-x*Math.sin(tA);
96 }
97 private static double spread(int n)//provision for mixed wdg
98 {
99 double x=R1;
100 double y=R4;
101 if(n==1)
102 {
103 x-=dcs/2;
104 y-=dcs/2;
105 }
106 else
107 {
108 x-=dcs1/2;
109 y-=dcs1/2;

Page 2
MLT.java

110 }
111 return Math.sqrt(x*x+y*y-2*x*y*Math.cos(2*Math.toRadians(phi_)));
112 }
113 private static void calculateForSingle()//top and bottom lengths unequal
114 {
115 /*
116 * calculate A
117 */
118 A=W_e+B_a+EWC;//page 2
119 /*
120 * calculate D1,D2,D2_
121 */
122 D1=Dg+2*(d2+d3)+3*dcs+2*tsep;//page 3
123 D2=Dg+2*(d2+d3)+dcs;
124 D2_=Dg+2*(d2+d3);
125 /*
126 * calculate R values
127 */
128 R1=Dg/2+d2+d3+dcs/2;
129 R2=Dg/2+nosedrop+dtt/2;
130 R3=R2+(Ep+dtt)*Math.cos(theta_t);
131 R4=R1+dcs+tsep;
132 /*
133 * calculate phi
134 */
135 phi=Pc*360/(2*S);
136 phi_=phi+slw*180/(Math.PI*Dg);
137 /*
138 * Calculate angle theta_2
139 */
140 theta_2=Math.asin(A*S/(Math.PI*D2_));
141 /*
142 * calculate P2
143 */
144 P2=/*BC*R1/(R1+R4);*/Math.PI*D2*Pc/(2*S);
145 /*
146 * initialise E and calculate F
147 */
148 F=E+Wst/2;
149 /*
150 * calculate L_
151 */
152 L_=(L_top-L_bottom)/2;
153 /*
154 * calculate Z2
155 */
156 Z2=F*Math.tan((Math.PI/2-theta_2)/2);
157 /*
158 * calculate W2
159 */
160 W2=P2*Math.tan(theta_2);
161 /*
162 * calculate P1
163 */
164 P1=/*BC*R4/(R1+R4);*/Math.PI*D1*Pc/(2*S);
165 theta_1=2*Math.atan((-P1+2*F+Math.sqrt((P1-2*F)*(P1-2*F)-4*F*F+(W2+2*Z2+L_)*
(W2+2*Z2+L_)))/(2*F+W2+2*Z2+L_));

Page 3
MLT.java

166 /*
167 * calculate C
168 */
169 C=Math.PI*Pc/(2*S);//radians
170 /*
171 * calculate K
172 */
173 K=Math.sqrt(1+Math.pow(2*(R3-R4)/(phi*0.01745*(R3+R4)),2))-1;
174 /*
175 * calculate D
176 */
177 D=0.5*(R1+R2+R3+R4)+K*(R3+R4)/2.0;
178 /*
179 * calculate beta_1 and beta_2
180 */
181 beta_1=(Math.PI-2*theta_1)-2*(1-Math.sin(theta_1))/(Math.cos(theta_1));
182 beta_2=(Math.PI-2*theta_2)-2*(1-Math.sin(theta_2))/(Math.cos(theta_2));
183 /*
184 * calculate H1
185 */
186 H1=0.5*(de+de_);
187 /*
188 * calculate N
189 */
190 N=0.5*(dtt+Ep)*Math.sin(theta_t);
191 /*
192 * calculate G1 and G2
193 */
194 G1=(C*D-N)/Math.cos(theta_1)+beta_1*F/2;
195 G2=(C*D-N)/Math.cos(theta_2)+beta_2*F/2;
196 /*
197 * calculate J
198 */
199 J=Math.PI*(H1+Ep)/2;
200 /*
201 * calculate MLT
202 */
203 MLT=2*(G1+G2+J)+L_top+L_bottom;
204 totL=L_top+2*(W2-N*Math.tan(theta_2)+Ep/2+dtt)+2*Z2;//modified formula from fig 1
geometry
205 //R1+=dcs/4;
206 //R4+=dcs/4;
207 aGL=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi_)));
208 ccd=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi)));
209 bA=Math.asin(R1*Math.sin(Math.toRadians(2*phi))/ccd);
210 tA=Math.asin(R4*Math.sin(Math.toRadians(2*phi))/ccd);
211 spread=spread(1);
212 tht=tableHeight(1);
213 }
214
215 private static void calculateForMixed()//top and bottom lengths equal
216 {
217 /*
218 * calculate A
219 */
220 A=W_e+B_a+EWC;//page 2
221 /*

Page 4
MLT.java

222 * calculate D1,D2,D2_


223 */
224 D1=Dg+2*(d2+d3)+2*dcs+dcs1+2*tsep;//page 3
225 D2=Dg+2*(d2+d3)+dcs;
226 D2_=Dg+2*(d2+d3);
227 /*
228 * calculate R values
229 */
230 R1=Dg/2+d2+d3+dcs/2;
231 R2=Dg/2+nosedrop+dtt/2;
232 R3=R2+(Ep+dtt)*Math.cos(theta_t);
233 R4=R1+dcs1+tsep;
234 /*
235 * calculate phi
236 */
237 phi=Pc*360/(2*S);
238 phi_=phi+slw*180/(Math.PI*Dg);
239 /*
240 * Calculate angle theta_2
241 */
242 theta_2=Math.asin(A*S/(Math.PI*D2_));
243 /*
244 * calculate D2
245 */
246 P2=/*BC*R1/(R1+R4);*/Math.PI*D2*Pc/(2*S);
247 /*
248 * initialise E and calculate F
249 */
250 F=E+Wst/2;
251 /*
252 * calculate L_
253 */
254 L_=(L_top-L_bottom)/2;
255 /*
256 * calculate Z2
257 */
258 Z2=F*Math.tan((Math.PI/2-theta_2)/2);
259 /*
260 * calculate W2
261 */
262 W2=P2*Math.tan(theta_2);
263 /*
264 * calculate P1
265 */
266 P1=/*BC*R4/(R1+R4)*/Math.PI*D1*Pc/(2*S);
267 theta_1=2*Math.atan((-P1+2*F+Math.sqrt((P1-2*F)*(P1-2*F)-4*F*F+(W2+2*Z2+L_)*
(W2+2*Z2+L_)))/(2*F+W2+2*Z2+L_));
268 /*
269 * calculate C
270 */
271 C=Math.PI*Pc/(2*S);//radians
272 /*
273 * calculate K
274 */
275 K=Math.sqrt(1+Math.pow(2*(R3-R4)/(phi*0.01745*(R3+R4)),2))-1;
276 /*
277 * calculate D

Page 5
MLT.java

278 */
279 D=0.5*(R1+R2+R3+R4)+K*(R3+R4)/2.0;
280 /*
281 * calculate beta_1 and beta_2
282 */
283 beta_1=(Math.PI-2*theta_1)-2*(1-Math.sin(theta_1))/(Math.cos(theta_1));
284 beta_2=(Math.PI-2*theta_2)-2*(1-Math.sin(theta_2))/(Math.cos(theta_2));
285 /*
286 * calculate H1
287 */
288 H1=0.5*(de+de_);
289 /*
290 * calculate N
291 */
292 N=0.5*(dtt+Ep)*Math.sin(theta_t);
293 /*
294 * calculate G1 and G2
295 */
296 G1=(C*D-N)/Math.cos(theta_1)+beta_1*F/2;
297 G2=(C*D-N)/Math.cos(theta_2)+beta_2*F/2;
298 /*
299 * calculate J
300 */
301 J=Math.PI*(H1+Ep)/2;
302 /*
303 * calculate MLT
304 */
305 MLT=2*(G1+G2+J)+L_top+L_bottom;
306 totL=L_top+2*(W2-N*Math.tan(theta_2)+Ep/2+dtt)+2*Z2;
307 //R1+=dcs/4;
308 //R4+=dcs/4;
309 aGL=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi_)));
310 ccd=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi)));
311 bA=Math.asin(R1*Math.sin(Math.toRadians(2*phi))/ccd);
312 tA=Math.asin(R4*Math.sin(Math.toRadians(2*phi))/ccd);
313 spread=spread(1);
314 tht=tableHeight(1);
315 /*
316 * calculate A
317 */
318 A=W_e+B_a+EWC;//page 2
319 /*
320 * calculate D1,D2,D2_
321 */
322 D1=Dg+2*(d2+d3)+2*dcs1+dcs+2*tsep;//page 3
323 D2=Dg+2*(d2+d3)+dcs1;
324 D2_=Dg+2*(d2+d3);
325 /*
326 * calculate R values
327 */
328 R1=Dg/2+d2+d3+dcs1/2;
329 R2=Dg/2+nosedrop+dtt1/2;
330 R3=R2+(Ep+dtt)*Math.cos(theta_t);
331 R4=R1+dcs+tsep;
332 /*
333 * calculate phi
334 */

Page 6
MLT.java

335 phi=Pc*360/(2*S);
336 /*
337 * Calculate angle theta_2
338 */
339 theta_2=Math.asin(A*S/(Math.PI*D2_));
340 /*
341 * calculate D2
342 */
343 P2=/*BC*R1/(R1+R4);*/Math.PI*D2*Pc/(2*S);
344 /*
345 * initialise E and calculate F
346 */
347 F=E+Wst/2;
348 /*
349 * calculate L_
350 */
351 L_=(L_top-L_bottom)/2;
352 /*
353 * calculate Z2
354 */
355 Z2=F*Math.tan((Math.PI/2-theta_2)/2);
356 /*
357 * calculate W2
358 */
359 W2=P2*Math.tan(theta_2);
360 /*
361 * calculate P1
362 */
363 P1=/*BC*R4/(R1+R4);*/Math.PI*D1*Pc/(2*S);
364 theta_1=2*Math.atan((-P1+2*F+Math.sqrt((P1-2*F)*(P1-2*F)-4*F*F+(W2+2*Z2+L_)*
(W2+2*Z2+L_)))/(2*F+W2+2*Z2+L_));
365 /*
366 * calculate C
367 */
368 C=Math.PI*Pc/(2*S);//radians
369 /*
370 * calculate K
371 */
372 K=Math.sqrt(1+Math.pow(2*(R3-R4)/(phi*0.01745*(R3+R4)),2))-1;
373 /*
374 * calculate D
375 */
376 D=0.5*(R1+R2+R3+R4)+K*(R3+R4)/2.0;
377 /*
378 * calculate beta_1 and beta_2
379 */
380 beta_1=(Math.PI-2*theta_1)-2*(1-Math.sin(theta_1))/(Math.cos(theta_1));
381 beta_2=(Math.PI-2*theta_2)-2*(1-Math.sin(theta_2))/(Math.cos(theta_2));
382 /*
383 * calculate H1
384 */
385 H1=0.5*(de1+de_1);
386 /*
387 * calculate N
388 */
389 N=0.5*(dtt1+Ep)*Math.sin(theta_t);
390 /*

Page 7
MLT.java

391 * calculate G1 and G2


392 */
393 G1=(C*D-N)/Math.cos(theta_1)+beta_1*F/2;
394 G2=(C*D-N)/Math.cos(theta_2)+beta_2*F/2;
395 /*
396 * calculate J
397 */
398 J=Math.PI*(H1+Ep)/2;
399 /*
400 * calculate MLT
401 */
402 MLT+=2*(G1+G2+J)+L_top+L_bottom;
403 MLT/=2;
404 totL+=L_top+2*(W2-N*Math.tan(theta_2)+Ep/2+dtt1)+2*Z2;
405 totL/=2;
406 double temp=aGL;//temporarily store old aGL
407 //R1+=dcs1/4;
408 //R4+=dcs1/4;
409 aGL=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi_)));
410 ccd=Math.sqrt(R1*R1+R4*R4-2*R1*R4*Math.cos(2*Math.toRadians(phi)));
411 bA+=Math.asin(R1*Math.sin(Math.toRadians(2*phi))/ccd);
412 tA+=Math.asin(R4*Math.sin(Math.toRadians(2*phi))/ccd);
413 aGL+=temp;
414 aGL/=2;
415 bA/=2;
416 tA/=2;
417 spread+=spread(2);
418 spread/=2;
419 tht+=tableHeight(2);
420 tht/=2;
421 }
422
423 static double gxValue(double g)
424 {
425 if(g<320)
426 return 0.25*g-10.2;
427 return 1.05*g-260;
428 }
429
430 static void formerPinDia(int j,double d)
431 {
432 if(j==1)
433 {
434 ef = 19;
435 if(d>=2.5)
436 ef1=25;
437 else
438 ef1=22;
439 }
440 else if(j==4)
441 {
442 if(d>=2.5)
443 {
444 ef=35;
445 ef1=41;
446 }
447 else

Page 8
MLT.java

448 {
449 ef=25;
450 ef1=28;
451 }
452 }
453 }
454 static double beamWidth(int np,String ct)
455 {
456 if(np==2 && ct.equals("FLOWPAK"))
457 return 110;
458 return 50;
459 }
460 static void calculateFormer()
461 {
462 do
463 {
464 g=(G1+G2)/2;
465 x=0.5*(gxValue(G1)+gxValue(G2));
466 l=0.5*(L_top+L_bottom);
467
468 b=l+2*x;
469 a=l+2*g;
470 c=(a-b)/2;
471
472 //System.out.println("G1 = "+G1);
473 //System.out.println("G2 = "+G2);
474 d=beamWidth(EDS.nPole,EDS.coreType);
475 formerPinDia(EDS.j,Math.max(EDS.depth, EDS.depth1));
476
477 qr=Math.sqrt(Math.pow(c-ef/2,2)+Math.pow(d-ef/2,2));
478 pq=Math.sqrt(qr*qr-ef*ef/4);
479
480 gamma=1.5*Math.PI-Math.acos((c-ef/2)/qr)-Math.acos(0.5*ef/qr);
481 delta=Math.PI-gamma;
482 pn=0.5*(ef+dtt)*gamma;
483
484 mll=a-ef+b+2*(pq+pn+0.5*dtt*delta);
485 G1+=(MLT-mll)/5;
486 G2+=(MLT-mll)/5;
487 }while(Math.abs(MLT-mll)>2);
488 //System.out.println("Setup dimension = "+a);
489 //System.out.println("Beam length = "+b);
490 //System.out.println("Mean loop length = "+mll);
491
492 }
493 static void findLength()//find mean turn length of coil
494 {
495 if(dcs1==0)
496 calculateForSingle();
497 else
498 calculateForMixed();
499 calculateFormer();
500 }
501
502 static void display()//display length
503 {
504 System.out.println("\nMean length of turn:"+MLT+" mm");

Page 9
MLT.java

505 System.out.println("\nLength of coil:"+totL+"mm");


506 System.out.println("\nAngle Gauge Settings\nTOP
ANGLE="+EndCoil.fix(Math.toDegrees(tA))+" BOTTOM
ANGLE="+EndCoil.fix(Math.toDegrees(bA))+"\nGAUGE LENGTH="+aGL);
507 }
508 }

Page 10
Separator.java

1 public class Separator


2{
3 static double[] S={1,1,1,2,2,4,4,4,5,5,6};
4 double tSep;//separator thickness
5 String sepType;//type of separator used
6 Separator(int j)//decide separator based on insulation class
7 {
8 if(j==10)
9 sepType="MM1196";
10 else
11 sepType="MM1205";
12 tSep=S[j];
13 }
14 }
15

Page 1
SlotCoil.java

1 class SlotCoil
2{
3 SlotConductor sc;//slot conductor
4 MainIns mi;//main insulation
5 CoronaShield cs;//corona shield
6 String spec;//specification
7 double depth;//depth of bare copper
8 double width;//width of bare copper
9 int nTurns;//no. of conductors
10 int nWide,nDeep;//no. of conductors width wise and depth wise per turn
11 double x,y;
12 private double fix(double x)//two decimal place roundoff
13 {
14 return (Math.round(100*x))/100.0;
15 }
16
17 SlotCoil(String s,double d, double w,int nw,int nd,int n)
18 {
19 spec=s;
20 sc=new SlotConductor(spec);
21 mi=new MainIns(spec);
22 cs=new CoronaShield(spec);
23 depth=d;
24 width=w;
25 nWide=nw;
26 nDeep=nd;
27 nTurns=n;
28 }
29
30 public void displayDim()//display coil dimensions at different stages
31 {
32 x=width;
33 y=depth;
34 double s;//depth of stack pressing strip
35 System.out.println("\t\t\t\t\tWIDTH\t\tDEPTH");
36 System.out.println("Copper size, bare\t\t\t"+x+"\t\t"+y);
37 Img.dimensions[0]=x;
38 Img.dimensions[1]=y;
39 x=(width+sc.t)*nWide;
40 y=(depth+sc.t)*nDeep;
41 System.out.println("Covered conductor "+sc.type+"\t\t"+fix(x)+"\t\t"+fix(y));
42 Img.dimensions[2]=fix(x);
43 Img.dimensions[3]=fix(y);
44 y*=nTurns;
45 s=0.5*Math.floor(2*y);
46 System.out.println("Consolidated stack (nominal)\t\t"+fix(x)+"\t\t"+fix(y));
47 Img.dimensions[4]=fix(x);
48 Img.dimensions[5]=fix(y);
49 x+=mi.t;
50 y+=mi.t;
51 if(spec.equals("IS740F6C3"))
52 {
53 if(EDS.coreType.equals("FLOWPAK"))
54 {
55 if (EDS.nPole==2)
56 y-=0.3;//observed in original EDS, depth taken 2.5 and NOT 2.8 for
IS740F6C3 2 pole

Page 1
SlotCoil.java

57 else if(EDS.nPole==4||EDS.nPole==6)
58 y-=0.5;//observed in original EDS, depth taken 2.3 and NOT 2.8 for
IS740F6C3 4 pole
59 }
60 else
61 {
62 if(EDS.nPole==2)
63 {
64 if(EDS.nWide==2)
65 y-=0.19;
66 else
67 y-=0.42;
68 }
69 else if (EDS.nPole==4)
70 {
71 if(EDS.nWide==2)
72 y-=0.23;
73 else
74 y-=0.4;
75 }
76 else if(EDS.nPole==6)
77 y-=0.29;
78 else if(EDS.nPole==8)
79 y-=0.52;
80 }
81 }
82 System.out.println("Insulated coil size(nominal)\t\t"+fix(x)+"\t\t"+fix(y));
83 Img.dimensions[6]=fix(x);
84 Img.dimensions[7]=fix(y);
85 if(cs.req)
86 {
87 x+=cs.t;
88 y+=cs.t;
89 System.out.println("Corona shielded coil size\t\t"+fix(x)+"\t\t"+fix(y));
90 Img.dimensions[8]=fix(x);
91 Img.dimensions[9]=fix(y);
92 }
93 else
94 {
95 System.out.println("NO CORONA SHIELD");
96 Img.dimensions[8]=0;
97 Img.dimensions[9]=0;
98 }
99 //MLT.dcs=y;//dcs for MLT
100 //MLT.Wst=x;//Wst for MLT
101 System.out.println("Stack pressing strip size: 12.7 x "+fix(s)+ " x 0");
102 Img.dimensions[10]=fix(s);
103 }
104 }

Page 2
SlotConductor.java

1
2 public class SlotConductor
3{
4 String type;//type
5 String des;//designation
6 double t;//thickness
7 SlotConductor(String spec)
8 {
9 des=spec.substring(spec.length()-2,spec.length());//extract last two chars containing
designation
10 if(des.equals("Q2"))
11 {
12 type="MM9262";
13 t=0.38;
14 }
15 else if(des.equals("C3"))
16 {
17 type="MM9331";
18 t=0.38;
19 }
20 else if(des.equals("C4"))
21 {
22 type="MM9332";
23 t=0.56;
24 }
25 }
26 }
27

Page 1
SpecEntry.java

1 import java.awt.Color;
17 class SpecEntry extends JFrame
18 {
19 JPanel data,core,cond,wdg,slot,misc,cable,butt;
20 JComboBox pc,ctc,stconn,cabtc;
21 JLabel
sol,ol,vl,cll,bdl,pcl,dl,d1l,wl,wll,pwl,cpsl,srl,sl,sdl,swl,bwdl,cpl,pl,ctl,cnl,rtdl,impakl,ca
bal,cabtl,rnol;
22 JPanel container;
23 JRadioButton impak;
24 JTextField
sot,ot,vt,clt,bdt,pct,dt,d1t,wt,wlt,pwt,cpst,srt,st,sdt,swt,bwdt,cpt,rtdt,cabat,rnot;
25 JButton ent;
26 public SpecEntry() throws Exception
27 {
28 super();
29 this.setSize(800,300);
30 //this.setLayout(new FlowLayout(FlowLayout.LEFT));
31 this.setLayout(new GridBagLayout());
32 GridBagConstraints c=new GridBagConstraints();
33 c.fill=GridBagConstraints.BOTH;
34
35 JPanel data=new JPanel();
36 data.setLayout(new GridBagLayout());
37 sol=new JLabel("Shop Order no.");
38 c.weightx=1;
39 c.weighty=0;
40 c.gridx=0;
41 c.gridy=0;
42 data.add(sol,c);
43 sot=new JTextField(6);
44 c.gridx=1;
45 c.gridy=0;
46 data.add(sot,c);
47 vl=new JLabel("Voltage (kV)");
48 c.gridx=0;
49 c.gridy=1;
50 data.add(vl,c);
51 vt=new JTextField(6);
52 c.gridx=1;
53 c.gridy=1;
54 data.add(vt,c);
55 ol=new JLabel("Output (kW)");
56 c.gridx=0;
57 c.gridy=2;
58 data.add(ol,c);
59 ot=new JTextField(6);
60 c.gridx=1;
61 c.gridy=2;
62 data.add(ot,c);
63 pl=new JLabel("Poles");
64 c.gridx=0;
65 c.gridy=3;
66 data.add(pl,c);
67 String[] arr= {"2","4","6","8","10","12"};
68 pc=new JComboBox(arr);
69 c.gridx=1;

Page 1
SpecEntry.java

70 c.gridy=3;
71 data.add(pc,c);
72 c.gridx=0;
73 c.gridy=0;
74 c.weightx=c.weighty=1;
75 //data.setBorder(BorderFactory.createLineBorder(Color.black));
76
data.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"S
pecifications",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
77 this.add(data,c);
78
79
80 JPanel core=new JPanel();
81 core.setLayout(new GridBagLayout());
82 cll=new JLabel("Core Length");
83 c.gridx=0;
84 c.gridy=0;
85 c.weightx=1;
86 c.weighty=0;
87 core.add(cll,c);
88 clt=new JTextField(6);
89 c.gridx=1;
90 c.gridy=0;
91 core.add(clt,c);
92 bdl=new JLabel("Bore Diameter");
93 c.gridx=0;
94 c.gridy=1;
95 core.add(bdl,c);
96 bdt=new JTextField(6);
97 c.gridx=1;
98 c.gridy=1;
99 core.add(bdt,c);
100 String[] ctarr= {"UNIPAK","FLOWPAK"};
101 ctl=new JLabel("Core Type");
102 c.gridx=0;
103 c.gridy=2;
104 core.add(ctl,c);
105 ctc=new JComboBox(ctarr);
106 c.gridx=1;
107 c.gridy=2;
108 core.add(ctc,c);
109 impakl=new JLabel("IMPAK");
110 c.gridx=0;
111 c.gridy=3;
112 core.add(impakl,c);
113 impak=new JRadioButton();
114 c.gridx=1;
115 c.gridy=3;
116 core.add(impak,c);
117 c.gridx=1;
118 c.gridy=0;
119 c.weightx=c.weighty=1;
120 //core.setBorder(BorderFactory.createLineBorder(Color.black));
121
core.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"C
ore dimensions",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
122 this.add(core,c);

Page 2
SpecEntry.java

123
124 JPanel cond=new JPanel();
125 cond.setLayout(new GridBagLayout());
126 dl=new JLabel("Bare Depth");
127 c.gridx=0;
128 c.gridy=0;
129 c.weightx=1;
130 c.weighty=0;
131 cond.add(dl,c);
132 dt=new JTextField(6);
133 c.gridx=1;
134 c.gridy=0;
135 cond.add(dt,c);
136 d1l=new JLabel("Bare Depth 1");
137 c.gridx=0;
138 c.gridy=1;
139 cond.add(d1l,c);
140 d1t=new JTextField(6);
141 c.gridx=1;
142 c.gridy=1;
143 cond.add(d1t,c);
144 wl=new JLabel("Bare Width");
145 c.gridx=0;
146 c.gridy=2;
147 cond.add(wl,c);
148 wt=new JTextField(6);
149 c.gridx=1;
150 c.gridy=2;
151 cond.add(wt,c);
152 c.gridx=2;
153 c.gridy=0;
154 c.weightx=c.weighty=1;
155 //cond.setBorder(BorderFactory.createLineBorder(Color.black));
156
cond.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"C
onductor cross-section",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
157 this.add(cond,c);
158
159 JPanel wdg=new JPanel();
160 wdg.setLayout(new GridBagLayout());
161 wll=new JLabel("Wdg./layer");
162 c.gridx=0;
163 c.gridy=0;
164 c.weightx=1;
165 c.weighty=0;
166 wdg.add(wll,c);
167 wlt=new JTextField(6);
168 c.gridx=1;
169 c.gridy=0;
170 wdg.add(wlt,c);
171 pwl=new JLabel("Parallel Wires");
172 c.gridx=0;
173 c.gridy=1;
174 wdg.add(pwl,c);
175 pwt=new JTextField(6);
176 c.gridx=1;
177 c.gridy=1;

Page 3
SpecEntry.java

178 wdg.add(pwt,c);
179 cpsl=new JLabel("Cond. per slot");
180 c.gridx=0;
181 c.gridy=2;
182 wdg.add(cpsl,c);
183 cpst=new JTextField(6);
184 c.gridx=1;
185 c.gridy=2;
186 wdg.add(cpst,c);
187 srl=new JLabel("Series Sections");
188 c.gridx=0;
189 c.gridy=3;
190 wdg.add(srl,c);
191 srt=new JTextField(6);
192 c.gridx=1;
193 c.gridy=3;
194 wdg.add(srt,c);
195 cpl=new JLabel("Coil Chord");
196 c.gridx=0;
197 c.gridy=4;
198 wdg.add(cpl,c);
199 cpt=new JTextField(6);
200 c.gridx=1;
201 c.gridy=4;
202 wdg.add(cpt,c);
203 c.gridx=3;
204 c.gridy=0;
205 c.weightx=c.weighty=1;
206 //cond.setBorder(BorderFactory.createLineBorder(Color.black));
207
wdg.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"Co
nductor configuration",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
208 this.add(wdg,c);
209
210 JPanel slot=new JPanel();
211 slot.setLayout(new GridBagLayout());
212 sl=new JLabel("No. of Slots");
213 c.gridx=0;
214 c.gridy=0;
215 c.weightx=1;
216 c.weighty=0;
217 slot.add(sl,c);
218 st=new JTextField(6);
219 c.gridx=1;
220 c.gridy=0;
221 slot.add(st,c);
222 sdl=new JLabel("Slot Depth");
223 c.gridx=0;
224 c.gridy=1;
225 slot.add(sdl,c);
226 sdt=new JTextField(6);
227 c.gridx=1;
228 c.gridy=1;
229 slot.add(sdt,c);
230 bwdl=new JLabel("Bridge+Wedge Depth");
231 c.gridx=0;
232 c.gridy=2;

Page 4
SpecEntry.java

233 slot.add(bwdl,c);
234 bwdt=new JTextField(6);
235 c.gridx=1;
236 c.gridy=2;
237 slot.add(bwdt,c);
238 swl=new JLabel("Slot Width");
239 c.gridx=0;
240 c.gridy=3;
241 slot.add(swl,c);
242 swt=new JTextField(6);
243 c.gridx=1;
244 c.gridy=3;
245 slot.add(swt,c);
246 c.gridx=0;
247 c.gridy=1;
248 c.weightx=c.weighty=1;
249 //cond.setBorder(BorderFactory.createLineBorder(Color.black));
250
slot.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"S
lot details",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
251 this.add(slot,c);
252
253 JPanel misc=new JPanel();
254 misc.setLayout(new GridBagLayout());
255 cnl=new JLabel("Stator conn.");
256 c.gridx=0;
257 c.gridy=0;
258 c.weightx=1;
259 c.weighty=0;
260 misc.add(cnl,c);
261 String stc[]= {"Star (int)","Star (ext)","Delta"};
262 stconn=new JComboBox(stc);
263 c.gridx=1;
264 c.gridy=0;
265 misc.add(stconn,c);
266 rtdl=new JLabel("No. of RTD reqd.");
267 c.gridx=0;
268 c.gridy=1;
269 misc.add(rtdl,c);
270 rtdt=new JTextField(6);
271 c.gridx=1;
272 c.gridy=1;
273 misc.add(rtdt,c);
274 pcl=new JLabel("Parallel Circuits");
275 c.gridx=0;
276 c.gridy=2;
277 misc.add(pcl,c);
278 pct=new JTextField(6);
279 c.gridx=1;
280 c.gridy=2;
281 misc.add(pct,c);
282 c.gridx=1;
283 c.gridy=1;
284 c.weightx=c.weighty=1;
285 //cond.setBorder(BorderFactory.createLineBorder(Color.black));
286
misc.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"M

Page 5
SpecEntry.java

iscellaneous",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));


287 this.add(misc,c);
288
289 JPanel cable=new JPanel();
290 cable.setLayout(new GridBagLayout());
291 cabal=new JLabel("Cross section (sq. mm)");
292 c.gridx=0;
293 c.gridy=0;
294 c.weightx=1;
295 c.weighty=0;
296 cable.add(cabal,c);
297 cabat=new JTextField(6);
298 c.gridx=1;
299 c.gridy=0;
300 cable.add(cabat,c);
301 cabtl=new JLabel("Type");
302 c.gridx=0;
303 c.gridy=1;
304 cable.add(cabtl,c);
305 String[] cab= {"Silicone","PTFE"};
306 cabtc=new JComboBox(cab);
307 c.gridx=1;
308 c.gridy=1;
309 cable.add(cabtc,c);
310 c.gridx=2;
311 c.gridy=1;
312 c.weightx=c.weighty=1;
313 //data.setBorder(BorderFactory.createLineBorder(Color.black));
314
cable.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),"
Cable",2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
315 this.add(cable,c);
316
317 JPanel butt=new JPanel();
318 butt.setLayout(new GridBagLayout());
319 rnol=new JLabel("Revision No.");
320 c.weightx=1;
321 c.weighty=0;
322 c.gridx=0;
323 c.gridy=0;
324 butt.add(rnol,c);
325 rnot=new JTextField(6);
326 c.gridx=1;
327 c.gridy=0;
328 butt.add(rnot,c);
329 ent=new JButton("Enter");
330 c.gridx=1;
331 c.gridy=1;
332 ent.setBorder(BorderFactory.createEmptyBorder(5,15,5,15));
333 butt.add(ent,c);
334 c.gridx=3;
335 c.gridy=1;
336 c.weightx=c.weighty=1;
337
butt.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black),""
,2,1,new Font("SERIF",1,14),new Color(0.2f,0f,0.2f)));
338 this.add(butt,c);

Page 6
SpecEntry.java

339
340 this.setTitle("Coil Design Assistant");
341
342 //this.getContentPane().setPreferredSize(new Dimension(800, 600));
343 //this.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("C:\\JavaDir\
\backgrnd.jpg")))));
344
345 ent.addActionListener(new ActionListener()
346 {
347 public void actionPerformed(ActionEvent a)
348 {
349 try
350 {
351 String s=vt.getText()+" "+clt.getText()+" "+bdt.getText()+"
"+dt.getText()+" "+
352 d1t.getText()+" "+wt.getText()+" "+wlt.getText()+" "+pwt.getText()+"
"+cpst.getText()+" "+
353 srt.getText()+" "+st.getText()+" "+sdt.getText()+" "+bwdt.getText()+"
"+cpt.getText()+" "+
354 (String)pc.getSelectedItem()+" "+sot.getText()+" "+pct.getText()+"
"+rtdt.getText();
355 EDS.coreType=(String) ctc.getSelectedItem();
356 switch((EDS.stConn=(String)stconn.getSelectedItem()))
357 {
358 case "Delta":
359 case "Star (ext)":EDS.nLeads=6;
360 break;
361 default:EDS.nLeads=3;
362 }
363 if(impak.isSelected())
364 EDS.impak=12;
365 else
366 EDS.impak=0;
367 EDS.cableAr=Double.parseDouble(cabat.getText());
368 EDS.cableType=(String) cabtc.getSelectedItem();
369 EDS.s=s;
370 EDS.sWidth=Double.parseDouble(swt.getText());
371 EDS.revno=rnot.getText();
372 EDS.run();
373 }
374 catch(Exception e)
375 {
376 System.out.println("Did not run");
377 }
378 }
379 });
380 /*jt1.addMouseListener(new MouseAdapter(){
381 @Override
382 public void mouseClicked(MouseEvent e){
383 jt1.setText("");
384 }
385 });*/
386 }
387
388 public static void main(String[] args)throws Exception
389 {
390 File file=new File("C:\\JavaDir");

Page 7
SpecEntry.java

391 if(!file.exists())
392 if(file.mkdir()) System.out.println("Yahoo");
393 SpecEntry s=new SpecEntry();
394 s.setVisible(true);
395 }
396 }

Page 8
Tape.java

1 public class Tape


2{
3 String name;//name of tape
4 String code;//mm code of tape
5 double t;//tape thickness
6 double w;//tape width
7 double l;//length of tape
8 int nLayer;//no. of layers
9 double lap;//amount of overlap with previous turn of tape
10 int rollSize;//size of each roll
11 Tape(String name,String code,double t, double w,int nLayer,double lap,int rollSize)
12 {
13 this.name=name;
14 this.code=code;
15 this.t=t;
16 this.w=w;
17 l=0;
18 this.nLayer=nLayer;
19 this.lap=lap;
20 this.rollSize=rollSize;
21 }
22
23 public double findLengthMetres(double a, double b,double x,int n)//n conductor of cross
section a X b, length x
24 {
25 for(int i=0;i<nLayer;i++)
26 {
27 l+=2*(a+b)*n*x/(w*(1-lap)*1000);
28 a+=2*t/(1-lap);//update cross section for next layer of tape
29 b+=2*t/(1-lap);
30 }
31 return Double.parseDouble(Img.fix0(2*t*nLayer/(1-lap)));
32 }
33 }
34

Page 1

You might also like