Skip to content

Energy Losses

The performance database has several tables, views and materialized views to organize and store the data related to energy losses. The main objective is to have a centralized place to have both the measured and target energy losses for different periods and assets, allowing for easy integration with dashboards, reports, etc.

Tables

energyloss_types

This is the main table with configuration that define how each energy loss is calculated and how it is used in materialized views. It contains the following relevant columns:

  • name: Name of the energy loss type. Usually with lowercase and underscore.
  • display_name: Name of the energy loss type to be displayed in reports and dashboards.
  • description: Description of the energy loss type.
  • loss_order: Order of the loss, which will be used to gross up measured and target and also defines the order in which the losses are displayed in energy losses waterfall. The highest number is represents the loss before net energy and the lowest number is the first loss, right after gross energy. Numbers must be higher or equal to 1.
  • source: Source of the measured data, currently the following values are used (other values will not result in no data being stored):
    • bazefield: Data acquired for each SPE directly from a Bazefield tag, summing all the values for each day. The method that does this data acquisition is KpiEnergyLossesValues.sync_bazefield().
    • Asset_availability and BoP_availability: Data comes from the pre-calculated values in availability materialized views.
    • waterfall uncertainty: This is a special source that does not have measured data, but is used to calculate the uncertainty in the energy losses waterfall. The measured value for this loss is calculated as the difference between the grossed up measured energy and the grossed up target energy. Target value is always 0 for this loss.
  • bazefield_point: When the source is bazefield, this column contains the Bazefield tag name which is used to acquire the data.
  • target_source: Source of the target data, currently the following values are used (other values will not result in no data being stored):
    • energyloss_target: Data manually inserted in the energyloss_targets table.
    • resource_assessment: Data comes from the v_resource_assessment_losses_values view, where loss is stored as an array with 12 percentages values indicating the loss for each month. The resource assessment loss considered must be defined in the resource_assessment_loss_type_id column. Also, keep in mind that the default resource assessment for each SPE is used.
    • Asset_availability_target and BoP_availability_target: Data comes from the pre-calculated values in availability materialized views.
    • 0: Force a target of 0 for this loss.
  • resource_assessment_loss_type_id: When the target source is resource_assessment, this column contains the ID of the resource assessment loss type that is used to calculate the target loss.
  • considered_in_waterfall: Boolean that indicates if the loss should be considered in the energy losses waterfall. If false, the loss will not be displayed in the waterfall.
  • waterfall_group: This is a text that if set will be used to group the losses in the waterfall. Please only group losses that are one after another considering the loss order. The materialized view will fail if the grouped losses are not contiguous.
  • applicable_to: One of solar, wind or NULL. If set to solar or wind, the loss will only be considered for SPEs of that type. If NULL, it will be considered for all SPEs.

energyloss_targets

This table stores the target energy losses for each SPE and period. It will be used only if the target source in energyloss_types is energyloss_target.

energyloss_values

This table stores the measured energy losses for each SPE and period. The data is stored in a daily basis and will be used only if the source in energyloss_types is bazefield.

Materialized Views

As with other KPIs, the calculation of the energy losses involves complexes queries and takes a little bit of time to be calculated. To improve the performance of the reports and dashboards, we have created materialized views that store the calculated values for each time resolution and aggregation. The available materialized views are:

  • mv_energyloss_values_daily: Daily resolution, no aggregation.
  • mv_energyloss_values_daily_12m: Daily resolution, 12 months aggregation.
  • mv_energyloss_values_daily_mtd: Daily resolution, month-to-date aggregation.
  • mv_energyloss_values_daily_ytd: Daily resolution, year-to-date aggregation.
  • mv_energyloss_values_monthly: Monthly resolution, no aggregation.
  • mv_energyloss_values_monthly_12m: Monthly resolution, 12 months aggregation.
  • mv_energyloss_values_monthly_ytd: Monthly resolution, year-to-date aggregation.
  • mv_energyloss_values_quarterly: Quarterly resolution, no aggregation.
  • mv_energyloss_values_yearly: Yearly resolution, no aggregation.

