'''JSON parameters'''
with open('jsonOUTPUT_PMVOpt10.txt') as jsonParams:
    paramSet = json.load(jsonParams)
'''files used for energy plus simulation'''
iddfile = "C:\EnergyPlusV8-5-0\Energy+.idd"
fname = "SmallOffice.idf"
weatherfile = "USA_UT_Salt.Lake.City.Intl.AP.725720_TMY3.epw"
'''initialize idf file'''
IDF.setiddname(iddfile)
idfdevice = IDF(fname, weatherfile)
'''declare simulation run period'''
Begin_Month = '1'
Begin_Day_of_Month = '14'
End_Month = '1'
End_Day_of_Month = '24'
'''configure the idf file that will be used for simulations'''
configuresmalloffice(idfdevice, Begin_Month, Begin_Day_of_Month, End_Month,
                     End_Day_of_Month)
'''run parametric simulations'''
for i in range(N):
    # for i in range(50):
    '''update JSON file and input parameter array for training meta model'''
    runJSON = {}

    for obj in paramSet['input']:
        runJSON[obj['eppy json string']] = obj['Sample Values'][i]

    json_functions.updateidf(idfdevice, runJSON)
    '''run IDF and the associated batch file to export the custom csv output'''
    idfdevice.run(verbose='q')
예제 #2
0
def test_updateidf():
    """py.test for updateidf"""
    iddtxt = """!IDD_Version 8.4.0"""
    data = (
    (
    """Version,
        8.3;                     !- Version Identifier

    """,
    {"idf.version..Version_Identifier":"0.1"},
    "version",
    "Version_Identifier",
    "0.1"), # idftxt, dct, key, field, fieldval
    (
    """SimulationControl,
    No,                      !- Do Zone Sizing Calculation
    No,                      !- Do System Sizing Calculation
    No,                      !- Do Plant Sizing Calculation
    No,                      !- Run Simulation for Sizing Periods
    Yes;                     !- Run Simulation for Weather File Run Periods
    """,
    {"idf.SimulationControl..Do_Zone_Sizing_Calculation":"Yes"},
    "SimulationControl",
    "Do_Zone_Sizing_Calculation",
    "Yes"), # idftxt, dct, key, field, fieldval
    (
    """Building,
    Untitled,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
    {"idf.BUilding.Untitled.Terrain":"Rural"},
    "Building",
    "Terrain",
    "Rural"), # idftxt, dct, key, field, fieldval
    # make a new object
    (
    """
    """,
    {"idf.BUilding.Taj.Terrain":"Rural"},
    "Building",
    "Terrain",
    "Rural"), # idftxt, dct, key, field, fieldval
    # make a new object with no Name field
    (
    """
    """,
    {"idf.GlobalGeometryRules..Starting_Vertex_Position":"UpperLeftCorner"},
    "GlobalGeometryRules",
    "Starting_Vertex_Position",
    "UpperLeftCorner"), # idftxt, dct, key, field, fieldval
    (
    """Building,
    Name.name,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
    {"idf.BUilding.Name.name.Terrain":"Rural"},
    "Building",
    "Terrain",
    "Rural"), # idftxt, dct, key, field, fieldval
    (
    """Building,
    Name.name,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
    {"idf.BUilding.'Name.name'.Terrain":"Rural"},
    "Building",
    "Terrain",
    "Rural"), # idftxt, dct, key, field, fieldval
    )
    for idftxt, dct, key, field, fieldval in data:
        idfhandle = StringIO(idftxt)
        idf = IDF(idfhandle)
        json_functions.updateidf(idf, dct)
        assert idf.idfobjects[key.upper()][0][field] ==fieldval
예제 #3
0
    def __init__(self, idfdevice, CLG_SETPOINT, HTG_SETPOINT):
        # modify idf with inputs
        self.runJSON = {
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_1':
            'Through: %s/%s' % ('12', '31'),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_2':
            'For: Weekday',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_3':
            'Until: 6:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_4':
            str(CLG_SETPOINT[0]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_5':
            'Until: 7:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_6':
            str(CLG_SETPOINT[1]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_7':
            'Until: 8:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_8':
            str(CLG_SETPOINT[2]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_9':
            'Until: 9:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_10':
            str(CLG_SETPOINT[3]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_11':
            'Until: 10:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_12':
            str(CLG_SETPOINT[4]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_13':
            'Until: 11:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_14':
            str(CLG_SETPOINT[5]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_15':
            'Until: 12:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_16':
            str(CLG_SETPOINT[6]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_17':
            'Until: 13:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_18':
            str(CLG_SETPOINT[7]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_19':
            'Until: 14:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_20':
            str(CLG_SETPOINT[8]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_21':
            'Until: 15:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_22':
            str(CLG_SETPOINT[9]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_23':
            'Until: 16:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_24':
            str(CLG_SETPOINT[10]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_25':
            'Until: 17:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_26':
            str(CLG_SETPOINT[11]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_27':
            'Until: 18:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_28':
            str(CLG_SETPOINT[12]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_29':
            'Until: 19:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_30':
            str(CLG_SETPOINT[13]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_31':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_32':
            str(CLG_SETPOINT[14]),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_33':
            'For: Weekend',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_34':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_35':
            str(29.44),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_36':
            'For: Holiday',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_37':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_38':
            str(29.44),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_39':
            'For: WinterDesignDay',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_40':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_41':
            str(29.44),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_42':
            'For: SummerDesignDay',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_43':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_44':
            str(29.44),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_45':
            'For: CustomDay1',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_46':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_47':
            str(29.44),
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_48':
            'For: CustomDay2',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_49':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_50':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_1':
            'Through: %s/%s' % ('12', '31'),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_2':
            'For: Weekday',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_3':
            'Until: 6:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_4':
            str(HTG_SETPOINT[0]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_5':
            'Until: 7:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_6':
            str(HTG_SETPOINT[1]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_7':
            'Until: 8:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_8':
            str(HTG_SETPOINT[2]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_9':
            'Until: 9:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_10':
            str(HTG_SETPOINT[3]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_11':
            'Until: 10:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_12':
            str(HTG_SETPOINT[4]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_13':
            'Until: 11:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_14':
            str(HTG_SETPOINT[5]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_15':
            'Until: 12:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_16':
            str(HTG_SETPOINT[6]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_17':
            'Until: 13:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_18':
            str(HTG_SETPOINT[7]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_19':
            'Until: 14:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_20':
            str(HTG_SETPOINT[8]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_21':
            'Until: 15:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_22':
            str(HTG_SETPOINT[9]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_23':
            'Until: 16:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_24':
            str(HTG_SETPOINT[10]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_25':
            'Until: 17:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_26':
            str(HTG_SETPOINT[11]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_27':
            'Until: 18:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_28':
            str(HTG_SETPOINT[12]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_29':
            'Until: 19:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_30':
            str(HTG_SETPOINT[13]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_31':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_32':
            str(HTG_SETPOINT[14]),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_33':
            'For: Weekend',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_34':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_35':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_36':
            'For: Holiday',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_37':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_38':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_39':
            'For: WinterDesignDay',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_40':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_41':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_42':
            'For: SummerDesignDay',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_43':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_44':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_45':
            'For: CustomDay1',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_46':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_47':
            str(29.44),
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_48':
            'For: CustomDay2',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_49':
            'Until: 24:00',
            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_50':
            str(29.44)
        }

        # self.runJSON = {'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_1': 'Through: 12/31',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_2': 'For: Weekday',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_3': 'Until: 6:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_4': str(HTG_SETPOINT[0]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_5': 'Until: 7:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_6': str(HTG_SETPOINT[1]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_7': 'Until: 8:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_8': str(HTG_SETPOINT[2]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_9': 'Until: 19:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_10': str(HTG_SETPOINT[3]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_11': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_12': str(HTG_SETPOINT[4]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_13': 'For: Weekend',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_14': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_15': str(HTG_SETPOINT[5]),
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_16': 'For: Holiday',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_17': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_18': str(HTG_SETPOINT[6]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_1': 'Through: 12/31',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_2': 'For: Weekday',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_3': 'Until: 6:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_4': str(CLG_SETPOINT[0]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_5': 'Until: 7:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_6': str(CLG_SETPOINT[1]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_7': 'Until: 8:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_8': str(CLG_SETPOINT[2]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_9': 'Until: 19:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_10': str(CLG_SETPOINT[3]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_11': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_12': str(CLG_SETPOINT[4]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_13': 'For: Weekend',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_14': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_15': str(CLG_SETPOINT[5]),
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_16': 'For: Holiday',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_17': 'Until: 24:00',
        #            'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_18': str(CLG_SETPOINT[6])}

        json_functions.updateidf(idfdevice, self.runJSON)

        # run IDF and the associated batch file to export the custom csv output
        # self, idf='SmallOffice.idf', weather='USA_UT_Salt.Lake.City.Intl.AP.725720_TMY3.epw', ep_version='8-5-0'
        idfdevice.run(verbose='q')
        os.system(r'CD E:\Masters Thesis\EnergyPlus MPC\Simulations\Baseline')
        os.system('CustomCSV SO OUTPUT')

        # self.smallofficeoutputs('SO_OUTPUT_hourly.csv')

        # Read csv file into new data dictionary
        newEntry = defaultdict(list)
        with open('SO_OUTPUT_hourly.csv', newline='') as newFile:
            newData = csv.DictReader(newFile)
            for row in newData:
                [newEntry[key].append(value) for key, value in row.items()]
        '''Date/Time array'''
        self.DateTime = np.asarray(newEntry['Date/Time'], dtype=str)
        '''PMV values for core zone'''
        self.corePMV = np.asarray(newEntry[
            'CORE_ZN:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                  dtype=np.float32)
        self.corePMV_mean = np.mean(self.corePMV)
        self.corePMV_max = np.max(self.corePMV)
        self.corePMV_min = np.min(self.corePMV)
        '''PMV values for zone 1'''
        self.zn1PMV = np.asarray(newEntry[
            'PERIMETER_ZN_1:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn1PMV_mean = np.mean(self.zn1PMV)
        self.zn1PMV_max = np.max(self.zn1PMV)
        self.zn1PMV_min = np.min(self.zn1PMV)
        '''PMV values for zone 2'''
        self.zn2PMV = np.asarray(newEntry[
            'PERIMETER_ZN_2:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn2PMV_mean = np.mean(self.zn2PMV)
        self.zn2PMV_max = np.max(self.zn2PMV)
        self.zn2PMV_min = np.min(self.zn2PMV)
        '''PMV values for zone 3'''
        self.zn3PMV = np.asarray(newEntry[
            'PERIMETER_ZN_3:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn3PMV_mean = np.mean(self.zn3PMV)
        self.zn3PMV_max = np.max(self.zn3PMV)
        self.zn3PMV_min = np.min(self.zn3PMV)
        '''PMV values for zone 4'''
        self.zn4PMV = np.asarray(newEntry[
            'PERIMETER_ZN_4:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn4PMV_mean = np.mean(self.zn4PMV)
        self.zn4PMV_max = np.max(self.zn4PMV)
        self.zn4PMV_min = np.min(self.zn4PMV)
        '''PMV values for all zones'''
        self.allPMV = np.asarray([[self.corePMV], [self.zn1PMV], [self.zn2PMV],
                                  [self.zn3PMV], [self.zn4PMV]])
        self.allPMV_mean1 = np.mean(self.allPMV, 0)
        self.allPMV_mean2 = np.mean(self.allPMV_mean1)
        self.allPMV_max = np.amax(self.allPMV)
        self.allPMV_min = np.amin(self.allPMV)
        '''HVAC power demand (kW)'''
        self.hvacPower = np.asarray(newEntry[
            'Whole Building:Facility Total HVAC Electric Demand Power [W](Hourly)'],
                                    dtype=np.float32)
        self.hvacPower_ave = np.mean(self.hvacPower)
        self.hvacPower_max = np.max(self.hvacPower)
예제 #4
0
def test_updateidf():
    """py.test for updateidf"""
    iddtxt = """!IDD_Version 8.4.0"""
    data = (
        (
            """Version,
        8.3;                     !- Version Identifier

    """,
            {
                "idf.version..Version_Identifier": "0.1"
            },
            "version",
            "Version_Identifier",
            "0.1",
        ),  # idftxt, dct, key, field, fieldval
        (
            """SimulationControl,
    No,                      !- Do Zone Sizing Calculation
    No,                      !- Do System Sizing Calculation
    No,                      !- Do Plant Sizing Calculation
    No,                      !- Run Simulation for Sizing Periods
    Yes;                     !- Run Simulation for Weather File Run Periods
    """,
            {
                "idf.SimulationControl..Do_Zone_Sizing_Calculation": "Yes"
            },
            "SimulationControl",
            "Do_Zone_Sizing_Calculation",
            "Yes",
        ),  # idftxt, dct, key, field, fieldval
        (
            """Building,
    Untitled,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
            {
                "idf.BUilding.Untitled.Terrain": "Rural"
            },
            "Building",
            "Terrain",
            "Rural",
        ),  # idftxt, dct, key, field, fieldval
        # make a new object
        (
            """
    """,
            {
                "idf.BUilding.Taj.Terrain": "Rural"
            },
            "Building",
            "Terrain",
            "Rural",
        ),  # idftxt, dct, key, field, fieldval
        # make a new object with no Name field
        (
            """
    """,
            {
                "idf.GlobalGeometryRules..Starting_Vertex_Position":
                "UpperLeftCorner"
            },
            "GlobalGeometryRules",
            "Starting_Vertex_Position",
            "UpperLeftCorner",
        ),  # idftxt, dct, key, field, fieldval
        (
            """Building,
    Name.name,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
            {
                "idf.BUilding.Name.name.Terrain": "Rural"
            },
            "Building",
            "Terrain",
            "Rural",
        ),  # idftxt, dct, key, field, fieldval
        (
            """Building,
    Name.name,                !- Name
    0.0,                     !- North Axis {deg}
    City,                    !- Terrain
    0.04,                    !- Loads Convergence Tolerance Value
    0.4,                     !- Temperature Convergence Tolerance Value {deltaC}
    FullInteriorAndExterior, !- Solar Distribution
    25,                      !- Maximum Number of Warmup Days
    ;                        !- Minimum Number of Warmup Days
    """,
            {
                "idf.BUilding.'Name.name'.Terrain": "Rural"
            },
            "Building",
            "Terrain",
            "Rural",
        ),  # idftxt, dct, key, field, fieldval
    )
    for idftxt, dct, key, field, fieldval in data:
        idfhandle = StringIO(idftxt)
        idf = IDF(idfhandle)
        json_functions.updateidf(idf, dct)
        assert idf.idfobjects[key][0][field] == fieldval
    def __init__(self, idfdevice, CLG_SETPOINT, HTG_SETPOINT):
        '''update setpoints and run energyplus simulation'''

        '''append setpoints from optimizer to the optimized list'''
        # OptCS[(24 - len(CLG_SETPOINT)):] = CLG_SETPOINT
        # OptHS[(24 - len(HTG_SETPOINT)):] = HTG_SETPOINT

        '''update idf with uncertain parameters for the parameter file listed'''
        runJSON = {}
        for object in paramSet['input']: runJSON[object['eppy json string']] = object['Sample Values'][random.randint(0, len(object['Sample Values'])-1)]
        json_functions.updateidf(idfdevice, runJSON)

        '''modify idf with inputs'''
        self.runJSON = {'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_1': 'Through: %s/%s' % ('12', '31'),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_2': 'For: Weekday',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_3': 'Until: 1:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_4': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_5': 'Until: 2:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_6': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_7': 'Until: 3:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_8': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_9': 'Until: 4:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_10': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_11': 'Until: 5:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_12': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_13': 'Until: 6:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_14': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_15': 'Until: 7:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_16': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_17': 'Until: 8:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_18': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_19': 'Until: 9:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_20': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_21': 'Until: 10:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_22': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_23': 'Until: 11:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_24': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_25': 'Until: 12:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_26': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_27': 'Until: 13:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_28': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_29': 'Until: 14:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_30': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_31': 'Until: 15:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_32': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_33': 'Until: 16:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_34': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_35': 'Until: 17:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_36': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_37': 'Until: 18:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_38': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_39': 'Until: 19:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_40': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_41': 'Until: 20:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_42': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_43': 'Until: 21:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_44': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_45': 'Until: 22:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_46': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_47': 'Until: 23:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_48': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_49': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_50': str(CLG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_51': 'For: Weekend',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_52': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_53': str(29.44),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_54': 'For: Holiday',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_55': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_56': str(29.44),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_57': 'For: WinterDesignDay',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_58': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_59': str(29.44),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_60': 'For: SummerDesignDay',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_61': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_62': str(29.44),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_63': 'For: CustomDay1',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_64': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_65': str(29.44),
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_66': 'For: CustomDay2',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_67': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.CLGSETP_SCH_YES_OPTIMUM.Field_68': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_1': 'Through: %s/%s' % ('12', '31'),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_2': 'For: Weekday',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_3': 'Until: 1:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_4': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_5': 'Until: 2:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_6': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_7': 'Until: 3:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_8': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_9': 'Until: 4:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_10': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_11': 'Until: 5:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_12': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_13': 'Until: 6:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_14': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_15': 'Until: 7:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_16': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_17': 'Until: 8:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_18': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_19': 'Until: 9:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_20': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_21': 'Until: 10:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_22': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_23': 'Until: 11:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_24': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_25': 'Until: 12:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_26': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_27': 'Until: 13:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_28': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_29': 'Until: 14:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_30': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_31': 'Until: 15:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_32': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_33': 'Until: 16:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_34': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_35': 'Until: 17:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_36': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_37': 'Until: 18:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_38': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_39': 'Until: 19:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_40': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_41': 'Until: 20:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_42': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_43': 'Until: 21:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_44': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_45': 'Until: 22:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_46': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_47': 'Until: 23:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_48': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_49': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_50': str(HTG_SETPOINT[0]),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_51': 'For: Weekend',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_52': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_53': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_54': 'For: Holiday',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_55': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_56': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_57': 'For: WinterDesignDay',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_58': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_59': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_60': 'For: SummerDesignDay',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_61': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_62': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_63': 'For: CustomDay1',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_64': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_65': str(29.44),
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_66': 'For: CustomDay2',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_67': 'Until: 24:00',
                        'idf.SCHEDULE:COMPACT.HTGSETP_SCH_YES_OPTIMUM.Field_68': str(29.44)
                        }

        json_functions.updateidf(idfdevice, self.runJSON)

        '''run IDF and the associated batch file to export the custom csv output'''
        '''self, idf='SmallOffice.idf', weather='USA_UT_Salt.Lake.City.Intl.AP.725720_TMY3.epw', ep_version='8-5-0'''
        idfdevice.run(verbose='q')
        os.system(r'CD E:\Masters Thesis\EnergyPlus MPC\Simulations\Baseline')
        os.system('CustomCSV SO OUTPUT')

        # self.smallofficeoutputs('SO_OUTPUT_hourly.csv')

        '''Read csv file into new data dictionary'''
        newEntry = defaultdict(list)
        with open('SO_OUTPUT_hourly.csv', newline='') as newFile:
            newData = csv.DictReader(newFile)
            for row in newData:
                [newEntry[key].append(value) for key, value in row.items()]

        '''Date/Time array'''
        self.DateTime = np.asarray(newEntry['Date/Time'], dtype=str)

        '''Outdoor dry bulb temperature'''
        self.outdoorT = np.asarray(newEntry['Environment:Site Outdoor Air Drybulb Temperature [C](Hourly)'],
                                  dtype=np.float32)

        '''PMV values for core zone'''
        self.corePMV = np.asarray(newEntry['CORE_ZN:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                  dtype=np.float32)
        self.corePMV_mean = np.mean(self.corePMV)
        self.corePMV_max = np.max(self.corePMV)
        self.corePMV_min = np.min(self.corePMV)

        '''PMV values for zone 1'''
        self.zn1PMV = np.asarray(newEntry['PERIMETER_ZN_1:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn1PMV_mean = np.mean(self.zn1PMV)
        self.zn1PMV_max = np.max(self.zn1PMV)
        self.zn1PMV_min = np.min(self.zn1PMV)

        '''PMV values for zone 2'''
        self.zn2PMV = np.asarray(newEntry['PERIMETER_ZN_2:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn2PMV_mean = np.mean(self.zn2PMV)
        self.zn2PMV_max = np.max(self.zn2PMV)
        self.zn2PMV_min = np.min(self.zn2PMV)

        '''PMV values for zone 3'''
        self.zn3PMV = np.asarray(newEntry['PERIMETER_ZN_3:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn3PMV_mean = np.mean(self.zn3PMV)
        self.zn3PMV_max = np.max(self.zn3PMV)
        self.zn3PMV_min = np.min(self.zn3PMV)

        '''PMV values for zone 4'''
        self.zn4PMV = np.asarray(newEntry['PERIMETER_ZN_4:Zone Thermal Comfort Fanger Model PMV [](Hourly)'],
                                 dtype=np.float32)
        self.zn4PMV_mean = np.mean(self.zn4PMV)
        self.zn4PMV_max = np.max(self.zn4PMV)
        self.zn4PMV_min = np.min(self.zn4PMV)

        '''PMV values for all zones'''
        self.allPMV = np.asarray([[self.corePMV], [self.zn1PMV], [self.zn2PMV], [self.zn3PMV], [self.zn4PMV]])
        self.allPMV_mean1 = np.mean(self.allPMV, 0)
        self.allPMV_mean2 = np.mean(self.allPMV_mean1)
        self.allPMV_max = np.amax(self.allPMV)
        self.allPMV_min = np.amin(self.allPMV)

        '''HVAC power demand (kW)'''
        self.hvacPower = np.asarray(newEntry['Whole Building:Facility Total HVAC Electric Demand Power [W](Hourly)'],
                                     dtype=np.float32)
        self.hvacPower_ave = np.mean(self.hvacPower)
        self.hvacPower_max = np.max(self.hvacPower)

        '''Core Zone Cooling Setpoint (C)'''
        self.coreCS = np.asarray(newEntry['CORE_ZN:Zone Thermostat Cooling Setpoint Temperature [C](Hourly)'],
                                       dtype=np.float32)
        self.coreCS_mean = np.mean(self.coreCS)
        self.coreCS_max = np.max(self.coreCS)
        self.coreCS_min = np.min(self.coreCS)

        '''Zone 1 Cooling Setpoint (C)'''
        self.zn1CS = np.asarray(newEntry['PERIMETER_ZN_1:Zone Thermostat Cooling Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn1CS_mean = np.mean(self.zn1CS)
        self.zn1CS_max = np.max(self.zn1CS)
        self.zn1CS_min = np.min(self.zn1CS)

        '''Zone 2 Cooling Setpoint (C)'''
        self.zn2CS = np.asarray(newEntry['PERIMETER_ZN_2:Zone Thermostat Cooling Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn2CS_mean = np.mean(self.zn2CS)
        self.zn2CS_max = np.max(self.zn2CS)
        self.zn2CS_min = np.min(self.zn2CS)

        '''Zone 3 Cooling Setpoint (C)'''
        self.zn3CS = np.asarray(newEntry['PERIMETER_ZN_3:Zone Thermostat Cooling Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn3CS_mean = np.mean(self.zn3CS)
        self.zn3CS_max = np.max(self.zn3CS)
        self.zn3CS_min = np.min(self.zn3CS)

        '''Zone 4 Cooling Setpoint (C)'''
        self.zn4CS = np.asarray(newEntry['PERIMETER_ZN_4:Zone Thermostat Cooling Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn4CS_mean = np.mean(self.zn4CS)
        self.zn4CS_max = np.max(self.zn4CS)
        self.zn4CS_min = np.min(self.zn4CS)

        '''All Zones Cooling Setpoint (C)'''
        self.allCS = np.asarray([[self.coreCS], [self.zn1CS], [self.zn2CS], [self.zn3CS], [self.zn4CS]])
        self.allCS_mean1 = np.mean(self.allCS, 1)
        self.allCS_mean2 = np.mean(self.allCS_mean1)
        self.allCS_max = np.max(self.allCS)
        self.allCS_min = np.min(self.allCS)

        '''Core Zone Heating Setpoint (C)'''
        self.coreHS = np.asarray(newEntry['CORE_ZN:Zone Thermostat Heating Setpoint Temperature [C](Hourly)'],
                                        dtype=np.float32)
        self.coreHS_mean = np.mean(self.coreHS)
        self.coreHS_max = np.max(self.coreHS)
        self.coreHS_min = np.min(self.coreHS)

        '''Zone 1 Heating Setpoint (C)'''
        self.zn1HS = np.asarray(newEntry['PERIMETER_ZN_1:Zone Thermostat Heating Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn1HS_mean = np.mean(self.zn1HS)
        self.zn1HS_max = np.max(self.zn1HS)
        self.zn1HS_min = np.min(self.zn1HS)

        '''Zone 2 Heating Setpoint (C)'''
        self.zn2HS = np.asarray(newEntry['PERIMETER_ZN_2:Zone Thermostat Heating Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn2HS_mean = np.mean(self.zn2HS)
        self.zn2HS_max = np.max(self.zn2HS)
        self.zn2HS_min = np.min(self.zn2HS)

        '''Zone 3 Heating Setpoint (C)'''
        self.zn3HS = np.asarray(newEntry['PERIMETER_ZN_3:Zone Thermostat Heating Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn3HS_mean = np.mean(self.zn3HS)
        self.zn3HS_max = np.max(self.zn3HS)
        self.zn3HS_min = np.min(self.zn3HS)

        '''Zone 4 Heating Setpoint (C)'''
        self.zn4HS = np.asarray(newEntry['PERIMETER_ZN_4:Zone Thermostat Heating Setpoint Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn4HS_mean = np.mean(self.zn4HS)
        self.zn4HS_max = np.max(self.zn4HS)
        self.zn4HS_min = np.min(self.zn4HS)

        '''All Zones Heating Setpoint (C)'''
        self.allHS = np.asarray([[self.coreHS], [self.zn1HS], [self.zn2HS], [self.zn3HS], [self.zn4HS]])
        self.allHS_mean1 = np.mean(self.allHS, 1)
        self.allHS_mean2 = np.mean(self.allHS_mean1)
        self.allHS_max = np.max(self.allHS)
        self.allHS_min = np.min(self.allHS)

        '''Core Zone Thermostat Temperature (C)'''
        self.coreT = np.asarray(newEntry['CORE_ZN:Zone Thermostat Air Temperature [C](Hourly)'],
                                        dtype=np.float32)
        self.coreT_mean = np.mean(self.coreT)
        self.coreT_max = np.max(self.coreT)
        self.coreT_min = np.min(self.coreT)

        '''Zone 1 Thermostat Temperature (C)'''
        self.zn1T = np.asarray(newEntry['PERIMETER_ZN_1:Zone Thermostat Air Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn1T_mean = np.mean(self.zn1T)
        self.zn1T_max = np.max(self.zn1T)
        self.zn1T_min = np.min(self.zn1T)

        '''Zone 2 Thermostat Temperature (C)'''
        self.zn2T = np.asarray(newEntry['PERIMETER_ZN_2:Zone Thermostat Air Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn2T_mean = np.mean(self.zn2T)
        self.zn2T_max = np.max(self.zn2T)
        self.zn2T_min = np.min(self.zn2T)

        '''Zone 3 Thermostat Temperature (C)'''
        self.zn3T = np.asarray(newEntry['PERIMETER_ZN_3:Zone Thermostat Air Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn3T_mean = np.mean(self.zn3T)
        self.zn3T_max = np.max(self.zn3T)
        self.zn3T_min = np.min(self.zn3T)

        '''Zone 4 Thermostat Temperature (C)'''
        self.zn4T = np.asarray(newEntry['PERIMETER_ZN_4:Zone Thermostat Air Temperature [C](Hourly)'],
                       dtype=np.float32)
        self.zn4T_mean = np.mean(self.zn4T)
        self.zn4T_max = np.max(self.zn4T)
        self.zn4T_min = np.min(self.zn4T)

        '''All Zones Thermostat Temperature (C)'''
        self.allT = np.asarray([[self.coreT], [self.zn1T], [self.zn2T], [self.zn3T], [self.zn4T]])
        self.allT_mean1 = np.mean(self.allT, 1)
        self.allT_mean2 = np.mean(self.allT_mean1)
        self.allT_max = np.max(self.allT)
        self.allT_min = np.min(self.allT)