Ask Your Question
0

ImportDWG file

asked 2018-05-28 06:35:04 -0500

Amir90 gravatar image

Hello,

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

could you help me? Thanks.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2021-12-02 09:11:54 -0500

Tran Huu Phuc gravatar image

updated 2021-12-02 09:19:41 -0500

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)
edit flag offensive delete link more
0

answered 2018-05-28 08:34:07 -0500

perolofl gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2018-05-28 06:35:04 -0500

Seen: 533 times

Last updated: Dec 02 '21