Esempio n. 1
0
    def test_setback_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 12, 0, 0, 0)
        # delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60]
        append_data_to_datetime(IAT, IAT_temp)

        # just the first data point will count as during operational hours
        op_hours = [[0, 1], [3], []]

        test_ele_cost = 10000
        test_area = 5000
        result = setback_non_op(IAT, DAT, op_hours, test_ele_cost, test_area)

        expected = {
            "Problem": "Nighttime thermostat setbacks are not enabled.",
            "Diagnostic": "More than 30 percent of the data indicates that the "
            + "building is being conditioned or ventilated normally "
            + "during unoccupied hours.",
            "Recommendation": "Program your thermostats to decrease the "
            + "heating setpoint, or increase the cooling setpoint during "
            + "unoccuppied times.  Additionally, you may have a "
            + "contractor configure the RTU to reduce ventilation.",
            "Savings": round(((80 - 60) * 0.03 * 1 * 0.07 * test_ele_cost * (10 / 11)), 2),
        }

        self.assertEqual(result, expected)
Esempio n. 2
0
    def test_comfort_undercooling(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [200, 200, 200, 200, 200, 200, 200, 200, 200, 200]
        append_data_to_datetime(IAT, IAT_temp)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost)

        expected = {
        'Problem': "Under-conditioning, thermostat cooling " + \
                "setpoint is high.",
        'Diagnostic':  "More than 30 percent of the time, the cooling setpoint " + \
                "during occupied hours was greater than 80F.",
        'Recommendation': "Program your thermostats to decrease the cooling " + \
                "setpoint to improve building comfort during occupied hours."
        }

        self.assertEqual(comfort_result, expected)
    def test_comfort_undercooling(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [200, 200, 200, 200, 200, 200, 200, 200, 200, 200]
        append_data_to_datetime(IAT, IAT_temp)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost)

        expected = {
        'Problem': "Under-conditioning, thermostat cooling " + \
                "setpoint is high.",
        'Diagnostic':  "More than 30 percent of the time, the cooling setpoint " + \
                "during occupied hours was greater than 80F.",
        'Recommendation': "Program your thermostats to decrease the cooling " + \
                "setpoint to improve building comfort during occupied hours."
        }

        self.assertEqual(comfort_result, expected)
    def test_setback_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 12, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60]
        append_data_to_datetime(IAT, IAT_temp)

        # just the first data point will count as during operational hours
        op_hours = [[0, 1], [3], []]

        test_ele_cost = 10000
        test_area = 5000
        result = setback_non_op(IAT, DAT, op_hours, test_ele_cost, test_area)

        expected = {
            'Problem': "Nighttime thermostat setbacks are not enabled.",
            'Diagnostic': "More than 30 percent of the data indicates that the " + \
                    "building is being conditioned or ventilated normally " + \
                    "during unoccupied hours.",
            'Recommendation': "Program your thermostats to decrease the " + \
                    "heating setpoint, or increase the cooling setpoint during " + \
                    "unoccuppied times.  Additionally, you may have a " + \
                    "contractor configure the RTU to reduce ventilation.",
            'Savings': round(((80-60) * 0.03 * 1 * 0.07 * test_ele_cost * (10/11)), 2)}

        self.assertEqual(result, expected)
Esempio n. 5
0
    def test_setback_comfort_success_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        self.assertEqual(comfort_result, {})
        self.assertEqual(setback_result, {})
    def test_setback_comfort_success_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        self.assertEqual(comfort_result, {})
        self.assertEqual(setback_result, {})
Esempio n. 7
0
    def test_economizer_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69]
        append_data_to_datetime(DAT, DAT_temp)

        OAT = copy.deepcopy(base)
        OAT_temp = [65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65]
        append_data_to_datetime(OAT, OAT_temp)

        HVACstat = copy.deepcopy(base)
        HVAC_data = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = economizer(DAT, OAT, HVACstat, 10000, 5000)
        expected = {
            'Problem': "Under use of 'free cooling', i.e.,under-economizing.",
            'Diagnostic': "More than 30 percent of the time, the " + \
                    "economizer is not taking advantage of 'free cooling' " + \
                    "when it is possible to do so.",
            'Recommendation': "Ask an HVAC service contractor to check " + \
                    "the economizer control sequence, unless the RTU does" + \
                    "not have an economizer.",
            'Savings': 0.16 * 10000 * 0.1
            }

        self.assertEqual(expected, result)
    def test_short_cycling_expect_success(self):
        """Test: Compressor is switched on/off (HVACstat = 2) every 10 mins."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 1, 1, 0, 0, 0)
        HVACstat = set_up_datetimes(a, b, 360)
        HVAC_data = [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat, 100, 100)
Esempio n. 9
0
    def test_short_cycling_expect_success(self):
        """Test: Compressor is switched on/off (HVACstat = 2) every 10 mins."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 1, 1, 0, 0, 0)
        HVACstat = set_up_datetimes(a, b, 360)
        HVAC_data = [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat, 100, 100)
def test_util_findDateIndex():
    # Testing index finder for specific dates.
    a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
    b = datetime.datetime(2014, 1, 2, 0, 0, 0, 0)
    datetime_list = numpy.array(set_up_datetimes(a, b, 3600)).flatten()
    testDateIndex = dtt.findDateIndex(
        datetime_list, datetime.datetime(2014, 1, 1, 7, 0, 0, 0))
    assert testDateIndex == 0
    testDateIndex = dtt.findDateIndex(
        datetime_list, datetime.datetime(2014, 2, 1, 0, 0, 0, 0))
    assert testDateIndex == 24
Esempio n. 11
0
    def test_short_cycling_basic(self):
        """Test: Compressor is switched on/off (HVACstat = 2) every minute."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 1, 0, 29, 0, 0)
        HVACstat = set_up_datetimes(a, b, 60)
        HVAC_data = [0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2,
                0, 2, 0, 2, 0, 2, 0, 2, 0, 2]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat, 100, 100)
        self.assertTrue('Problem' in result.keys())
Esempio n. 12
0
 def test_short_cycling_mixed_status(self):
     """Test: Compressor is switched on/off (HVACstat = 2) mixed in different statuses."""
     a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
     b = dt.datetime(2014, 1, 1, 0, 29, 0, 0)
     HVAC_data = [0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 2,
             0, 2, 0, 2, 0, 2, 0, 2, 0, 2]
     HVACstat = set_up_datetimes(a, b, 60)
     append_data_to_datetime(HVACstat, HVAC_data)
     
     result = short_cycling(HVACstat, 100, 100)
     self.assertTrue('Problem' in result.keys())
    def test_excessive_day_light_expect_success_unoccupied_time(self):
        """Test: Lights not on during half of the whole occupied period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 2, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[15:23] = True
        append_data_to_datetime(base, light_stat)
        result = excessive_daylight(base, [[7,17],[1,2,3,4,5],[]], 100, 100)

        self.assertTrue(result == {})
Esempio n. 14
0
    def test_short_cycling_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 1, 0, 29, 0, 0)
        #delta = 1 minute
        HVACstat = set_up_datetimes(a, b, 60)
        print("hehe: ", len(HVACstat))
        HVAC_data = [0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3,
                0, 3, 0, 3, 0, 3, 0, 3, 0, 3]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat)
        self.assertTrue(result)
    def test_excessive_day_light_ones(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        # delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        light_all_ones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

        append_data_to_datetime(base, light_all_ones)

        result = excessive_daylight(base, 8)
        self.assertTrue(result)
    def test_excessive_day_light_ones(self):
        """Test: Lights are on for the whole time period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 4, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 21600)

        light_stat = np.ones(len(base),bool)

        append_data_to_datetime(base, light_stat)

        result = excessive_daylight(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue('Problem' in result.keys())
    def test_excessive_day_light_zeroes(self):
        """Test: Lights are off for the whole time period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 4, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 21600)

        light_stat = np.zeros(len(base),bool)

        append_data_to_datetime(base, light_stat)

        result = excessive_daylight(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue(result == {})
    def test_excessive_night_light_ones(self):
        """Test: Lights are on the whole time period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 4, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 21600)

        light_stat = np.ones(len(base), bool)

        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue('Problem' in result.keys())
Esempio n. 19
0
    def test_short_cycling_mixed_status(self):
        """Test: Compressor is switched on/off (HVACstat = 2) mixed in different statuses."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 1, 0, 29, 0, 0)
        HVAC_data = [
            0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 2, 0, 2,
            0, 2, 0, 2, 0, 2, 0, 2
        ]
        HVACstat = set_up_datetimes(a, b, 60)
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat, 100, 100)
        self.assertTrue('Problem' in result.keys())
Esempio n. 20
0
    def test_short_cycling_basic(self):
        """Test: Compressor is switched on/off (HVACstat = 2) every minute."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 1, 0, 29, 0, 0)
        HVACstat = set_up_datetimes(a, b, 60)
        HVAC_data = [
            0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2,
            0, 2, 0, 2, 0, 2, 0, 2
        ]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = short_cycling(HVACstat, 100, 100)
        self.assertTrue('Problem' in result.keys())
    def test_findDateIndex(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 2, 0, 0, 0, 0)
        datetime_list = numpy.array(set_up_datetimes(a, b, 3600)).flatten()

        # Testing index finder for specific dates.
        testDateIndex = dtt.findDateIndex(datetime_list, 
                                          datetime.datetime(2014, 1, 1, 7, 0, 0, 0))
        self.assertTrue(str.isdigit(str(testDateIndex)))

        testDateIndex = dtt.findDateIndex(datetime_list, 
                                          datetime.datetime(2014, 2, 1, 0, 0, 0, 0))
        self.assertIs(str.isdigit(str(testDateIndex)), False)
    def test_excessive_day_light_expect_fail(self):
        """Test: Lights are on throughout the whole occupied period.""" 
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 3, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[7:17] = True
        light_stat[31:41] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_daylight(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue('Problem' in result.keys())
    def test_excessive_night_expect_fail(self):
        """Test: Lights are on for 5 hours every day during unoccupied hours."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 3, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[0:6] = True
        light_stat[39:47] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue('Problem' in result.keys())
    def test_excessive_night_expect_success(self):
        """Test: Lights are on for 2 hours every day during unoccupied hours."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 3, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[17:19] = True
        light_stat[41:43] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue(result == {})
    def test_excessive_night_light_zeros(self):
        """Test: Lights are on the whole time period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 4, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 21600)

        light_stat = np.zeros(len(base), bool)

        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7, 17], [1, 2, 3, 4, 5], []], 100,
                                     100)
        self.assertTrue(result == {})
    def test_excessive_night_expect_success(self):
        """Test: Lights are on for 2 hours every day during unoccupied hours."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 3, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[17:19] = True
        light_stat[41:43] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7, 17], [1, 2, 3, 4, 5], []], 100,
                                     100)
        self.assertTrue(result == {})
    def test_excessive_night_expect_fail(self):
        """Test: Lights are on for 5 hours every day during unoccupied hours."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 3, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[0:6] = True
        light_stat[39:47] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_nighttime(base, [[7, 17], [1, 2, 3, 4, 5], []], 100,
                                     100)
        self.assertTrue('Problem' in result.keys())
    def test_excessive_day_light_expect_success_on_off(self):
        """Test: Lights turn on and off twice during the occupied period."""
        a = dt.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = dt.datetime(2014, 1, 2, 0, 0, 0, 0)
        base = set_up_datetimes(a, b, 3600)

        light_stat = np.zeros(len(base), bool)
        light_stat[7:11] = True
        light_stat[13:14] = True
        light_stat[16] = True
        append_data_to_datetime(base, light_stat)

        result = excessive_daylight(base, [[7,17],[1,2,3,4,5],[]], 100, 100)
        self.assertTrue(result == {})
def test_util_findDateIndex():
    # Testing index finder for specific dates.
    a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
    b = datetime.datetime(2014, 1, 2, 0, 0, 0, 0)
    datetime_list = numpy.array(set_up_datetimes(a, b, 3600)).flatten()
    testDateIndex = dtt.findDateIndex(
        datetime_list,
        datetime.datetime(2014, 1, 1, 7, 0, 0, 0)
        )
    assert testDateIndex == 0
    testDateIndex = dtt.findDateIndex(
        datetime_list,
        datetime.datetime(2014, 2, 1, 0, 0, 0, 0)
        )
    assert testDateIndex == 24
Esempio n. 30
0
    def test_economizer_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [8, 8, 8, 8, 8, 8, 8, 8, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [10, 10, 10, 10, 10, 10, 10, 10, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        op_hours = [[0, 0], [], []]

        comfort = setback_non_op(IAT, DAT, op_hours)

        self.assertIsNot(comfort, True)
Esempio n. 31
0
    def test_economizer_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [8, 8, 8, 8, 8, 8, 8, 8, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [10, 10, 10, 10, 10, 10, 10, 10, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        comfort, setback = comfort_and_setpoint(IAT, DAT, op_hours)

        self.assertIsNot(comfort, False)
        self.assertTrue(setback)
    def test_comfort_underheating_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_cool_cost = (76 - 50) * 0.03 * 0.5 * 0.07 * 1 * test_elec_cost
        exp_heat_cost = (80 - 72) * 0.03 * 0.5 * 0.31 * 1 * test_elec_cost

        expected = {
        'Problem': "Under-conditioning - thermostat heating " + \
                "setpoint is low.",
        'Diagnostic': "For more than 30% of the time, the cooling setpoint " + \
                "during occupied hours was less than 69 degrees F.",
        'Recommendation': "Program thermostats to increase the heating " + \
                "setpoint to improve building comfort during occupied hours."
        }


        self.assertEqual(comfort_result, expected)
    def test_setback_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_cool_cost = (76 - 50) * 0.03 * 0.5 * 0.07 * 1 * test_elec_cost
        exp_heat_cost = (80 - 72) * 0.03 * 0.5 * 0.31 * 1 * test_elec_cost

        expected = {
            'Problem': "Overly narrow separation between heating " + \
                    "and cooling setpoints.",
            'Diagnostic': "During occupied hours, the cooling setpoint was lower " + \
                    "than 76F and the heating setpoint was greater than 72F.",
            'Recommendation': "Adjust the heating and cooling setpoints so that " + \
                    "they differ by more than four degrees.",
            'Savings': round(exp_cool_cost + exp_heat_cost, 2)
        }

        self.assertEqual(setback_result, expected)
Esempio n. 34
0
    def test_setback_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_cool_cost = (76 - 50) * 0.03 * 0.5 * 0.07 * 1 * test_elec_cost
        exp_heat_cost = (80 - 72) * 0.03 * 0.5 * 0.31 * 1 * test_elec_cost

        expected = {
            'Problem': "Overly narrow separation between heating " + \
                    "and cooling setpoints.",
            'Diagnostic': "During occupied hours, the cooling setpoint was lower " + \
                    "than 76F and the heating setpoint was greater than 72F.",
            'Recommendation': "Adjust the heating and cooling setpoints so that " + \
                    "they differ by more than four degrees.",
            'Savings': round(exp_cool_cost + exp_heat_cost, 2)
        }

        self.assertEqual(setback_result, expected)
Esempio n. 35
0
    def test_comfort_overheating_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [80, 80, 80, 80, 80, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_heat_cost = (80 - 72) * 0.03 * 1 * 0.31 * 1 * test_elec_cost

        expected = {
        'Problem': "Over-conditioning, thermostat heating " + \
                "setpoint is high.",
        'Diagnostic': "More than 30 percent of the time, the heating setpoint " + \
                "during occupied hours was greater than 72F, a temperature that " + \
                "is comfortable to most occupants.",
        'Recommendation': "Program your thermostats to decrease the heating " + \
                "setpoint during occupied hours.",
        'Savings': round(exp_heat_cost, 2)
        }

        self.assertEqual(comfort_result, expected)
    def test_comfort_overheating_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [80, 80, 80, 80, 80, 80, 80, 80, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_heat_cost = (80 - 72) * 0.03 * 1 * 0.31 * 1 * test_elec_cost

        expected = {
        'Problem': "Over-conditioning, thermostat heating " + \
                "setpoint is high.",
        'Diagnostic': "More than 30 percent of the time, the heating setpoint " + \
                "during occupied hours was greater than 72F, a temperature that " + \
                "is comfortable to most occupants.",
        'Recommendation': "Program your thermostats to decrease the heating " + \
                "setpoint during occupied hours.",
        'Savings': round(exp_heat_cost, 2)
        }

        self.assertEqual(comfort_result, expected)
Esempio n. 37
0
    def test_economizer_basic(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69]
        append_data_to_datetime(DAT, DAT_temp)

        OAT = copy.deepcopy(base)
        OAT_temp = [65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65]
        append_data_to_datetime(OAT, OAT_temp)

        HVACstat = copy.deepcopy(base)
        HVAC_data = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = economizer(DAT, OAT, HVACstat)
        self.assertIsNotNone(result,
                "Should return a dictionary of suggestions, but does not.")
Esempio n. 38
0
    def test_comfort_underheating_HVAC(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(IAT, IAT_temp)

        HVAC = copy.deepcopy(base)
        HVAC_stat = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
        append_data_to_datetime(HVAC, HVAC_stat)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost, HVAC)

        exp_cool_cost = (76 - 50) * 0.03 * 0.5 * 0.07 * 1 * test_elec_cost
        exp_heat_cost = (80 - 72) * 0.03 * 0.5 * 0.31 * 1 * test_elec_cost

        expected = {
        'Problem': "Under-conditioning - thermostat heating " + \
                "setpoint is low.",
        'Diagnostic': "For more than 30% of the time, the cooling setpoint " + \
                "during occupied hours was less than 69 degrees F.",
        'Recommendation': "Program thermostats to increase the heating " + \
                "setpoint to improve building comfort during occupied hours."
        }

        self.assertEqual(comfort_result, expected)
Esempio n. 39
0
    def test_economizer_no_flag(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 4, 0, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69]
        append_data_to_datetime(DAT, DAT_temp)

        OAT = copy.deepcopy(base)
        OAT_temp = [65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65]
        append_data_to_datetime(OAT, OAT_temp)

        HVACstat = copy.deepcopy(base)
        HVAC_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(HVACstat, HVAC_data)

        result = economizer(DAT, OAT, HVACstat, 10000, 5000)
        expected = {}

        self.assertEqual(expected, result)
Esempio n. 40
0
    def test_setback_success(self):
        # ten data points
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        # delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        # copy data to put in the right format
        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [10, 10, 10, 10, 10, 10, 10, 10, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        # the first point is the only operational point
        op_hours = [[0, 1], [3], []]

        result = setback_non_op(IAT, DAT, op_hours, 10000, 5000)

        self.assertEqual(result, {})
Esempio n. 41
0
    def test_setback_success(self):
        # ten data points
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        # copy data to put in the right format
        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [10, 10, 10, 10, 10, 10, 10, 10, 80, 80]
        append_data_to_datetime(IAT, IAT_temp)

        # the first point is the only operational point
        op_hours = [[0, 1], [3], []]

        result = setback_non_op(IAT, DAT, op_hours, 10000, 5000)

        self.assertEqual(result, {})
    def test_comfort_overcooling(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
        append_data_to_datetime(IAT, IAT_temp)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost)

        exp_cool_cost = (76 - 50) * 0.03 * 1 * 0.07 * 1 * test_elec_cost

        expected = {
        'Problem': "Over-conditioning, thermostat cooling setpoint is low",
        'Diagnostic': "More than 30 percent of the time, the cooling setpoint " + \
                "during occupied hours was lower than 75F, a temperature that " + \
                "is comfortable to most occupants",
        'Recommendation': "Program your thermostats to increase the cooling " + \
                "setpoint during occupied hours.",
        'Savings': round(exp_cool_cost, 2)
        }

        self.assertEqual(comfort_result, expected)
Esempio n. 43
0
    def test_comfort_overcooling(self):
        a = datetime.datetime(2014, 1, 1, 0, 0, 0, 0)
        b = datetime.datetime(2014, 1, 3, 6, 0, 0, 0)
        #delta = 6 hours
        base = set_up_datetimes(a, b, 21600)

        DAT = copy.deepcopy(base)
        DAT_temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        append_data_to_datetime(DAT, DAT_temp)

        IAT = copy.deepcopy(base)
        IAT_temp = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
        append_data_to_datetime(IAT, IAT_temp)

        # 24/7, no holidays
        op_hours = [[0, 23], [1, 2, 3, 4, 5, 6, 7], []]

        test_area = 5000
        test_elec_cost = 10000

        comfort_result, setback_result = comfort_and_setpoint(IAT, DAT, op_hours, \
                test_area, test_elec_cost)

        exp_cool_cost = (76 - 50) * 0.03 * 1 * 0.07 * 1 * test_elec_cost

        expected = {
        'Problem': "Over-conditioning, thermostat cooling setpoint is low",
        'Diagnostic': "More than 30 percent of the time, the cooling setpoint " + \
                "during occupied hours was lower than 75F, a temperature that " + \
                "is comfortable to most occupants",
        'Recommendation': "Program your thermostats to increase the cooling " + \
                "setpoint during occupied hours.",
        'Savings': round(exp_cool_cost, 2)
        }

        self.assertEqual(comfort_result, expected)