Last active
April 19, 2023 19:32
-
-
Save pbetancourtp/638b0ec2e14ffd3ebe65 to your computer and use it in GitHub Desktop.
DPL genera archivo de datos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set Text,Sloads,BusBars,allBars,allLine,allLoad,allSym,OldMons; | |
object Ldf; | |
object Ini; | |
object Sim; | |
string str,elemento; | |
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; | |
object busbar,load,gen,line,result; | |
string nombre,subestacion; | |
double it; | |
allBars = AllRelevant('*.ElmTerm'); | |
allLine = AllRelevant ('*.ElmLne'); | |
allLoad = AllRelevant ('*.ElmLod'); | |
allSym = AllRelevant ('*.ElmSym'); | |
!Definiendo las acciones de simulación | |
Ldf = GetCaseCommand('ComLdf'); | |
Ini = GetCaseCommand('ComInc'); | |
Sim = GetCaseCommand('ComSim'); | |
!Definiendo las condiciones de ejecucion para las simulaciones | |
Ldf:iopt_net = 0; | |
!Ini:iopt_sim = 0; !no le gusta | |
Sim:iopt_show = 0; | |
Sim:iopt_dbev = 0; | |
!Ejecuando las acciones de simulación | |
Ldf.Execute(); | |
!!!! Para los datos medidos!!!!!! | |
Ini.Execute(); | |
fopen('C:\Users\Pedro\Google Drive\benches\digsilent\DPL\test.txt','w',0); | |
t_end=0.0; | |
it = 0; | |
while ( t_end<1.0) | |
{ | |
Sim:tstop =t_end; | |
str=fprintf(0,'t:%2.2f',t_end); | |
Sim.Execute(); | |
!!!!!!!!!!!!!Magnitudes medidas del elemento!!!!!!!!!!!!! | |
for (busbar=allBars.First(); busbar; busbar=allBars.Next()) | |
{ | |
result=busbar.GetNextHVBus(); | |
busbar.GetVal(nombre,'loc_name'); | |
busbar.GetVal(tension,'m:Ul'); | |
busbar.GetVal(t_n,'e:uknom'); | |
if (t_n>=220){ | |
if (it=0.0){ | |
str =fprintf(0,'bus:%s:U1:kV\t%.2f',nombre,tension);}; | |
if (it>0.0){ | |
str =fprintf(0,'%.2f',tension);}; | |
} | |
} | |
for (busbar=allBars.First(); busbar; busbar=allBars.Next()) | |
{ | |
result=busbar.GetNextHVBus(); | |
busbar.GetVal(nombre,'loc_name'); | |
busbar.GetVal(tension,'m:u'); | |
busbar.GetVal(t_n,'e:uknom'); | |
if (t_n>=220){ | |
if (it=0){ | |
str =fprintf(0,'bus:%s:u:pu\t%2.2f',nombre,tension);}; | |
if (it>0){ | |
str =fprintf(0,'%2.2f',tension);}; | |
} | |
} | |
for (busbar=allBars.First(); busbar; busbar=allBars.Next()) | |
{ | |
result=busbar.GetNextHVBus(); | |
busbar.GetVal(nombre,'loc_name'); | |
busbar.GetVal(phi,'m:phiu'); | |
busbar.GetVal(t_n,'e:uknom'); | |
if (t_n>=220){ | |
if (it=0){ | |
str =fprintf(0,'bus:%s:phiu:deg\t%2.2f',nombre,phi); }; | |
if (it>0){ | |
str =fprintf(0,'%2.2f',phi); }; | |
} | |
} | |
for (busbar=allBars.First(); busbar; busbar=allBars.Next()) | |
{ | |
result=busbar.GetNextHVBus(); | |
busbar.GetVal(nombre,'loc_name'); | |
busbar.GetVal(frec,'m:frnom'); | |
busbar.GetVal(t_n,'e:uknom'); | |
if (t_n>=220){ | |
if (it=0){ | |
str =fprintf(0,'bus:%s:fehz:hz\t%2.2f',nombre,frec); }; | |
if (it>0){ | |
str =fprintf(0,'%2.2f',frec); }; | |
} | |
} | |
for (gen=allSym.First(); gen ; gen=allSym.Next()) | |
{ | |
gen.GetVal(P_a,'m:P:bus1'); | |
gen.GetVal(nombre,'loc_name'); | |
gen.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if (it=0){ | |
str= fprintf(0,'sym:%s:P1:MW\t%2.2f',nombre,P_a);}; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',P_a);}; | |
} | |
} | |
for (gen=allSym.First(); gen ; gen=allSym.Next()) | |
{ | |
gen.GetVal(P_r,'m:Q:bus1'); | |
gen.GetVal(nombre,'loc_name'); | |
gen.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if (it=0){ | |
str= fprintf(0,'sym:%s:Q1:Mvar\t%2.2f',nombre,P_r); }; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',P_r); }; | |
} | |
} | |
for (gen=allSym.First(); gen ; gen=allSym.Next()) | |
{ | |
gen.GetVal(ve,'s:ve'); | |
gen.GetVal(nombre,'loc_name'); | |
gen.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if (it=0){ | |
str= fprintf(0,'sym:%s:ve:pu\t%2.2f',nombre,ve); }; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',ve); }; | |
} | |
} | |
for (load=allLoad.First(); load ; load=allLoad.Next()) | |
{ | |
load.GetVal(p_a,'m:P:bus1'); | |
load.GetVal(nombre,'loc_name'); | |
load.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0){ | |
if (it=0){ | |
str= fprintf(0,'load:%s:P1:Mvar\t%2.2f',nombre,p_a);}; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',p_a);}; | |
} | |
} | |
for (load=allLoad.First(); load ; load=allLoad.Next()) | |
{ | |
load.GetVal(p_r,'m:Q:bus1'); | |
load.GetVal(nombre,'loc_name'); | |
load.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0){ | |
if (it=0){ | |
str= fprintf(0,'load:%s:Q1:Mvar\t%2.2f',nombre,p_r);}; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',p_r);}; | |
} | |
} | |
for (line=allLine.First(); line ; line=allLine.Next()) | |
{ | |
line.GetVal(pl_a,'m:Psum:bus1'); | |
line.GetVal(nombre,'loc_name'); | |
line.GetVal(t_n,'t:uline'); | |
line.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if(t_n >=220){ | |
if (it=0){ | |
str= fprintf(0,'line:%s:P1:MW\t%2.2f',nombre,pl_a); }; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',pl_a); }; | |
} | |
} | |
} | |
for (line=allLine.First(); line ; line=allLine.Next()) | |
{ | |
line.GetVal(pl_r,'m:Qsum:bus1'); | |
line.GetVal(nombre,'loc_name'); | |
line.GetVal(t_n,'t:uline'); | |
line.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if(t_n >=220){ | |
if (it=0){ | |
str= fprintf(0,'line:%s:P1:Mvar\t%2.2f',nombre,pl_r); }; | |
if (it>0){ | |
str= fprintf(0,'%2.2f',pl_r); } | |
} | |
} | |
} | |
for (line=allLine.First(); line ; line=allLine.Next()) | |
{ | |
line.GetVal(pl_carga,'c:loading'); | |
line.GetVal(nombre,'loc_name'); | |
line.GetVal(t_n,'t:uline'); | |
line.GetVal(f_servicio,'e:outserv'); | |
if (f_servicio = 0) { | |
if(t_n >=220){ | |
if (it=0){ | |
str= fprintf(0,'line:%s:loading:percent\t%2.2f',nombre,pl_carga); }; | |
if (it>0) { | |
str= fprintf(0,'%2.2f',pl_carga); }; | |
} | |
} | |
} | |
t_end=t_end+0.1 ; | |
it = it +1; | |
} | |
fclose(0); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment