# Industry 4.0 towards Forestry 4.0: Fire Detection Use Case +
## 5 Methodology
### Dynamic Query Window-Based Selector for Stream Rate Change
#### 5.3.2 The Proposed Dynamic Window-Based Selector
First, the algorithm identifies the stream type using the _get_Stream_Type_ function as shown in Line 6. The function of _get_Stream_Type_ is used to map the numerical values of stream rate to the high-level representations of requirements within the built knowledgebase (e.g., stream rate = high). Secondly, the algorithm gets the window type and size from the built knowledgebase based on the workload requirements and stream rate type. Thirdly, for the window size, the algorithm decodes the high-level representations of window size into numerical values to be used for new window configuration. For the recommended large window size, the new window size will be increased. For the small window size, the new window size is identified according to the _StreamRateChangeRatio_ stated on Line 14. The _StreamRateChangeRatio_ is calculated based on the last stream rate and the current stream rate. Therefore, the new window size is rationally recommended based on the previous recommendation extracted from the knowledgebase, the status of both of current stream rate and the last executed window size(s). \begin{table}
\begin{tabular}{l l c c c c c} \hline \hline \multirow{2}{*}{**Usecase. No**} & **Requirements** & \multicolumn{2}{c}{**Workload Requirements**} & **Stream** & **Recommended** & **Recommended** \\  & **Description** & **Latency** & **Data Enrichment** & **Rate** & **Window Type** & **Window Size** \\ \hline \multirow{2}{*}{1} & data enrichment requirement & \multirow{2}{*}{-} & \multirow{2}{*}{High} & \multirow{2}{*}{Low} & Sliding & Large \\  & has the higher priority & & & & & \\ \hline \multirow{2}{*}{2} & data enrichment requirement & \multirow{2}{*}{-} & \multirow{2}{*}{High} & \multirow{2}{*}{High} & Sliding & Large \\  & has the higher priority & & & & & \\ \hline \multirow{2}{*}{3} & Latency requirement & \multirow{2}{*}{Low} & \multirow{2}{*}{-} & \multirow{2}{*}{Low} & \multirow{2}{*}{Tumbling} & Small \\  & has the higher priority & & & & & \\ \hline \multirow{2}{*}{4} & Latency requirement & \multirow{2}{*}{Low} & \multirow{2}{*}{-} & \multirow{2}{*}{High} & \multirow{2}{*}{Tumbling} & Small \\  & has the higher priority & & & & & \\ \hline \multirow{2}{*}{5} & Latency requirement & \multirow{2}{*}{Low} & \multirow{2}{*}{Medium} & \multirow{2}{*}{Low} & Sliding & Small \\  & and reasonable resulted & & & & & \\ \hline \multirow{2}{*}{6} & Latency requirement & \multirow{2}{*}{Low} & \multirow{2}{*}{Medium} & \multirow{2}{*}{High} & Sliding & Small \\  & has the higher priority & & & & & \\ \multicolumn{2}{c}{and reasonable resulted} & & & & & \\ \multicolumn{2}{c}{data size is needed} & & & & & \\ \hline \multirow{2}{*}{7} & Latency requirement and & \multirow{2}{*}{Medium} & \multirow{2}{*}{Low} & \multirow{2}{*}{Sliding} & Small \\  & data enrichment have & & & & & \\ \multicolumn{2}{c}{the same priority} & & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Recommended stream query window configurations for some use cases requirements i.e., latency and data enrichment.