Last active
August 29, 2015 14:16
-
-
Save pbetancourtp/f5130161f9d3569dba3b to your computer and use it in GitHub Desktop.
Este DPL crea un evento de cortocircuito en las lineas seleccionadas y realiza las simulaciones de lugar en todos los escenarios de la base de datos.
This file contains hidden or 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
| !Este script realiza simulaciones dinamicas (RMS) evaluando cortocircuitos | |
| !bifasicos en las lineas seleccionadas. | |
| !Para la ejecucion de este script es necesario añadir el conjunto de lineas | |
| !a evaluar dando click derecho sobre el elemento luego add y por ultimo seleccionar | |
| !Shortcircuit Set. | |
| !En la seleccion general del DPL, ubicada en opciones basicas, se debera seleccionar | |
| !el "SET" donde se han añadido los elementos en los cuales se realizarán las | |
| ! perturbaciones. | |
| set Text, | |
| Sloads, | |
| BusBars, | |
| allBars, | |
| allLine, | |
| allLoad, | |
| allSym, | |
| OldMons, | |
| EventSet, | |
| Sline, | |
| SBars, | |
| DelSet, | |
| Scenarios; | |
| object Ldf, | |
| Ini, | |
| Sim, | |
| busbar, | |
| load, | |
| gen, | |
| line, | |
| Scen, | |
| Lib, | |
| evt, | |
| Shc_folder, | |
| Lne_element, | |
| result; | |
| 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, | |
| Scen_name, | |
| Lne_name, | |
| terminal; | |
| string nombre, | |
| subestacion; | |
| double it; | |
| set IntScenario ; | |
| !Estableciendo los "Set" | |
| allBars = AllRelevant('*.ElmTerm'); | |
| allLine = AllRelevant ('*.ElmLne'); | |
| allLoad = AllRelevant ('*.ElmLod'); | |
| allSym = AllRelevant ('*.ElmSym'); | |
| Sline = SEL.AllLines(); | |
| !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; | |
| !Definiendo escenario | |
| Lib = GetLocalLib('IntScenario'); | |
| Scenarios = Lib.GetContents(); | |
| Scen = Scenarios.First(); | |
| !Obteniendo las clases | |
| Shc_folder = GetCaseObject('IntEvt'); | |
| ! Shc_folder.ShowFullName(); | |
| !Abriendo archivo de almacenamiento de datos | |
| fopen('C:\Users\Pedro\Google Drive\benches\digsilent\DPL\Estudios_dinamicos.txt','w',0); | |
| while (Scen){ !Este while se utiliza para realizar las simulaciones en todos los escenarios existentes | |
| !Activando escenario | |
| Scen.Activate(); | |
| Scen_name=Scen.GetVal(nombre,'loc_name'); | |
| !Definiendo elemento a perturbar | |
| Lne_element = Sline.First(); | |
| str=fprintf(0,'Escenario:%s',nombre); | |
| while (Lne_element) { !Este while se utiliza para realizar los cortocircuitos en las lineas seleccionadas | |
| Lne_name= Lne_element.GetVal(nombre,'loc_name'); | |
| str=fprintf(0,'Elemento:%s',nombre); | |
| Lne_element.ShowFullName(); | |
| !Creando los eventos | |
| !creando evento de cortocirucito | |
| Shc_folder.CreateObject('EvtShc', 'cc_evento'); | |
| EventSet = Shc_folder.GetContents('cc_evento.EvtShc'); | |
| evt = EventSet.First(); | |
| evt.ShowFullName(); | |
| evt:time =1.0; | |
| evt:i_shc = 1; | |
| evt:p_target = Lne_element; | |
| !Creando evento de despeje de falta | |
| Shc_folder.CreateObject('EvtShc', 'despeje'); | |
| EventSet = Shc_folder.GetContents('despeje.EvtShc'); | |
| evt = EventSet.First(); | |
| evt.ShowFullName(); | |
| evt:time =1.1; | |
| evt:i_shc = 4; | |
| evt:p_target = Lne_element; | |
| !Ejecuando las acciones de simulación | |
| Ldf.Execute(); !flujo de potencia | |
| Ini.Execute(); !calculando condiciones iniciales | |
| !!!! Obtención de los datos medidos!!!!!! | |
| ! str=fprintf(0,'t:%s',Lne_element); | |
| t_end=0.0; | |
| while ( t_end<1.2){ | |
| Sim:tstop =t_end; | |
| it = 0; | |
| str=fprintf(0,'t:%2.2f',t_end); | |
| ! | |
| Sim.Execute(); !realizando simulación | |
| !!!!!!!!!!!!!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; | |
| } | |
| !poniendo fuera de servicio los eventos para que no se activen en varias lineas al mismo tiempo | |
| ResetCalculation(); | |
| DelSet = Shc_folder.GetContents('*.EvtShc'); | |
| Delete(DelSet); | |
| Lne_element = Sline.Next(); | |
| } | |
| Scen = Scenarios.Next(); | |
| } | |
| fclose(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment