| @@ 685-715 (lines=31) @@ | ||
| 682 | result['reporting_period_efficiency']['cumulations'] = list() |
|
| 683 | result['reporting_period_efficiency']['increment_rates'] = list() |
|
| 684 | ||
| 685 | if energy_category_set_output is not None and len(energy_category_set_output) > 0: |
|
| 686 | for energy_category_id_output in energy_category_set_output: |
|
| 687 | for energy_category_id_input in energy_category_set_input: |
|
| 688 | result['reporting_period_efficiency']['names'].append( |
|
| 689 | energy_category_dict[energy_category_id_output]['name'] + '/' + |
|
| 690 | energy_category_dict[energy_category_id_input]['name']) |
|
| 691 | result['reporting_period_efficiency']['units'].append( |
|
| 692 | energy_category_dict[energy_category_id_output]['unit_of_measure'] + '/' + |
|
| 693 | energy_category_dict[energy_category_id_input]['unit_of_measure']) |
|
| 694 | result['reporting_period_efficiency']['timestamps'].append( |
|
| 695 | reporting_output[energy_category_id_output]['timestamps']) |
|
| 696 | efficiency_values = list() |
|
| 697 | for i in range(len(reporting_output[energy_category_id_output]['timestamps'])): |
|
| 698 | efficiency_values.append((reporting_output[energy_category_id_output]['values'][i] / |
|
| 699 | reporting_input[energy_category_id_input]['values'][i]) |
|
| 700 | if reporting_input[energy_category_id_input]['values'][i] > Decimal(0.0) |
|
| 701 | else None) |
|
| 702 | result['reporting_period_efficiency']['values'].append(efficiency_values) |
|
| 703 | ||
| 704 | base_cumulation = (base_output[energy_category_id_output]['subtotal'] / |
|
| 705 | base_input[energy_category_id_input]['subtotal']) if \ |
|
| 706 | base_input[energy_category_id_input]['subtotal'] > Decimal(0.0) else None |
|
| 707 | ||
| 708 | reporting_cumulation = (reporting_output[energy_category_id_output]['subtotal'] / |
|
| 709 | reporting_input[energy_category_id_input]['subtotal']) if \ |
|
| 710 | reporting_input[energy_category_id_input]['subtotal'] > Decimal(0.0) else None |
|
| 711 | ||
| 712 | result['reporting_period_efficiency']['cumulations'].append(reporting_cumulation) |
|
| 713 | result['reporting_period_efficiency']['increment_rates'].append( |
|
| 714 | ((reporting_cumulation - base_cumulation) / base_cumulation if (base_cumulation > Decimal(0.0)) |
|
| 715 | else None) |
|
| 716 | ) |
|
| 717 | ||
| 718 | result['parameters'] = { |
|
| @@ 672-702 (lines=31) @@ | ||
| 669 | result['reporting_period_efficiency']['cumulations'] = list() |
|
| 670 | result['reporting_period_efficiency']['increment_rates'] = list() |
|
| 671 | ||
| 672 | if energy_category_set_output is not None and len(energy_category_set_output) > 0: |
|
| 673 | for energy_category_id_output in energy_category_set_output: |
|
| 674 | for energy_category_id_input in energy_category_set_input: |
|
| 675 | result['reporting_period_efficiency']['names'].append( |
|
| 676 | energy_category_dict[energy_category_id_output]['name'] + '/' + |
|
| 677 | energy_category_dict[energy_category_id_input]['name']) |
|
| 678 | result['reporting_period_efficiency']['units'].append( |
|
| 679 | energy_category_dict[energy_category_id_output]['unit_of_measure'] + '/' + |
|
| 680 | energy_category_dict[energy_category_id_input]['unit_of_measure']) |
|
| 681 | result['reporting_period_efficiency']['timestamps'].append( |
|
| 682 | reporting_output[energy_category_id_output]['timestamps']) |
|
| 683 | efficiency_values = list() |
|
| 684 | for i in range(len(reporting_output[energy_category_id_output]['timestamps'])): |
|
| 685 | efficiency_values.append((reporting_output[energy_category_id_output]['values'][i] / |
|
| 686 | reporting_input[energy_category_id_input]['values'][i]) |
|
| 687 | if reporting_input[energy_category_id_input]['values'][i] > |
|
| 688 | Decimal(0.0) else None) |
|
| 689 | result['reporting_period_efficiency']['values'].append(efficiency_values) |
|
| 690 | ||
| 691 | base_cumulation = (base_output[energy_category_id_output]['subtotal'] / |
|
| 692 | base_input[energy_category_id_input]['subtotal']) if \ |
|
| 693 | base_input[energy_category_id_input]['subtotal'] > Decimal(0.0) else None |
|
| 694 | ||
| 695 | reporting_cumulation = (reporting_output[energy_category_id_output]['subtotal'] / |
|
| 696 | reporting_input[energy_category_id_input]['subtotal']) if \ |
|
| 697 | reporting_input[energy_category_id_input]['subtotal'] > Decimal(0.0) else None |
|
| 698 | ||
| 699 | result['reporting_period_efficiency']['cumulations'].append(reporting_cumulation) |
|
| 700 | result['reporting_period_efficiency']['increment_rates'].append( |
|
| 701 | ((reporting_cumulation - base_cumulation) / base_cumulation if (base_cumulation > Decimal(0.0)) |
|
| 702 | else None) |
|
| 703 | ) |
|
| 704 | ||
| 705 | result['parameters'] = { |
|