def test_api_dcopf(): # TODO Make this work and parameterize this test using pytest fname = os.path.join('..', '..', 'Grids_and_profiles', 'grids', 'Lynn 5 Bus pv.gridcal') print('loading...') grid = FileOpen(fname).open() opf_options = OptimalPowerFlowOptions( power_flow_options=PowerFlowOptions()) print('Running ts...') opf_ts = OptimalPowerFlowTimeSeries(grid, opf_options) opf_ts.run()
self.progress_signal.emit(0.0) self.progress_text.emit('Cancelled!') self.done_signal.emit() if __name__ == '__main__': from matplotlib import pyplot as plt from GridCal.Engine import FileOpen, SolverType, TimeSeries # 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/1354 Pegase.xlsx' fname = r'C:\Users\PENVERSA\OneDrive - Red Eléctrica Corporación\Escritorio\IEEE cases\WSCC 9 bus.gridcal' main_circuit = FileOpen(fname).open() pf_options_ = PowerFlowOptions(solver_type=SolverType.NR) ptdf_driver = PtdfTimeSeries(grid=main_circuit, pf_options=pf_options_) ptdf_driver.run() pf_options_ = PowerFlowOptions(solver_type=SolverType.NR) ts_driver = TimeSeries(grid=main_circuit, options=pf_options_) ts_driver.run() fig = plt.figure() ax1 = fig.add_subplot(221) ax1.set_title('Newton-Raphson based flow') ax1.plot(ts_driver.results.Sbranch.real) ax2 = fig.add_subplot(222) ax2.set_title('PTDF based flow') ax2.plot(ptdf_driver.results.Sbranch.real)
def cancel(self): self.__cancel__ = True if __name__ == '__main__': from GridCal.Engine import FileOpen, SolverType # 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/1354 Pegase.xlsx' main_circuit = FileOpen(fname).open() pf_options = PowerFlowOptions(solver_type=SolverType.DC) options_ = PTDFOptions(group_mode=PtdfGroupMode.ByGenLoad, power_increment=10, use_multi_threading=False) simulation = PTDF(grid=main_circuit, options=options_, pf_options=pf_options) simulation.run() ptdf_df = simulation.results.get_flows_data_frame() print(ptdf_df) print() a = time.time() options_ = PTDFOptions(group_mode=PtdfGroupMode.ByGenLoad, power_increment=10,