Get incoming irradiance from site power production

31 views
Skip to first unread message

Erik Mårtensson

unread,
Jan 6, 2023, 7:18:51 PM1/6/23
to pvlib-python
Hello, 

I was wondering if there is any way to calculate the incoming irradiance from the power produced by a site? So essentially running a "normal" forward pvlib simulation backwards with the same site layout, inverter and module characteristics. I want to compare my external weather data with what the site seems to be actually experiencing.  

If not, do you know of any other way to achieve such a result? 

Kind regards, 
Erik  

Mark Mikofski

unread,
Jan 7, 2023, 3:58:21 PM1/7/23
to pvlib-python
Hi Erik, I think you can achieve what you want, backing out irradiance from power approximately by using a scalar root finder from SciPy optimize (https://docs.scipy.org/doc/scipy/reference/optimize.html#root-finding), then 

1. first write the FORWARD function to find AC power given an irradiance, for example call it `calc_acpower_from_irrad(irrad) -> acpower`, 

2. next write a function to calculate the norm of the residual, which is the square of the difference between the calculated `acpower` and the given value, Callie `pac0`. This function is often written online as a lambda like `lambda irrad, pac0: (calc_acpower_from_irrad(irrad) - pac0)**2` but it can also be defined as a function:

```python
def calc_resnorm(irrad, pac0):
    return (calc_acpower_from_irrad(irrad) - pac0)**2
```

Read the docs for `scipy.optimize.root_scalar` where it explains that the first argument of the function must be the value you are searching for, which is `irrad` in our example

3. then finally use the residual function (aka your objective) in the root finder either in a loop or use Newton which is vectorized. Note some root finder require you to set high and low boundaries (`a, b`), while others require an initial guess, `x0`

For example using newton:

```python
from scipy.optimize import newton

PAC0 = <an array of AC power values>

results = newton(f=calc_resnorm, x0=1000, args=(PAC0, )) # or something like this
```

Sorry I’m on my phone so this might not be exactly right but hopefully you get the idea?

Good luck,
Mark

Anton Driesse

unread,
Jan 8, 2023, 2:43:13 PM1/8/23
to pvlib-...@googlegroups.com

Hi Mark, Erik,

I agree with this approach in principle. Have you done it before Mark?  It will be hard to back out both temperature and irradiance--the two main inputs to the simulation--so the actual approach may vary a bit depending on whether you have any temperature information available or trust it enough.

It's probably easier to just do some plausibility tests on the external weather followed by analysis of the actual vs expected output.

Anton

-- 
PV Performance Labs
Emmy-Noether-Str. 2
79110 Freiburg
Germany

+49-761-8973-5603 (Office)
+49-174-532-7677 (Mobile)

www.pvperformancelabs.com
--
You received this message because you are subscribed to the Google Groups "pvlib-python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pvlib-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pvlib-python/46355d3b-8a86-4a03-b5fa-73c1d2a82a2dn%40googlegroups.com.

  

Mark Mikofski

unread,
Jan 8, 2023, 3:24:37 PM1/8/23
to Anton Driesse, pvlib-...@googlegroups.com
Good point Anton.

My approach would be to assume fixed module temperature of 50C (or any appropriate temperature between 45C & 55C depending on known ambient temperatures at the site).

Then, if a refinement is necessary, rerun the optimization using the backed out irradiance as known and solve for module temperature.

Keep alternating until you reach convergence. Probably 1 or none iterations are enough, but you can satisfy your curiosity and CYA.

This psuedo steady state quasi equilibrium assumption is good I think because temperature changes so much more slowly than power because of the thermal time constant of the cell/glass stack.

I think this  type of problem is “stiff”, meaning irradiance to power conversion is infinitely faster than the heat transfer. There are similar analogs in chemical kinetics (eg fire/combustion).

Sent from my iPhone

On Jan 8, 2023, at 11:43 AM, Anton Driesse <anton....@pvperformancelabs.com> wrote:


You received this message because you are subscribed to a topic in the Google Groups "pvlib-python" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pvlib-python/7YlN0iak_e8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pvlib-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pvlib-python/7a5150ea-1d8c-b3fd-559c-2f48fe24025e%40pvperformancelabs.com.

Erik Mårtensson

unread,
Jan 8, 2023, 4:21:26 PM1/8/23
to pvlib-python
Hello Mark and Anton, 

Thank you for your replies! I think I understand your method, Mark, it's quite a neat solution. My only issue is that I would like to compare the given irradiance data that I have with irradiance data that I calculate from the actual power data attained from the site's inverter, not from the PVlib simulation. I am currently comparing the PVlib output with the actual power calculation and I want to see how much of the difference is implicated by the difference in sattelite and actual irradiance, if that makes sense? You are right that by using regression between the PVlib output and the datellite irradiance then I get a model to simply "back-track" the PVlib forward simulation, but I don't think that it woul allow me to compare the actual irradiance with the satellite data? 

I do apologies that I didn't make this clear in the post! 

Erik 

Mark Mikofski

unread,
Jan 8, 2023, 5:37:58 PM1/8/23
to Erik Mårtensson, pvlib-python
Erik,

The method I described to you *is* for back calculating the irradiance from the “…the actual power data attained from the site's inverter, not from the PVlib simulation.“

In the example I gave you above, the “actual power data attained from the site's inverter” *is* the constant: `PAC0`. Happy to maybe get on a call and help you work through this. The way a reverse solver works is by guessing & correcting. Essentially each iteration the solver is *guessing* what irradiance would give you the same calculated `acpower` as the measured `PAC0` that you’ve been given from the “actual power data attained from the site's inverter.” When they are the same or very close, the the norm of the residual will be very close to zero or less than some tolerance. This is why this branch of solvers are called root finders.

Hope this helps, and to be honest, understanding how silvers work will open a powerful skill in reversing any forward problem.

Cheers,
Mark

Sent from my iPhone

On Jan 8, 2023, at 1:21 PM, Erik Mårtensson <erikmaa...@gmail.com> wrote:

Hello Mark and Anton, 

Kevin Anderson

unread,
Jan 8, 2023, 5:43:05 PM1/8/23
to Mark Mikofski, Erik Mårtensson, pvlib-python

Erik Mårtensson

unread,
Jan 8, 2023, 7:08:27 PM1/8/23
to pvlib-python
Hi All, 

I get your point, Mark, thank you for clarifying! For some reason I  confused using the forward pvlib method with having to use the data I normally use with it, which is completely besides the point! A very interesting solution for sure and like you say, applicable to reversing most forward problems. I'll try to give it a go this week. 

Thank you for the link, Kevin! 

Erik 

Reply all
Reply to author
Forward
0 new messages