The most important of the above materialized views is the mv_energyloss_values_daily which is used then resampled and/or aggregated to create the other materialized views. The mv_energyloss_values_daily basically calls the fn_calc_daily_energy_losses function that calculates the energy losses for each SPE and day, joining all the data from the different sources defined in the energyloss_types table.

All materialized views have the following most important columns:

  • object_or_group_name: Name of the SPE or group of SPEs.
  • group_type_name: In case is a group, the name of the group type. Else will be SPE.
  • date: Date of the data.
  • energyloss_type_name: Name of the energy loss type.
  • measured: Measured energy loss value in kWh.
  • measured_as_percentage: Measured energy loss value as a percentage.
  • measured_after_loss: Measured energy production after removing the loss (net).
  • target: Target energy loss value in kWh.
  • target_as_percentage: Target energy loss value as a percentage.
  • target_after_loss: Target energy production after removing the loss (net).

It's important to note that some values are acquired in percentage, so we depend on the actual net measured or target energy to calculate the actual loss in kWh. These measured and target values are always at the connection point and are acquired from mv_energy_values_daily (measured) and mv_energy_targets_daily (target).

The function will grow from the last loss to the first loss, grossing up the measured and target values along the way. This means that as_percentage columns can be calculated as, considering measured as an example, measured / (measured_after_loss + measured). Also, the measured_after_loss value is equivalent to the gross value of the next loss (higher loss order) in the waterfall.

Waterfall

Waterfall is calculated based on values present in energy loss materialized views. There are multiple options to see the values in it:

  • measured: Actual values in MWh
  • measured_perc: Actual values in percentage
  • target: Target values in MWh
  • target_perc: Target values in percentage
  • relative_abs: Difference of measured and target values in MWh
  • relative_perc: Difference of measured and target values in percentage

Regardless of the option, all the calculations are done based on MWh values (later converted to percentage as needed) and the order of the losses is defined by the loss_order column in the energyloss_types table.

measured and target values are the actual values of the losses, so what is shown is basically the values stored in the materialized views, showing how much energy was lost in each loss, no comparisons needed. measured_perc and target_perc are the same as the previous ones, but converted to percentage by dividing all the values by the gross energy.

Relative Views

relative_abs shows how each loss deviation (measured vs target) contributes to the difference between measured and target net energy. Rather than showing absolute loss values, it reveals the individual impact of each loss performing better or worse than expected.

The calculation works by simulating what the net energy would be if losses performed exactly as targeted up to a certain point, then applying measured losses for the remaining stages. The impact of each loss is the difference between consecutive simulations.

Example with 3 losses (A → B → C):

Starting from the grossed-up energy (measured net energy grossed up by all measured losses):

  1. Loss A Impact:
  2. Simulate net energy using target for loss A, but measured for losses B and C
  3. Impact = Grossed-up energy - Simulated net
  4. Shows how much loss A performing differently than target affects final net energy

  5. Loss B Impact:

  6. Simulate net energy using target for losses A and B, but measured for loss C
  7. Impact = Previous simulated net - New simulated net
  8. Shows the additional impact from loss B deviation

  9. Loss C Impact:

  10. Simulate net energy using target for all losses A, B, and C
  11. Impact = Previous simulated net - Final simulated net
  12. Shows the final impact from loss C deviation

Result interpretation:

  • Positive values indicate a loss performing worse than target (reducing net energy)
  • Negative values indicate a loss performing better than target (increasing net energy)
  • The sum of all impacts equals the total difference between measured and target net energy

This view helps identify which specific losses are the main contributors to underperformance or overperformance versus targets.

relative_perc is the same as the previous one, but converted to percentage by dividing all the values by the target energy.

Note

In relative views the Uncertainty represents the difference between the target and the measured grossed up by losses. In a way, this represents any other impacts not calculated in the losses, which may include resource variation if no specific loss is configured for it.