示例#1
0
    def generate_total_bill_bar_chart(self, *args):
        """Generates bar chart showing the total bill with energy storage each month."""
        bar_data = []

        if len(self.chart_data) > len(PALETTE):
            colors = PALETTE
        else:
            colors = sample(PALETTE, len(self.chart_data))

        for ix, op in enumerate(self.chart_data, start=0):
            name = op[0]
            month = name.split(' | ')[1]
            label = month

            solved_op = op[1]
            results = solved_op.results

            bar_color = colors[divmod(ix, len(colors))[1]]
            bar_data.append([
                label,
                rgba_to_fraction(bar_color),
                float(solved_op.total_bill_with_es)
            ])

        self.chart.draw_chart(bar_data)
        max_bar = self.chart.max_bar
        min_bar = self.chart.min_bar

        # generate report text
        self.title.text = "Here's the total bill for each month."
        self.desc.text = 'The total bill is the sum of demand charges, energy charges, and net metering charges. '

        total_charges_str = format_dollar_string(
            sum(op[1].total_bill_with_es for op in self.chart_data))
        month_high_str = format_dollar_string(max_bar.value)
        month_low_str = format_dollar_string(min_bar.value)

        report_templates = [
            'The total charges for the year was [b]{0}[/b].'.format(
                total_charges_str),
            'The highest bill for a month was [b]{0}[/b] in [b]{1}[/b].'.
            format(
                month_high_str, calendar.month_name[list(
                    calendar.month_abbr).index(max_bar.name)]),
            'The lowest bill for a month was [b]{0}[/b] in [b]{1}[/b].'.format(
                month_low_str, calendar.month_name[list(
                    calendar.month_abbr).index(min_bar.name)]),
        ]

        self.desc.text += ' '.join(report_templates)
        self.is_drawn = True
示例#2
0
    def generate_demand_charge_comparison_chart(self, *args):
        """Generates the multiset bar chart comparing total demand charges with and without energy storage each month."""
        if any(op[1].has_demand_charges() for op in self.chart_data):
            n_cats = 2

            if n_cats > len(PALETTE):
                colors = PALETTE
            else:
                colors = sample(PALETTE, n_cats)

            multisetbar_data = OrderedDict()

            for ix, op in enumerate(self.chart_data, start=0):
                name = op[0]
                month = name.split(' | ')[1]
                label = month

                solved_op = op[1]
                results = solved_op.results

                bar_group = [[
                    'without ES',
                    rgba_to_fraction(colors[0]),
                    float(solved_op.demand_charge_without_es)
                ]]
                bar_group.append([
                    'with ES',
                    rgba_to_fraction(colors[1]),
                    float(solved_op.demand_charge_with_es)
                ])

                multisetbar_data[label] = bar_group

            self.chart.draw_chart(multisetbar_data)

            self.title.text = "Here are the demand charge totals each month."
            self.desc.text = 'The demand charge total consists of time-of-use peak demand charges in addition to a flat peak demand charge, if applicable. The time-of-use demand charge is based on the peak demand during each time period and the corresponding rate. The flat demand charge is based on the peak demand over the entire month, sometimes subject to minimum and/or maximum values. The ESS is useful for reducing net power draw during high time-of-use rates. '
            report_templates = []

            total_demand_charge_difference = sum(op[1].demand_charge_with_es -
                                                 op[1].demand_charge_without_es
                                                 for op in self.chart_data)

            if total_demand_charge_difference < 0:
                relation = 'decrease'
                total_difference_str = "It looks like the ESS was able to [b]{0}[/b] the total demand charges over the year by [b]{1}[/b].".format(
                    relation,
                    format_dollar_string(abs(total_demand_charge_difference)))
                report_templates.append(total_difference_str)

            self.desc.text += ' '.join(report_templates)
            self.is_drawn = True
        else:
            self.title.text = "It looks like there were no demand charges."
            self.desc.text = "The particular rate structure you selected resulted in no demand charges. Either there are no demand charges or no savings on demand charges were accrued using energy storage."
