Beispiel #1
0
    import time
    np.set_printoptions(linewidth=10000)
    pd.set_option('display.max_rows', 500)
    pd.set_option('display.max_columns', 500)
    pd.set_option('display.width', 1000)

    # fname = os.path.join('..', '..', '..', 'Grids_and_profiles', 'grids', 'IEEE 30 Bus with storage.xlsx')
    # fname = os.path.join('..', '..', '..', 'Grids_and_profiles', 'grids', 'Illinois200Bus.xlsx')
    # fname = os.path.join('..', '..', '..', 'Grids_and_profiles', 'grids', 'Pegase 2869.xlsx')
    # fname = os.path.join('..', '..', '..', 'Grids_and_profiles', 'grids', '1354 Pegase.xlsx')
    # fname = os.path.join('..', '..', '..', 'Grids_and_profiles', 'grids', 'IEEE 14.xlsx')
    # fname = '/home/santi/Documentos/Private_Grids/2026_INVIERNO_para Plexos_FINAL_9.raw'
    fname = '/home/santi/Documentos/Private_Grids/201902271115 caso TReal Israel.raw'

    grid = FileOpen(file_name=fname).open()
    nc = compile_snapshot_circuit(grid)
    islands = nc.split_into_islands(ignore_single_node_islands=True)
    circuit = islands[0]

    # declare figure
    fig = plt.figure(figsize=(12, 7))
    ax = fig.add_subplot(1, 1, 1)

    # circuit.Vbus = np.ones(len(circuit.Vbus), dtype=complex)

    print('Newton-Raphson-Line-search 3')
    for acc in [0.5]:  # [1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 0.1]
        start_time = time.time()

        # print('Ybus')
        # print(circuit.Ybus.toarray())
Beispiel #2
0
    op3 = sp.csc_matrix((data3, Yf.indices, Yf.indptr), shape=Yf.shape)

    dSf_dVa = 1j * (op1 - op2)
    dSf_dVm = op3 + op4

    return dSf_dVa, dSf_dVm


if __name__ == '__main__':

    from GridCal.Engine import FileOpen, compile_snapshot_circuit

    fname = '/home/santi/Documentos/GitHub/GridCal/Grids_and_profiles/grids/Lynn 5 Bus pv.gridcal'
    main_circuit = FileOpen(fname).open()

    nc = compile_snapshot_circuit(main_circuit)

    V = nc.Vbus + np.array([0.01, -0.05, 0.002, -0.007, 0.006])  # to not to be perfectly 1

    dSf_dVa_1, dSf_dVm_1 = dSf_dV(Yf=nc.Yf, V=V, F=nc.F, Cf=nc.Cf)
    dSf_dVa_2, dSf_dVm_2 = dSf_dV_fast(Yf=nc.Yf.tocsc(), V=V, F=nc.F, Cf=nc.Cf.tocsc())
    da = dSf_dVa_1 - dSf_dVa_2
    dm = dSf_dVm_1 - dSf_dVm_2
    assert len(da.data) == 0
    assert len(dm.data) == 0

    dSt_dVa_1, dSt_dVm_1 = dSt_dV(Yt=nc.Yt, V=V, T=nc.T, Ct=nc.Ct)
    dSt_dVa_2, dSt_dVm_2 = dSf_dV_fast(Yf=nc.Yt.tocsc(), V=V, F=nc.T, Cf=nc.Ct.tocsc())
    da = dSt_dVa_1 - dSt_dVa_2
    dm = dSt_dVm_1 - dSt_dVm_2
    assert len(da.data) == 0