Measured and forecasted weather and power dataset for management of an island and grid-connected microgrid

This article presents the weather and power data files from renewable sources used to solve the economic dispatch problem of a microgrid that operates in the isolated and grid-connected modes. Methodology is used in the research article “Management of an island and grid-connected microgrid using hybrid economic model predictive control with weather data” (Silva et al., 2020). Automatic stations located in the Brazil's south and northeast furnished the weather data (global horizontal irradiance, temperature, and wind speed). A script generates files containing weather forecasts from one-day ahead using the geographical coordinates of the weather stations. Hybrid models, characterized by real and binary variables, use the weather forecasting data to calculate the photovoltaic and wind power forecasts. A microgrid management algorithm uses these forecasts to solve the optimal economic dispatch problem. This data-in-brief paper presents five datasets for each weather station: (i) Weather dataset downloaded from the website of the National Meteorological Institute, (ii) Weather research and forecasting (WRF) dataset derived from the raw data generated by the weather research and forecasting model, (iii) Weather dataset that joins the forecasted data with the measured data in a single file, (iv) Handled dataset that treats some gaps in the weather dataset and converts it to other formats, (v) Files containing only the temperature, global horizontal irradiance, and wind speed data, (vi) Files containing the measured and forecasted wind and solar power.

Meteorological Institute, (ii) Weather research and forecasting (WRF) dataset derived from the raw data generated by the weather research and forecasting model, (iii) Weather dataset that joins the forecasted data with the measured data in a single file, (iv) Handled dataset that treats some gaps in the weather dataset and converts it to other formats, (v) Files containing only the temperature, global horizontal irradiance, and wind speed data, (vi) Files containing the measured and forecasted wind and solar power.  Table   Subject Energy engineering and power technology. Specific subject area Microgrid management. Weather forecasting model. Type of data Temperature, global horizontal irradiance (GHI) and wind speed measured/forecasted dataset of Natal (.mat and .dat formats); temperature, irradiance and wind speed measured/WRF dataset of Santa Vitoria do Palmar (.mat and .dat formats); WRF dataset of Natal (xlsx); WRF dataset of Santa Vitoria do Palmar (xlsx); weather dataset of Natal (xlsx) and weather dataset of Santa Vitoria do Palmar (xlsx); weather measured dataset of Natal (.csv); weather measured dataset of Santa Vitoria do Palmar(.csv); photovoltaic (PV) and wind power dataset of Natal (.mat and .dat formats); photovoltaic and wind power dataset of Santa Vitoria do Palmar (.mat and .dat formats). How data were acquired The measured weather data were extracted from the National Meteorological Institute (INMET) [2] located in Brazil. The forecasted meteorological data were obtained through the global WRF weather research and forecasting model [3] . Data format Raw, converted, processed and filtered data. Parameters for data collection All data were collected at Natal and Santa Vitoria do Palmar weather stations located in Brazil. Data were collected between 01/08/2020 to 01/21/2021 for Natal and from 02/15/2020 to 01/21/2021 for Santa Vitória do Palmar. The measured data have a one-hour-sample rate and the forecasted data have a 10 m sample rate. Description of data collection The measured data were obtained from the INMET

Value of the Data
• Weather data is important to calculate the measured and forecasted power of renewable sources through mathematical models. These models convert the temperature, GHI and wind speed data into photovoltaic and wind powers. The management algorithm presented in [1] use all these data to solve the optimal economic dispatch problem. • The data presented in this brief-data article can assist researchers and companies in the energy sector to simulate and compare various energy management and conversion systems that combine heat and power [4] , intelligent buildings [5] , virtual power plants [6] , microgrids [7] , among others. • These meteorological data can validate energy conversion models and the management algorithm of renewable energy based on forecasts [8] . The power data help researchers to develop power forecasting techniques and mathematical models that convert weather data into solar and wind power. • The data presented here allows energy management research to produce real results and more reliable renewable energy forecast to consumers. For example, in [9] , the atmospheric air inlet temperature of the solid oxide fuel cell model is considered constant. However, according to [8] , more realistic results should be obtained in [9] by considering real and forecasted ambient temperature values.