示例#3
0
    def generate_total_bill_comparison_chart(self, *args):
        """Generates the multiset bar chart comparing total bill with and without energy storage each month."""
        n_cats = 2

        if n_cats > len(PALETTE):
            colors = PALETTE
        else:
            colors = sample(PALETTE, n_cats)

        multisetbar_data = OrderedDict()

        for ix, op in enumerate(self.chart_data, start=0):
            name = op[0]
            month = name.split(' | ')[1]
            label = month

            solved_op = op[1]

            bar_group = [[
                'without ES',
                rgba_to_fraction(colors[0]),
                float(solved_op.total_bill_without_es)
            ]]
            bar_group.append([
                'with ES',
                rgba_to_fraction(colors[1]),
                float(solved_op.total_bill_with_es)
            ])

            multisetbar_data[label] = bar_group

        self.chart.draw_chart(multisetbar_data)

        # generate report text
        self.title.text = "Here's the total bill with and without energy storage for each month."
        self.desc.text = 'The total bill is the sum of demand charges, energy charges, and net metering charges or credits. '

        report_templates = []

        total_bill_difference = sum(op[1].total_bill_with_es -
                                    op[1].total_bill_without_es
                                    for op in self.chart_data)

        if total_bill_difference < 0:
            relation = 'decrease'
            total_difference_str = "It looks like the ESS was able to [b]{0}[/b] the total charges over the year by [b]{1}[/b].".format(
                relation, format_dollar_string(abs(total_bill_difference)))
            report_templates.append(total_difference_str)

        self.desc.text += ' '.join(report_templates)
        self.is_drawn = True
