# Decision Support Application for Energy Consumption Forecasting
## 3 Proposed Model
### The Architecture of the Application  
This section includes the details of the architecture of the application. The application is based on three parts, which are:  
1. **Forecasting app**: This part includes the implementation of the forecasting algorithms and is based on Java and R programming languages. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Strategy** & \multicolumn{2}{c}{**Train Data**} & \multicolumn{2}{c}{**Test Data**} \\ \cline{2-5}  & **Duration** & **Variables** & **Duration** & **Variables** \\ \hline
**1** & Past 10 days & Energy consumption & past 24 h & Energy consumption \\ \hline
**2** & Past 10 days & Energy consumption + Environmental temperature & past 24 h & Energy consumption + Environmental temperature \\ \hline
**3** & 10 chosen days & Energy consumption & past 24 h & Energy consumption \\ \hline
**4** & 10 chosen days & Energy consumption + Environmental temperature & past 24 h & Environmental temperature \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Used data sets in the proposed strategies of this work. 2. **Parse app**: The implementations of the training strategies. All the connections between the application and the databases are also included in this part. 3. **Main app**: This part has the controllers of the application, the connections between the other components and the graphical interface of the application. The main app is the central component of the application which connects the other two components. All the communications between the user and the application are a part of the responsibilities of the main app. Once the user chooses a date to start a forecasting process, the main app makes a connection to the parse app and asks for the needed data from the chosen date to run the forecasting algorithms. After receiving the data, the main app sends this data to the forecasting app. The forecasting app runs the forecasting methods by the received data from the main app and returns the results of the forecasting. The main app shows the results to the user and sends them to the parse app to be stored. Figure 4 presents the connections between the components of the application. The forecasting app is based on the java and R programming languages and is responsible to receive the data from the main app and run the forecasting methods. This component of the application includes the implementation of the forecasting methods. Every algorithm has its own class which creates a connection to the R programing language to run the methods in this language. There are two available ways to run the methods. The first is run the algorithms by an excel file that the user should insert; and the second way is an automatic forecasting, in which the user chooses a date and hour and the application does the forecast automatically, the second way is where the application asks for data from parse app. For every forecasting method, there are two R scripts one for automatic forecasting and one for forecasting by an excel file. Figure 5 presents the R script of HyFIS method in case of automatic forecasting, where the FRBS library [29] is used to implement this method. As it is visible in Figure 5, the _hyffz_ function in R receives three data sets as well as the needed variables to configure the method that the user can insert during the process of the forecasting. The _traininput_ and _trainoutput_ are used as the training data, and the _testinput_ is meant to be used as the test data. Figure 6 presents the sequence of running the HyFIS method in R language. Parse app includes the implementation of the forecasting strategies, all the connections to the databases and the data storage processes. Every proposed forecasting strategy has its own class which is connected to the databases connection classes. Every time the user chooses a date and a strategy to run the forecasting process, this date will be sent to the class of the deliberate strategy.