Calculate solar costs and savings for non-US locations

This section describes how to do the calculations that enable you to determine the best solar configuration for households in non-US locations. To calculate the recommendations, you need to model the costs of installing solar panels and the savings that they provide by using the data from a Solar API response.

For US locations, the Solar API returns an instance of the FinancialAnalysis object for each electric bill size for the input location. You use the information in these instances to determine the bill, energy consumption, and, ultimately, the savings that are associated with each solar installation size.

For non-US locations, the API response doesn't include the FinancialAnalysis instances, so you have to calculate the cost and savings for each solar configuration yourself before you can recommend the best one. To perform the calculations, you need to gather location-specific data and follow the guidance in this document.

You can model your calculations on the calculations that the Solar API uses for US locations. For an explanation of these calculations, see Calculate cost savings (US).

Solar panel configurations

For non-US locations, the information about each solar panel configuration that you need for financial analysis is provided in the SolarPanelConfig field. The number of SolarPanelConfig instances that are returned depends on the roof size of the input location. For your calculations, you need the values from the following two fields:

The following example shows one instance of the SolarPanelConfig object in the solarPanelConfigs field in a request response:

  "solarPanelConfigs": [
      {
        "panelsCount": 4,
        "yearlyEnergyDcKwh": 1709.2424,
        "roofSegmentSummaries": [
          {
            "pitchDegrees": 16.253168,
            "azimuthDegrees": 169.41516,
            "panelsCount": 4,
            "yearlyEnergyDcKwh": 1709.2424
          }
        ]
      }
  ]

For solar installations, installationSize refers to the kW output rather than the area or panel count and is defined as:

installationSize = panelsCount * panelCapacityWatts/1000 kW

Adjust energy production estimates for different panel ratings

To calculate the yearlyEnergyDcKwh value, the Solar API uses the power rating in the panelCapacityWatts field, which is currently 250W.

If you need to use a different panel power rating in your calculations and the dimensions of the panels are roughly comparable to the values in the panelHeightMeters and panelWidthMeters fields, you can adjust your calculations by multiplying the value returned by the API in the yearlyEnergyDcKwh field by the ratio of your power rating to the value in panelCapacityWatts.

For example, if the power rating of your panels is 400W and panelCapacityWatts is 250W, multiply the value of yearlyEnergyDcKwh, which the API calculated by using panelCapacityWatts, by a factor of 400/250, or 1.6. If your panel power rating is 200W, multiply yearlyEnergyDcKwh by 200/250, or 0.8.

Excess energy production

Accounting for excess energy that might be produced by a solar installation is out of scope for the Solar API calculations. In fact, if the Solar API returns multiple possible SolarPanelConfig instances for a given household, the Solar API doesn't consider results or configurations that produce more power than the assumed US average household consumption in the FinancialAnalysis.

However, you might have reasons for including installations that produce excess electricity in your recommendations. For example, you might want to offset the gradual decline in panel efficiency (the efficiencyDepreciationFactor) by allowing for excess production in the first part of an installation's life. For more information, see Required values for financial analysis.

Whatever your reasons, if you do include solar installations that produce excess electricity in your calculations, just be aware that the calculations that are explained here don't cover that scenario.

Required values for financial analysis for non-US locations

From each SolarPanelConfig instance in the API response, you need two values to perform the financial analysis for that instance:

  • panelsCount: The number of solar panels in an installation. You use this value in your calculation of the installationSize.
  • yearlyEnergyDcKwh: How much solar energy a layout captures over the course of a year, in kWh of DC electricity, given a specific panelsCount. You use this value in your calculation of the solar energy that is usable as AC electricity in a household (initialAcKwhPerYear) of each installationSize, taking into account any energy loss during the conversion from DC to AC.