示例#4
0
    def generate_executive_summary(self):
        """Generates an executive summary similar to the report screen using chart data."""
        chart_data = self.host_report.chart_data

        executive_summary_strings = []

        total_bill_summary = "The total bill is the sum of demand charges, energy charges, and net metering charges. The total charges for the year was <b>{total_charges}</b>. The highest bill for a month was <b>{highest_bill}</b>. The lowest bill for a month was <b>{lowest_bill}</b>.".format(
            total_charges=format_dollar_string(
                sum(op[1].total_bill_with_es for op in chart_data)),
            highest_bill=format_dollar_string(
                max(op[1].total_bill_with_es for op in chart_data)),
            lowest_bill=format_dollar_string(
                min(op[1].total_bill_with_es for op in chart_data)),
        )

        executive_summary_strings.append(total_bill_summary)

        bill_comparison_summary = "The total bill without energy storage was <b>{total_bill_without_es}</b>. The total bill with energy storage was <b>{total_bill_with_es}</b>: a difference of <b>{total_bill_diff}</b>.".format(
            total_bill_without_es=format_dollar_string(
                sum(op[1].total_bill_without_es for op in chart_data)),
            total_bill_with_es=format_dollar_string(
                sum(op[1].total_bill_with_es for op in chart_data)),
            total_bill_diff=format_dollar_string(
                abs(
                    sum(op[1].total_bill_with_es - op[1].total_bill_without_es
                        for op in chart_data))),
        )

        executive_summary_strings.append(bill_comparison_summary)

        demand_charge_strings = []
        demand_charge_strings.append(
            "The demand charge total consists of time-of-use (TOU) peak demand charges in addition to flat peak demand charges, if applicable. The TOU demand charge is based on the peak demand during each time period and the corresponding rate. The flat demand charge is based on the peak demand over the entire month, sometimes subject to minimum and/or maximum values. The ESS is useful for reducing net power draw during high TOU rates."
        )

        demand_charge_summary = ' '.join(demand_charge_strings)
        executive_summary_strings.append(demand_charge_summary)
        demand_charge_strings = []

        peak_demand_without_es = max(max(op[1].model.pnet
                                         for op in chart_data))
        peak_demand_with_es = max(op[1].model.pfpk.value for op in chart_data)

        demand_charge_strings.append(
            "Without energy storage, the peak demand observed during the evaluation period was <b>{peak_demand_without_es:.2f} kW</b>. By adding energy storage, this value was changed to <b>{peak_demand_with_es:.2f} kW</b>."
            .format(
                peak_demand_without_es=peak_demand_without_es,
                peak_demand_with_es=peak_demand_with_es,
            ))

        if any(op[1].has_demand_charges() for op in chart_data):
            demand_charge_with_es = sum(op[1].demand_charge_with_es
                                        for op in chart_data)
            demand_charge_without_es = sum(op[1].demand_charge_without_es
                                           for op in chart_data)
            total_demand_charge_difference = demand_charge_with_es - demand_charge_without_es

            if total_demand_charge_difference < 0:
                relation = 'decrease'
            else:
                relation = 'increase'

            demand_charge_strings.append(
                "It looks like the ESS was able to <b>{relation}</b> the total demand charges over the year from <b>{demand_charge_without_es}</b> to <b>{demand_charge_with_es}</b> for a total difference of <b>{total_demand_charge_difference}</b>."
                .format(
                    relation=relation,
                    demand_charge_without_es=format_dollar_string(
                        demand_charge_without_es),
                    demand_charge_with_es=format_dollar_string(
                        demand_charge_with_es),
                    total_demand_charge_difference=format_dollar_string(
                        total_demand_charge_difference),
                ))
        else:
            demand_charge_strings.append(
                "It looks like there were no demand charges. The particular rate structure you selected resulted in no demand charges. Either there are no demand charges or no savings on demand charges were accrued using energy storage."
            )

        demand_charge_summary = ' '.join(demand_charge_strings)
        executive_summary_strings.append(demand_charge_summary)

        energy_charge_strings = []
        energy_charge_strings.append(
            "The energy charge total is based on the net energy consumption and TOU rates. The ESS is useful for reducing energy consumption during high TOU periods."
        )

        if any(op[1].has_energy_charges for op in chart_data):
            energy_charge_with_es = sum(op[1].energy_charge_with_es
                                        for op in chart_data)
            energy_charge_without_es = sum(op[1].energy_charge_without_es
                                           for op in chart_data)
            total_energy_charge_difference = energy_charge_with_es - energy_charge_without_es

            if total_energy_charge_difference < 0:
                relation = 'decrease'
                total_difference_str = "It looks like the ESS was able to <b>{relation}</b> the total energy charges over the year by <b>{total_difference}</b> from <b>{energy_charge_without_es}</b> to <b>{energy_charge_with_es}</b>.".format(
                    relation=relation,
                    total_difference=format_dollar_string(
                        total_energy_charge_difference),
                    energy_charge_without_es=format_dollar_string(
                        energy_charge_without_es),
                    energy_charge_with_es=format_dollar_string(
                        energy_charge_with_es),
                )
            else:
                relation = 'increased'
                total_difference_str = "It looks like the total energy charges over the year with the ESS <b>{relation}</b> by <b>{total_difference}</b> from <b>{energy_charge_without_es}</b> to <b>{energy_charge_with_es}</b>. This is likely due to opportunities for decreasing demand charges or obtaining net metering credits.".format(
                    relation=relation,
                    total_difference=format_dollar_string(
                        total_energy_charge_difference),
                    energy_charge_without_es=format_dollar_string(
                        energy_charge_without_es),
                    energy_charge_with_es=format_dollar_string(
                        energy_charge_with_es),
                )

            energy_charge_strings.append(total_difference_str)
        else:
            energy_charge_strings.append(
                "It looks like there were no energy charges. Either there are no TOU energy charges or no savings on energy charges were accrued using energy storage."
            )

        energy_charge_summary = ' '.join(energy_charge_strings)
        executive_summary_strings.append(energy_charge_summary)

        net_metering_strings = []
        net_metering_rate = chart_data[0][1].nem_rate
        net_metering_type = chart_data[0][1].nem_type

        if net_metering_type == 2:
            net_metering_strings.append(
                "<b>Net energy metering (NEM) 2.0</b> uses the TOU energy rate for energy."
            )
        else:
            net_metering_strings.append(
                "<b>Net energy metering (NEM) 1.0</b> uses a fixed price for energy, which was set as <b>{net_metering_rate}/kWh</b>."
                .format(
                    net_metering_rate=format_dollar_string(net_metering_rate)))

        if any(op[1].has_nem_charges() for op in chart_data):
            net_metering_without_es = sum(op[1].nem_charge_without_es
                                          for op in chart_data)
            net_metering_with_es = sum(op[1].nem_charge_with_es
                                       for op in chart_data)
            total_net_metering_difference = net_metering_with_es - net_metering_without_es

            relation = 'increase' if total_net_metering_difference < 0 else 'decrease'

            net_metering_strings.append(
                "The total <b>{relation}</b> in NEM credits with energy storage was <b>{total_nem_difference}</b>, from <b>{nem_without_es}</b> to <b>{nem_with_es}</b>."
                .format(
                    relation=relation,
                    total_nem_difference=format_dollar_string(
                        total_net_metering_difference),
                    nem_without_es=format_dollar_string(
                        net_metering_without_es),
                    nem_with_es=format_dollar_string(net_metering_with_es),
                ))
        else:
            net_metering_strings.append(
                "It looks like there were no net energy metering charges or credits. Either that or no savings on NEM charges were accrued using energy storage."
            )

        net_metering_summary = ' '.join(net_metering_strings)
        executive_summary_strings.append(net_metering_summary)

        return executive_summary_strings
