## 3 Control Algorithm
### The Process of Optimization  
The coefficient \(\beta\) can be obtained by solving the above objective function. The number of load curves selected from \(Q\) is \(m\). Since the number of load curves in \(Q\) is much larger than \(m\), the next problem is how to select appropriate curves from the set so that the objective function is minimized. By the optimized solution algorithm, the optimal load curve combination and \(\beta\) can be obtained. Compared with other optimization algorithms, the artificial immune algorithm has good parallelism and can be perfectly combined with other algorithms. Additionally, if a comprehensive evaluation system is used to evaluate the individuals involved in optimization, the generation of new individuals will be more complex. This can ensure the diversity of the individuals involved in optimization, and avoid falling into the local optimal, thus, the overall convergence of the algorithm is excellent and the operation efficiency is high [28; 29; 30; 31; 32; 33]. Figure 6 shows the process of objective function optimization. The combination of the load curves is set to \(M\) and the number of load curves contained is \(m\). Firstly, based on the load curve set \(Q\), an antibody population with size \(n\) is randomly generated, and each antibody represents a load curve combination \(M\). Then, the objective function solution model is used to obtain \(\beta\). We then calculate the antibody evaluation coefficient and evaluate the antibody according to \(\beta\). Excellent antibodies are used as the parent antibodies and are preserved. Then we determine whether the optimization end condition is met. If the iteration continues, a good antibody is used to generate a new antibody population through crossover and mutation methods until the best load curve combination is obtained. In this paper, each antibody is evaluated by comparing the individual's desired reproductive rate. In Equation (20), \(\alpha\) is a constant and reproductive rate \(P\) is affected by antibody concentration and antibody affinity. \(A_{v}\) is the affinity between the antibody and antigen, which takes the reciprocal of the objective function \(F\). As shown in Equation (21), the smaller the objective function is, the higher the affinity becomes. This indicates that the higher the antibody's recognition of the antigen is, the better the selected combination \(M\) of load curves is. \(C_{v}\) is the antibody concentration, which represents the proportion of similar antibodies in the antibody population. In other word, it is the similar degree between the different load curve combinations \(M\). Obviously, a high antibody concentration will increase the individual reproductive rate, but it is not conducive to the diversity of antibody population. Thus, Equation (21) plays a role in inhibiting high-concentration individuals and ensures antibody diversity:  
\[P=\alpha\frac{A_{v}}{\sum A_{v}}+(1-\alpha)\frac{C_{v}}{\sum C_{v}} \tag{20}\]  
\[A_{v}=\frac{1}{F}=\frac{1}{\sum\limits_{j=1}^{C}w(j)[y_{v}(j)-y_{s}(j)]^{2}} \tag{21}\]  
Figure 6: Optimization of objective function. \(C_{v}\) is obtained by the affinity \(S_{v,s}\) shown in Equations (22) and (23). In Equation (23), \(k_{v,s}\) is the number of the same elements between the antibody \(v\) and \(s\); the length of the antibody is \(m\):  
\[C_{v}=\frac{1}{n}{\sum_{i\in n}S_{v,s}} \tag{22}\]  
\[S_{v,s}=\frac{k_{v,s}}{m} \tag{23}\]  
Figure 7 shows the overall flow of the proposed algorithm. According to the temperature state distribution table of air conditioning loads, a virtual load curve set \(Q\) is obtained. On this basis, the artificial immune algorithm is used to select the optimal load curve combination. At the same time, the target function is solved by the weighted least square method, and \(\beta\) is obtained. The fitting curve is obtained by optimal load curves and \(\beta\), which can ensure the minimum load deviation from the target curve. The algorithm can be effectively applied to track renewable energy output. Figure 7: Algorithm flow chart.