# Exploiting Deep Learning for Wind Power Forecasting Based on Big Data Analytics
## 6 Problem Formulation
```
1:Input:[W, L, P]
2:Output:C
3:ifW = L then\(\triangleright\) Wind power is sufficient to fulfill demand
4:\(P_{new}=0\)\(\triangleright\) Wind power is sufficient that has no cost
5:\(L_{new}=L\)\(\triangleright\) Load is equal to wind power, so load adjustment is not performed
6:\(C=P_{new}\times L_{new}\)\(\triangleright\) Calculating consumption cost
7:elseifW > L then\(\triangleright\) Wind power is greater than demand
8:\(W-L\to SG\)\(\triangleright\) Excessive wind power is transmitted to the SG
9: S = 0.9\(\triangleright\) 10 % reduction in price is subsidiary for next power purchase
10:\(P_{new}=0\)\(\triangleright\) Wind power is sufficient that has no cost
11:\(L_{new}=L\)\(\triangleright\) Load is lesser than wind power, so load adjustment is not performed
12:\(C=P_{new}\times L_{new}\)
13:elseifW \(\geq\) 0 \(AND\)\(W\)\(<\)\(L\)then\(\triangleright\) Wind power is not sufficient to fulfill the demand
14:\(DWD=L-W\)\(\triangleright\) Finding demand that have to be fulfilled by the SG
15:\(L_{new}=Manage\_Demand(DWD,\ L)\)\(\triangleright\) Managing demand to distribute it normally
16:ifS = 0.9 then\(\triangleright\) If there is subsidiary on the price, the price will be adjusted
17:\(P_{new}=P\times S\)\(\triangleright\) 10% reduction on price by subsidiary
18:\(C=P_{new}\times L_{new}\)\(\triangleright\) Calculating consumption cost
19:else
20:\(P_{new}=P\)\(\triangleright\) If there is no subsidiary on price, price remains same
21:\(C=P_{new}\times L_{new}\)\(\triangleright\) Calculating consumption cost
22:endif
23:Manage\_Demand Function
24:Function \(L_{new}=Manage\_Demand(DWD,\ L)\)
25:\(\mu=mean(DWD)\)\(\triangleright\) Average of demand to be fulfilled by the SG
26:\(\sigma=std(DWD)\)\(\triangleright\) Standard deviation of demand to be fulfilled by the SG
27:\(SD=sum(DWD)\)\(\triangleright\) Sum of demand to be fulfilled by the SG
28:if DWD < \(\mu\)then\(\triangleright\) Checking each value of demand vector if it is smaller than mean
29:\(L^{\prime}=L+\sigma\)\(\triangleright\) When value is smaller, add standard deviation to make it closer to mean
30:elseif DWD > \(\mu\)then\(\triangleright\) Checking each value of demand vector if it is greater than mean
31:\(L^{\prime}=L-\sigma\)\(\triangleright\) When value is larger, subtract standard deviation to make it closer to mean
32:endif
33:\(SL=sum(L^{\prime})\)\(\triangleright\) Taking sum of all values of new adjusted load vector
34:d = SL - SD\(\triangleright\) Taking the difference of demanding load and new adjusted load
35:\(\triangleright\) Now the demanded load and new load are adjusted to be equal
36:ifd > 0 then\(\triangleright\) Difference greater than zero means the new adjusted load is more than the demanded load
37:\([idx\ Count]=L>\mu\)\(\triangleright\) Count is the number of values greater than average and index are their index
38:\(L_{new}=L(index)-\frac{d}{count}\)\(\triangleright\) Subtracting the difference from all the larger values
39:elseifd < 0 then\(\triangleright\) Difference smaller than zero means the new adjusted load is lesser than the demanded
40:
41:\([idx\ Count]=L<\mu\)\(\triangleright\) Count is the number of values that are smaller than average load
42:\(L_{new}=L(index)+\frac{d}{count}\)\(\triangleright\) Adding the difference in all the smaller values
43:endif
44:\([index\ L_{sorted}]=\text{Sort}(L_{new})\)\(\triangleright\) Sort will sort the \(L_{new}\) in ascending order and return index of the sorted array
45:\(L_{sorted}\)\(\triangleright\) Shift the peak load to the lowest load
46:if\(\text{=i}\) = 1 to 6
47:j = i-1, \(\text{sf}\) = 5\(\text{i}\) a = length(\(L_{new}\))\(\triangleright\) Defining shifting factor
48:if\(\text{index(i)}>6\)then\(\triangleright\) Shift the load to the lowest load that is not late night
49:\(\text{shftFac}=\frac{L_{new}(index(i-j))}{sf}\)\(\triangleright\) Shift the load to the lowest load that is not late night
50:\(L_{new}(\text{index(i)})=L_{new}(\text{index(i)})\) - shftFac\(\triangleright\) Subtracting the shifting factor from the highest load
51:\(L_{new}(\text{index(a-j)})=L_{new}(\text{index(a-j)})\)\(+\) shftFac\(\triangleright\) Adding the shifting factor to the lowest load
52:endif
53:End For
54:End Function
```  
**Algorithm 1** Algorithm for Demand Side Management (DSM).