Esempio n. 1
0
    console.push_local_ns('line_outage_ctrl', line_outage_ctrl)
    console.push_local_ns('excitation_ctrl', excitation_ctrl)
    console.show()
    console.eval_in_thread()
    app.exec_()

    return app
    # sys.exit(app.exec_())


if __name__ == '__main__':

    import ps_models.k2a as model_data
    model = model_data.load()

    [importlib.reload(mdl) for mdl in [dps_rts, dps]]
    ps = dps.PowerSystemModel(model=model)
    ps.use_numba = True

    ps.power_flow()
    ps.init_dyn_sim()
    ps.build_y_bus_red()#ps.buses['name'])
    # ps.x0[ps.angle_idx][0] += 1e-3
    ps.ode_fun(0, ps.x0)
    rts = dps_rts.RealTimeSimulator(ps, dt=5e-3, speed=1)
    rts.start()

    from threading import Thread
    app = main(rts)
    rts.stop()
Esempio n. 2
0
if __name__ == '__main__':

    [importlib.reload(module) for module in [dps, dps_rts, gui]]

    import ps_models.ieee39 as model_data
    model = model_data.load()

    importlib.reload(dps)
    ps = dps.PowerSystemModel(model=model)
    ps.use_numba = False

    ps.power_flow()
    ps.init_dyn_sim()
    ps.build_y_bus_red(ps.buses['name'])
    ps.ode_fun(0, ps.x0)

    rts = dps_rts.RealTimeSimulator(ps,
                                    dt=10e-3,
                                    speed=0.5,
                                    solver=dps_uf.ModifiedEuler)
    rts.sol.n_it = 0
    rts.ode_fun(0, ps.x0)

    #plt.scatter(x, y)

    #rts.start()

    app = main(rts)
    #rts.stop()
Esempio n. 3
0
    [importlib.reload(module) for module in [dps, dps_rts, dps_rts_gui]]
    import ps_models.n44 as model_data
    model = model_data.load()

    ps = dps.PowerSystemModel(model=model)
    ps.use_numba = True
    ps.use_sparse = True
    ps.power_flow()
    ps.init_dyn_sim()

    ps.ode_fun(0, ps.x0)
    ps.build_y_bus_red(ps.buses['name'])
    log = defaultdict(list)
    rts = dps_rts.RealTimeSimulator(ps,
                                    dt=1e-3,
                                    solver=dps_uf.ModifiedEuler,
                                    log_fun=lambda x: dps_rts.logger(x, log))
    rts.sol.n_it = 0
    rts.start()

    time.sleep(10)
    rts.stop()

    fig, ax = plt.subplots(1)
    ax.plot(log['dt_loop'])
    ax.plot(log['dt_ideal'], zorder=10)
    ax.plot(log['dt_sim'])

    plt.show()