def fault_LL(faultbus, faultphases, phases, r, buscoords, dssObj, conn, c):
    """LL fault simulation in bus and results
    """

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    dssText = dssObj.Text
    dssCircuit = dssObj.ActiveCircuit
    dssBus = dssCircuit.ActiveBus

    dssText.Command = "Edit Fault.fault phases=1 bus1="+faultbus \
    +faultphases[0]+" bus2="+faultbus+faultphases[1]+" r="+r

    for season in ["Spring", "Summer", "Autumn", "Winter"]:
        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        dssText.Command = "Redirect " + dir + "\\5PV_" + season + ".dss"

        for hour in [9, 10, 11, 12, 13, 14, 15, 16, 17]:

            dssText.Command = "Redirect " + dir + "\\ckt24_vbases.dss"
            dssText.Command = "Solve mode=daily number=1 hour=" + str(hour)

            Vsub = V("SubXfmr_LSB", dssCircuit)
            Csub = C("Transformer.SUBXFMR", dssCircuit)

            c.execute(
                """INSERT INTO PV5_faultloc_db (fault_type,
            season, hour, bus, buscoordX, buscoordY, fault_resistance,
            busphases, faultphases, Vsub_mag1, Vsub_ang1, Vsub_mag2,
            Vsub_ang2, Vsub_mag3, Vsub_ang3, Isub_mag1, Isub_ang1,
            Isub_mag2, Isub_ang2, Isub_mag3, Isub_ang3) VALUES (
            ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",
                ("LL", season, int(hour), faultbus, float(
                    buscoords[0]), float(buscoords[1]), int(r), phases,
                 faultphases[0] + faultphases[1], float3(Vsub[0]),
                 float3(Vsub[1]), float3(Vsub[2]), float3(
                     Vsub[3]), float3(Vsub[4]), float3(Vsub[5]), float3(
                         Csub[8]), float3(Csub[9]), float3(Csub[10]),
                 float3(Csub[11]), float3(Csub[12]), float3(Csub[13])))
            conn.commit()

    return
Esempio n. 2
0
def buses_criteria_pu_var():

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    flag_noPV = 0
    flag_PV = 1

    # Bus_1p_list
    bus1p_list = bus_name_lists()[0]
    for i in range(len(bus1p_list)):
        if i == 0:
            bus1p_listn = [bus1p_list[0][0]]
        else:
            bus1p_listn.append(bus1p_list[i][0])

    # Bus_2p_list
    bus2p_list = bus_name_lists()[1]
    for i in range(len(bus2p_list)):
        if i == 0:
            bus2p_listn = [bus2p_list[0][0]]
        else:
            bus2p_listn.append(bus2p_list[i][0])

    # Bus_3p_list
    bus3p_list = bus_name_lists()[2]
    for i in range(len(bus3p_list)):
        if i == 0:
            bus3p_listn = [bus3p_list[0][0]]
        else:
            bus3p_listn.append(bus3p_list[i][0])

    hours = ["9", "10", "11", "12", "13", "14", "15", "16", "17"]

    PV_powers_Vlimit = []  # Bus voltage variation criteria

    print("Running circuit comparisons for voltage pu variations\n")
    t_start = time.time()

    for season in ["Spring", "Summer", "Autumn", "Winter"]:

        for hour in hours:

            PV_power = 500
            power_iteration = "run again"
            while power_iteration == "run again":

                for flag in [flag_noPV, flag_PV]:

                    # Start the DSS
                    dssObj = win32com.client.Dispatch("OpenDSSEngine.DSS")
                    if dssObj.Start(0) == False:
                        sys.exit("DSS failed to start")
                    else:
                        #Assign a variable to each of the interfaces
                        dssText = dssObj.Text
                        dssCircuit = dssObj.ActiveCircuit
                        dssSolution = dssCircuit.Solution

                    # Clear the DSS
                    dssObj.ClearAll()

                    # Load circuit
                    dssText.Command = "Compile " + dir + "\\ckt24\\ckt24.dss"

                    # Set and calculate voltage bases
                    dssText.Command = "Redirect " + dir + "\\ckt24\\ckt24_vbases.dss"

                    # Solve circuit in different loadshapes, season based
                    dssText.Command = "Edit Loadshape.LS_PhaseA" \
                    +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
                    dssText.Command = "Edit Loadshape.LS_PhaseB" \
                    +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
                    dssText.Command = "Edit Loadshape.LS_PhaseC" \
                    +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
                    dssText.Command = "Edit Loadshape.LS_ThreePhase" \
                    +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
                    dssText.Command = "Edit Loadshape.Other_Bus_Load" \
                    +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

                    # Change PVSystem parameters to get max power
                    if flag == flag_PV:
                        dssText.Command = \
                        "Redirect "+dir+"\\ckt24\\5PV_new.dss"
                        dssText.Command = \
                        "Redirect "+dir+"\\ckt24\\5PV_"+season+".dss"
                        dssText.Command = "Edit PVSystem.PV1 kVA=" \
                        +str(PV_power)+" pmpp="+str(PV_power)
                        dssText.Command = "Edit PVSystem.PV2 kVA=" \
                        +str(PV_power)+" pmpp="+str(PV_power)
                        dssText.Command = "Edit PVSystem.PV3 kVA=" \
                        +str(PV_power)+" pmpp="+str(PV_power)
                        dssText.Command = "Edit PVSystem.PV4 kVA=" \
                        +str(PV_power)+" pmpp="+str(PV_power)
                        dssText.Command = "Edit PVSystem.PV5 kVA=" \
                        +str(PV_power)+" pmpp="+str(PV_power)
                        dssText.Command = "Edit Transformer.pv_up1 kVA=" \
                        +str(PV_power)
                        dssText.Command = "Edit Transformer.pv_up2 kVA=" \
                        +str(PV_power)
                        dssText.Command = "Edit Transformer.pv_up3 kVA=" \
                        +str(PV_power)
                        dssText.Command = "Edit Transformer.pv_up4 kVA=" \
                        +str(PV_power)
                        dssText.Command = "Edit Transformer.pv_up5 kVA=" \
                        +str(PV_power)

                    # Set and calculate voltage bases
                    dssText.Command = "Redirect " + dir + "\\ckt24\\ckt24_vbases.dss"
                    # Solve circuit
                    dssText.Command = "Solve mode=daily number=1 hour=" + hour

                    # Results list
                    if flag == flag_PV:

                        voltages_list1p_PV = []
                        voltages_list2p_PV = []
                        voltages_list3p_PV = []

                        for buses1p in bus1p_listn:
                            voltages_list1p_PV.append(V(buses1p, dssCircuit))
                        for buses2p in bus2p_listn:
                            voltages_list2p_PV.append(V(buses2p, dssCircuit))
                        for buses3p in bus3p_listn:
                            voltages_list3p_PV.append(V(buses3p, dssCircuit))

                    if flag == flag_noPV:

                        voltages_list1p_noPV = []
                        voltages_list2p_noPV = []
                        voltages_list3p_noPV = []

                        for buses1p in bus1p_listn:
                            voltages_list1p_noPV.append(V(buses1p, dssCircuit))
                        for buses2p in bus2p_listn:
                            voltages_list2p_noPV.append(V(buses2p, dssCircuit))
                        for buses3p in bus3p_listn:
                            voltages_list3p_noPV.append(V(buses3p, dssCircuit))

                pu_limit = 0.01

                V_flag = 0
                for i in range(len(voltages_list1p_noPV)):
                    if abs(voltages_list1p_PV[i][0] -
                           voltages_list1p_noPV[i][0]) > pu_limit:
                        V_flag = 1
                for i in range(len(voltages_list2p_noPV)):
                    if abs(voltages_list2p_PV[i][0] -
                           voltages_list2p_noPV[i][0]) > pu_limit:
                        V_flag = 1
                    elif abs(voltages_list2p_PV[i][2] -
                             voltages_list2p_noPV[i][2]) > pu_limit:
                        V_flag = 1
                for i in range(len(voltages_list3p_noPV)):
                    if abs(voltages_list3p_PV[i][0] -
                           voltages_list3p_noPV[i][0]) > pu_limit:
                        V_flag = 1
                    elif abs(voltages_list3p_PV[i][2] -
                             voltages_list3p_noPV[i][2]) > pu_limit:
                        V_flag = 1
                    elif abs(voltages_list3p_PV[i][0] -
                             voltages_list3p_noPV[i][0]) > pu_limit:
                        V_flag = 1

                if V_flag == 1:
                    PV_powers_Vlimit.append([season, hour, PV_power - 500])
                    power_iteration = "stop running"

                if PV_power == 9000:
                    PV_powers_Vlimit.append([season, hour, "max_iter_9000"])
                    power_iteration = "stop running"

                PV_power = PV_power + 500

            print("Running simulation of season %s, hour %s..." %
                  (season, hour))
    print()
    print("List with season, hour and maximum power for PVSystem:")
    print(PV_powers_Vlimit)
    print()
    PV_powers_Vlimit = [int(e[-1]) for e in PV_powers_Vlimit]
    print("Minimum value: %d kW" % min(PV_powers_Vlimit))
    print()

    t_end = time.time()
    print("Total simulation time \
    (voltage pu variation comparisons): %f" % (t_end - t_start))
Esempio n. 3
0
def fault_LLLG(faultbus, r, buscoords, xfmr_list, dssObj, conn, c):
    """LLLG fault simulation in bus and results
    """

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    dssText = dssObj.Text
    dssCircuit = dssObj.ActiveCircuit
    dssBus = dssCircuit.ActiveBus

    dssText.Command = "Edit Fault.fault phases=3 bus1=" + faultbus + ".1.2.3 r=" + r

    for season in ["Spring", "Summer", "Autumn", "Winter"]:

        if season == "Spring":
            irrad = "0.981"
        if season == "Summer":
            irrad = "0.944"
        if season == "Autumn":
            irrad = "0.923"
        if season == "Winter":
            irrad = "0.950"

        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        dssText.Command = "Redirect " + dir + "\\339PV_" + season + ".dss"
        for i in range(len(xfmr_list)):
            bus_pv = xfmr_list[i][6]
            kv_pv = xfmr_list[i][7]
            phase = str(xfmr_list[i][1])
            dssText.Command = "Edit PVSystem.PV"+str(i)\
+" phases=1 bus1="+bus_pv+"."+phase+" kv="+kv_pv+" kVA=15"\
+" irrad="+irrad+" pmpp=15 temperature=25 pf=1"\
+" %cutin=5 %cutout=5 effcurve=MyEff P-tCurve=MyPvst"\
+" Daily=MyIrrad Tdaily=Mytemp"

        for hour in [9, 10, 11, 12, 13, 14, 15, 16, 17]:

            dssText.Command = "Redirect " + dir + "\\ckt24_vbases.dss"
            dssText.Command = "Solve mode=daily number=1 hour=" + str(hour)

            Vsub = V("SubXfmr_LSB", dssCircuit)
            Csub = C("Transformer.SUBXFMR", dssCircuit)

            c.execute(
                """INSERT INTO PV339_faultloc_db (fault_type,
            season, hour, bus, buscoordX, buscoordY, fault_resistance,
            busphases, faultphases, Vsub_mag1, Vsub_ang1, Vsub_mag2,
            Vsub_ang2, Vsub_mag3, Vsub_ang3, Isub_mag1, Isub_ang1,
            Isub_mag2, Isub_ang2, Isub_mag3, Isub_ang3) VALUES (
            ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",
                ("LLLG", season, int(hour), faultbus, float(
                    buscoords[0]), float(buscoords[1]), int(r), ".1.2.3",
                 ".1.2.3", float3(Vsub[0]), float3(Vsub[1]), float3(Vsub[2]),
                 float3(Vsub[3]), float3(Vsub[4]), float3(Vsub[5]),
                 float3(Csub[8]), float3(Csub[9]), float3(Csub[10]),
                 float3(Csub[11]), float3(Csub[12]), float3(Csub[13])))
            conn.commit()

    return
Esempio n. 4
0
def fault_LLG(faultbus, faultphases, phases, r, buscoords, dssObj, conn, c):
    """LLG fault simulation in bus and results
    """

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    # Create database for faults
    conn = sqlite3.connect('database_faultlocation_1PV.db')
    c = conn.cursor()
    c.execute("""CREATE TABLE IF NOT EXISTS PV1_faultloc_db (
    fault_type TEXT, season TEXT, hour INT, bus TEXT,
    buscoordX REAL, buscoordY REAL, fault_resistance INT,
    busphases TEXT, faultphases TEXT, Vsub_mag1 REAL, Vsub_ang1 REAL,
    Vsub_mag2 REAL, Vsub_ang2 REAL, Vsub_mag3 REAL, Vsub_ang3 REAL,
    Isub_mag1 REAL, Isub_ang1 REAL, Isub_mag2 REAL, Isub_ang2 REAL,
    Isub_mag3 REAL, Isub_ang3 REAL)""")

    dssText = dssObj.Text
    dssCircuit = dssObj.ActiveCircuit
    dssBus = dssCircuit.ActiveBus

    dssText.Command = "Edit Fault.fault phases=2 bus1="+faultbus \
    +faultphases[0]+faultphases[0]+" bus2="+faultbus+faultphases[1] \
    +".0"+" Gmatrix=[10000|0 "+str(1/float(r))+"|-10000 0 10000|0 " \
    +str(-1/float(r))+" 0 "+str(1/float(r))+"]"

    for season in ["Spring", "Summer", "Autumn", "Winter"]:
        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        dssText.Command = "Redirect " + dir + "\\1PV_" + season + ".dss"

        for hour in [9, 10, 11, 12, 13, 14, 15, 16, 17]:

            dssText.Command = "Redirect " + dir + "\\ckt24_vbases.dss"
            dssText.Command = "Solve mode=daily number=1 hour=" + str(hour)

            Vsub = V("SubXfmr_LSB", dssCircuit)
            Csub = C("Transformer.SUBXFMR", dssCircuit)

            c.execute(
                """INSERT INTO PV1_faultloc_db (fault_type,
            season, hour, bus, buscoordX, buscoordY, fault_resistance,
            busphases, faultphases, Vsub_mag1, Vsub_ang1, Vsub_mag2,
            Vsub_ang2, Vsub_mag3, Vsub_ang3, Isub_mag1, Isub_ang1,
            Isub_mag2, Isub_ang2, Isub_mag3, Isub_ang3) VALUES (
            ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",
                ("LLG", season, int(hour), faultbus, float(
                    buscoords[0]), float(buscoords[1]), int(r), phases,
                 faultphases[0] + faultphases[1], float3(Vsub[0]),
                 float3(Vsub[1]), float3(Vsub[2]), float3(
                     Vsub[3]), float3(Vsub[4]), float3(Vsub[5]), float3(
                         Csub[8]), float3(Csub[9]), float3(Csub[10]),
                 float3(Csub[11]), float3(Csub[12]), float3(Csub[13])))
            conn.commit()

    return
Esempio n. 5
0
def main():

    t_start = time.time()

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    # Bus_1p_list
    bus1p_list = bus_name_lists()[0]

    # Bus_2p_list
    bus2p_list = bus_name_lists()[1]

    # Bus_3p_list
    bus3p_list = bus_name_lists()[2]

    print("Running circuit solution\n")
    t_start = time.time()

    # Start the DSS
    dssObj = win32com.client.Dispatch("OpenDSSEngine.DSS")
    if dssObj.Start(0) == False:
        sys.exit("DSS failed to start")
    else:
        #Assign a variable to each of the interfaces for easier access
        dssText = dssObj.Text
        dssCircuit = dssObj.ActiveCircuit
        dssSolution = dssCircuit.Solution

    # Clear the DSS
    dssObj.ClearAll()

    # Load circuit
    dssText.Command = "Compile " + dir + "\\ckt24\\ckt24.dss"

    # Solve circuit in different loadshapes, according to seasons
    dssText.Command = "Redirect " + dir + "\\ckt24\\1PV_new.dss"

    for season in ["Spring", "Summer", "Autumn", "Winter"]:
        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        dssText.Command = "Redirect " + dir + "\\ckt24\\1PV_" + season + ".dss"

        for hour in [9, 10, 11, 12, 13, 14, 15, 16, 17]:

            # Set and calculate voltage bases
            dssText.Command = "Redirect " + dir + "\\ckt24\\ckt24_vbases.dss"

            dssText.Command = "Solve mode=daily number=1 hour=" + str(hour)

            # Results list
            results_list = [[season, hour],
                            V("SourceBus", dssCircuit),
                            V("SubXfmr_LSB", dssCircuit),
                            C("Vsource.source", dssCircuit),
                            C("Transformer.SUBXFMR", dssCircuit)]

            with open(dir+"\\ckt24_solve.txt","a") \
            as filehandler:
                json.dump(results_list, filehandler)
                filehandler.write("\n")

    t_end = time.time()
    print("Total simulation time: %f" % (t_end - t_start))
def main():

    t_start = time.time()

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    # Bus_1p_list
    bus1p_list = bus_name_lists()[0]

    # Bus_2p_list
    bus2p_list = bus_name_lists()[1]

    # Bus_3p_list
    bus3p_list = bus_name_lists()[2]

    # List with transformers info
    xfmr_list = transformer_list()

    print("Running circuit solution\n")
    t_start = time.time()

    # Start the DSS
    dssObj = win32com.client.Dispatch("OpenDSSEngine.DSS")
    if dssObj.Start(0) == False:
        sys.exit("DSS failed to start")
    else:
        #Assign a variable to each of the interfaces for easier access
        dssText = dssObj.Text
        dssCircuit = dssObj.ActiveCircuit
        dssSolution = dssCircuit.Solution

    # Clear the DSS
    dssObj.ClearAll()

    # Load circuit
    dssText.Command = "Compile " + dir + "\\ckt24\\ckt24.dss"

    new_edit = "New "

    # Solve circuit in different loadshapes, according to seasons
    dssText.Command = "Redirect " + dir + "\\ckt24\\339PV_new.dss"

    for season in ["Spring", "Summer", "Autumn", "Winter"]:

        if season == "Spring":
            irrad = "0.981"
        if season == "Summer":
            irrad = "0.944"
        if season == "Autumn":
            irrad = "0.923"
        if season == "Winter":
            irrad = "0.950"

        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        dssText.Command = "Redirect " + dir + "\\ckt24\\339PV_" + season + ".dss"
        for i in range(len(xfmr_list)):
            bus_pv = xfmr_list[i][6]
            kv_pv = xfmr_list[i][7]
            phase = str(xfmr_list[i][1])
            dssText.Command = new_edit+"PVSystem.PV"+str(i)\
+" phases=1 bus1="+bus_pv+"."+phase+" kv="+kv_pv+" kVA=15"\
+" irrad="+irrad+" pmpp=15 temperature=25 pf=1"\
+" %cutin=5 %cutout=5 effcurve=MyEff P-tCurve=MyPvst"\
+" Daily=MyIrrad Tdaily=Mytemp"

        if new_edit == "New ":
            new_edit = "Edit "

        for hour in [9, 10, 11, 12, 13, 14, 15, 16, 17]:

            # Set and calculate voltage bases
            dssText.Command = "Redirect " + dir + "\\ckt24\\ckt24_vbases.dss"

            dssText.Command = "Solve mode=daily number=1 hour=" + str(hour)

            # Results list
            results_list = [[season, hour],
                            V("SourceBus", dssCircuit),
                            V("SubXfmr_LSB", dssCircuit),
                            C("Vsource.source", dssCircuit),
                            C("Transformer.SUBXFMR", dssCircuit)]

            with open(dir+"\\ckt24_solve.txt","a") \
            as filehandler:
                json.dump(results_list, filehandler)
                filehandler.write("\n")

    t_end = time.time()
    print("Total simulation time: %f" % (t_end - t_start))
Esempio n. 7
0
def main():

    # Get directory of .py file
    dir = os.path.dirname(os.path.abspath(__file__))

    # Make lists with bus names

    # Bus_1p_list
    bus1p_list = bus_name_lists()[0]
    for i in range(len(bus1p_list)):
        if i == 0:
            bus1p_listn = [bus1p_list[0][0]]
        else:
            bus1p_listn.append(bus1p_list[i][0])

    # Bus_2p_list
    bus2p_list = bus_name_lists()[1]
    for i in range(len(bus2p_list)):
        if i == 0:
            bus2p_listn = [bus2p_list[0][0]]
        else:
            bus2p_listn.append(bus2p_list[i][0])

    # Bus_3p_list
    bus3p_list = bus_name_lists()[2]
    for i in range(len(bus3p_list)):
        if i == 0:
            bus3p_listn = [bus3p_list[0][0]]
        else:
            bus3p_listn.append(bus3p_list[i][0])

    # Start the DSS
    dssObj = win32com.client.Dispatch("OpenDSSEngine.DSS")
    if dssObj.Start(0) == False:
        sys.exit("DSS failed to start")
    else:
        #Assign a variable to each of the interfaces
        dssText = dssObj.Text
        dssCircuit = dssObj.ActiveCircuit
        dssSolution = dssCircuit.Solution

    # Clear the DSS
    dssObj.ClearAll()

    # Load circuit
    dssText.Command = "Compile " + dir + "\\ckt24\\ckt24.dss"

    # Min and max pu voltage in bus of the circuit in hours and seasons
    min_pu_list = []
    max_pu_list = []

    for season in ["Spring", "Summer", "Autumn", "Winter"]:

        # Solve circuit in different loadshapes, season based
        dssText.Command = "Edit Loadshape.LS_PhaseA" \
        +" mult=(file=LS_PhaseA_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseB" \
        +" mult=(file=LS_PhaseB_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_PhaseC" \
        +" mult=(file=LS_PhaseC_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.LS_ThreePhase" \
        +" mult=(file=LS_ThreePhase_"+season+"Day.txt)"
        dssText.Command = "Edit Loadshape.Other_Bus_Load" \
        +" mult=(file=Other_Bus_Load_"+season+"Day.txt)"

        # Set and calculate voltage bases
        dssText.Command = "Redirect " + dir + "\\ckt24\\ckt24_vbases.dss"

        hours = ["9", "10", "11", "12", "13", "14", "15", "16", "17"]

        for hour in hours:

            min_pu = 1.05
            max_pu = 0

            # Solve circuit
            dssText.Command = "Solve mode=daily number=1 hour=" + hour

            for bus in bus1p_listn:
                # print(V(bus,dssCircuit))
                # print(bus)
                if min_pu > V(bus, dssCircuit)[0]:
                    min_pu = V(bus, dssCircuit)[0]
                if max_pu < V(bus, dssCircuit)[0]:
                    max_pu = V(bus, dssCircuit)[0]

            for bus in bus2p_listn:
                # print(V(bus,dssCircuit))
                # print(bus)
                for i in [0, 2]:
                    if min_pu > V(bus, dssCircuit)[i]:
                        min_pu = V(bus, dssCircuit)[i]
                    if max_pu < V(bus, dssCircuit)[i]:
                        max_pu = V(bus, dssCircuit)[i]

            for bus in bus3p_listn:
                # print(V(bus,dssCircuit))
                # print(bus)
                for i in [0, 2, 4]:
                    if min_pu > V(bus, dssCircuit)[i]:
                        min_pu = V(bus, dssCircuit)[i]
                    if max_pu < V(bus, dssCircuit)[i]:
                        max_pu = V(bus, dssCircuit)[i]

            min_pu_list.append(min_pu)
            max_pu_list.append(max_pu)

    print("min pu voltage:")
    print(min(min_pu_list))
    print()
    print("max pu voltage:")
    print(max(max_pu_list))