Ask Your Question

danzg's profile - activity

2016-10-04 04:56:32 -0500 received badge  Necromancer (source)
2016-10-04 04:56:32 -0500 received badge  Teacher (source)
2016-05-22 10:59:03 -0500 answered a question low pass filter design using python


You can try this simplest implementation.

def PT1(x,Ts,Tf,y0):

# The algorithm is based on the Euler backward difference scheme for the simplest 1st order filter :
#    y(k)-y(k-1)=Ts*(x(k)-y(k))/Tf
#   x  - actual value of the input signal that is to be passed to 1st order (PT1) filter transfer 
#        function  y=(1/(1+sTf)*x
#   Ts (s) - time step (discretization time for the filter)
#   Tf (s) -  filter time constant
#   y0 - output signal value from the previous step, must be assigned in the calling 
#        program (y0=y(k-1))

  dy=Ts/(Tf+Ts)*x      # output signal increment
  y=Tf/(Tf+Ts)*y0+dy   # updated output signal
  return y             # returns filtered input signal

This function should be called from a time loop implemented in a Python script. If you for example want to filter the frequency deviation signal dfreq using a PT1 filter with time constant 10 seconds and discretization time of 20 ms and you are going to store the filtered value as dfreqf, that call might look something like this:

for tstep in range(1,Nstep):
    dfreqf0=dfreqf                                 # 

Of course the basic time step in PSS/E dynamic simulation must be less or equal to filter discretization time and the initial frequency deviation is assumed to be zero.

2016-04-08 11:15:15 -0500 received badge  Editor (source)
2016-04-07 15:30:09 -0500 answered a question Electrical and Mechanical Power

The difference is due to the convention used in dynamics simulation output (see list of output signals in Table 14-2 in PSS/E V32 Operation Manual). Mechanical power is given in pu on machine MVA base (MBASE) while electrical power is expressed on system MVA base (SYSMVA=100 MVA by default). For example, a 500 MVA machine with 0.8 pu mechanical power (i.e. 0.8x500=400 MW) will have electrical power equal to 4 pu (on 100 MVA basis), if losses are neglected.

2016-01-04 06:51:08 -0500 answered a question How to get the list of Machine inertia from PSSE?

Hi, instead reading the .dyr file you can retrieve the required values from internal dynamic data arrays. General idea is presented below (not the most elegant code but it serves its purpose). Hope this would help.

import psspy

#         (a basic example shown here)
Sid=-1   # All machines
Flag=1   # Only in-service machines at in-service plants
ierr, Nmach=psspy.amachcount(Sid, Flag)           # get no of machines in the subsystem
ierr, iMbus = psspy.amachint(Sid, Flag, 'NUMBER') # get machine bus numbers
ierr, cMids = psspy.amachchar(Sid, Flag, 'ID')    # get machine IDs

fout=open('D:\Examples\Inertia.txt','w') # open a text file at desired location
savFn, snpFn = psspy.sfiles()
fout.write('MODEL: Load flow:     %s\n       Dynamic model: %s\n\n' % (savFn,snpFn))
fout.write(' BUS    NAME                GEN  MODEL    H (sec)\n--------------------------------------------------------\n')
for iM in range(0,Nmach):  # iterate through the list of machines
    iH=0  # resetting the intertia value index   
    ierr, icon0 = psspy.mdlind(ibus, genId, 'GEN', 'CON') # get initial CON address (index)
    ierr, genMdl = psspy.mdlnam(ibus, genId, 'GEN') # get generator model name
    genMdl=genMdl.strip()                           # remove blanks
#   Find absolute index iH in CONS array using relative CON index in the generator model and
#   previously found starting CON index of the generator model
#  (here shown only for the three most common models)
    if genMdl=='GENCLS': iH=icon0                           
    if (genMdl=='GENSAL')|(genMdl=='GENSAE'): iH=icon0+3    
    if (genMdl=='GENROU')|(genMdl=='GENROE'): iH=icon0+4
#   Get value from CONS array corresponding to the generator inertia
    ierr,H=psspy.dsrval('CON', iH)
#   Write output to the file    
    fout.write ('%6d  %12s   %2s  %6s  %6.3f\n' % (ibus,busN,genId,genMdl,H))