Data Description
The shared data are essential to obtain wind and solar power from any power systems that include these renewable energy generations, such as microgrids, virtual power plants, heat and power combined systems, wind farms, and solar energy farms. The paper [1] studied a microgrid characterized by photovoltaic panels, wind turbines, converters (photovoltaic and wind), load control panel, controllable resistive loads, battery bank type-energy storage system, and standard connection panel. During the initialization of the optimization algorithm proposed by [1] , it is necessary to define the planning ( Np) and forecasting ( N) horizons. The planning horizon defines the period of time needed to manage the microgrid and also the amount of meteorological data forecasted by the WRF model at the end of the previous day. These forecasted meteorological data are used by hybrid models to calculate the photovoltaic and wind power forecasts from the current sample k until k + N. The photovoltaic power depends on the ambient temperature and the GHI. The wind power, on the other hand, depends on the wind speed and its direction. The forecasts of photovoltaic and wind powers contained in the actual and future samples ( k, k + 1 , k + 2 , ...k + N − 1 ), previously determined by hybrid models, must be sent to the optimization algorithm at the current time kT s , where Ts is the sample time. Next, the optimization algorithm manages in real time the status of the battery bank and performs the grid connection/disconnection of the microgrid. This procedure is repeated from instant ( k + 1 ) T s until the total planning period Np T s . An important note is that the size of the forecast dataset must be less than or equal to k + N. Otherwise, the algorithm will report an error at the end of its execution due to lack of forecasting data. The measured and forecasted meteorological data allow performing the following studies: • Determine the forecasting errors of the meteorological data of temperature, GHI, and wind speed. • Determine the forecasting errors of the wind and photovoltaic powers.
• Perform the microgrid management strategy's sensitivity analysis in relation to forecast errors, comparing power generation forecasts and their respective actual data.
In this study, the Weather Research and Forecasting model (WRF version 4.1.2, available at https://www2.mmm.ucar.edu/wrf/users/ ) [3] was used to simulate two distinct regions (see  Furthermore, to minimize possible instability problems in the simulation, a spin-up cycle was added, where the first 3 h of each prediction cycle were not included in the analyzes for a 24 h period of simulation.
The locations may be briefly described as follows: 1. Natal-RN. Capital of the State of Rio Grande do Norte, was founded in 1599 on the banks of the River Potengi. It is known for its natural beauty, beautiful beaches, dunes, lagoons and coconut trees. Natal has a tropical rainy climate with dry summer, and relatively low temperature ranges and relatively high air humidity, due to its location on the coast. The state capital boasts the title of City of the Sun due to its high solar luminosity that exceeds 2900 h per year. The annual rainfall index exceeds 1700 millimeters (mm), concentrated between the months of March and July. Stronger winds happen especially between the months of August and October. 2. Santa Vitoria do Palmar-RS, Brazil. Located in the extreme south of Brazil, it borders on the north with the city of Rio Grande and on the south with the city of Chuí, also bordering Uruguay. The eastern part of Santa Vitória do Palmar is bathed by the Atlantic Ocean, totaling 140 km of coastline with 4 maritime lighthouses installed. Between the sea and the BR 471, there is the Mangueira lagoon, which was formed by the rise and fall of the sea over thousands of years. It is the only lagoon in Brazil that has the Spirulina microalgae capable of absorbing pollutants from the atmosphere. The city's climate is subtropical, with moderate summers and cool winters. The annual average maximum temperature is around 22 °C and the minimum around 12 °C. It has an average wind speed of over 6.5 m/s, which is considered a good average for installing wind turbines. In general, the rains are well distributed throughout the year, with a little more frequency in winter. Table 1 shows the main physical options selected. More information on these physical options can be found in [3] .  The code read_wrf_nc.f, available in https://www2.mmm.ucar.edu/wrf/src/read _ wrf _ nc.f , was used to read output files of the WRF in the exact center points in D4 domain to both locals, Natal-RN and Santa Vitoria do Palmar-RS. The WRF model was used for prognostic of air temperature, global horizontal irradiation (GHI), wind speed, and estimations of the photovoltaic power. Focusing on the model central domain with 1 km resolution, the difference due to the variation in the resolution of the WRF data and the INMET data is showed in the Table 2 We can observe that Santa Vitória do Palmar has an average temperature 37% lower than Natal, but MAE and MAPE were higher in relation to these values for Natal. In the case of GHI, the WRF model performed very well in Santa Vitória do Palmar with low MAE and MAPE values. Natal has an average GHI 22% higher than Santa Vitória do Palmar and also had higher MAE and MAPE values. In terms of wind speed, Santa Vitória has an average speed 36% higher than Natal, with MAE and MAPE values also higher than Natal values. Thus, the photovoltaic generation in Natal is 21% greater than the photovoltaic generation in Santa Vitória do Palmar. On the other hand, wind generation in Santa Vitória do Palmar is 129% greater than wind generation in Natal. The MAPE values for power are greater than the MAPE values for the meteorological data due to the additional error arising from the mathematical models for the calculation of photovoltaic and wind powers.
The Fig. 2 shows the flow chart to obtain the data files. The weather data of GHI, temperature, and wind speed were extracted from INMET [2] . We used the weather research and forecasting (WRF) model [3] for estimations of the direction and speed of wind, air temperature, and global radiation.
The raw data obtained through INMET and the WRF model are processed and filtered into five datasets: 1. WRF dataset . It has data related to the calculation of wind speed and direction at 10 m height, the conversion of Coordinated Universal Time (UTC) to the local time zone of the microgrid, and the resampling of the meteorological data of Natal and Santa Vitória. 2. Weather dataset . It has measured data from the automatic weather stations and their respective forecasted temperature, GHI, and wind speed, obtained through the WRF model. 3. Handled dataset: It consists the conversion of weather dataset to .mat/.dat files and filling the gaps of measure data. 4. Temperature, GHI, and wind speed dataset . It has data related to the graphs and tables presented in the article's numerical result section [1] and the power data presented in the next item. 5. Photovoltaic and wind power dataset . It has the actual and forecasted power data obtained from the mathematical models proposed by [1] and the temperature, GHI, and wind speed dataset.
The following is a detailed description of each data file available in [11] .

Daily dataset
It has daily raw files (.dat) with the one-day ahead weather forecasts of the data described in Table 3 for coordinates (X, Y, Z).
The variables wind speed, wind direction, air temperature and GHI was forecasted in the same heights of the measurement instruments of automatic stations. The data were collected between from 01/08/2020 to 01/21/2021 for Natal and from 02/15/2020 to 01/21/2021 for Santa Vitória do Palmar, and they were sampled every 10 min. The WRF model generated 720 daily files (379 files for Natal and 341 files for Santa Vitoria do Palmar). These raw data are sequentially organized in the WRF dataset files.

Measured weather dataset
It has raw files (.csv) generated by INMET automatic stations collected from 01/08/2020 until 01/21/2021 for Natal and from 02/15/2020 until 01/21/2021 for Santa Vitória do Palmar. The field names of raw files are in Portuguese. Table 4 presents the translation of each field of .csv files. Table 5 summarizes the measurement instruments specifications and heights of surface. The weather station measures at every minute the meteorological information such as temperature, humidity, atmospheric pressure, precipitation, wind speed and direction, solar radiation. Every hour, these data are available to be transmitted, via satellite or cell phone, to INMET's headquarters in Brasília. The received data are validated through quality control and stored in a dataset. The data are also available free of charge in real-time, through the internet [2] to elaborate on various meteorological services such as meteorological reports, weather surveillance, and weather forecasts and patterns. These data are useful for many applications, such as hydrology and oceanography research [12] .

WRF dataset
This dataset contains the one-day-ahead forecasts of the Natal and Santa Vitória daily weather data. In addition to the meteorological data described in Table 3 , this spreadsheet includes: • Additional columns with local time (TIME (LT = LOCAL TIME), the temperature in °C (T2( °C)), calculation of the resulting wind speed (Wspeed) at 10 m height, which corresponds to the automatic station's height and the estimation of the wind direction in degrees (Dir ( °)). • Additional columns with the variables U10, V10, Wspeed, Dir., SWDOWN, and T2 ( °C) sampled at each hour.

Weather dataset
It has spreadsheets that contain all the data from the measured weather dataset and the forecast of temperature, GHI, wind speed and direction speed. The variables are described in Table 6 .
In this dataset there are some gaps of the measured data obtained from INMET in the months of October 2020 to January 2021. It is up to the user to choose the best way to treat these gaps.

Handled dataset
The measured weather data contained in the weather dataset had gaps for some days in the months of October 2020 to January 2021. If the user wants to work with the complete dataset, the weather dataset was converted from .xls to .mat/dat. This conversion made in MAT-LAB includes filling these gaps with the average of the measured values of each time. These new datasets do not have column 1 of the weather dataset as MATLAB was not able to read and convert the weather dataset's date format. The code used to simulate the handlet dataset is available at https://github.com/danilopsv/Weather-dataset-code.git .

Temperature, GHI and wind speed dataset
The files in this dataset have the filtering variables of the weather dataset. This procedure is necessary because the conversion to the .mat/.dat extension of the complete meteorological dataset contains information that is not used by the optimization algorithm. This generates a high and unnecessary computational cost. The temperature and GHI are used to calculate the photovoltaic power generation and the wind speed is used to calculate the power generation of the wind turbine. See Table 5 to check the heights of these variables. Columns 1, 3, and 5 refer to the measured data of temperature, GHI, and wind speed, respectively. Columns 2, 4, and 6 are the temperature, GHI, and wind speed forecasting data, respectively. The sample rate is one hour. The code used to simulate the temperature, GHI and wind speed dataset is available on https://github.com/danilopsv/Weather-dataset-code.git and Zenodo [ 13 ]..

Photovoltaic and wind power dataset
The mathematical models of the wind system and the photovoltaic system use real equipment specifications. The photovoltaic system consists of six panels of 250Wp each connected in series and an 20 0 0W inverter. The wind system consists of a 10 0 0W wind turbine 2.46 meters in blade diameter, and an 1500W inverter. In addition to the technical specifications of the equipment, the mathematical models of solar and wind generation in [1] calculated the power data, in Watts, through the temperature, GHI, and wind speed dataset, starting from 01/08/2020 to 01/20/2021 for Natal, and from 02/15/2020 to 01/20/2021 for Santa Vitória do Palmar. Columns 1 and 2 refer to the measured and forecasted wind power, respectively. Columns 3 and 4 represent the measured and forecasted photovoltaic power, respectively. The code used to simulate the power dataset is available on https://github.com/danilopsv/Power-dataset-code.git and Zenodo [14] .

Experimental Design, Materials and Methods
To generate the meteorological data files, we follow the following procedure (see Fig. 1 ): A -Download via webpage or file generation through a script.
On the INMET automatic stations website, we choose the location, the start date, and the end date of the data. The INMET website generates the data and a download link in .csv format. The global WRF model consists of scripts defined by location chosen through geographic coordinates. We specify in the scripts which weather variable will be forecasted, the forecasting time horizon, and the sampling rate. These scripts generate daily .dat files with a 10 min sample rate.
The WRF generated daily forecasting data in several files. It was necessary to join this data set in a single file to represent a time interval larger than one day. In this case, the data was merged in a single spreadsheet as follows: • Natal: from 01/08/2020 at midnight to 01/21/2021. • Santa Vitória do Palmar: from 02/15/2020 at midnight to 01/21/2021. C -Data processing.
It performs the following tasks: • Convert the temperature given in Kelvin to degree Celsius and the supplied solar radiation in kJ/ ( h. m 2 ) to GHI in W/m ² considering that 1 . 0 W/ m 2 = 3 . 6 kJ/ h . m 2 .
• Calculate the resulting wind speed and direction at 10 m height using the following equations: W speed = U 10 2 + V 10 2 and, d ir = mod ( ( 180 • π ) × arctan 2( V 10 , where U 10 and V 10 are the wind speed components X and Y, respectively. • Replace the outlier data of GHI due to the inconsistencies with their respective predicted values.
D -Data filtering.
Not all raw data was relevant to the microgrid management simulation in [1] . Only the temperature, GHI, and wind speed data are necessary. We perform the filtering of these data from the MS Excel filter command. E -File conversion.
It converts the raw data to a more user-friendly format like the .xlsx extension. Therefore, it was possible to develop mathematical equations and data filtering directly in the spreadsheet. Besides, it was possible to convert the files to .mat format, an extension used in MATLAB to simulate the microgrid optimization algorithm presented in [1] , and .dat format as an additional option for the user. This last conversion includes to fill the gaps of the measured data with the average of the values of each hour. Suppose the average measured temperature of Natal-RN at 2:00 A.M. and 6:00 A.M. are 24 °C and 27 °C respectively. The data processing script fills the gaps with these averages at the respective hours of days when the measured temperature is not available.
F -Copy and paste data.
The WRF forecasting data was copied and pasted into the same data file that contains the weather data. The unification of these data facilitates the extraction and conversion of the data predicted and measured by simulation software such as MATLAB and it assists in the graphical comparison between the measured and forecasted data.

G -Power calculation
Wind and photovoltaic power generations were calculated through mathematical models developed in MATLAB using temperature, GHI, wind speed data, and technical data from manufacturers of these generators.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.