Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. set Text,Sloads,BusBars,allBars,allLine,allLoad,allSym,OldMons;
  2. object Ldf;
  3. object Ini;
  4. object Sim;
  5. string str,elemento;
  6. double f_servicio,t_n,tension,Pwr,t_end,phi,frec,P_a,P_r,ve,p_a,p_r,pl_a,pl_r,pl_carga,terminal;
  7. object busbar,load,gen,line,result;
  8. string nombre,subestacion;
  9. double it;
  10. allBars = AllRelevant('*.ElmTerm');
  11. allLine = AllRelevant ('*.ElmLne');
  12. allLoad = AllRelevant ('*.ElmLod');
  13. allSym = AllRelevant ('*.ElmSym');
  14.  
  15. !Definiendo las acciones de simulación
  16. Ldf = GetCaseCommand('ComLdf');
  17. Ini = GetCaseCommand('ComInc');
  18. Sim = GetCaseCommand('ComSim');
  19.  
  20. !Definiendo las condiciones de ejecucion para las simulaciones
  21. Ldf:iopt_net = 0;
  22. !Ini:iopt_sim = 0; !no le gusta
  23.  
  24. Sim:iopt_show = 0;
  25. Sim:iopt_dbev = 0;
  26. !Ejecuando las acciones de simulación
  27. Ldf.Execute();
  28.  
  29.  
  30. !!!! Para los datos medidos!!!!!!
  31. Ini.Execute();
  32.  
  33. fopen('C:\Users\Pedro\Google Drive\benches\digsilent\DPL\test.txt','w',0);
  34. t_end=0.0;
  35.  
  36. it = 0;
  37. while ( t_end<1.0)
  38. {
  39.  
  40.  
  41. Sim:tstop =t_end;
  42.  
  43. str=fprintf(0,'t:%2.2f',t_end);
  44.  
  45. Sim.Execute();
  46.  
  47.  
  48. !!!!!!!!!!!!!Magnitudes medidas del elemento!!!!!!!!!!!!!
  49.  
  50. for (busbar=allBars.First(); busbar; busbar=allBars.Next())
  51. {
  52. result=busbar.GetNextHVBus();
  53. busbar.GetVal(nombre,'loc_name');
  54. busbar.GetVal(tension,'m:Ul');
  55. busbar.GetVal(t_n,'e:uknom');
  56. if (t_n>=220){
  57. if (it=0.0){
  58. str =fprintf(0,'bus:%s:U1:kV\t%.2f',nombre,tension);};
  59. if (it>0.0){
  60. str =fprintf(0,'%.2f',tension);};
  61. }
  62. }
  63. for (busbar=allBars.First(); busbar; busbar=allBars.Next())
  64. {
  65. result=busbar.GetNextHVBus();
  66. busbar.GetVal(nombre,'loc_name');
  67. busbar.GetVal(tension,'m:u');
  68. busbar.GetVal(t_n,'e:uknom');
  69. if (t_n>=220){
  70. if (it=0){
  71. str =fprintf(0,'bus:%s:u:pu\t%2.2f',nombre,tension);};
  72. if (it>0){
  73. str =fprintf(0,'%2.2f',tension);};
  74. }
  75. }
  76. for (busbar=allBars.First(); busbar; busbar=allBars.Next())
  77. {
  78. result=busbar.GetNextHVBus();
  79. busbar.GetVal(nombre,'loc_name');
  80. busbar.GetVal(phi,'m:phiu');
  81. busbar.GetVal(t_n,'e:uknom');
  82. if (t_n>=220){
  83. if (it=0){
  84. str =fprintf(0,'bus:%s:phiu:deg\t%2.2f',nombre,phi); };
  85. if (it>0){
  86. str =fprintf(0,'%2.2f',phi); };
  87. }
  88. }
  89.  
  90. for (busbar=allBars.First(); busbar; busbar=allBars.Next())
  91. {
  92. result=busbar.GetNextHVBus();
  93. busbar.GetVal(nombre,'loc_name');
  94. busbar.GetVal(frec,'m:frnom');
  95. busbar.GetVal(t_n,'e:uknom');
  96. if (t_n>=220){
  97. if (it=0){
  98. str =fprintf(0,'bus:%s:fehz:hz\t%2.2f',nombre,frec); };
  99. if (it>0){
  100. str =fprintf(0,'%2.2f',frec); };
  101. }
  102. }
  103. for (gen=allSym.First(); gen ; gen=allSym.Next())
  104. {
  105. gen.GetVal(P_a,'m:P:bus1');
  106. gen.GetVal(nombre,'loc_name');
  107. gen.GetVal(f_servicio,'e:outserv');
  108. if (f_servicio = 0) {
  109. if (it=0){
  110. str= fprintf(0,'sym:%s:P1:MW\t%2.2f',nombre,P_a);};
  111. if (it>0){
  112. str= fprintf(0,'%2.2f',P_a);};
  113. }
  114. }
  115. for (gen=allSym.First(); gen ; gen=allSym.Next())
  116. {
  117. gen.GetVal(P_r,'m:Q:bus1');
  118. gen.GetVal(nombre,'loc_name');
  119. gen.GetVal(f_servicio,'e:outserv');
  120. if (f_servicio = 0) {
  121. if (it=0){
  122. str= fprintf(0,'sym:%s:Q1:Mvar\t%2.2f',nombre,P_r); };
  123. if (it>0){
  124. str= fprintf(0,'%2.2f',P_r); };
  125. }
  126. }
  127. for (gen=allSym.First(); gen ; gen=allSym.Next())
  128. {
  129. gen.GetVal(ve,'s:ve');
  130. gen.GetVal(nombre,'loc_name');
  131. gen.GetVal(f_servicio,'e:outserv');
  132. if (f_servicio = 0) {
  133. if (it=0){
  134. str= fprintf(0,'sym:%s:ve:pu\t%2.2f',nombre,ve); };
  135. if (it>0){
  136. str= fprintf(0,'%2.2f',ve); };
  137. }
  138. }
  139. for (load=allLoad.First(); load ; load=allLoad.Next())
  140. {
  141. load.GetVal(p_a,'m:P:bus1');
  142. load.GetVal(nombre,'loc_name');
  143. load.GetVal(f_servicio,'e:outserv');
  144. if (f_servicio = 0){
  145. if (it=0){
  146. str= fprintf(0,'load:%s:P1:Mvar\t%2.2f',nombre,p_a);};
  147. if (it>0){
  148. str= fprintf(0,'%2.2f',p_a);};
  149. }
  150. }
  151. for (load=allLoad.First(); load ; load=allLoad.Next())
  152. {
  153. load.GetVal(p_r,'m:Q:bus1');
  154. load.GetVal(nombre,'loc_name');
  155. load.GetVal(f_servicio,'e:outserv');
  156. if (f_servicio = 0){
  157. if (it=0){
  158. str= fprintf(0,'load:%s:Q1:Mvar\t%2.2f',nombre,p_r);};
  159. if (it>0){
  160. str= fprintf(0,'%2.2f',p_r);};
  161. }
  162. }
  163. for (line=allLine.First(); line ; line=allLine.Next())
  164. {
  165. line.GetVal(pl_a,'m:Psum:bus1');
  166. line.GetVal(nombre,'loc_name');
  167. line.GetVal(t_n,'t:uline');
  168. line.GetVal(f_servicio,'e:outserv');
  169. if (f_servicio = 0) {
  170. if(t_n >=220){
  171. if (it=0){
  172. str= fprintf(0,'line:%s:P1:MW\t%2.2f',nombre,pl_a); };
  173. if (it>0){
  174. str= fprintf(0,'%2.2f',pl_a); };
  175. }
  176. }
  177. }
  178. for (line=allLine.First(); line ; line=allLine.Next())
  179. {
  180. line.GetVal(pl_r,'m:Qsum:bus1');
  181. line.GetVal(nombre,'loc_name');
  182. line.GetVal(t_n,'t:uline');
  183. line.GetVal(f_servicio,'e:outserv');
  184. if (f_servicio = 0) {
  185. if(t_n >=220){
  186. if (it=0){
  187. str= fprintf(0,'line:%s:P1:Mvar\t%2.2f',nombre,pl_r); };
  188. if (it>0){
  189. str= fprintf(0,'%2.2f',pl_r); }
  190. }
  191. }
  192. }
  193. for (line=allLine.First(); line ; line=allLine.Next())
  194. {
  195. line.GetVal(pl_carga,'c:loading');
  196. line.GetVal(nombre,'loc_name');
  197. line.GetVal(t_n,'t:uline');
  198. line.GetVal(f_servicio,'e:outserv');
  199. if (f_servicio = 0) {
  200. if(t_n >=220){
  201. if (it=0){
  202. str= fprintf(0,'line:%s:loading:percent\t%2.2f',nombre,pl_carga); };
  203. if (it>0) {
  204. str= fprintf(0,'%2.2f',pl_carga); };
  205. }
  206. }
  207. }
  208.  
  209.  
  210. t_end=t_end+0.1 ;
  211. it = it +1;
  212. }
  213.  
  214. fclose(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement