예제 #1
0
파일: test3.py 프로젝트: yuanzy97/psseXtra
def randdist(argin):
    filename=argin[0]
    percentage=argin[1]
    mode=argin[2]
    shuntctrlmode=0
    if mode!='arbitrary':
        shuntctrlmode=argin[3]
    psspy.case(filename)
    ierr, Qload=psspy.aloadcplx(-1, string="MVAACT")    
    Qload=[x.imag for x in Qload[0]]   
    ierr, tlbuses = psspy.aloadint(string='NUMBER')
    nbus=len(tlbuses[0])
    if mode=='random':
        zoseq=[0,1]*nbus
        sb=random.sample(zoseq,nbus)
    elif mode=='arbitrary':
        abus=argin[3]      # argin[3] in this case is the arbitrary buses to apply the disturbance
        sb=[0]*nbus
        for i in range(len(abus)):
            sb[tlbuses[0].index(abus[i])]=1            
    else:
        sb=[1]*nbus
    for j in range(nbus):
        if sb[j]==1:            
            Qd=Qload[j]+percentage/100.0*abs(Qload[j])
            ierr=psspy.load_data_3(i=tlbuses[0][j],REALAR2=Qd)
    if shuntctrlmode==1:
        for i in tlbuses[0]:
            ierr = psspy.switched_shunt_data_3(i, intgar9=1)
    psspy.fnsl(options1=0,options5=0)
    ierr, voltd = psspy.abusreal(-1, string="PU")        #voltage at buses after disturbance
    argout=[]
    argout.append(voltd)
    argout.append(Qload)
    argout.append(tlbuses)
    return argout;
예제 #2
0
if flag7 == 1:
    ierr, Qload = psspy.aloadcplx(
        -1, string="MVAACT"
    )  # Qload is the amount of apparent power (P+jQ) for all loads
    Qload = [
        x.imag for x in Qload[0]
    ]  # We just need Reactive power (Q) so we find imaginary part of apparent power
    ierr, tlbuses = psspy.aloadint(
        string='NUMBER'
    )  # tlbuses is all loads' bus nomber, it includes also the compensators that we have added as loads to the network

    ctrl = [0, 1, -1, 0, 0, 0, 0, 2, -1, 1, 0, 2, 0, 1, 0, 1]
    Qctrl = [0 for x in range(ncap)]
    for k in range(len(ctrl)):
        Qctrl[k] = Qload[tlbuses[0].index(capbus[k])] - ctrl[k] * capQ[k]
        ierr = psspy.load_data_3(i=capbus[k], REALAR2=Qctrl[k])
    psspy.fdns(OPTIONS1=0, OPTIONS5=0,
               OPTIONS6=1)  # do power flow on the disturbed system
    ierr, voltdc = psspy.abusreal(
        -1, string="PU"
    )  # and measure voltage at all buses after disturbance (there is no option in PSS to measure the voltage of just one bus)

    x2 = excelpy.workbook(
        r'C:\Documents and Settings\xw0419\Mes documents\Mon Projet\Simulation\IREQ\PythonProgs\final_result.xls',
        sheet="Feuil1",
        overwritesheet=True,
        mode='w')
    x2.show()
    x2.show_alerts(False)

    x2.set_range(2, 1, zip(*volt[0]))
예제 #3
0
                      _f])
psspy.machine_data_2(103, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [ActivePowerSetpoint * S , _f, _f, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f])
psspy.machine_data_2(103, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [_f, _f, ReactivePowerSetpoint * S, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f])
psspy.machine_data_2(103, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [_f, _f, _f, ReactivePowerSetpoint * S, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f,
                      _f])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [ActivePowerSetpoint * S, _f, _f, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [_f, _f, ReactivePowerSetpoint * S, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i],
                     [_f, _f, _f, ReactivePowerSetpoint * S, 120, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f,
                      _f])
psspy.load_data_3(600, r"""1""", [_i, _i, _i, _i, _i], [600, 20, _f, _f, _f, _f])  # apply assumption load

psspy.fdns([0, 0, 0, 1, 0, 0, 99, 0])
# psspy.add_plant_model(600, r"""1""", 6, r"""SEXS""", 0, "", 0, [], [], 6, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 1, 0.1)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 2, 10.0)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 3, 50.0)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 4, 0.05)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 6, 2.5)
psspy.change_plmod_con(600, r"""1""", r"""GENCLS""", 1, 0.1)
psspy.change_plmod_con(600, r"""1""", r"""GENCLS""", 2, 1)

for t_var in range(1, 9000):
    psspy.change_var(t_var, 0)

[ierr, var_ppc_conp] = psspy.mdlind(101, '1', 'EXC', 'CON')
# Initialize
psspy.case(GridInfoPath+file_name+".sav")
# psspy.rstr(GridInfoPath+file_name+".snp")
psspy.resq(GridInfoPath  + "/" + file_name + ".seq")
psspy.dyre_new([1, 1, 1, 1], GridInfoPath  + "/" + file_name + ".dyr", "", "", "")
psspy.addmodellibrary(HuaweiModelPath+'HWS2000_psse34.dll')
psspy.addmodellibrary(HuaweiModelPath+'MOD_GPM_PPC_V13_34.dll')
psspy.addmodellibrary(HuaweiModelPath+'MOD_GPM_SB_V7.dll')
psspy.dynamics_solution_param_2([_i,_i,_i,_i,_i,_i,_i,_i],[1.0,_f, 0.001,0.004,_f,_f,_f,_f])
psspy.plant_chng_3(500,0,_i,[ 1.05,_f])
psspy.plant_chng_3(1000,0,_i,[ 1.045,_f])
psspy.machine_data_2(500, r"""1""", [_i, _i, _i, _i, _i, _i],[85, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f, _f])
psspy.two_winding_chng_5(700,800,r"""1""",[_i,_i,_i,_i,_i,_i,_i,_i,800,_i,_i,1,_i,_i,_i],[_f,_f,_f, 1.0,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f],r"""SS-TF-1""",
r"""YNYN0""")
psspy.machine_chng_2(500,r"""1""",[_i,_i,_i,_i,_i,_i],[_f,0.0,0,0,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f])
psspy.load_data_3(1000,r"""1""",[_i,_i,_i,_i,_i],[1000,20,_f,_f,_f,_f])	# apply assumption load
psspy.fnsl([0,0,0,1,0,0,99,0])

psspy.cong(0)
psspy.bus_frequency_channel([1,1000],r"""System frequency""")
ierr=psspy.machine_array_channel([2,4,500],r"""1""",r"""Inverter Terminal Voltage""")
ierr=psspy.voltage_channel([3,-1,-1,800],r"""WISF PoC Voltage""")
psspy.branch_p_and_q_channel([4,-1,-1,800,900],r"""1""",[r"""P Injection""",r"""Q Injection"""])
psspy.branch_p_and_q_channel([6,-1,-1,500,600],r"""1""",[r"""Pelec Inverter""",r"""Pelec Inverter"""])
# ierr=psspy.machine_array_channel([6,2,500],r"""1""",r"""Pelec Inverter""")
# ierr=psspy.machine_array_channel([7,3,500],r"""1""",r"""Qelec Inverter""")
[ierr, var_ppc_conp] = psspy.mdlind(500, '1', 'EXC', 'CON')
[ierr, var_ppc_setp] = psspy.mdlind(500, '1', 'EXC', 'VAR')
[ierr, var_ppc_mode] = psspy.mdlind(500, '1', 'EXC', 'ICON')
[ierr, var_inv1_con] = psspy.mdlind(500, '1', 'GEN', 'CON')
[ierr, var_inv1_var]=  psspy.mdlind(500,'1','GEN','VAR')
예제 #5
0
ierr = psspy.bus_data_2(44140, intgar1=4)  #CHAS1
ierr = psspy.bus_data_2(44141, intgar1=4)  #RNIGNJ1
ierr = psspy.bus_data_2(44214, intgar1=4)  #RNIGNJ2
ierr = psspy.bus_data_2(44219, intgar1=4)  #GOLA2
ierr = psspy.bus_data_2(44227, intgar1=4)  #RTPS2
ierr = psspy.bus_data_2(44228, intgar1=4)  #MOSB2
ierr = psspy.bus_data_2(44230, intgar1=4)  #CHAS2
ierr = psspy.bus_data_2(44232, intgar1=4)  #KGP2
ierr = psspy.bus_data_2(44235, intgar1=4)  #NKPURA2
ierr = psspy.bus_data_2(44236, intgar1=4)  #PATR2
ierr = psspy.bus_data_2(44409, intgar1=4)  #MOSB4
ierr = psspy.bus_data_2(44405, intgar1=4)  #BkroA
ierr = psspy.bus_data_2(44009, intgar1=4)  #DTPSG3

# 2017 load forecast
ierr = psspy.load_data_3(44100, realar1=68.1, realar2=22.3)  #BOKARO
ierr = psspy.load_data_3(44101, realar1=24.4, realar2=8.)  #MOSABANI
ierr = psspy.load_data_3(44102, realar1=143.7, realar2=47.2)  #BURDWAN
ierr = psspy.load_data_3(44103, realar1=63., realar2=20.7)  #BELMURI
ierr = psspy.load_data_3(44104, realar1=55., realar2=18.8)  #HOWRAH
ierr = psspy.load_data_3(44105, realar1=57., realar2=18.6)  #KHARAGPUR
ierr = psspy.load_data_3(44106, realar1=384.5, realar2=100.3)  #CHANDRAPURA
ierr = psspy.load_data_3(44107, realar1=22.5, realar2=7.4)  #KOLAGHAT
ierr = psspy.load_data_3(44108, realar1=140., realar2=46.)  #JAMSHEDPUR
ierr = psspy.load_data_3(44109, realar1=42.2, realar2=13.8)  #DTPS
ierr = psspy.load_data_3(44110, realar1=35., realar2=11.5)  #BARHI
ierr = psspy.load_data_3(44111, realar1=41.4, realar2=13.6)  #MAITHON HYDEL
ierr = psspy.load_data_3(44112, realar1=17.6, realar2=5.7)  #PANCHET HYDEL
ierr = psspy.load_data_3(44137, realar1=91.6, realar2=30.1)  #KODERMAOLD
ierr = psspy.load_data_3(44114, realar1=60., realar2=19.7)  #HAZARIBAGH
ierr = psspy.load_data_3(44115, realar1=36.35, realar2=11.9)  #GOLA
예제 #6
0
    _f, _f, _f, ReactivePowerSetpoint * S, 120, _f, _f, _f, _f, _f, _f, _f, _f,
    _f, _f, _f, _f
])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i], [
    ActivePowerSetpoint * S, _f, _f, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f,
    _f, _f, _f, _f
])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i], [
    _f, _f, ReactivePowerSetpoint * S, _f, 120, _f, _f, _f, _f, _f, _f, _f, _f,
    _f, _f, _f, _f
])
psspy.machine_data_2(104, r"""1""", [_i, _i, _i, _i, _i, _i], [
    _f, _f, _f, ReactivePowerSetpoint * S, 120, _f, _f, _f, _f, _f, _f, _f, _f,
    _f, _f, _f, _f
])
psspy.load_data_3(600, r"""1""", [_i, _i, _i, _i, _i],
                  [600, 20, _f, _f, _f, _f])  # apply assumption load

psspy.fdns([0, 0, 0, 1, 0, 0, 99, 0])
# psspy.add_plant_model(600, r"""1""", 6, r"""SEXS""", 0, "", 0, [], [], 6, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 1, 0.1)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 2, 10.0)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 3, 50.0)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 4, 0.05)
# psspy.change_plmod_con(600, r"""1""", r"""SEXS""", 6, 2.5)
psspy.change_plmod_con(600, r"""1""", r"""GENCLS""", 1, 0.1)
psspy.change_plmod_con(600, r"""1""", r"""GENCLS""", 2, 1)

for t_var in range(1, 9000):
    psspy.change_var(t_var, 0)

[ierr, var_ppc_conp] = psspy.mdlind(101, '1', 'EXC', 'CON')
예제 #7
0
psspy.bus_data_2(busMap['CHAS2'], intgar1=4) #CHAS2
psspy.bus_data_2(busMap['DSTPS2'], intgar1=4) #DSTPS2
psspy.bus_data_2(busMap['KHARAGPUR2'], intgar1=4) #KGP2
psspy.bus_data_2(busMap['PANAGARH2'], intgar1=4) #PANAG2
psspy.bus_data_2(busMap['BURDWAN2'], intgar1=4) #BDWN2
psspy.bus_data_2(busMap['NKPURA2'], intgar1=4) #NKPURA2
psspy.bus_data_2(busMap['PATRATU2'], intgar1=4) #PATR2
psspy.bus_data_2(busMap['MEJIAB2'], intgar1=4) #MEJIAB2
psspy.bus_data_2(busMap['KALIPAHARI2'], intgar1=4) #KALI2
psspy.bus_data_2(busMap['JAMURIA2'], intgar1=4) #JAMURIA2
psspy.bus_data_2(busMap['MUCHIPARA3'], intgar1=1, intgar2=AREA, intgar3=DVC_ZONE, intgar4=OWNER, realar1=33., name='MUCHI3') 
psspy.bus_data_2(busMap['MOSABANI4'], intgar1=4) #MOSB4


#LOAD AS ON 31.8.2015
psspy.load_data_3(busMap['BTPSB1'], realar1=68.) #BOKARO
psspy.load_data_3(busMap['MOSABANI1'], realar1=96.) #MOSABANI
psspy.load_data_3(busMap['BURDWAN1'], realar1=124.) #BURDWAN
psspy.load_data_3(busMap['BELMURI1'], realar1=43.) #BELMURI
psspy.load_data_3(busMap['HOWRAH1'], realar1=15.) #HOWRAH
psspy.load_data_3(busMap['KHARAGPUR1'], realar1=17.) #KHARAGPUR
psspy.load_data_3(busMap['CTPS1'], realar1=359.) #CHANDRAPURA
psspy.load_data_3(busMap['KOLAGHAT1'], realar1=14.5) #KOLAGHAT
psspy.load_data_3(busMap['JAMSHEDPUR1'], realar1=140.) #JAMSHEDPUR
psspy.load_data_3(busMap['DTPS1'], realar1=42.2) #DTPS
psspy.load_data_3(busMap['BARHI1'], realar1=48.) #BARHI
psspy.load_data_3(busMap['MAITHONHYDL1'], realar1=56.6+18.) #MAITHON HYDEL
psspy.load_data_3(busMap['PANCHETHYDL1'], realar1=17.6) #PANCHET HYDEL
psspy.load_data_3(busMap['KODERMAO1'], realar1=93.) #KODERMAOLD
psspy.load_data_3(busMap['HAZARIBAGH1'], realar1=80.) #HAZARIBAGH
psspy.load_data_3(busMap['GOLA1'], realar1=48.6) #GOLA
예제 #8
0
sys.path.append(psspath)
os.environ['PATH'] += ';' + psspath

import psspy
import redirect
redirect.psse2py()
psspy.psseinit(10000)
psspy.case(r'C:\Documents and Settings\xw0419\Mes documents\Mon Projet\Simulation\HQ_PSSmodel\HQ1_shuntadded.sav')
psspy.fnsl(
    options1=0,
    options5=0
    )
ierr, volt = psspy.abusreal(-1, string="PU")        #voltage at buses in normal condition

ierr=psspy.load_data_3(i=303,
                       REALAR2=600
                       )
ierr, buses = psspy.abusint(-1, string="NUMBER")
psspy.fnsl(
    options1=0,
    options5=0
    )
ierr, voltd = psspy.abusreal(-1, string="PU")
n=len(volt[0][:])
dv=[[0]*n]
for i in range(0,n-1):
    dv[0][i]=voltd[0][i]-volt[0][i]

import excelpy
x1=excelpy.workbook(r'C:\Documents and Settings\xw0419\Mes documents\Mon Projet\Simulation\IREQ\PythonProgs\inoutdata.xls',sheet="Feuil1",overwritesheet=True, mode='w')
x1.show()
예제 #9
0
파일: dvc_sys_data.py 프로젝트: amaity/work
# psspy.bus_data_2(busMap['NKPURA2'], intgar1=4) #NKPURA2
# psspy.bus_data_2(busMap['PATRATU2'], intgar1=4) #PATR2
# psspy.bus_data_2(busMap['MEJIAB2'], intgar1=4) #MEJIAB2
# psspy.bus_data_2(busMap['KALIPAHARI2'], intgar1=4) #KALI2
# psspy.bus_data_2(busMap['JAMURIA2'], intgar1=4) #JAMURIA2
psspy.bus_data_2(busMap['MUCHIPARA3'],
                 intgar1=1,
                 intgar2=AREA,
                 intgar3=DVC_ZONE,
                 intgar4=OWNER,
                 realar1=33.,
                 name='MUCHI3')
# psspy.bus_data_2(busMap['MOSABANI4'], intgar1=4) #MOSB4

#LOAD AS ON 31.8.2015
psspy.load_data_3(busMap['BTPSB1'], realar1=68.)  #BOKARO
psspy.load_data_3(busMap['MOSABANI1'], realar1=96.)  #MOSABANI
psspy.load_data_3(busMap['BURDWAN1'], realar1=124.)  #BURDWAN
psspy.load_data_3(busMap['BELMURI1'], realar1=43.)  #BELMURI
psspy.load_data_3(busMap['HOWRAH1'], realar1=15.)  #HOWRAH
psspy.load_data_3(busMap['KHARAGPUR1'], realar1=17.)  #KHARAGPUR
psspy.load_data_3(busMap['CTPS1'], realar1=359.)  #CHANDRAPURA
psspy.load_data_3(busMap['KOLAGHAT1'], realar1=14.5)  #KOLAGHAT
psspy.load_data_3(busMap['JAMSHEDPUR1'], realar1=140.)  #JAMSHEDPUR
psspy.load_data_3(busMap['DTPS1'], realar1=42.2)  #DTPS
psspy.load_data_3(busMap['BARHI1'], realar1=48.)  #BARHI
psspy.load_data_3(busMap['MAITHONHYDL1'], realar1=56.6 + 18.)  #MAITHON HYDEL
psspy.load_data_3(busMap['PANCHETHYDL1'], realar1=17.6)  #PANCHET HYDEL
psspy.load_data_3(busMap['KODERMAO1'], realar1=93.)  #KODERMAOLD
psspy.load_data_3(busMap['HAZARIBAGH1'], realar1=80.)  #HAZARIBAGH
psspy.load_data_3(busMap['GOLA1'], realar1=48.6)  #GOLA
예제 #10
0
psspy.psseinit(9000)
psspy.case(CASE)

#------------------------
ierr = psspy.bus_data_2(44405, intgar1=4)  #BkroA
ierr = psspy.bus_data_2(44010, intgar1=4)  #BkroA
ierr, realaro = psspy.two_winding_data(44010, 44405, "1",
                                       intgar1=0)  #BTPSAG to BkroA
ierr, realaro = psspy.two_winding_data(
    44200, 44405, "1", intgar1=0)  #btps-b to bokaro-a interconnection
ierr = psspy.branch_data(44402, 44405, "1", intgar1=0)  #Koderma - BkroA line
ierr = psspy.branch_data(44402, 44405, "2", intgar1=0)  #Koderma - BkroA line

# Case specific load changes to be indicated here
# CD as on 28.2.2014
ierr = psspy.load_data_3(44100, realar1=44.6)  #BOKARO
ierr = psspy.load_data_3(44101, realar1=24.4)  #MOSABANI
ierr = psspy.load_data_3(44102, realar1=123.7)  #BURDWAN
ierr = psspy.load_data_3(44103, realar1=43.0)  #BELMURI
ierr = psspy.load_data_3(44104, realar1=15.0)  #HOWRAH
ierr = psspy.load_data_3(44105, realar1=17.0)  #KHARAGPUR
ierr = psspy.load_data_3(44106, realar1=359.5)  #CHANDRAPURA
ierr = psspy.load_data_3(44107, realar1=10.0)  #KOLAGHAT
ierr = psspy.load_data_3(44108, realar1=140.0)  #JAMSHEDPUR
ierr = psspy.load_data_3(44101, realar1=42.2)  #DTPS
ierr = psspy.load_data_3(44110, realar1=20.0)  #BARHI
ierr = psspy.load_data_3(44111, realar1=59.4)  #MAITHON HYDEL
ierr = psspy.load_data_3(44112, realar1=17.6)  #PANCHET HYDEL
ierr = psspy.load_data_3(44113, realar1=89.65)  #KODERMA
ierr = psspy.load_data_3(44114, realar1=30.0)  #HAZARIBAGH
ierr = psspy.load_data_3(44115, realar1=36.35)  #GOLA
예제 #11
0
import os, sys
psspath = r'c:\program files\pti\psse32\pssbin'
sys.path.append(psspath)
os.environ['PATH'] += ';' + psspath

import psspy
import redirect
redirect.psse2py()
psspy.psseinit(10000)
psspy.case(
    r'C:\Documents and Settings\xw0419\Mes documents\Mon Projet\Simulation\HQ_PSSmodel\nseieee_jan_23_13_0714.sav'
)
psspy.fnsl(options1=0, options5=0)
ierr, volt = psspy.abusreal(-1, string="PU")
ierr = psspy.load_data_3(i=1020, intgar1=0)
ierr, buses = psspy.abusint(-1, string="NUMBER")
psspy.fnsl(options1=0, options5=0)
ierr, voltd = psspy.abusreal(-1, string="PU")
n = len(volt[0][:])
dv = [[0] * n]
for i in range(0, n - 1):
    dv[0][i] = voltd[0][i] - volt[0][i]

import excelpy
x1 = excelpy.workbook(
    r'C:\Documents and Settings\xw0419\Mes documents\Mon Projet\Simulation\IREQ\PythonProgs\outdata1.xls',
    sheet="Feuil1",
    overwritesheet=False,
    mode='w')
x1.show()
x1.show_alerts(False)
예제 #12
0
#CASE = r"C:\Program Files\PTI\PSSE32\EXAMPLE\12TH_PLAN_MAR_2017R1.sav"
CASE = r"C:\Program Files (x86)\PTI\PSSE33\EXAMPLE\11TH_PLAN_REV_MAR_2012.sav"
psspy.psseinit(9000)
psspy.case(CASE)

#------------------------
ierr = psspy.bus_data_2(44405, intgar1=4) #BkroA
ierr = psspy.bus_data_2(44010, intgar1=4) #BkroA
ierr, realaro = psspy.two_winding_data(44010, 44405, "1", intgar1=0) #BTPSAG to BkroA
ierr, realaro = psspy.two_winding_data(44200, 44405, "1", intgar1=0) #btps-b to bokaro-a interconnection
ierr = psspy.branch_data(44402, 44405, "1", intgar1=0) #Koderma - BkroA line
ierr = psspy.branch_data(44402, 44405, "2", intgar1=0) #Koderma - BkroA line

