Ejemplo n.º 1
0
def doreadtest(iddfile, folder, silent=False):
    """print out all the readtest results"""

    iddhandle = open(iddfile, "r")
    fname1 = thefile
    idfhandle1 = open(fname1, "rb")
    idfhandle2 = open(fname1, "rb")
    verbose = not silent
    result = simpleread.idfreadtest(iddhandle,
                                    idfhandle1,
                                    idfhandle2,
                                    verbose=verbose,
                                    save=False)
    # print result,   fname
    if result == False and (not silent):
        print("first mismatch at the above line numbers")
        print("full filepath of file that failed the read test ->")
        print("    %s" % (fname1, ))
        print()
        print("compare files 'simpleread.idf' vs 'eppyread.idf'")
        print()
    else:
        print("file passed test")
    idfhandle1.close()
    idfhandle2.close()
    iddhandle.close()
Ejemplo n.º 2
0
def doreadtest(iddfile, folder, silent=False):
    """print out all the readtest results"""
    lst = os.listdir(folder)
    lst = [l for l in lst if l.endswith('.idf')]

    iddhandle = open(iddfile, 'r')
    for i, fname in enumerate(lst[355:359]):  # lst[6:7]
        # if you want to test a specific file
        fname1 = "%s/%s" % (folder, fname)
        idfhandle1 = open(fname1, 'rb')
        idfhandle2 = open(fname1, 'rb')
        verbose = not silent
        result = simpleread.idfreadtest(iddhandle,
                                        idfhandle1,
                                        idfhandle2,
                                        verbose=verbose,
                                        save=False)
        print(i, result, fname)
        if result == False and (not silent):
            print("full filepath of file that failed the read test ->")
            print("    %s" % (fname1, ))
            print()
        idfhandle1.close()
        idfhandle2.close()
    iddhandle.close()
Ejemplo n.º 3
0
def doreadtest(iddfile, folder, silent=False):
    """print out all the readtest results"""


    iddhandle = open(iddfile, 'r')
    fname1 = thefile
    idfhandle1 = open(fname1, 'rb')
    idfhandle2 = open(fname1, 'rb')
    verbose = not silent
    result = simpleread.idfreadtest(
        iddhandle, idfhandle1, idfhandle2,
        verbose=verbose, save=False)
    # print result,   fname
    if result == False and (not silent):
        print("first mismatch at the above line numbers")
        print("full filepath of file that failed the read test ->")
        print("    %s" % (fname1, ))
        print()
        print("compare files 'simpleread.idf' vs 'eppyread.idf'")
        print()
    else:
        print("file passed test")
    idfhandle1.close()
    idfhandle2.close()
    iddhandle.close()
Ejemplo n.º 4
0
def doreadtest(iddfile, folder, silent=False):
    """print out all the readtest results"""
    lst = os.listdir(folder)
    lst = [l for l in lst if l.endswith('.idf')]
    iddhandle = open(iddfile, 'r')
    for i, fname in enumerate(lst[355:359]):  # lst[6:7]
                                    # if you want to test a specific file
        fname1 = "%s/%s" % (folder, fname)
        idfhandle1 = open(fname1, 'rb')
        idfhandle2 = open(fname1, 'rb')
        verbose = not silent
        result = simpleread.idfreadtest(
            iddhandle, idfhandle1, idfhandle2,
            verbose=verbose, save=False)
        print(i, result, fname)
        if result == False and (not silent):
            print("full filepath of file that failed the read test ->")
            print("    %s" % (fname1, ))
            print()
        idfhandle1.close()
        idfhandle2.close()
    iddhandle.close()
Ejemplo n.º 5
0
def test_idfreadtest():
    """py.test for idfreadtest"""
    data = (
        ("""!IDD_Version 7.2.0.006
Version,
      \\unique-object
      \\format singleLine
  A1 ; \\field Version Identifier

SimulationControl,
      \\unique-object
  A1, \\field Do Zone Sizing Calculation
  A2, \\field Do System Sizing Calculation
  A3, \\field Do Plant Sizing Calculation
  A4, \\field Run Simulation for Sizing Periods
  A5; \\field Run Simulation for Weather File Run Periods

Building,
       \\unique-object
  A1 , \\field Name
  N1 , \\field North Axis
  A2 , \\field Terrain
  N2 , \\field Loads Convergence Tolerance Value
  N3 , \\field Temperature Convergence Tolerance Value
  A3 , \\field Solar Distribution
  N4 , \\field Maximum Number of Warmup Days
  N5 ; \\field Minimum Number of Warmup Days

Site:Location,
       \\unique-object
  A1 , \\field Name
  N1 , \\field Latitude
  N2 , \\field Longitude
  N3 , \\field Time Zone
  N4 ; \\field Elevation

""", """
VERSION,
    7.3;                      !- Version Identifier

SIMULATIONCONTROL,
    Yes,                      !- Do Zone Sizing Calculation
    Yes,                      !- Do System Sizing Calculation
    Yes,                      !- Do Plant Sizing Calculation
    No,                       !- Run Simulation for Sizing Periods
    Yes;                      !- Run Simulation for Weather File Run Periods

BUILDING,
    Empire State Building,    !- Name
    30.0,                     !- North Axis
    City,                     !- Terrain
    0.04,                     !- Loads Convergence Tolerance Value
    0.4,                      !- Temperature Convergence Tolerance Value
    FullExterior,             !- Solar Distribution
    25,                       !- Maximum Number of Warmup Days
    6;                        !- Minimum Number of Warmup Days

SITE:LOCATION,
    CHICAGO_IL_USA TMY2-94846,    !- Name
    41.78,                    !- Latitude
    -87.75,                   !- Longitude
    -6.0,                     !- Time Zone
    190.0;                    !- Elevation
"""),  # iddtxt, idftxt
    )
    for iddtxt, idftxt in data:
        iddhandle = StringIO.StringIO(iddtxt)
        idfhandle1 = StringIO.StringIO(idftxt)
        idfhandle2 = StringIO.StringIO(idftxt)
        result = simpleread.idfreadtest(iddhandle, idfhandle1, idfhandle2)
        assert result == True
Ejemplo n.º 6
0
def test_idfreadtest():
    """py.test for idfreadtest"""
    data = (("""!IDD_Version 7.2.0.006
Version,
      \\unique-object
      \\format singleLine
  A1 ; \\field Version Identifier

SimulationControl,
      \\unique-object
  A1, \\field Do Zone Sizing Calculation
  A2, \\field Do System Sizing Calculation
  A3, \\field Do Plant Sizing Calculation
  A4, \\field Run Simulation for Sizing Periods
  A5; \\field Run Simulation for Weather File Run Periods

Building,
       \\unique-object
  A1 , \\field Name
  N1 , \\field North Axis
  A2 , \\field Terrain
  N2 , \\field Loads Convergence Tolerance Value
  N3 , \\field Temperature Convergence Tolerance Value
  A3 , \\field Solar Distribution
  N4 , \\field Maximum Number of Warmup Days
  N5 ; \\field Minimum Number of Warmup Days

Site:Location,
       \\unique-object
  A1 , \\field Name
  N1 , \\field Latitude
  N2 , \\field Longitude
  N3 , \\field Time Zone
  N4 ; \\field Elevation

""",
             """
VERSION,
    7.3;                      !- Version Identifier

SIMULATIONCONTROL,
    Yes,                      !- Do Zone Sizing Calculation
    Yes,                      !- Do System Sizing Calculation
    Yes,                      !- Do Plant Sizing Calculation
    No,                       !- Run Simulation for Sizing Periods
    Yes;                      !- Run Simulation for Weather File Run Periods

BUILDING,
    Empire State Building,    !- Name
    30.0,                     !- North Axis
    City,                     !- Terrain
    0.04,                     !- Loads Convergence Tolerance Value
    0.4,                      !- Temperature Convergence Tolerance Value
    FullExterior,             !- Solar Distribution
    25,                       !- Maximum Number of Warmup Days
    6;                        !- Minimum Number of Warmup Days

SITE:LOCATION,
    CHICAGO_IL_USA TMY2-94846,    !- Name
    41.78,                    !- Latitude
    -87.75,                   !- Longitude
    -6.0,                     !- Time Zone
    190.0;                    !- Elevation
"""
            ), # iddtxt, idftxt
           )
    for iddtxt, idftxt in data:
        iddhandle = StringIO(iddtxt)
        idfhandle1 = StringIO(idftxt)
        idfhandle2 = StringIO(idftxt)
        result = simpleread.idfreadtest(iddhandle, idfhandle1, idfhandle2)
        assert result == True