USING ARTIFICIAL INTELLIGENCE TO ASSESS SOLAR RADIATION FROM THE TOTAL SKY IMAGES

Solar power generation converts solar radiation into electrical energy. It is the most environmentally friendly green energy source in modern times, but the solar radiation reception rate is unstable due to weather. The general weather forecast is for the climate of a large area and cannot provide effective real-time prediction to the area where the power plant generating radiant energy from solar radiation. The sky imager can collect the sky image of the location of the solar power panel in real time, which can help to understand the weather conditions in real time, especially the dynamics of the clouds, which is the main reason for affecting the solar power generation. In this study, the optical flow method was used to analyze the motion vectors of clouds in the sky image, thereby estimating the changes of clouds in a short time, and the correlation between the distribution of clouds in the sky and the radiation of the whole sky images was analyzed through a neural network. The change further predicts the change in radiation across the sky, thereby effectively assessing the efficiency of solar power generation.


Introduction
Smart grid is a modern power transmission network [1]. In order to reduce losses and improve the reliability of the power grid, it uses information and communication technology to detect and collect the power status on the power side and the power usage status on the use side through digital or analog signals, and then make adjustments. According to this information, power generation, transmission and distribution are performed to save power consumption [2]. Among them, the unstable power supply of solar power generation affected by the weather, which is an urgent problem to be solved by the smart grid.
In this paper, the method of using machine learning is proposed. Without the professional knowledge of meteorology, the change of solar radiation in the future can be estimated from the whole sky image by Neural Network. The specific method is described as follows: first collect the past sky imager image data (Total Sky Image, TSI) and ground observation data (Global  Horizontal Irradiance, GHI), after neural network training, obtain the relationship between TSI  and GHI, and then use the Optical Flow method to detect the motion vector of the current TSI,  Estimate the future TSI based on the motion vector, and use the trained Neural Network to  calculate the GHI value. Solar irradiance refers to the power (watt per square meter, W/m 2 ) received by the sun's electromagnetic radiation per unit area within the wavelength range of the measuring instrument. Solar radiation is usually integrated within a given time period to calculate the radiant energy (joule per square meter, J/m 2 ) emitted into the surrounding environment during that time period. After solar radiation is absorbed and scattered by the atmosphere, irradiance can be measured in cosmic space or on the surface of the earth. The irradiance in cosmic space is a function of the distance from the sun, the solar cycle and the change across cycles [3]. In addition, the irradiance of the earth's surface also depends on the inclination of the measurement surface, the height of the sun above the horizon and atmospheric conditions [4].
There are several ways to measure solar irradiance: Total solar irradiance (TSI): the sum of all wavelengths of solar energy per unit area incident on the earth's atmosphere. Measure the normal incidence of sunlight [4].
Directly Normal Irradiance (DNI) or beam radiation: the surface of the earth at a given location is measured using curved surface elements perpendicular to the sun. [5] It does not include diffuse solar radiation (radiation scattered or reflected by atmospheric components). Direct irradiance is equal to the extra-earth irradiance above the atmosphere minus the atmospheric losses due to absorption and scattering. The loss depends on the time of day, cloud cover, moisture content and other content.
Diffuse Horizontal irradiance (DHI) or diffuse sky radiation: Radiation of light scattered on the surface of the atmosphere on the surface of the earth. It is measured on a horizontal surface, and its radiation comes from all points in the sky, except for radiation around the sun (radiation from the solar disk). [5] [6] there is almost no DHI in the absence of atmosphere [5].
Global Horizontal Irradiance (GHI): The total irradiance of the sun on the earth's horizontal plane. It is the sum of direct irradiance (after considering the solar zenith angle of the sun z) and diffuse horizontal irradiance [5].
The power of solar power generation is determined by the received GHI. Under normal circumstances, GHI can be calculated according to the relative position of the area and the sun. However, GHI is affected by the weather conditions. Obviously, it can be observed that the cloud layer will effectively shield the solar radiation, and the clouds with different composition have different occlusion rates, and the distribution and composition of clouds in the sky could be recorded with total sky images. If we can understand the relationship between total sky images and GHI changes, we can use total sky images to evaluate the power of solar power generation.
In the case of artificial neurons called artificial neural networks (ANN) or simulated neural networks (SNN), neural networks (NN) are a set of interconnected natural or artificial neurons that use mathematical or computational models to connect Calculation method. In most cases, an artificial neural network is an adaptive system that can change its structure based on external or internal information flowing through the network.
These artificial networks can be used for predictive modeling, adaptive control and applications, and can be trained through data sets. Self-learning generated by experience can happen inside the network, and the network can draw conclusions from a complex set of seemingly unrelated information.
In fact, neural networks are non-linear statistical data modeling or decision-making tools. They can be used to model complex relationships between inputs and outputs or find data patterns.
The usefulness of artificial neural network models is that they can be used to infer a function from observations, and it can also be used. Unsupervised neural networks can also be used to learn input representations that capture the salient features of the input distribution, and the recently used deep learning algorithm, which can implicitly learn the distribution function of observed data. Learning in neural networks is particularly useful in applications where the complexity of data or tasks makes it impossible to manually design such functions.
Optical flow is a significant motion pattern on the surface and edges of objects in the visual scene caused by the relative movement between the observer and the scene [7] [8]. The optical flow can also be defined as the velocity distribution of obviously of each color scale in the image [9]. It can be used for motion detection, object cutting, collision time estimation and object expansion calculation. The principle of the optical flow is to find the corresponding position of the same object (with the same pixel intensity) in the two images before and after. It is assumed that because the time difference is extremely small, so it means that the pixel intensity of the same object has not changed. If several objects move, then find the pixel pair that has the smallest sum of pixel intensity changes corresponding to each object, and the motion vector of each object can be analyzed.

