from GridCal.Engine import FileOpen import pandas as pd np.set_printoptions(linewidth=2000, suppress=True) pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE39_1W.gridcal' fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 14.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/lynn5buspv.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 118.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/1354 Pegase.xlsx' # fname = 'helm_data1.gridcal' grid = FileOpen(fname).open() nc = grid.compile_snapshot() inputs = nc.compute()[0] # pick the first island V, converged_, error, Scalc_, iter_, elapsed_ = helm_josep( Ybus=inputs.Ybus, Yseries=inputs.Yseries, V0=inputs.Vbus, S0=inputs.Sbus, Ysh0=inputs.Ysh, pq=inputs.pq, pv=inputs.pv, sl=inputs.ref, pqpv=inputs.pqpv, tolerance=1e-6,
self.__cancel__ = True if __name__ == '__main__': import os import pandas as pd from GridCal.Engine import FileOpen, SolverType,PowerFlowOptions # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/Lynn 5 Bus pv.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE39_1W.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/grid_2_islands.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/2869 Pegase.gridcal' fname = os.path.join('..', '..', '..', '..', '..', 'Grids_and_profiles', 'grids', 'IEEE 30 Bus with storage.xlsx') # fname = os.path.join('..', '..', '..', '..', '..', 'Grids_and_profiles', 'grids', '2869 Pegase.gridcal') main_circuit = FileOpen(fname).open() options_ = NMinusKOptions() simulation = NMinusK(grid=main_circuit, options=options_) simulation.run() otdf_ = simulation.get_otdf() # save the result br_names = [b.name for b in main_circuit.branches] br_names2 = ['#' + b.name for b in main_circuit.branches] w = pd.ExcelWriter('OTDF IEEE30.xlsx') pd.DataFrame(data=simulation.results.Sf.real, columns=br_names, index=['base'] + br_names2).to_excel(w, sheet_name='branch power') pd.DataFrame(data=otdf_,
theta=None, Beq=None, Ybus=None, Yf=None, Yt=None, iterations=iter_, elapsed=elapsed) if __name__ == '__main__': fname = r'/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 9 Bus.gridcal' from GridCal.Engine import FileOpen circuit = FileOpen(fname).open() nc = circuit.compile_snapshot() islands = nc.compute() island = islands[0] voltage_, converged_, normF_, Scalc_, iter_, elapsed_ = FDPF( Vbus=island.Vbus, Sbus=island.Sbus, Ibus=island.Ibus, Ybus=island.Ybus, B1=island.B1, B2=island.B2, pq=island.pq, pv=island.pv, pqpv=island.pqpv, tol=1e-9,
print('Beq:', Beq) print('norm_f:', norm_f) iterations += 1 converged = norm_f <= tolerance end = time.time() elapsed = end - start return NumericPowerFlowResults(V, converged, norm_f, Scalc, m, theta, Beq, iterations, elapsed) if __name__ == "__main__": from GridCal.Engine import FileOpen, compile_snapshot_circuit np.set_printoptions(precision=4, linewidth=100000) # np.set_printoptions(linewidth=10000) # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/LineHVDCGrid.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE57+IEEE14 DC grid.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/ACDC_example_grid.gridcal' fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/fubm_caseHVDC_vt.gridcal' grid = FileOpen(fname).open() #################################################################################################################### # Compile #################################################################################################################### nc_ = compile_snapshot_circuit(grid) res = NR_LS_ACDC(nc=nc_, tolerance=1e-4, max_iter=20)
pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000) # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE39_1W.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 14.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/lynn5buspv.xlsx' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 118.xlsx' fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/1354 Pegase.xlsx' # fname = 'helm_data1.gridcal' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/IEEE 14 PQ only.gridcal' # fname = 'IEEE 14 PQ only full.gridcal' # fname = '/home/santi/Descargas/matpower-fubm-master/data/case5.m' # fname = '/home/santi/Descargas/matpower-fubm-master/data/case30.m' # fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/PGOC_6bus.gridcal' grid_ = FileOpen(fname).open() test_ptdf(grid_) name = os.path.splitext(fname.split(os.sep)[-1])[0] method = 'ACPTDF (No Jacobian, V=1)' nc_ = compile_snapshot_circuit(grid_) islands_ = split_into_islands(nc_) circuit_ = islands_[0] H_ = compute_acptdf(Ybus=circuit_.Ybus, Yseries=circuit_.Yseries, Yf=circuit_.Yf, Yt=circuit_.Yt, Cf=circuit_.C_branch_bus_f, V=circuit_.Vbus, pq=circuit_.pq,