diff --git a/bpeng/bill/disaggregate.py b/bpeng/bill/disaggregate.py index d0587a4997c5bc5d6b5335cf491f3c3f0c16edc6..e8849ca4ba201ebcd6006ae544da0c7550143a1e 100644 --- a/bpeng/bill/disaggregate.py +++ b/bpeng/bill/disaggregate.py @@ -95,16 +95,14 @@ class BillDisaggregation(): """HDD (for each day)""" if curr_temp > set_temp: return 0 - else: - return set_temp - curr_temp + return set_temp - curr_temp @staticmethod def cooling(curr_temp, set_temp): """ CDD (for each day) """ if curr_temp > set_temp: return curr_temp - set_temp - else: - return 0 + return 0 @staticmethod def regression_r2_op(set_heating, set_cooling, temperature, consumption): @@ -215,6 +213,12 @@ class BillDisaggregation(): self.cooling_load_m = self.cooling_load_m * sum_ratio self.others_m = self.others_m * sum_ratio + if any(i < 0 for i in self.others_m): + self.heating_load_m, self.cooling_load_m = \ + np.array([self.heating_load_m, self.cooling_load_m]) \ + * real_sum / (self.cooling_load_m + self.heating_load_m) + self.others_m = np.zeros(len(self.others_m)) + # For printing output bill_cp = self.bill.copy() bill_cp = bill_cp[['Bill From Date', 'Bill To Date', 'Days In Bill', 'Usage']]