# Multi-Model Identification of HVAC System
## 2 The Proposed Simultaneous Clustering and Regression Method  
[PERSON] et al. [14] proposed a clustering method that utilizes a support vector (SV) to define a cost function. In this work, we use the support vector-based clustering (SVC) proposed by [14], and make modifications in order to make it compatible with our framework. Recall the input space as \(X\in R^{N\times M}\). In this method, any point that has a smaller distance than \(R_{1}\) from point \(a\) (center of all circles) is classified in cluster 1 (red dots in Figure 1), and the same for cluster 2 (black dots in Figure 1). To find the center (\(a\)) and each \(R_{i}\), one needs to solve an optimization problem:  
\[ \begin{split} min_{a,R_{i}^{2}}\ R_{i}^{2}\\ \text{Subject to :}\ ||x_{k}-a||^{2}\leq R_{i}^{2}.\ i=\{1.2. \cdots\ J_{h}\}\end{split}  \tag{1}\]  
where \(h\) denotes the number of clusters and \(||\bullet||\) represents the Euclidean distance. By solving the above-mentioned objective function, the boundaries of the clusters can be obtained. Considering that the data may not be separable by spherical shape clusters, we modify this approach. In the modified approach, the centers of clusters are not fixed points. Instead, the center of the clusters come from the dynamic models. To assign each point to a cluster, the distances between the point and all dynamic models (i.e., the model error or residual) are used. The point will be assigned to the cluster in which the the associated dynamic model produces the lowest residual error. In other words, among all dynamic models, the point belongs to the dynamic model with the lowest local error, and thus the point is assigned to that mode (cluster). Suppose that data are gathered from a general model switching between \(h\) linear models \(I_{i}\), \(i=1,\ldots\ J_{h}\), defined as  
\[y_{k}=\langle w_{i}.\ x_{k}\rangle.\ \ \ \ \ \ if\ x_{k}\in I_{i} \tag{2}\]  
where \(w_{i}\) contains the parameters of the linear model and \(x_{k}\) is the corresponding regressors, and \(<\bullet>\) denotes inner product operation. In this paper, the ARX model (where \(x_{k}=\left[y_{k-1}.\ y_{k-2}.\ \cdots\ y_{k-n_{y}},u_{k}.\ u_{k-1}.\ \cdots\ u_{k-n_{y}}\right]^{T}\) and \(w_{i}=\left[a_{1}^{i}.a_{2}^{i}.\ \cdots\ a_{n_{y}}^{i}.\ y_{1}^{i}.\ y_{2}^{i}.\ \cdots\ b_{n_{u}}^{i}\right]\)) is used for HVAC system identification. In this model, \(y_{k}\) and \(u_{k}\) are system outputs and inputs, respectively; \(n_{y}\) and \(n_{u}\) denote orders of system outputs and inputs in the model, and \(a_{j}^{i}\) and \(b_{k}^{i}\) for \(j=1.\ \cdots\ n_{y}\) and \(k=1.\ \cdots\ n_{u}\) are model parameters associated with outputs and inputs terms, respectively. Obviously, if the point (\(x_{k}\), \(y_{k}\)) is generated by model \(i\), then its distance from that model will be the smallest compared to others. So, an intuitive way to determine a cluster for the point (\(x_{k}\), \(y_{k}\)), is calculating the distances of the point from each of the models and assigning it to the cluster in which the corresponding model generates the lowest error. This way, the dynamic models are regarded as the centers, and the corresponding errors are used to determine the clusters. As mentioned, the cluster center in [14] is supposed to be known, but this is not the case in our application. Therefore, it is required to perform identification along with clustering. In order to aggregate clustering and regression steps, we propose the following  
Figure 1: Support vector-based clustering (SVC) schematic. Red and black dots belong to cluster 1 and 2, respectively. The partial derivatives of \(L\) with respect to the primal variables \((R_{i}.w_{i}.r_{k,i}.z_{k,i})\) should be equal to zero for optimality.