Charts - Solar charts

== Introduction ==
These charts are only available if the station has a solar sensor for measuring the solar radiation.
The Solar charts submodule consists of four charts:
#Solar hours statistics - Plotting the range, average and estimator for the standard deviation for the solar hours per year
#Monthly solar hours statistics per year - Plotting the range, average and estimator for the standard deviation for the solar hours per month per year
#Insolation statistics - Plotting the range, average and estimator for the standard deviation for the solar energy per year
#Monthly Insolation statistics per year - Plotting the range, average and estimator for the standard deviation for the solar energy per month per year
Below you will find an example image of each chart and an explanation of the origin of the numbers. 
For the insolation graphs the method of calculation is explained.
For the calculations the standard C# LINQ-functions Min, Max and Avg are used. For the standard deviation this LINQ-extension is used with a modification for a minimum number of observations required of 2, if less the StdDev returns 0 (zero).
NOTE: for years where no solar sensor was present the chart displays the value 0 on all charts. The possibility not to display the years at all has not been implemented.
== Solar hours statistics ==
For all days in a year the value of field 25, Total hours of sunshine (see Dayfile), is taken and the resulting statistics are calculated and plotted. 
== Monthly solar hours statistics per year ==
For all days in a month in a year, the value of field 25, Total hours of sunshine (see Dayfile), is taken and the resulting statistics are calculated and plotted. 
== Insolation statistics ==
For an explanation of this chart it is necessary to explain the insolation first. 
We measure Solar Irradiance as the power per unit area received from the Sun in the form of electromagnetic radiation as measured in the wavelength range of the measuring instrument (your solar sensor of your weather station). CumulusMX stores this in the monthly logs as the value of the Solar Radiation (field nr 19) at that moment. It is the momentary solar power in W/m2. 
The Solar Insolation for a given time period is the integration of the measured Solar Radiation values. Or as the wiki says:
 Solar irradiance is often integrated over a given time period in order to report the radiant energy emitted into the surrounding environment (joule per square metre, J/m2) during that time period. This integrated solar irradiance is called solar irradiation, solar exposure, solar insolation, or insolation. 
So if we take R for Radiation (which we sample in field 19) we get for a time period of a day:
 \int{R} \, dt
=== Using Numerical Integration ===
But because we do not have continuous measurement we have to approximate this by taking the samples of the Solar Radiation we do have for the sampling interval we use (1, 5, 10 etc... minutes). We use the theory of Numerical Integration. Assuming equal distance \Delta t between the samples and a not too disruptive radiation function we get an approximation for the integral as:
 \sum_{0}^{\sum_{\Delta t}} ({field19} \times \, \Delta t)
for all samples, assuming the measured value is the midpoint of 
 t + \frac{1}{2}\times \Delta t and t - \frac{1}{2}\times \Delta t.
=== Variable interval ===
However this interval appears not to be constant in the reality of CumulusMX. Not only appears the user to change the interval once in a while but also in the start and stop sequence of CMX and for other reasons unknown there appear to be smaller and larger 'gaps' in the data resulting in time interval changes which have been found to be unpredictable. As a result an algorithmic solution has been applied to reduce the influence of the interval size. With a bit of grandeur you might say it is an integration with variable step size.
=== Method of calculation ===
#A list of monthly logfile entries is created for each day where the theoretical solar max radiation is above zero (i.e. the sun is up)
#The interval in minutes is the sampling interval (loginterval) the user has assigned in the CumulusMX settings (1, 5, 10, 15, 20 or 30 minutes)
#Then in a loop over all values, each time it is checked if the interval setting corresponds with the realised interval. If not the interval is adjusted to the new value.
#If the interval is larger then 30 minutes the gap is too large and the value is skipped, no addition is made, the calculation is restarted at the next entry.
#The Energy over the interval is calculated as {SolarRad} \times {Interval} \times 60 to get the energy in Ws and summed up to the total for the day.
#At the end of the day the total energy sum in Ws is converted to KWh by {the\ energy\ sum} \div {3600 \div 1000}
NOTE: during this process the actual calculation of the solar hours is also executed. All calculation are done in one pass. The creation of the actual charts data consists merely of the selection of the data from the resulting list.
== Monthly Insolation statistics per year ==
The chart is analogue to the previous chart for all years.
Category:CumulusUtils