本文整理汇总了Python中eppy.modeleditor.IDF.setiddname方法的典型用法代码示例。如果您正苦于以下问题:Python IDF.setiddname方法的具体用法?Python IDF.setiddname怎么用?Python IDF.setiddname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eppy.modeleditor.IDF
的用法示例。
在下文中一共展示了IDF.setiddname方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_IDF
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def test_IDF():
"""py.test for class IDF"""
stored_idd = IDF.iddname
IDF.iddname = None
assert IDF.iddname == None
IDF.setiddname("gumby", testing=True)
assert IDF.iddname == "gumby"
IDF.setiddname("karamba", testing=True)
assert IDF.iddname != "karamba"
assert IDF.iddname == "gumby"
IDF.iddname = stored_idd
示例2: setup
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def setup(self):
"""Set the IDD and file paths, and make a copy of the original file.
"""
iddfile = os.path.join(IDD_FILES, "Energy+V7_2_0.idd")
IDF.setiddname(iddfile, testing=True)
self.origfile = os.path.join(INTEGRATION_FILES, "origfile.idf")
#set tempfile names
self.startfile = os.path.join(INTEGRATION_FILES, "startfile.idf")
self.saveasfile = os.path.join(INTEGRATION_FILES, "saveas.idf")
self.copyfile = os.path.join(INTEGRATION_FILES, "savecopy.idf")
# make a copy of test file
shutil.copy(self.origfile, self.startfile)
示例3: idfreadtest
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def idfreadtest(iddhandle, idfhandle1, idfhandle2, verbose=False, save=False):
"""compare the results of eppy reader and simple reader"""
# read using eppy:
try:
IDF.setiddname(iddhandle)
except modeleditor.IDDAlreadySetError:
# idd has already been set
pass
idf = IDF(idfhandle1)
idfstr = idf.idfstr()
idfstr = idf2txt(idfstr)
# -
# do a simple read
simpletxt = idfhandle2.read()
try:
simpletxt = simpletxt.decode('ISO-8859-2')
except AttributeError:
pass
simpletxt = idf2txt(simpletxt)
# -
if save:
open('simpleread.idf', 'w').write(idfstr)
open('eppyread.idf', 'w').write(simpletxt)
# do the compare
lines1 = idfstr.splitlines()
lines2 = simpletxt.splitlines()
for i, (line1, line2) in enumerate(zip(lines1, lines2)):
if line1 != line2:
# test if it is a mismatch in number format
try:
line1 = float(line1[:-1])
line2 = float(line2[:-1])
if line1 != line2:
if verbose:
print()
print("%s- : %s" % (i, line1))
print("%s- : %s" % (i, line2))
return False
except ValueError:
if verbose:
print()
print("%s- : %s" % (i, line1))
print("%s- : %s" % (i, line2))
return False
return True
示例4: main
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def main():
"""the main routine"""
from StringIO import StringIO
import eppy.iddv7 as iddv7
IDF.setiddname(StringIO(iddv7.iddtxt))
idf1 = IDF(StringIO(''))
loopname = "p_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
dloop = ['db0', ['db1', 'db2', 'db3'], 'db4']
# makeplantloop(idf1, loopname, sloop, dloop)
loopname = "c_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
dloop = ['db0', ['db1', 'db2', 'db3'], 'db4']
# makecondenserloop(idf1, loopname, sloop, dloop)
loopname = "a_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
dloop = ['zone1', 'zone2', 'zone3']
makeairloop(idf1, loopname, sloop, dloop)
idf1.savecopy("hh1.idf")
示例5: main
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def main(argv=None):
if argv is None:
argv = sys.argv
try:
try:
opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="])
except getopt.error, msg:
raise Usage(msg)
# option processing
for option, value in opts:
if option == "-v":
verbose = True
if option in ("-h", "--help"):
raise Usage(help_message)
if option in ("-o", "--output"):
output = value
iddfile, fname1, fname2 = args
IDF.setiddname(iddfile)
idf1 = IDF(fname1)
idf2 = IDF(fname2)
idfdiffs(idf1, idf2)
示例6: IDF
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
# if you have not done so, uncomment the following three lines
import sys
# pathnameto_eppy = 'c:/eppy'
pathnameto_eppy = "../"
sys.path.append(pathnameto_eppy)
from eppy import modeleditor
from eppy.modeleditor import IDF
iddfile = "../eppy/resources/iddfiles/Energy+V7_2_0.idd"
fname1 = "../eppy/resources/idffiles/V_7_2/smallfile.idf"
# <codecell>
IDF.setiddname(iddfile)
idf1 = IDF(fname1)
# <markdowncell>
# idf1 now holds all the data to your in you idf file.
#
# Now that the behind-the-scenes work is done, we can print this file.
# <codecell>
idf1.printidf()
# <markdowncell>
# Looks like the same file as before, except that all the comments are slightly different.
示例7: IDF
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
try:
idf1 = IDF(fname1)
except modeleditor.IDDNotSetError as e:
print("raised eppy.modeleditor.IDDNotSetError")
# <markdowncell>
# OK. It does not let you do that and it raises an exception
#
# So let us set the **idd** file and then open the idf file
# <codecell>
iddfile = "../eppy/resources/iddfiles/Energy+V7_2_0.idd"
IDF.setiddname(iddfile)
idf1 = IDF(fname1)
# <markdowncell>
# That worked without raising an exception
#
# Now let us try to change the **idd** file. Eppy should not let you do this and should raise an exception.
# <codecell>
try:
IDF.setiddname("anotheridd.idd")
except modeleditor.IDDAlreadySetError as e:
print("raised modeleditor.IDDAlreadySetError")
示例8: StringIO
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
import eppy.snippet as snippet
iddsnippet = iddcurrent.iddtxt
idfsnippet = snippet.idfsnippet
# idffhandle = StringIO(idfsnippet)
# iddfhandle = StringIO(iddsnippet)
# bunchdt, data, commdct, gdict = idfreader.idfreader(idffhandle, iddfhandle, None)
# idd is read only once in this test
# if it has already been read from some other test, it will continue with
# the old reading
iddfhandle = StringIO(iddcurrent.iddtxt)
if IDF.getiddname() == None:
IDF.setiddname(iddfhandle)
def test_poptrailing():
"""py.test for poptrailing"""
tdata = (
(
[1, 2, 3, '', 56, '', '', '', ''],
[1, 2, 3, '', 56]
), # lst, popped
(
[1, 2, 3, '', 56],
[1, 2, 3, '', 56]
), # lst, popped
(
[1, 2, 3, 56],
示例9: find_links
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
def find_links(f):
"""Find target/source links between e+ objects
Args:
objs (idf.idfobjects())
Returns
list of dicts,
[ {"source": int, "target":int}, .. ]
Raises:
dunno yet
"""
# start eppy
iddfile = "/usr/local/EnergyPlus-8-0-0/Energy+.idd"
IDF.setiddname(iddfile) # only do this once
# geometry_filename = os.path.join(input_directory, "model.idf") #"//home/tom/repos/www-maddog/mde/tutorials/ods-studio/afn0/ep/Output
idf = IDF(f)
#get a idf.idfobjects
# get all idfobjects
try:
listed_objects = [obj[1] for obj in idf.idfobjects.iteritems() if len(obj[1]) > 0]
all_objects = [x for lst in listed_objects for x in lst]
#all_objects = [key for key, value in idf1.idfobjects.items() if len(value) > 0]
except:
return "couldnt get all objects, Santosh - whats up?"
"""all_objects = idf.idfobjects
non_empty = []
for obj in allobjects.iteritems():
if obj[1]:
non_empty.append(obj[1][0])
"""
#afn_surfaces = idf.idfobjects['AirflowNetwork:Multizone:Surface'.upper()]
list_of_names = []
for obj in all_objects:
try:
n = getattr(obj, 'Name')
list_of_names.append(n)
except:
pass
list_of_names
# make list of all object names, source id
# loop over objects, look for other names in that object
links = []
for name in list_of_names:
for obj in all_objects:
if name in obj.obj:
#links.append("name %s found in %s" %(name, obj) )
#print(obj.Name)
#print(name)
try:
if name != obj.Name:
#print(" link from name : %s to name %s "%(name, obj.Name))
links.append(["source :%s"%name, "target: %s"%obj.Name ])
except:
try:
if name != obj.Zone_Name:
#print(" \tlink from name : %s to Zone Name %s "%(name, obj.Zone_Name))
links.append(["source :%s"%name, "target: %s"%obj.Zone_Name ])
except:
#print("\t \t Variables are not supported couldnt get name from %s"%obj.obj)
pass
示例10: distribute_job
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
from eppy.modeleditor import IDF
from manager.src.ssh_lib import sftpGetDirFiles
from manager.src.ssh_lib import sshCommandNoWait
from manager.src.ssh_lib import sshCommandWait
from manager.src import ssh_lib
from manager.src.config import config
from manager.src.ssh_lib import sftpSendFile
logging.basicConfig(level=logging.INFO)
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = os.path.join(THIS_DIR, os.pardir, 'data')
IDF.setiddname(os.path.join(DATA_DIR, 'idd/Energy+.idd'))
JOBQUEUE = os.path.join(THIS_DIR, os.pardir, os.pardir, 'queue', 'job_queue')
RESULTS = os.path.join(THIS_DIR, os.pardir, os.pardir, 'queue', 'results_queue')
def distribute_job(jobpath):
"""Find a server on which to run an EnergyPlus simulation.
Parameters
----------
jobpath : str
Path to a folder containing everything needed to run the simulation.
"""
jobdir = os.path.basename(jobpath)
示例11: open
# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import setiddname [as 别名]
from eppy import modeleditor
from eppy.modeleditor import IDF
import csv
import importdir
# Initialization #1
importdir.do("Functions",globals())
IDDFile = 'C:\EnergyPlusV8-3-0\Energy+.idd'
IDF.setiddname(IDDFile)
BatchProcesingFile = open("BatchProcessing.csv","r")
BatchProcessing = list(csv.reader(BatchProcesingFile, delimiter=',', quotechar=chr(34)))
Idx = 0
for i in range(0,len(BatchProcessing)):
# Display the progress of the script
if Idx >= 2:
print "Creating "+str(Idx-1)+" out of "+str(len(BatchProcessing)-2)+" models."
# Initialization #2
NbRows = BatchProcessing[i]
if NbRows[0] <> 'idf' and NbRows[0] <> '-':
# Initialization #3
idf_file = IDF(NbRows[0])
# Iterates throught the CSV file and execute the specified functions
for j in range(2,len(NbRows)):
# Retrieve the user input arguments
arguments = NbRows[j].split(",")
#print str(len(arguments))+" " +str(arguments[0])