# Case specific load changes to be indicated here
# CD as on 28.2.2014
ierr = psspy.load_data_3(44100, realar1=44.6) #BOKARO
ierr = psspy.load_data_3(44101, realar1=24.4) #MOSABANI
ierr = psspy.load_data_3(44102, realar1=123.7) #BURDWAN
ierr = psspy.load_data_3(44103, realar1=43.0) #BELMURI
ierr = psspy.load_data_3(44104, realar1=15.0) #HOWRAH
ierr = psspy.load_data_3(44105, realar1=17.0) #KHARAGPUR
ierr = psspy.load_data_3(44106, realar1=359.5) #CHANDRAPURA
ierr = psspy.load_data_3(44107, realar1=10.0) #KOLAGHAT
ierr = psspy.load_data_3(44108, realar1=140.0) #JAMSHEDPUR
ierr = psspy.load_data_3(44101, realar1=42.2) #DTPS
ierr = psspy.load_data_3(44110, realar1=20.0) #BARHI
ierr = psspy.load_data_3(44111, realar1=59.4) #MAITHON HYDEL
ierr = psspy.load_data_3(44112, realar1=17.6) #PANCHET HYDEL
ierr = psspy.load_data_3(44113, realar1=89.65) #KODERMA
ierr = psspy.load_data_3(44114, realar1=30.0) #HAZARIBAGH
ierr = psspy.load_data_3(44115, realar1=36.35) #GOLA
psspy.addmodellibrary(HuaweiModelPath + 'MOD_GPM_SB_V7.dll')
#psspy.addmodellibrary(GridInfoPath + 'GEWTG34.dll')
#psspy.addmodellibrary(GridInfoPath + 'SMAPPC_B111_34_IVF111.dll')
#psspy.addmodellibrary(GridInfoPath + 'SMASC_C135_34_IVF111.dll')
psspy.dynamics_solution_param_2([_i, _i, _i, _i, _i, _i, _i, _i],
                                [1.000, _f, 0.001, 0.004, _f, _f, _f, _f])

for i in range(0, len(Disturbance_Load_Amount)):

    # re - initialize
    psspy.read(0, GridInfoPath + LoadScenario + "/" + file_name + ".raw")
    psspy.resq(GridInfoPath + LoadScenario + "/" + file_name + ".seq")
    psspy.dyre_new([1, 1, 1, 1],
                   GridInfoPath + LoadScenario + "/" + file_name + ".dyr", "",
                   "", "")
    psspy.load_data_3(600, r"""1""", [_i, _i, _i, _i, _i],
                      [300, 20, _f, _f, _f, _f])  # apply assumption load
    psspy.fdns([1, 0, 0, 1, 0, 0, 99, 0])
    for t_var in range(1, 500):
        psspy.change_var(t_var, 0)

    psspy.bus_frequency_channel([1, 400], r"""System frequency""")
    psspy.voltage_channel([2, -1, -1, 101], r"""Inverter Voltage Mag.""")
    psspy.voltage_channel([3, -1, -1, 400], r"""WDSF POC Voltage Mag.""")
    psspy.branch_p_and_q_channel([4, -1, -1, 400, 46660], r"""1""",
                                 [r"""P Injection""", r"""Q Injection"""])
    ierr = psspy.machine_array_channel([7, 2, 101], r"""1""", r"""Pelec 101""")
    ierr = psspy.machine_array_channel([8, 3, 101], r"""1""", r"""Qelec 101""")
    [ierr, var_ppc_conp] = psspy.mdlind(101, '1', 'EXC', 'CON')
    [ierr, var_ppc_setp] = psspy.mdlind(101, '1', 'EXC', 'VAR')
    [ierr, var_ppc_mode] = psspy.mdlind(101, '1', 'EXC', 'ICON')
    [ierr, var_inv_con] = psspy.mdlind(101, '1', 'GEN', 'CON')