Materials and Methods
As mentioned earlier, the purpose of this study is to predict the future changes in Global Horizontal Irradiance (GHI) values from current Total Sky Imagery (TSI). In order to provide overall management information for the smart grid. To achieve this goal, the study can be divided two parts:

Use Neural Networks to Train the Relationship between TSI and GHI
We first collect the image data from total sky imager and ground observation data, and preprocess the TSI by image processing. In order to eliminate the interference of the image brightness, the image expressed in RGB primary colors is converted into YCbCr color space. The conversion formula is as follows: (2) Where Y represents luminance, which is the density of light and is non-linear, and Cb and Cr are the blue and red concentration shift components, respectively. The brightness of the light in the image is regarded as the attenuation of solar radiation caused by weather conditions it is the source of weather information during machine learning.
After expressing the total sky image in lumens, it is divided into 7x7 blocks on average, and the average pixel intensity of each block is taken as the image feature, as shown in Figure 1 below.
Because the solar radiation from the top of the atmosphere to the ground is attenuated by weather conditions, and the solar radiation distribution at the top of the atmosphere depends on the sphericity and orbital parameters of the earth, we simplify this information to the latitude and longitude of the experimental field and the experimental time The latitude and longitude are fixed values, so only the time parameter is needed.
The feature vector composed of the above 50 data is taken as the input layer data of the neural network; the output layer of the neural network is the ground data GHI corresponding to each image. The training model is shown in Figure 2 below. The total sky images collected throughout all the day are arranged in chronological order, with odd number data as the training set; even number data as the test set.

Use Optical Flow to Predict the Future Total Sky Image
After the color conversion, the sky image will be presented as blue with a higher spectral frequency due to light scattering. Red with a lower relative spectral frequency can be regarded as an obscuration obstacle in a clear sky. As a method for distinguishing between sky and cloud regions, in this study, the critical value is set to 0.85, and a good cloud discrimination effect can be obtained. Optical flow calculation is performed on the cloud edge in the total sky image, and the motion vectors on the edge of the cloud can be used to learn the parameter information of cloud movement, expansion and diffusion. Bring these parameters into the current total sky image to predict the total sky image of the next few minutes.

Results and Discussions
In this experiment, Mean Absolute Percentage Error (MAPE) was used to evaluate the predictive ability of neural networks. MAPE is calculated as follows: According to MAPE, the prediction ability of neural network can be divided into the following four levels: • MAPE ＜ 10%, it has a highly accurate prediction ability • 10% ≦ MAPE <20%, you have good predictive ability • 20% ≦ MAPE <50%, it has reasonable prediction ability • 50% ≦ MAPE, it has inaccurate prediction ability The experiment using neural networks to find the correlation between TSI and GHI is designed as follows: the total sky images from 05:00 am to 17:00 pm are used as testing data, and the sampling frequency is 60 images per hour. Part of the image is disturbed by water stains on the total sky imager, and some images cause distortion when the sun shield is removed. After manually removing these data, there are 3,000 training data sets and 635 testing data sets to exclude contamination.
After the image preprocess, use the aforementioned neural network model to calculate the correlation weight between the input TSI and the output GHI. Figure 4 below shows the results of using neural networks to estimate GHI based on TSI. The blue line is the ground observation data, the orange line is the prediction result, the horizontal axis is the test time, the time is arranged in order, and the vertical axis is the normalized GHI Value, it can be clearly seen that if the weather does not change drastically, there is no obvious loss of the GHI value, but when the weather changes drastically, the GHI changes due to the cloud cover, and the model trained by the neural network can also effectively predict. Evaluating the prediction performance of neural networks by MAPE is shown in Figure 5 below. MAPE finally converges to 2.075%. Figures 6 and 7 below are the Root Mean Square Error (RMSE) of feature vector between the predicted total sky image and the real total sky image after one minute and five minutes, respectively. The RMSE of the predicted image and the real image after one minute is 7.84%; the predicted image and the real after five minutes The RMSE of the image is 19.55%, and the peak point in the figure is the rapid change of the cloud layer, which causes the image content to change drastically. As the change mode of the cloud layer changes, the accuracy decreases as the prediction time lengthens.