示例#5
0
    def generate_nem_charge_comparison_chart(self, *args):
        """Generates the multiset bar chart comparing total net energy metering charges with and without energy storage each month."""
        if any(op[1].has_nem_charges() for op in self.chart_data):
            n_cats = 2

            if n_cats > len(PALETTE):
                colors = PALETTE
            else:
                colors = sample(PALETTE, n_cats)

            multisetbar_data = OrderedDict()

            for ix, op in enumerate(self.chart_data, start=0):
                name = op[0]
                month = name.split(' | ')[1]
                label = month

                solved_op = op[1]

                bar_group = [[
                    'without ES',
                    rgba_to_fraction(colors[0]),
                    float(solved_op.nem_charge_without_es)
                ]]
                bar_group.append([
                    'with ES',
                    rgba_to_fraction(colors[1]),
                    float(solved_op.nem_charge_with_es)
                ])

                multisetbar_data[label] = bar_group

            self.chart.draw_chart(multisetbar_data)

            self.title.text = "Here are the net energy metering (NEM) totals each month."

            net_metering_type = self.chart_data[0][1].nem_type
            net_metering_rate = self.chart_data[0][1].nem_rate

            if net_metering_type == 2:
                net_metering_type_str = '[b]Net energy metering 2.0[/b] uses the time-of-use energy rate for energy.'
            else:
                net_metering_type_str = '[b]Net energy metering 1.0[/b] uses a fixed price for energy, which was [b]{0}[/b]/kWh.'.format(
                    format_dollar_string(net_metering_rate))

            self.desc.text = "{0} Negative values represent credits. ".format(
                net_metering_type_str)
            report_templates = []

            total_nem_difference = sum(op[1].nem_charge_with_es -
                                       op[1].nem_charge_without_es
                                       for op in self.chart_data)

            relation = 'increase' if total_nem_difference < 0 else 'decrease'
            total_difference_str = "The total [b]{0}[/b] in NEM credits with energy storage was [b]{1}[/b].".format(
                relation, format_dollar_string(abs(total_nem_difference)))
            report_templates.append(total_difference_str)

            self.desc.text += ' '.join(report_templates)
            self.is_drawn = True
        else:
            self.title.text = "It looks like there were no net energy metering charges or credits."
            self.desc.text = "The particular rate structure you selected resulted in no net energy metering charges. Either that or no savings on net energy metering charges were accrued using energy storage."
示例#6
0
    def generate_energy_charge_comparison_chart(self, *args):
        """Generates the multiset bar chart comparing total energy charges with and without energy storage each month."""
        if any(op[1].has_energy_charges() for op in self.chart_data):
            n_cats = 2

            if n_cats > len(PALETTE):
                colors = PALETTE
            else:
                colors = sample(PALETTE, n_cats)

            multisetbar_data = OrderedDict()

            for ix, op in enumerate(self.chart_data, start=0):
                name = op[0]
                month = name.split(' | ')[1]
                label = month

                solved_op = op[1]
                results = solved_op.results

                bar_group = [[
                    'without ES',
                    rgba_to_fraction(colors[0]),
                    float(solved_op.energy_charge_without_es)
                ]]
                bar_group.append([
                    'with ES',
                    rgba_to_fraction(colors[1]),
                    float(solved_op.energy_charge_with_es)
                ])

                multisetbar_data[label] = bar_group

            self.chart.draw_chart(multisetbar_data)

            self.title.text = "Here are the energy charge totals each month."
            self.desc.text = 'The energy charge total is based on net energy consumption and different time-of-use rates. The ESS is useful for reducing energy consumption during high time-of-use periods. '
            report_templates = []

            total_energy_charge_difference = sum(op[1].energy_charge_with_es -
                                                 op[1].energy_charge_without_es
                                                 for op in self.chart_data)

            if total_energy_charge_difference < 0:
                relation = 'decrease'
                total_difference_str = "It looks like the ESS was able to [b]{0}[/b] the total energy charges over the year by [b]{1}[/b].".format(
                    relation,
                    format_dollar_string(abs(total_energy_charge_difference)))
                report_templates.append(total_difference_str)
            else:
                relation = 'increased'
                total_difference_str = "It looks like the total energy charges over the year with the ESS [b]{0}[/b] by [b]{1}[/b]. This is likely due to opportunities for decreasing demand charges or obtaining net metering credits.".format(
                    relation,
                    format_dollar_string(abs(total_energy_charge_difference)))
                report_templates.append(total_difference_str)

            self.desc.text += ' '.join(report_templates)
            self.is_drawn = True
        else:
            self.title.text = "It looks like there were no energy charges."
            self.desc.text = "The particular rate structure you selected resulted in no energy charges. Either there are no time-of-use energy charges or no savings on energy charges were accrued using energy storage."