예제 #14
0
def randdist(argin):

    filename = argin[0]  # initializing input arguments
    maxdist = argin[1]
    mode = argin[2]
    shuntctrlmode = argin[3]
    capbus = argin[4]
    capstep = argin[5]
    capQ = argin[6]
    pilot = argin[7]
    ndist = argin[8]
    nswitch = argin[9]
    reloadfile = 1
    # By default the network data file will be reloaded at each iteration
    if len(argin) == 11:
        reloadfile = argin[10]
    psspy.case(filename)
    ierr, Qload = psspy.aloadcplx(
        -1, string="MVAACT"
    )  # Qload is the amount of apparent power (P+jQ) for all loads
    Qload = [
        x.imag for x in Qload[0]
    ]  # We just need Reactive power (Q) so we find imaginary part of apparent power
    ierr, tlbuses = psspy.aloadint(
        string='NUMBER'
    )  # tlbuses is all loads' bus nomber, it includes also the compensators that we have added as loads to the network
    nbus = len(tlbuses[0])  # nbus is No. of all load buses
    ncap = len(capbus)
    ierr, busn = psspy.abusint(-1, string='NUMBER')

    npn = len(pilot)

    volt = []
    voltd = []
    vpn = [[0 for x in range(npn)] for y in range(ndist * nswitch)]
    vpnd = [[0 for x in range(npn)] for y in range(ndist * nswitch)]
    dvpn = [[0 for x in range(npn)] for y in range(ndist * nswitch)]
    switch = [[0 for x in range(ncap)] for y in range(ndist * nswitch)]
    for i in range(
            ndist
    ):  # in this loop we generate ndist random distrurbane cases and apply nswitch control actions on each case
        if reloadfile == 1:
            psspy.case(filename)
        percentage = random.random(
        ) * maxdist  # choose randomly the amount of disturbance with maximum of maxdist
        zoseq = [0, 1] * nbus
        if mode == 'random':
            sb = random.sample(
                zoseq, nbus)  # choose randomly loads to apply the disturbance
        if mode == 'all': sb = [1] * nbus
        capQd = [0 for x in range(ncap)]
        for j in range(nbus):  # applying the disturbance
            if sb[j] == 1:
                ##                if not(tlbuses[0][j] in capbus):          # we make sure that no dist. applied on capacitor buses (which are considered also as loads)
                Qd = Qload[j] + percentage / 100.0 * abs(Qload[j])
                ierr = psspy.load_data_3(i=tlbuses[0][j], REALAR2=Qd)
            if tlbuses[0][j] in capbus:
                capidx = capbus.index(tlbuses[0][j])
                if sb[j] == 1:
                    capQd[capidx] = Qd
                else:
                    capQd[capidx] = Qload[j]
        if shuntctrlmode == 1:  # by this option we can unlock all compensators over the network
            for j in tlbuses[0]:
                ierr = psspy.switched_shunt_data_3(j, intgar9=1)

        print '###### DIST(' + str(i) + ') ########'
        psspy.fdns(OPTIONS1=0, OPTIONS5=0,
                   OPTIONS6=1)  # do power flow on the disturbed system
        ierr, v = psspy.abusreal(
            -1, string="PU"
        )  # and measure voltage at all buses after disturbance (there is no option in PSS to measure the voltage of just one bus)

        for j in range(
                nswitch):  # now we apply random cap. switchings nswitch times
            [scb, ss, qss] = capselect(capbus, capstep, capQ)

            print '### ADD CAP ###'
            for k in range(len(scb)):
                scbidx = capbus.index(scb[k])
                switch[i * nswitch + j][scbidx] = ss[k]

                capQd[scbidx] = capQd[scbidx] - ss[k] * qss[k]
                ierr = psspy.load_data_3(i=scb[k], REALAR2=capQd[scbidx])

            print '###### DIST(' + str(i) + ') , ' + 'SWITCHCASE(' + str(
                i * nswitch + j) + ') ########'
            psspy.fdns(OPTIONS1=0, OPTIONS5=0,
                       OPTIONS6=1)  # do power flow on the disturbed system
            ierr, vd = psspy.abusreal(
                -1, string="PU"
            )  # and measure voltage at all buses after disturbance (there is no option in PSS to measure the voltage of just one bus)
            voltd.append(vd)
            volt.append(v)
            for k in range(npn):  # measuring vpn, and vpnd as outputs
                pnidx = busn[0].index(pilot[k])
                vpn[i * nswitch + j][k] = v[0][pnidx]
                vpnd[i * nswitch + j][k] = vd[0][pnidx]
                dvpn[i * nswitch +
                     j][k] = vpnd[i * nswitch + j][k] - vpn[i * nswitch + j][k]
            print '### REMOVE CAP ###'
            for k in range(
                    len(scb)
            ):  # after cap switchings we remove their effect for next switching
                scbidx = capbus.index(scb[k])
                capQd[scbidx] = capQd[scbidx] + ss[k] * qss[k]
                ierr = psspy.load_data_3(i=scb[k], REALAR2=capQd[scbidx])

    return volt, voltd, vpn, vpnd, dvpn, switch
예제 #15
0
    # change the owner number based on their regions
    regionSize = 3
    for region_index in range(0, regionSize):
        for bus_index in range(0, len(regions[region_index])):
            psspy.bus_data_2(regions[region_index][bus_index],
                             [_i, _i, _i, region_index + 1])

    # change the load buses owner number based on their regions
    regionSize = 3
    count = 0
    for region_index in range(0, regionSize):
        for bus_index in range(0, len(regions[region_index])):
            #if this bus is a load bus...
            if regions[region_index][bus_index] in load_bus != False:
                psspy.load_data_3(regions[region_index][bus_index], r"""BL""",
                                  [_i, _i, _i, region_index + 1, _i],
                                  [_f, _f, _f, _f, _f, _f])
                count = count + 1

    ###divide the system into 3 parts based on
    load_bus_region = []
    gen_bus_region = []
    BusLoadRegion = []
    for i in range(1, 4):
        psspy.bsys(0, 0, [0.0, 0.0], 0, [], 0, [], 1, [i], 0, [])
        ierr, load_bus_ineachregion = psspy.alodbusint(0, 1, ['NUMBER'])
        load_bus_ineachregion = load_bus_ineachregion[0]
        load_bus_region.append(load_bus_ineachregion)

        ierr, gen_bus_ineachregion = psspy.agenbusint(0, 1, ['NUMBER'])
        gen_bus_ineachregion = gen_bus_ineachregion[0]
예제 #16
0
ierr = psspy.bus_data_2(44141, intgar1=4) #RNIGNJ1
ierr = psspy.bus_data_2(44214, intgar1=4) #RNIGNJ2
ierr = psspy.bus_data_2(44219, intgar1=4) #GOLA2
ierr = psspy.bus_data_2(44227, intgar1=4) #RTPS2
ierr = psspy.bus_data_2(44228, intgar1=4) #MOSB2
ierr = psspy.bus_data_2(44230, intgar1=4) #CHAS2
ierr = psspy.bus_data_2(44232, intgar1=4) #KGP2
ierr = psspy.bus_data_2(44235, intgar1=4) #NKPURA2
ierr = psspy.bus_data_2(44236, intgar1=4) #PATR2
ierr = psspy.bus_data_2(44409, intgar1=4) #MOSB4
ierr = psspy.bus_data_2(44405, intgar1=4) #BkroA
ierr = psspy.bus_data_2(44009, intgar1=4) #DTPSG3


# 2017 load forecast 
ierr = psspy.load_data_3(44100, realar1=68.1, realar2=22.3) #BOKARO
ierr = psspy.load_data_3(44101, realar1=24.4, realar2=8.) #MOSABANI
ierr = psspy.load_data_3(44102, realar1=143.7, realar2=47.2) #BURDWAN
ierr = psspy.load_data_3(44103, realar1=63., realar2=20.7) #BELMURI
ierr = psspy.load_data_3(44104, realar1=55., realar2=18.8) #HOWRAH
ierr = psspy.load_data_3(44105, realar1=57., realar2=18.6) #KHARAGPUR
ierr = psspy.load_data_3(44106, realar1=384.5, realar2=100.3) #CHANDRAPURA
ierr = psspy.load_data_3(44107, realar1=22.5, realar2=7.4) #KOLAGHAT
ierr = psspy.load_data_3(44108, realar1=140., realar2=46.) #JAMSHEDPUR
ierr = psspy.load_data_3(44109, realar1=42.2, realar2=13.8) #DTPS
ierr = psspy.load_data_3(44110, realar1=35., realar2=11.5) #BARHI
ierr = psspy.load_data_3(44111, realar1=41.4, realar2=13.6) #MAITHON HYDEL
ierr = psspy.load_data_3(44112, realar1=17.6, realar2=5.7) #PANCHET HYDEL
ierr = psspy.load_data_3(44137, realar1=91.6, realar2=30.1) #KODERMAOLD
ierr = psspy.load_data_3(44114, realar1=60., realar2=19.7) #HAZARIBAGH
ierr = psspy.load_data_3(44115, realar1=36.35, realar2=11.9) #GOLA
예제 #17
0
파일: test3.py 프로젝트: yuanzy97/psseXtra
x1.show_alerts(False)
ierr, baseV = psspy.abusreal(-1, string='BASE')
ierr, buses = psspy.abusint(-1, string="NUMBER")
x1.set_cell('a1','Bus No.')
x1.set_range(2, 'a', zip(*buses))
x1.set_cell('b1','Base Voltage(kv)')
x1.set_range(2, 'b', zip(*baseV))

##distpercent=distpercent*2
##ndist=ndist*2
for i in range(ndist):
    x1.set_cell((1,i+3),'dist '+ str(distpercent[i])+' %')
    x1.set_range(2, i+3, zip(*vd[i]))

# the following code shows the effect of capacitor swithching on the disturbed system
C=308
capidx=tlbuses[0].index(C)
  
Qcapidx= Qload[capidx]   
Qd=Qcapidx-2*380
ierr=psspy.load_data_3(i=C,REALAR2=Qd)

psspy.fnsl(options1=0,options5=0)
ierr, voltd = psspy.abusreal(-1, string="PU")        #voltage at buses in normal condition
x1.set_cell((1,ndist+3),'cap308')
x1.set_range(2, ndist+3, zip(*voltd)) 
##[scb,ss,qss]=capselect(capbus,capstep,capQ)
##print 'Selected Capacitor Bus', scb
##print 'Selected Step', ss
##print 'Q(Mvar) of selected step',qss