Ask Your Question
0

ImportDWG file

asked May 28 '18

Amir90 gravatar image

Hello,

I have a DWG file and I want to import it into PSS/E,

could you help me? Thanks.

2 answers

Sort by » oldest newest most voted
0

answered Dec 2 '1

Tran Huu Phuc gravatar image

updated Dec 2 '1

There is a python code that can run to interact between PSS/E and .dxf file (can be open by AutoCad).

  • Typing busnumberkv (for example 2511kv) in the drawing (.dxf) to export voltage and angle of bus 2511.

  • Typing busnumberatobusnumberb-id (for example 2511to1997-1) to export the P and the Q from the branch to
    the drawing.

  • Typing the busnumberpq (for example 2511pq) to export the Pload and Qload in bus 2511 to the drawing.

Typing machinebusnumber gens (for example 251197 gens) to export Pgen and Qgen from machine number 251197. Save the code below into .py file and run it in PSS/E GUI

# encoding: utf-8
import csv
import psspy
import os

def complex(number):
    a = number.real
    b = number.imag
    if b>= 0:
        c = str(round(a,1)) + '+ j' + str(round(b,1))
    else:
        c = str(round(a,1)) + '- j' + str(abs(round(b,1)))
    return c
def check(string):
    t = 0
    for i in string:
        if '0' > i or '9' < i:
            t = 1
    return t
def splitys(tmpstr):
    strlst = []
    commalst = tmpstr.split('YS')
    for each in commalst:
        eachlst = each.split()
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')

    return strlst
def splitstring(tmpstr):
    strlst = []
    commalst = tmpstr.split(',')
    for each in commalst:
        eachlst = each.split()
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')

    return strlst
def splitkv(tmpstr):
    strlst = []
    commalst = tmpstr.split('kv')
    for each in commalst:
        eachlst = each.split()
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')

    return strlst
def splitbr(tmpstr):
    strlst = []
    str = []
    st = []
    commalst = tmpstr.split('to')
    for each in commalst:
        eachlst = each.split('x')
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')
    for each in strlst:
        en = each.split('-')
        if en:
            str.extend(en)
        else:
            str.extend(' ')
    for each in str:
        en = each.split('\n')
        if en:
            st.extend(en)
        else:
            st.extend(' ')
    return st
def splittrn(tmpstr):
    strlst = []
    str = []
    st = []
    commalst = tmpstr.split('tran')
    for each in commalst:
        eachlst = each.split('x')
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')
    for each in strlst:
        en = each.split('-')
        if en:
            str.extend(en)
        else:
            str.extend(' ')
    return str 
def splitpq(tmpstr):
    strlst = []
    commalst = tmpstr.split('pq')
    for each in commalst:
        eachlst = each.split()
        if eachlst:
            strlst.extend(eachlst)
        else:
            strlst.extend(' ')

    return strlst
def indexes(busnum, busnumlist):
    busidxes = []
    startidx = 0
    buscounts = busnumlist.count(busnum)
    if buscounts:
        for i in range(buscounts):
            tmpidx = busnumlist.index(busnum,startidx)
            busidxes.append(tmpidx)
            startidx = tmpidx+1
    return busidxes
def array2dict(dict_keys, dict_values):
    tmpdict = {}
    for i in range(len(dict_keys)):
        tmpdict[dict_keys[i].lower()] = dict_values[i]
    return tmpdict
def acad():
    import datetime
    import psspy
    sid = -1
    flag_bus     = 2    # in-service
    flag_plant   = 2    # in-service
    flag_load    = 2    # in-service
    flag_swsh    = 1    # in-service
    flag_brflow  = 2    # in-service
    owner_brflow = 1    # bus, ignored if sid is -ve
    ties_brflow  = 5
    # Bus Data
    # Bus Data - Integer
    istrings = ['number','type','area','zone','owner','dummy']
    ierr, idata = psspy.abusint(sid, flag_bus, istrings)
    ibuses = array2dict(istrings, idata)
     # Bus Data - Real
    rstrings = ['base','pu','kv','angle','angled','mismatch','o_mismatch']
    ierr, rdata = psspy.abusreal(sid, flag_bus, rstrings)
    rbuses = array2dict(rstrings, rdata)
    # Bus Data - Complex
    xstrings ...
(more)
link
0

answered May 28 '18

perolofl gravatar image

Why would you like to import a DWG file to PSSE? It cannot be done as far as I know...

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: May 28 '18

Seen: 564 times

Last updated: Dec 02 '21