FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
173 stars 11 forks source link

Wrong unit for sun irradiance #65

Closed andrekuehne closed 1 year ago

andrekuehne commented 1 year ago

The unit reported to home assistant for sun irradiance (W/m²) does not match the unit from the simple_dwd_forecast (kJ/m²/h). Either the unit should be updated or the reported values need to be divided by 3.6 to convert between kJ/h and W. I noticed this because the values I'm currently seeing are consistently above the solar constant of 1361 W/m², which is impossible. Dividing by 3.6 yields much more sensible values that also closely match my simple local weather station with a light sensor.

Either solution will probably mess up long-term statistics in Home Assistant (incompatible units or sudden jump in magnitude)

FL550 commented 1 year ago

Hi, thanks for reaching out. We had this already in #35 and now I'm a bit confused. I will have a look into this later. Or maybe you can clarify this?

andrekuehne commented 1 year ago

Thanks for pointing out the previous issue on this. However, I think it was correct originally and the change made following issue 35 was not correct. Let me clarify:

You cannot get a solar irradiance value above 1361 W/m² because this is the total power output of the sun at the earth's distance per m². This number is called the solar constant. Hence, this value is the physical upper limit on any measured value.

Due to atmospheric effects the actually measured value on earth is even lower, which is correctly cited by user @lbrandh in the previous issue (~1120 W/m²). However, even he states that he is getting values between 0-2000. While this is, as he writes, in the same ballpark as the Wikipedia value of 1120 W/m², it is nevertheless above the stated physically possible value, hence the unit cannot be W/m².

Going on, he mistakenly states that his measured value is about a factor of 10 too small for the kJ/m² figure taken from Wikipedia (21.6 MJ/m² = 21600 kJ/m²). This number however represents energy per area for a whole day, i.e. 21.6 MJ/m²/day. If we convert this value back to kJ/m² per hour (the original unit of the Rad1 value in your dataset), we arrive at 900 kJ/m²/hour which is again in the same ballpark as his number. As this 900 kJ/m²/hour is averaged over the whole day, the peak value at noon will of course be higher. We can simply calculate this maximum possible value if we multiply the solar constant by 1 hour (i.e. accumulating the solar energy deposited in 1 hour in 1 m²), arriving at 4899.2 kJ/m². I have never observed a value of more than ~2500 since last September, which is twice as high as the physical upper limit for solar irradiance of 1361 W/m² but only roughly half the the 4899.2 kJ/m² value. Given that I haven't had any measurement at the peak solar time (summer solstice, June 21), I think that's reasonable.

The numerical conversion factor between kJ/m²(/hour) and W/m² is simply 3.6. Below find a graph of the DWD values your integration provides divided by 3.6 (orange) and my local sensor (blue). My sensor goes down in the afternon due to some tree shading.

grafik

To conclude, the number provided by DWD is accumulated energy over 1 hour in kJ/m², which according to Wikipedia is called "solar irradiation, solar exposure, solar insolation, or insolation". The very similar named solar irradiance is momentary solar power per m², i.e. W/m². You can convert between the two by dividing the kJ/m² number by 3.6 to arrive at W/m². The W/m² solar irradiance will be the average value over one hour.

Whether the value provided by DWD for 12:00 is the accumulated energy between 11 and 12 or 12 and 13 I cannot say ;).

FL550 commented 1 year ago

Thank you very much for your detailed answer. I don't use the values myself, so I never compared them to real values.

I released a new version which fixes this.

Best regards