ImportDWG file
Hello,
I have a DWG file and I want to import it into PSS/E,
could you help me? Thanks.
Hello,
I have a DWG file and I want to import it into PSS/E,
could you help me? Thanks.
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 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 ...
Why would you like to import a DWG file to PSSE? It cannot be done as far as I know...