Additionally, you need to gather location-specific values for the following variables that you will use in the calculations:

  • billCostModel(): Your model for determining the cost, in local currency, paid by a household for using a given number of kWh. How much a utility charges for electricity can vary from day to day or hour to hour depending on things like demand, time of day, and how much electricity the household consumes. You might need to estimate an average cost.
  • costIncreaseFactor: The factor by which the cost of electricity increases annually. The Solar API uses 1.022 (2.2% annual increase) for US locations. Adjust this value as needed for your area.
  • dcToAcDerate: The efficiency at which an inverter converts the DC electricity that is produced by the solar panels to the AC electricity that is used in a household. The Solar API uses 85% for US locations. Adjust this value as needed for your area.
  • discountRate: The Solar API uses 1.04 (4% annual increase) for US locations. Adjust this value as needed for your area.
  • efficiencyDepreciationFactor: How much the efficiency of the solar panels declines each year. The Solar API uses 0.995 (0.5% annual decrease) for US locations. Adjust this value as needed for your area.
  • incentives: Include any monetary incentives to install solar panels given by government entities in your area.
  • installationCostModel(): Your method for estimating the cost of installing solar in local currency for a given installationSize. The cost model would typically account for local labor and material costs for a given installationSize.
  • installationLifeSpan: The expected lifespan of the solar installation. The Solar API uses 20 years. Adjust this value as needed for your area.
  • kWhConsumptionModel(): Your model for determining how much energy a household consumes based on a monthly bill. In its simplest form, you would divide the bill by the average cost of a kWh in the household's location.
  • monthlyBill: the average monthly electric bill for a subject household.
  • monthlyKWhEnergyConsumption: An estimate of the average amount of electricity the household at a given location consumes in a month, measured in KWh.

With these values and the information provided by the API response, you can perform the calculations necessary to recommend the best installationSize for locations not covered by the Solar API.

Calculation steps

The following steps are based on the Solar API's methodology. You might need to adjust your methodology based on the information that is available for your location.

  1. Calculate the annual energy consumption of the household at the input location:

    1. Estimate or request the monthly bill for the household.
    2. Calculate the monthlyKWhEnergyConsumption from the monthly bill. (If you know the monthlyKWhEnergyConsumption, you can skip this step.) For example:

    monthlyKWhEnergyConsumption = kWhConsumptionModel(monthlyBill)

    1. Calculate annualKWhEnergyConsumption by multiplying monthlyKWhEnergyConsumption by 12:

    annualKWhEnergyConsumption = monthlyKWhEnergyConsumption x 12

  2. Get the API response for the target household:

    https://solar.googleapis.com/v1/buildingInsights:findClosest?location.latitude=lat-number&location.longitude=long-number&key=yourAPIKey

    The response includes usable sunlight, usable roof space, and one or more possible solar panel configurations.

  3. Calculate the annual solar energy AC production of each installationSize the API proposes by multiplying the yearlyEnergyDcKwh value provided by the API in each SolarPanelConfig instance by your local dcToAcDerate:

    initialAcKwhPerYear = yearlyEnergyDcKwh x dcToAcDerate

  4. Optionally, remove from consideration any SolarPanelConfig instance that produces more electricity than the household consumes annually (initialAcKwhPerYear > annualKWhEnergyConsumption).

  5. Calculate the lifetime solar energy production (LifetimeProductionAcKwh) of each returned installationSize:

    1. For each year of the lifespan of the solar installation, calculate the amount of electricity the installation will produce annually, applying the efficiencyDepreciationFactor exponentially to each year after the first.
    2. Add the totals for all years.

    The following table shows an example of how to calculate the lifetime energy production assuming an installationLifeSpan of 20 years. Each row represents a year of production. After the first year, the efficiency decline is applied exponentially. Finally, the sum of all rows is the lifetime energy production of the solar installation.

    Year Yearly solar energy production (kWh)
    1 initialAcKwhPerYear
    2 + initialAcKwhPerYear x efficiencyDepreciationFactor
    : :
    20 + initialAcKwhPerYear x efficiencyDepreciationFactor19
    Total LifetimeProductionAcKwh

Because the solar panel efficiency decays at a constant rate, it is essentially a geometric series where a = initialAcKwhPerYear and r = efficiencyDepreciationFactor. We can use a geometric sum to calculate the LifetimeProductionAcKwh:

LifetimeProductionAcKwh = (dcToAcDerate * initialAcKwhPerYear * (1 - pow(efficiencyDepreciationFactor, installationLifeSpan)) / (1 - efficiencyDepreciationFactor))

The following Python code computes the geometric sum above:

def LifetimeProductionAcKwh(
    dcToAcDerate,
    yearlyEnergyDcKwh,
    efficiencyDepreciationFactor,
    installationLifeSpan):
  return (
    dcToAcDerate *
    yearlyEnergyDcKwh *
    (1 - pow(
      efficiencyDepreciationFactor,
      installationLifeSpan)) /
    (1 - efficiencyDepreciationFactor))
  1. For each returned installationSize, calculate the lifetime cost of energy consumption if the installationSize is installed:

    1. For each year of the lifespan of the solar installation, calculate the cost of the electricity the household will need to purchase annually to cover the energy consumption not met by solar power. Use the values for annualKWhEnergyConsumption and initialAcKwhPerYear that you calculated previously. For each year after the first year, apply the efficiencyDepreciationFactor, costIncreaseFactor, and the discountRate to the values.
    2. Add the totals for all years.

    The following table shows an example of how to calculate the lifetime cost of electricity. Each row represents the cost of electricity for a year in the life of the solar installation. After the first year, both the increased cost of electricity and the discount rate are applied exponentially. Finally, the sum of all rows is the lifetime cost of electricity with the solar installation.

    Year Annual utility bill in current local currency value (USD) (annualUtilityBillEstimate)
    1 annualUtilityBillEstimateYear1 = billCostModel (yearlyKWhEnergyConsumption - initialAcKwhPerYear)
    2 annualUtilityBillEstimateYear2 = billCostModel (yearlyKWhEnergyConsumption - initialAcKwhPerYear x efficiencyDepreciationFactor) x costIncreaseFactor / discountRate
    : :
    20 annualUtilityBillEstimateYear20 = billCostModel (yearlyKWhEnergyConsumption - initialAcKwhPerYear x efficiencyDepreciationFactor19) x costIncreaseFactor19 / discountRate19
    Total remainingLifetimeUtilityBill

The following Python code returns an array of annualUtilityBillEstimate for every year of the installationLifeSpan:

def annualUtilityBillEstimate(
    yearlyKWhEnergyConsumption,
    initialAcKwhPerYear,
    efficiencyDepreciationFactor,
    year,
    costIncreaseFactor,
    discountRate):
  return (
    billCostModel(
      yearlyKWhEnergyConsumption -
      annualProduction(
        initialAcKwhPerYear,
        efficiencyDepreciationFactor,
        year)) *
    pow(costIncreaseFactor, year) /
    pow(discountRate, year))

def lifetimeUtilityBill(
    yearlyKWhEnergyConsumption,
    initialAcKwhPerYear,
    efficiencyDepreciationFactor,
    installationLifeSpan,
    costIncreaseFactor,
    discountRate):
  bill = [0] * installationLifeSpan
  for year in range(installationLifeSpan):
    bill[year] = annualUtilityBillEstimate(
      yearlyKWhEnergyConsumption,
      initialAcKwhPerYear,
      efficiencyDepreciationFactor,
      year,
      costIncreaseFactor,
      discountRate)
  return bill
  1. Calculate the lifetime cost of electricity if a solar installation is not installed:

    1. For each year of the lifespan of the solar installation, calculate the cost of the electricity the household will need to purchase annually if solar is not installed. Use the value for monthlyBill. For each year after the first year, apply the costIncreaseFactor and the discountRate values to monthlyBill.
    2. Add the totals for all years.

    The following table shows an example of how to calculate the lifetime cost of electricity without solar. Each row represents the cost of electricity for a year over the same number of years as the lifespan of a solar installation. After the first year, both the increased cost of electricity and the discount rate are applied exponentially. Finally, the sum of all rows is the lifetime cost of electricity without solar installation.

    Year Annual utility bill in current local currency value
    1 annualBill = monthlyBill x 12
    2 annualBill = monthlyBill x 12 x costIncreaseFactor / discountRate
    : :
    20 annualBill = monthlyBill x 12 x costIncreaseFactor19 / discountRate19
    Total costOfElectricityWithoutSolar

The following code performs the calculation above:

lifetimeBill = (
    monthlyBill * 12 *
    (1 - pow(costIncreaseFactor / discountRate, installationLifeSpan)) /
    (1 - costIncreaseFactor / discountRate))
  1. For each installation size, calculate the installation cost:

    installationCost = localInstallationCostModel(installationSize)

  2. Add up any monetary incentives that are available to the household location.

  3. For each installation size, calculate the total costs associated with installing solar:

    totalCostWithSolar = installationCost + remainingLifetimeUtilityBill - incentives

  4. For each installation size, calculate the total savings associated with installing solar:

    savings = costOfElectricityWithoutSolar - totalCostWithSolar

  5. Select the installation size that provides the most savings.

When your calculations are done

Using the information you provide, the information returned by the Solar API, and the above calculations, you should be able to recommend solar installation sizes that provide maximum cost savings for households in your area.

In the recommendations that you provide to your end user, you can also include the following information that is returned by the API in the SolarPotential object of the solarPotential field:

  • How much usable sunlight a house receives annually, which is returned in the maxSunshineHoursPerYear field of the SolarPotential object.
  • How many square feet of a roof can be used for a solar installation, which is returned in the wholeRoofStats field of the SolarPotential object.
  • The average monthly electricity bill for the household.