Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.84 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<stdlib.h>
  4. #include<conio.h>
  5.  
  6.  
  7. #define pi 3.141592653589
  8. #define muo 0.000001256
  9.  
  10. // Object oriented code = best code
  11.  
  12. typedef struct _core{
  13. float K; //Value of the Voltage per turn Factor
  14. float Et; // Voltage per turn
  15. float phi_m;
  16. float Bm; //Max Flux density
  17. float Ai; //Iron area
  18. float Agi; // Gross Area of Core
  19. float Ki; //Stacking Factor
  20.  
  21. float ct; //Ai = ct*d^2
  22. float p;
  23. float q;
  24. float r;
  25. float s;
  26.  
  27. float d;
  28. int coreType;
  29.  
  30. } Core;
  31.  
  32. typedef struct _window{
  33. float Kw; //Space Factor
  34. float currentDensity; //in A/mm^2
  35. float Aw; //Area of Window
  36. float Hw;
  37. float Ww;
  38. float ratio; // Hw and Ww ka ratio
  39. float distanceBetweenCores;
  40.  
  41. } Window;
  42.  
  43. typedef struct _yoke{
  44. float Ayoke;
  45. float Dy;
  46. float Hy;
  47. float Bm;
  48. } Yoke;
  49.  
  50. typedef struct _frame{
  51. float H;
  52. float W;
  53. float D;
  54. } Frame;
  55.  
  56. typedef struct _lv{
  57. int turnsPerPhase;
  58. float currentDensity;
  59. float As; //in mm^2
  60. float x1;
  61. float x2;
  62. int layers;
  63. int turnsPerLayer;
  64. float axialDepth;
  65. float radialDepth;
  66. float Di; //Inner Dia
  67. float Do; //Outer Dia
  68. float conductorInsulation;
  69. float clearance;
  70. float pressBoard;
  71.  
  72. } LVwindingData;
  73.  
  74. typedef struct _hv{
  75. int turnsPerPhase;
  76. float Ap; //in mm^2
  77. float Di; //Inner Dia
  78. float Do; //Outer Dia
  79. float x1;
  80. float x2;
  81. float clearance;
  82. float clearanceAxial;
  83. float insulation;
  84. float conductorInsulation;
  85. float axialDepth;
  86. float radialDepth;
  87. float t;
  88. int numDiscs;
  89. float voltagePerDisc;
  90. int turnsPerDisc;
  91. float currentDensity;
  92. float bakelizedPaper;
  93. float spacer;
  94.  
  95.  
  96. } HVwindingData;
  97.  
  98. typedef struct _resistance{
  99. float pu;
  100. float absolute;
  101. } Resistance;
  102.  
  103. typedef struct _reactance{
  104. float pu;
  105. float absolute;
  106. } Reactance;
  107.  
  108.  
  109. typedef struct _impedance{
  110. Resistance R;
  111. Reactance X;
  112. float pu;
  113. float absolute;
  114. } Impedance;
  115.  
  116. typedef struct _regulation{
  117. float value;
  118. float pu;
  119. float pf;
  120.  
  121. } Regulation;
  122.  
  123. typedef struct _coreloss{
  124. float yoke;
  125. float limb;
  126. float lamDensity;
  127. float yokeSpec;
  128. float limbSpec;
  129. float yokeWeight;
  130. float limbWeight;
  131. float value;
  132.  
  133. } CoreLoss;
  134.  
  135. typedef struct _losses{
  136. CoreLoss CoreLoss;
  137. float CopperLoss;
  138. float totalLoss;
  139. } Losses;
  140.  
  141. typedef struct _tank{
  142. float H;
  143. float W;
  144. float L;
  145. float S;
  146. float diss;
  147. float tempRise;
  148. } Tank;
  149.  
  150. typedef struct _transformer{
  151. float kVA;
  152. float Vp; //Primary HV side Voltage(in KV)
  153. float Vs; //Secondary LV side Volatge(in KV)
  154. float phase; // Number of phases
  155. float frequency; //Obvio
  156. float maxTappings;
  157. float VpPhase;
  158. float VsPhase;
  159. float Ip; //in A
  160. float Is; //in A
  161. float IpPhase; //in A
  162. float IsPhase; //in A
  163.  
  164. int primaryType; // 1 for Delta 2 for Star
  165. int secondaryType;
  166.  
  167. Core Core;
  168. Window Window;
  169. Yoke Yoke;
  170. Frame Frame;
  171. LVwindingData LV;
  172. HVwindingData HV;
  173.  
  174. Impedance Z;
  175. Regulation Regulation;
  176. Losses Losses;
  177. float percentLoading;
  178. float efficiency;
  179. Tank Tank;
  180.  
  181. } Transformer;
  182.  
  183. void readFloat(char *c,float *f){
  184. printf("\n");
  185. printf("%s : ",c);
  186. scanf("%f",f);
  187. }
  188.  
  189. void readInt(char *c,int *f){
  190. printf("\n");
  191. printf("%s : ",c);
  192. scanf("%d",f);
  193. }
  194.  
  195. int mToMM(float num){
  196. int ans;
  197. float temp;
  198. temp = num*1000;
  199. ans = (int)temp;
  200. float decimal;
  201. decimal = temp - (float)ans;
  202. decimal*= 10;
  203. if(decimal/1< 5){
  204. return ans;
  205. }else{
  206. return ans+1;
  207. }
  208. }
  209.  
  210.  
  211. Core coreDesign(Transformer transformerData){
  212. Core ans;
  213.  
  214. readFloat("Enter the value of K\nFor Distribution Transformers, K=0.45\nFor Power Transformers, K=0.6 to 0.7",&ans.K);
  215.  
  216. //Et
  217. ans.Et = ans.K * sqrt(transformerData.kVA);
  218. printf("\n=> Et = %.2f V",ans.Et);
  219.  
  220. //phi_m
  221. ans.phi_m = ans.Et/(4.44*transformerData.frequency);
  222. printf("\n=> phi_m = %.4f Wb\n",ans.phi_m);
  223.  
  224. //Ai
  225. readFloat("Enter the value of Bm(in Wb/m^2)\nFor Distribution Transformers,Bm=1 to 1.35 Wb/m^2\nFor Power Transformers,Bm = 1.25 to 1.60 Wb/m^2",&ans.Bm);
  226. ans.Ai = ans.phi_m/ans.Bm;
  227. printf("\n=> Net Iron Area = %.4f m^2\n",ans.Ai);
  228.  
  229. //Agi
  230. readFloat("Enter the value of Stacking Factor (Typically 0.9)",&ans.Ki);
  231. ans.Agi = ans.Ai/ans.Ki;
  232. printf("\n=> Gross Area = %.4f m^2\n",ans.phi_m);
  233.  
  234. readInt("\nEnter the Core Type\n1. Square\n2. Cruciform\n3. 3-stepped\n4. 4-stepped",&ans.coreType);
  235. switch(ans.coreType){
  236. case 1:
  237. ans.ct = 0.45;
  238. ans.d = sqrt(ans.Ai/ans.ct);
  239. printf("\n=> Diameter of core is %.4f m",ans.d);
  240. ans.p = sqrt(0.5)*ans.d;
  241. printf("\n=> Dimension is %.4f m",ans.p);
  242. break;
  243.  
  244. case 2:
  245. ans.ct = 0.56;
  246. ans.d = sqrt(ans.Ai/ans.ct);
  247. printf("\n=> Diameter of core is %.4f m",ans.d);
  248. ans.p = 0.85*ans.d;
  249. ans.q = 0.53*ans.d;
  250. printf("\n=> Dimension is p = %.4f m , q = %.4f m",ans.p,ans.q);
  251. break;
  252.  
  253. case 3:
  254. ans.ct = 0.6;
  255. ans.d = sqrt(ans.Ai/ans.ct);
  256. printf("\n=> Diameter of core is %.4f m",ans.d);
  257. ans.p = 0.9*ans.d;
  258. ans.q = 0.7*ans.d;
  259. ans.r = 0.42*ans.d;
  260. printf("\n=> Dimension is p = %.4f m , q = %.4f m , r = %.4f m",ans.p,ans.q,ans.r);
  261. break;
  262.  
  263. case 4:
  264. ans.ct = 0.62;
  265. ans.d = sqrt(ans.Ai/ans.ct);
  266. printf("\n=> Diameter of core is %.4f m",ans.d);
  267. ans.p = 0.36*ans.d;
  268. ans.q = 0.36*ans.d;
  269. ans.r = 0.78*ans.d;
  270. ans.s = 0.92*ans.d;
  271. printf("\n=> Dimension is p = %.4f m , q = %.4f m , r = %.4f m , s = %.4f m",ans.p,ans.q,ans.r,ans.s);
  272. break;
  273. }
  274.  
  275. return ans;
  276. }
  277.  
  278. Window windowDesign(Transformer transformerData){
  279. // Window Space Factor
  280. Window ans;
  281.  
  282. if(transformerData.kVA <200){
  283. ans.Kw = 8/(30+transformerData.kVA);
  284. }else if(transformerData.kVA <700){
  285. ans.Kw = 10/(30+transformerData.kVA);
  286. }else if(transformerData.kVA <1000){
  287. ans.Kw = 12/(30+transformerData.kVA);
  288. }else{
  289. ans.Kw = 0.21;
  290. }
  291.  
  292. readFloat("Enter the value of Current Density(in A/mm^2)",&ans.currentDensity);
  293.  
  294. //Aw calculation
  295. ans.Aw = transformerData.kVA/(3.33*transformerData.frequency*transformerData.Core.Bm*ans.Kw*ans.currentDensity*1000*transformerData.Core.Ai);
  296. printf("\n=> Window area = %.4f m^2",ans.Aw);
  297.  
  298. readFloat("Enter the value of ratio of Hw and Ww",&ans.ratio);
  299. ans.Ww = sqrt(ans.Aw/ans.ratio);
  300. ans.Hw = ans.ratio*ans.Ww;
  301. ans.distanceBetweenCores = ans.Ww + transformerData.Core.d;
  302. printf("\n\n _____________Window Dimensions____________");
  303. printf("\n => Width of Window = %d mm",mToMM(ans.Ww));
  304. printf("\n => Height of Window = %d mm",mToMM(ans.Hw));
  305. printf("\n => Distance between adjacent Core centers = %d mm",mToMM(ans.distanceBetweenCores));
  306.  
  307. return ans;
  308. }
  309.  
  310. Yoke yokeDesign(Transformer transformerData){
  311. Yoke ans;
  312.  
  313. ans.Ayoke = 1.2 * transformerData.Core.Ai;
  314. printf("\n=> Net area of Yoke = %f m^2", ans.Ayoke);
  315. printf("\n=> Gross area of Yoke = %f m^2", ans.Ayoke/transformerData.Core.Ki);
  316. ans.Dy = transformerData.Core.p;
  317. ans.Hy = ans.Ayoke/(transformerData.Core.Ki*ans.Dy);
  318.  
  319. printf("\n\n _____________Yoke Dimensions____________");
  320. printf("\n => Depth of Yoke = %d mm",mToMM(ans.Dy));
  321. printf("\n => Height of Yoke = %d mm",mToMM(ans.Hy));
  322.  
  323. ans.Bm = transformerData.Core.Bm/1.2;
  324.  
  325.  
  326. return ans;
  327. }
  328.  
  329. Frame frameDesign(Transformer transformerData){
  330. Frame ans;
  331.  
  332. ans.H = transformerData.Window.Hw + 2*transformerData.Yoke.Hy;
  333. ans.W = 2*transformerData.Window.distanceBetweenCores + transformerData.Core.p;
  334. ans.D = transformerData.Yoke.Dy;
  335.  
  336. printf("\n => Height of Frame = %d mm",mToMM(ans.H));
  337. printf("\n => Width of Frame = %d mm",mToMM(ans.W));
  338. printf("\n => Depth of Frame = %d mm",mToMM(ans.D));
  339.  
  340. return ans;
  341. }
  342.  
  343. LVwindingData lvDesign(Transformer transformerData){
  344. LVwindingData ans;
  345. float x;
  346. x = (transformerData.VsPhase*1000)/transformerData.Core.Et;
  347. ans.turnsPerPhase = (int)x + 1;
  348.  
  349. readFloat("Enter the Current density for LV (in A/mm^2)",&ans.currentDensity);
  350. ans.As = transformerData.IsPhase/ans.currentDensity;
  351. printf("\n=> Area of Cross Section of LV winding Conductor(theoretical) = %f mm^2",ans.As);
  352. printf("\nEnter the proper Conductor dimensions as per IS:1897-1962 standards(in mm) seperated by a [space] : ");
  353. scanf("%f %f",&ans.x1,&ans.x2);
  354. readFloat("Enter the required Insulation(in mm)",&ans.conductorInsulation);
  355. ans.As = ans.x1*ans.x2;
  356. ans.currentDensity = transformerData.IsPhase/ans.As;
  357.  
  358. ans.x1 += ans.conductorInsulation;
  359. ans.x2 += ans.conductorInsulation;
  360. printf("\n=> Dimensions of Insulated conductors = %f x %f mm",ans.x1,ans.x2);
  361.  
  362.  
  363. //Helical Winding
  364. printf("\n__________For Helical Winding__________");
  365. readInt("Enter the number of layers",&ans.layers);
  366. ans.turnsPerLayer = (int)(ans.turnsPerPhase/ans.layers) + 1;
  367. printf("\nUsing Helical Winding, space is to be provided for %d turns along the axis",ans.turnsPerLayer);
  368.  
  369. //Axial Depth
  370. ans.axialDepth = ans.turnsPerLayer * ans.x1;
  371.  
  372. //Radial Depth
  373. ans.radialDepth= ans.layers * ans.x2 + (ans.layers-1)*ans.conductorInsulation;
  374.  
  375. //Inner Dia
  376. readFloat("Enter the thickness of press board cylinder(in mm)",&ans.pressBoard);
  377. ans.Di = transformerData.Core.d*1000 + 2*ans.pressBoard;
  378.  
  379. //Outer Dia
  380. ans.Do = ans.Di + 2*ans.radialDepth;
  381.  
  382. //clearance
  383. ans.clearance = (transformerData.Window.Hw*1000 - ans.axialDepth)/2;
  384.  
  385. printf("\n\n _____________LV Dimensions____________");
  386. printf("\n=> Axial Depth of LV Windings = %f mm",ans.axialDepth);
  387. printf("\n=> Clearance = %f mm on either side",ans.clearance);
  388. printf("\n=> Radial Depth of LV Windings = %f mm",ans.radialDepth);
  389. printf("\n=> Inner Diameter = %f mm",ans.Di);
  390. printf("\n=> Outer Diameter = %f mm",ans.Do);
  391. return ans;
  392. }
  393.  
  394. HVwindingData hvDesign(Transformer transformerData){
  395. HVwindingData ans;
  396.  
  397. //Turns per phase
  398. ans.turnsPerPhase = transformerData.LV.turnsPerPhase*(transformerData.VpPhase/transformerData.VsPhase);
  399. printf("\n=>HV Turns per phase = %d",ans.turnsPerPhase);
  400.  
  401. ans.turnsPerPhase *= (1+(transformerData.maxTappings/100));
  402. printf("\n=>HV Turns per phase after considering tappings = %d",ans.turnsPerPhase);
  403.  
  404. readFloat("Enter the value of Current Density(HV) (in A/mm^2)",&ans.currentDensity);
  405. ans.Ap = transformerData.IpPhase/ans.currentDensity;
  406. printf("\n=> Area of Cross Section of HV winding Conductor(theoretical) = %f mm^2",ans.Ap);
  407. printf("\nEnter the proper Conductor dimensions as per IS:1897-1962 standards(in mm) seperated by a [space] : ");
  408. scanf("%f %f",&ans.x1,&ans.x2);
  409. readFloat("Enter the required Insulation(in mm)",&ans.conductorInsulation);
  410. ans.Ap = ans.x1*ans.x2;
  411. ans.currentDensity = transformerData.IpPhase/ans.Ap;
  412. ans.x1 += ans.conductorInsulation;
  413. ans.x2 += ans.conductorInsulation;
  414.  
  415. printf("\n=> Dimensions of Insulated conductors = %f x %f mm",ans.x1,ans.x2);
  416.  
  417.  
  418. printf("\n\n__________For Continuous Disc Winding__________");
  419. readFloat("\nEnter the value of Maximum Voltage per Disc (in V)",&ans.voltagePerDisc);
  420. ans.numDiscs = (transformerData.VpPhase*1000/ans.voltagePerDisc);
  421. printf("\n\n=>Recomended number of Discs = %d\n", ans.numDiscs);
  422. readInt("Enter the number of discs you require ",&ans.numDiscs);
  423.  
  424. ans.turnsPerDisc = (ans.turnsPerPhase/ans.numDiscs);
  425. printf("\n=>Turns per Disc = %d\n", ans.turnsPerDisc);
  426.  
  427. readFloat("Enter the thickness of Bakelized Paper (in mm)",&ans.bakelizedPaper);
  428. readFloat("Enter the thickness of Spacer (in mm)",&ans.spacer);
  429.  
  430. //Axial Depth
  431. ans.axialDepth = ans.numDiscs * ans.x1 + (ans.numDiscs-1)*ans.spacer;
  432.  
  433. //Radial Depth
  434. ans.radialDepth= ans.turnsPerDisc*ans.x2;
  435.  
  436. //Axial Clearance
  437. ans.clearanceAxial = (transformerData.Window.Hw*1000 - ans.axialDepth)/2;
  438.  
  439. //Inner Dia
  440. ans.Di = transformerData.LV.Do + 2*ans.bakelizedPaper;
  441.  
  442. //Outer Dia
  443. ans.Do = ans.Di + ans.radialDepth;
  444.  
  445. //clearance
  446. ans.clearance = (transformerData.Window.distanceBetweenCores*1000 - ans.Do);
  447.  
  448. //Insulation
  449. ans.insulation = 5 + 0.9*transformerData.VpPhase;
  450.  
  451.  
  452.  
  453. printf("\n\n _____________HV Dimensions____________\n");
  454. printf("\n=> Axial Depth of HV Windings = %f mm",ans.axialDepth);
  455. printf("\n=> Axial Clearance = %f mm ",ans.clearanceAxial);
  456.  
  457. printf("\n=> Radial Depth of HV Windings = %f mm",ans.radialDepth);
  458. printf("\n=> Inner Diameter = %f mm",ans.Di);
  459. printf("\n=> Outer Diameter = %f mm",ans.Do);
  460.  
  461. printf("\n=> Clearance between windings of 2 limbs = %f mm ",ans.clearance);
  462. printf("\n=> Insulation between HV and LV = %f mm ",ans.insulation);
  463.  
  464.  
  465.  
  466. return ans;
  467. }
  468.  
  469. Resistance resistanceCalc(Transformer transformerData){
  470. Resistance ans;
  471. float Dm1,Dm2;
  472. float Lmtp,Lmts;
  473. float Rs,Rp;
  474.  
  475. Dm1 = (transformerData.HV.Di + transformerData.HV.Do)/2;
  476. Lmtp = pi*Dm1*0.001;//in m
  477. Rp = (transformerData.HV.turnsPerPhase * 0.021 * Lmtp)/transformerData.HV.Ap;
  478.  
  479. Dm2 = (transformerData.LV.Di + transformerData.LV.Do)/2;
  480. Lmts = pi*Dm2*0.001;//in m
  481. Rs = (transformerData.LV.turnsPerPhase * 0.021 * Lmts)/transformerData.LV.As;
  482.  
  483. ans.absolute = Rp + pow((transformerData.HV.turnsPerPhase/(transformerData.LV.turnsPerPhase*(1+transformerData.maxTappings/100))),2) * Rs;
  484. ans.pu = (ans.absolute*transformerData.IpPhase)/(transformerData.VpPhase*1000);
  485.  
  486. printf("\n=> Total Resistance referred to primary = %f ohm", ans.absolute);
  487. printf("\n=> Total Resistance referred to primary in p.u. = %f ", ans.pu);
  488.  
  489. return ans;
  490. }
  491.  
  492.  
  493. Reactance reactanceCalc(Transformer transformerData){
  494. Reactance ans;
  495. float Dm;
  496. float Lmt;
  497. float Lc;
  498. float Xp;
  499.  
  500. Dm = (transformerData.LV.Di+transformerData.HV.Do)/2;
  501. Lmt = pi*Dm*0.001; // in m
  502.  
  503.  
  504. Lc = (transformerData.LV.axialDepth + transformerData.HV.axialDepth)/2000;
  505. Xp = (2*pi*transformerData.frequency*muo*pow(transformerData.HV.turnsPerPhase/(1+transformerData.maxTappings/100),2)*Lmt*(transformerData.HV.insulation+(transformerData.LV.radialDepth+transformerData.HV.radialDepth)/3))/(Lc*1000);
  506. ans.absolute = Xp;
  507. ans.pu = (ans.absolute*transformerData.IpPhase)/(transformerData.VpPhase*1000);
  508.  
  509. printf("\n=> Total Reactance referred to primary = %f ohm", ans.absolute);
  510. printf("\n=> Total Reactance referred to primary in p.u. = %f ", ans.pu);
  511.  
  512.  
  513.  
  514. return ans;
  515. }
  516.  
  517. Regulation regulationCalc(Transformer transformerData){
  518. Regulation ans;
  519.  
  520. transformerData.Z.pu = sqrt(pow(transformerData.Z.R.pu,2)+pow(transformerData.Z.X.pu,2));
  521.  
  522. readFloat("Enter the pf at which Regulation is to be calculated \n +ve for lagging \n -ve for leading ",&ans.pf);
  523.  
  524. if(ans.pf>0){ // Lag
  525.  
  526. ans.pu = transformerData.Z.R.pu * ans.pf + transformerData.Z.X.pu*sqrt(1-pow(ans.pf,2));
  527.  
  528.  
  529.  
  530. }else{ // Lead
  531. ans.pu = -1*transformerData.Z.R.pu * ans.pf - transformerData.Z.X.pu*sqrt(1-pow(ans.pf,2));
  532.  
  533. }
  534.  
  535. printf("\n\n=> Percentage Regulation = %f",ans.pu*100);
  536.  
  537.  
  538. return ans;
  539. }
  540.  
  541.  
  542. Losses lossCalc(Transformer transformerData){
  543. Losses ans;
  544.  
  545. printf("\n_________Copper Loss___________\n");
  546.  
  547. ans.CopperLoss = 3*pow(transformerData.IpPhase,2)*transformerData.Z.R.absolute;
  548. printf("\n=> Copper Loss = %.3f kW",ans.CopperLoss/1000);
  549. ans.CopperLoss *= 1.15;
  550. printf("\n=> Copper Loss(considering Stray Load Loss) = %.3f kW",ans.CopperLoss/1000);
  551.  
  552. printf("\n\n_________Core Loss___________\n");
  553.  
  554. readFloat("Enter the value of Lamination Density (in kg/m^3)",&ans.CoreLoss.lamDensity);
  555.  
  556. ans.CoreLoss.limbWeight = 3*transformerData.Window.Hw*transformerData.Core.Ai*ans.CoreLoss.lamDensity;
  557.  
  558. readFloat("Enter the specific Core Loss for Limb (in W/kg)",&ans.CoreLoss.limbSpec);
  559. ans.CoreLoss.limb = ans.CoreLoss.limbWeight * ans.CoreLoss.limbSpec;
  560.  
  561.  
  562. ans.CoreLoss.yokeWeight = 2*transformerData.Frame.W * transformerData.Yoke.Ayoke*ans.CoreLoss.lamDensity;
  563. readFloat("Enter the specific Core Loss for Yoke (in W/kg)",&ans.CoreLoss.yokeSpec);
  564. ans.CoreLoss.yoke = ans.CoreLoss.yokeWeight * ans.CoreLoss.yokeSpec;
  565.  
  566. ans.CoreLoss.value = ans.CoreLoss.yoke + ans.CoreLoss.limb;
  567.  
  568. // printf("\n%f",ans.CoreLoss.value);
  569. printf("\n\n=> Core Loss = %.3f kW",ans.CoreLoss.value/1000);
  570. ans.totalLoss = ans.CoreLoss.value+ans.CopperLoss;
  571.  
  572. printf("\n\n=> Total Loss = %.3f kW",ans.totalLoss/1000);
  573.  
  574.  
  575. return ans;
  576. }
  577.  
  578.  
  579. Tank tankDesign(Transformer transformerData){
  580. Tank ans;
  581. ans.H = transformerData.Frame.H + 0.4; // m
  582. ans.W = 2*transformerData.Window.distanceBetweenCores + (transformerData.HV.Do/1000) + 0.08; // m
  583. ans.L = (transformerData.HV.Do/1000) + 0.1;
  584. ans.S = 2*(ans.W+ans.L)*ans.H;
  585.  
  586. readFloat("Enter the specific loss dissipiation constant (in W/m^2-*C)",&ans.diss);
  587. ans.tempRise = transformerData.Losses.totalLoss/(ans.diss*ans.S);
  588.  
  589. printf("\n=> Tank Height = %.3f m", ans.H);
  590. printf("\n=> Tank Width = %.3f m", ans.W);
  591. printf("\n=> Tank Length = %.3f m", ans.L);
  592.  
  593.  
  594.  
  595.  
  596. printf("\n\n=> Temperature Rise = %.2f *C", ans.tempRise);
  597.  
  598. return ans;
  599. }
  600.  
  601. int main(int argc, char const *argv[]) {
  602. /* code */
  603. system("cls");
  604. Transformer transformerData;
  605.  
  606. printf("============================\n");
  607. printf(" TRANSFORMER DESIGN \n");
  608. printf("============================\n");
  609.  
  610. //_________Initialization________________
  611. readFloat("Enter the kVA rating(in kVA)",&transformerData.kVA);
  612. readFloat("Enter the HV Voltage(in kV)",&transformerData.Vp);
  613. readFloat("Enter the LV Voltage(in kV)",&transformerData.Vs);
  614. readFloat("Enter the rated frequency(in Hz)",&transformerData.frequency);
  615. readFloat("Enter the number of phases(1 or 3)",&transformerData.phase);
  616. readFloat("Enter the tappings(in %)(if no tappings write 0)",&transformerData.maxTappings);
  617. readInt("Enter the Primary Type\n1. Delta\n2. Star",&transformerData.primaryType);
  618. readInt("Enter the Secondary Type\n1. Delta\n2. Star",&transformerData.secondaryType);
  619. //Line Currents
  620. transformerData.Ip = transformerData.kVA/(sqrt(3)*transformerData.Vp);
  621. transformerData.Is = transformerData.kVA/(sqrt(3)*transformerData.Vs);
  622.  
  623. switch(transformerData.primaryType){
  624. case 1: // Primary Delta
  625. transformerData.VpPhase = transformerData.Vp;
  626. transformerData.IpPhase = transformerData.Ip/sqrt(3);
  627. break;
  628. case 2: //Primary Star
  629. transformerData.VpPhase = transformerData.Vp/sqrt(3);
  630. transformerData.IpPhase = transformerData.Ip;
  631. break;
  632. }
  633.  
  634. switch(transformerData.secondaryType){
  635. case 1: // Secondary Delta
  636. transformerData.VsPhase = transformerData.Vs;
  637. transformerData.IsPhase = transformerData.Is/sqrt(3);
  638. break;
  639. case 2: //Secondary Star
  640. transformerData.VsPhase = transformerData.Vs/sqrt(3);
  641. transformerData.IsPhase = transformerData.Is;
  642. break;
  643. }
  644.  
  645.  
  646. //________Core Design__________________
  647.  
  648. printf("\n\n============================\n");
  649. printf(" CORE DESIGN \n");
  650. printf("============================\n");
  651. transformerData.Core = coreDesign(transformerData);
  652.  
  653. //_______Window Design_____________
  654. printf("\n\n============================\n");
  655. printf(" WINDOW DESIGN \n");
  656. printf("============================\n");
  657. transformerData.Window = windowDesign(transformerData);
  658.  
  659. //_______Yoke Design_______________
  660. printf("\n\n============================\n");
  661. printf(" YOKE DESIGN \n");
  662. printf("============================\n");
  663. transformerData.Yoke = yokeDesign(transformerData);
  664.  
  665. //______Frame Design_______________
  666. printf("\n\n============================\n");
  667. printf(" FRAME DESIGN \n");
  668. printf("============================\n");
  669. transformerData.Frame = frameDesign(transformerData);
  670.  
  671. //_____LV Winding__________________
  672. printf("\n\n============================\n");
  673. printf(" LV DESIGN \n");
  674. printf("============================\n");
  675. transformerData.LV = lvDesign(transformerData);
  676.  
  677. //_____HV Winding__________________
  678. printf("\n\n============================\n");
  679. printf(" HV DESIGN \n");
  680. printf("============================\n");
  681. transformerData.HV = hvDesign(transformerData);
  682.  
  683. //___________Resistance__________________
  684. printf("\n\n============================\n");
  685. printf(" RESISTANCE \n");
  686. printf("============================\n");
  687. transformerData.Z.R = resistanceCalc(transformerData);
  688.  
  689. //___________Reactance__________________
  690. printf("\n\n============================\n");
  691. printf(" REACTANCE \n");
  692. printf("============================\n");
  693. transformerData.Z.X = reactanceCalc(transformerData);
  694.  
  695. //___________Regulation__________________
  696. printf("\n\n============================\n");
  697. printf(" REGULATION \n");
  698. printf("============================\n");
  699. transformerData.Regulation = regulationCalc(transformerData);
  700.  
  701. //___________Losses__________________
  702. printf("\n\n============================\n");
  703. printf(" LOSSES \n");
  704. printf("============================\n");
  705. transformerData.Losses = lossCalc(transformerData);
  706.  
  707. //___________efficiency__________________
  708. printf("\n\n============================\n");
  709. printf(" EFFICIENCY \n");
  710. printf("============================\n");
  711. transformerData.efficiency = transformerData.kVA*1000/(transformerData.kVA*1000 + transformerData.Losses.totalLoss);
  712. printf("\n\n=> Efficiency at Full Load = %.2f %%",transformerData.efficiency*100);
  713.  
  714. //___________Tank__________________
  715. printf("\n\n============================\n");
  716. printf(" TANK \n");
  717. printf("============================\n");
  718. transformerData.Tank = tankDesign(transformerData);
  719.  
  720.  
  721. return 0;
  722. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement