# Copyright (c) 2012 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= """do just walls in eplusinterface""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from eppy.idfreader import idfreader iddfile = "../iddfiles/Energy+V7_0_0_036.idd" fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" bunchdt, data, commdct = idfreader(fname, iddfile) surfaces = bunchdt['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces for surface in surfaces: name = surface.Name area = surface.area height = surface.height width = surface.width azimuth = surface.azimuth tilt = surface.tilt print(name, area, height, width, azimuth, tilt)
# Copyright (c) 2012 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= """do just walls in eplusinterface""" from eppy.idfreader import idfreader iddfile = "../iddfiles/Energy+V7_0_0_036.idd" fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" bunchdt, data, commdct = idfreader(fname, iddfile) surfaces = bunchdt['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces for surface in surfaces: name = surface.Name area = surface.area height = surface.height width = surface.width azimuth = surface.azimuth tilt = surface.tilt print(name, area, height, width, azimuth, tilt)
# iddfile = "../iddfiles/Energy+V7_0_0_036.idd" # fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" # iddsnippet = snippet.iddsnippet from eppy.iddcurrent import iddcurrent iddsnippet = iddcurrent.iddtxt idfsnippet = snippet.idfsnippet from io import StringIO idffhandle = StringIO(idfsnippet) iddfhandle = StringIO(iddsnippet) bunchdt, data, commdct, idd_index = idfreader(idffhandle, iddfhandle) def test_readwrite(): """py.test for ex_readwrite""" txt = str(data) head = "Zone,\n PLENUM-1,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1,\n 1,\n 0.609600067,\n 283.2;\n\n" tail = "\n\nBuildingSurface:Detailed,\n WALL-1PF,\n WALL,\n WALL-1,\n PLENUM-1,\n Outdoors,\n ,\n SunExposed,\n WindExposed,\n 0.5,\n 4,\n 0.0,\n 0.0,\n 3.0,\n 0.0,\n 0.0,\n 2.4,\n 30.5,\n 0.0,\n 2.4,\n 30.5,\n 0.0,\n 3.0;\n\n" # assert head == txt[:108] # assert tail == txt[-280:] def test_pythonic(): """py.test for ex_pythonic.py""" zones = bunchdt["zone"] # all the zones zone0 = zones[0]
import bunch import eppy.idfreader as idfreader import eppy.modeleditor as modeleditor import eppy.snippet as snippet from eppy.modeleditor import IDF from eppy.iddcurrent import iddcurrent iddsnippet = iddcurrent.iddtxt idfsnippet = snippet.idfsnippet from StringIO import StringIO idffhandle = StringIO(idfsnippet) iddfhandle = StringIO(iddsnippet) bunchdt, data, commdct = idfreader.idfreader(idffhandle, iddfhandle) # 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 from eppy.iddcurrent import iddcurrent iddfhandle = StringIO(iddcurrent.iddtxt) if IDF.getiddname() == None: IDF.setiddname(iddfhandle) def test_poptrailing(): """py.test for poptrailing""" data = (([1, 2, 3, '', 56, '', '', '', ''], [1, 2, 3, '', 56]), # lst, poped ([1, 2, 3, '', 56], [1, 2, 3, '', 56]), # lst, poped
import eppy.modeleditor as modeleditor # iddfile = "../iddfiles/Energy+V7_0_0_036.idd" # fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" # iddsnippet = snippet.iddsnippet from eppy.iddcurrent import iddcurrent iddsnippet = iddcurrent.iddtxt idfsnippet = snippet.idfsnippet from io import StringIO idffhandle = StringIO(idfsnippet) iddfhandle = StringIO(iddsnippet) bunchdt, data, commdct = idfreader(idffhandle, iddfhandle) def test_readwrite(): """py.test for ex_readwrite""" txt = str(data) head = 'Zone,\n PLENUM-1,\n 0.0,\n 0.0,\n 0.0,\n 0.0,\n 1,\n 1,\n 0.609600067,\n 283.2;\n\n' tail = '\n\nBuildingSurface:Detailed,\n WALL-1PF,\n WALL,\n WALL-1,\n PLENUM-1,\n Outdoors,\n ,\n SunExposed,\n WindExposed,\n 0.5,\n 4,\n 0.0,\n 0.0,\n 3.0,\n 0.0,\n 0.0,\n 2.4,\n 30.5,\n 0.0,\n 2.4,\n 30.5,\n 0.0,\n 3.0;\n\n' # assert head == txt[:108] # assert tail == txt[-280:] def test_pythonic(): """py.test for ex_pythonic.py""" zones = bunchdt['zone'.upper()] # all the zones zone0 = zones[0]
from __future__ import division from __future__ import print_function from __future__ import unicode_literals from six import StringIO import pytest from eppy import modeleditor import eppy.idfreader as idfreader import eppy.snippet as snippet from eppy.iddcurrent import iddcurrent idfsnippet = snippet.idfsnippet iddsnippet = iddcurrent.iddtxt idffhandle = StringIO(idfsnippet) iddfhandle = StringIO(iddsnippet) bunchdt, data, commdct, idd_index = idfreader.idfreader(idffhandle, iddfhandle, None) def test_addobject(): """py.test for addobject""" thedata = ( # key, aname, fielddict ('ZONE', None, dict(Name="Gumby", X_Origin=50)), ('ZONE', 'karamba', {}), # key, aname, fielddict ('ZONE', None, {}), # key, aname, fielddict # key, aname, fielddict ('ZONE', None, dict(Name="Gumby", X_Origin=50)), ) for key, aname, fielddict in thedata: result = modeleditor.addobject( bunchdt, data, commdct, key, None, aname, **fielddict)