-
基于TICC聚类的自监督学习核电设备运行工况划分算法的具体步骤如下所示:
1)导入核电设备的运行数据。
2)由于核电设备中的传感器种类不同,导致所获得的数据存在着量纲不同的问题。为了消除量纲的影响,便于后续处理,需要对核电运行数据进行归一化处理。归一化公式如公式(1)所示。
$$ {x^*} = \dfrac{{(x - {x_{\min }})}}{{({x_{\max }} - {x_{\min }})}} $$ (1) 式中:
${x^*}$ ——归一化数据;
$ {x} $ ——原始数据;
${x_{\max }}$和${x_{\min }}$ ——原始数据中的最大值和最小值。
3)由于聚类初值的选择,会对最终的聚类结果造成影响。因此,为了提高TICC聚类算法的聚类结果准确性,需要选择一个合适的聚类初值。对此,可利用手肘法确定最佳聚类数。手肘法的核心的指标是SSE(Sum of the Squared Errors,误差平方和),SSE表达所有的聚类样本的误差。通过该方法寻找最佳聚类数时,由于在到达最佳聚类数前,SSE会大幅下降,而到达最佳聚类数以后,再增加聚类数SSE的下降会趋于缓慢,因此形成了类似于手肘的曲线图。
4)由于核电设备运行数据是时间序列数据,而TICC聚类算法对时间序列数据有很好的效果。因此,利用TICC聚类算法,对归一化矩阵进行聚类,获得不同运行工况下的聚类标签。
5)利用具有标签的数据训练卷积神经网络,获得工况划分模型。
6)导入真实的核电设备运行数据,利用工况划分模型完成工况划分。
该算法的流程图如图1所示。
-
TICC聚类算法是由HALLAC于2017年提出的一种基于托普利兹逆协方差矩阵聚类算法。该算法通过考察各维度之间的相关性,以确定信号间的相似性。而高维核电数据的每一行对应着一个时间戳,每一列对应着一个传感器参数,因此可以将核电运行数据集描述为一个时间序列矩阵X。其中X可以定义为公式(2)。
$$ {\boldsymbol{X}} = \left[ {{x_1},{x_2},...,{x_n}} \right] $$ (2) 式中:
${x_n}$ ——第n列的传感器数据。
TICC算法的关键就在于将时序数据的各个维度按照时间戳切割成具有一定宽度的时间段,然后把每个时间段内的数据进行聚类,最终得到整体的聚类结果。核电数据是一个n维的数据向量,那么每一个时间段内的数据可以以窗口的形式来定义,假设窗口的大小为w,那么时间段的数据$ {{\boldsymbol{X}}}_{i} $则可以定义为公式(3)的形式。
$$ \boldsymbol{X}_i=\left[x_{i-w+1},...x_{i-1},x_i\right] $$ (3) 此处,$ {\boldsymbol{X}}_{\mathit{i}} $为$ n\times w $维的数据矩阵。可将每一个数据矩阵聚为K类,且认为每一个数据段内的数据均服从0均值高斯分布,即可获得其协方差逆矩阵$ {{\boldsymbol{\varTheta}} _j} $,j=1,2,···,K。该矩阵由$ w\times w $个子矩阵构成,每个子矩阵的维度为$ n\times n $,最终构成的矩阵$ {{\boldsymbol{\varTheta}} _i} $的维度为$ nw\times nw $。任意两个位置上的子矩阵,表示这两个时刻间各维度的协方差逆矩阵。由此可知,矩阵$ {{\boldsymbol{\varTheta}} }_{i} $实质上是一个分块托普利兹矩阵。TICC算法希望找到不同变量间的相关性,由此TICC聚类的最终可以转化为数学问题,即对K个逆协方差进行求解,将数据段分配至K个分类之中,并保每个数据点只有一种分类。其表达式如公式(4)。
$$ \mathop {{\rm{argmin}}}\limits_{\varTheta \in \varPhi ,P} \sum\limits_{i = 1}^K {\left[ {{{\left\| {\lambda ^\circ {{\boldsymbol{\varTheta}} _i}} \right\|}_1} + \sum\limits_{{X_i} \in {P_i}} {( - \ell \ell ({X_t},{{\boldsymbol{\varTheta}} _i}) + \beta l\{ {{\boldsymbol{X}}_{t - 1}} \notin {{\boldsymbol{P}}_i}\} )} } \right]} $$ (4) 式中:
P ——K个分配集群的集合;
$ \lambda $ ——正则化参数;
$ |{{|\lambda \circ}}{{{{\boldsymbol{\varTheta }}}}_{{i}}}{\text{||}}_1 $ ——哈达玛乘积的1范数惩罚;
$ \ell \ell ({{\boldsymbol{X}}_t},{{\boldsymbol{\varTheta}} _i}) $ ——$ {{\boldsymbol{X}}_t} $来自聚类i的对数似然值;
$ \beta $ ——强制时间一致性的参数;
$ l\{ {{\boldsymbol{X}}_{t - 1}} \notin {{{P}}_i}\} $ ——检查相邻点是否被分配给同一聚类的指示函数;
$ {\varPhi} $ ——nw相邻点的对称分块托普利兹矩阵的集合。
在此,对似然函数$ \ell \ell ({{\boldsymbol{X}}_t},{{\boldsymbol{\varTheta}} _i}) $可以展开为公式(5)。
$$ \begin{gathered} \ell \ell ({{\boldsymbol{X}}_t},{{\boldsymbol{\varTheta}} _i}) = - \frac{1}{2}{({{\boldsymbol{X}}_t} - {{{\mu}} _i})^\text{T}}{{\boldsymbol{\varTheta}} _i}({{\boldsymbol{X}}_i} - {{{\mu}} _i})+ \\ \frac{1}{2}\lg [\det({\boldsymbol{\varTheta}_i})] - \frac{n}{2}\lg (2\text{π}) \\ \end{gathered} $$ (5) $ {{{\mu }}_i} $为第i类的经验平均值。对于整个TICC问题可分解为两个需要轮流求解的问题:(1)给定$ {{\boldsymbol{\varTheta}} _j} $,求解数据段的分类$ {{{P}}_j} $;(2)给定分类$ {{{P}}_j} $,求解逆协方差阵$ {{\boldsymbol{\varTheta}} _j} $。$ {{{P}}_j} $指的是数据段分类为K类时第j分类的集合。当给定$ {{\boldsymbol{\varTheta}} _j} $时,求解分类集合,即将数据点分配到聚类当中时。可通过公式(6)求解。
$$ \text{minimize }\sum\limits_{i = 1}^K {\sum\limits_{{{{X}}_t} \in {{{P}}_i}} { - \ell \ell ({\boldsymbol{X_t}},{{\boldsymbol{\varTheta}} _i})} } + \beta l\{ {{\boldsymbol{X}}_{t - 1}} \notin {{{P}}_i}\} $$ (6) 该公式即解决将T个时间子序列分配至K个聚类之中。在给定了分类集合$ {{{P}}_j} $时,需要求解各个逆协方差矩阵$ {{\boldsymbol{\varTheta}} _j} $,该问题可通过公式(7)求解。
$$ \begin{gathered} \sum\limits_{\boldsymbol{{X}}_t \in {P_i}} { - \ell \ell ({X_t},{{\boldsymbol{\varTheta}} _i})} = - |{P_i}|\{\lg[\det({\boldsymbol{\varTheta}} _i)]+ \\ \text{tr}({S_i}{{\boldsymbol{\varTheta}} _i})\} + \text{C} \\ \end{gathered} $$ (7) 式中:
$|{{{P}}_i}|$ ——处于第i个聚类中的数据点数量;
${{{S}}_i}$ ——这些点的经验协方差;
${\text{C}}$ ——常数。
利用EM算法可对该问题进行迭代优化,其M步的表达式可以为公式(8)所示。
$$ \begin{gathered} \text{minimize } \lg[\det({\boldsymbol{\varTheta}} _i)] + \text{tr}({S_i}{{\boldsymbol{\varTheta}}_i}) + \frac{1}{{|{P_i}|}}||\lambda \circ {{\boldsymbol{\varTheta}} _i}||_1 \\ {\text{subject to }}{{\boldsymbol{\varTheta}} _i} \in \varPhi \\ \end{gathered} $$ (8) TICC算法的关键就在于解决上述两个问题,将每个数据点分配至聚类之中和更新聚类参数。因此,便有了ADMM算法来求解上述问题。引入一致变量Z,便可得到公式(9)所示。
$$ \begin{gathered} \text{minimize }\lg [\det(\boldsymbol{\varTheta})] + \text{tr}(S{\boldsymbol{\varTheta}}) + {\text{||}}\lambda \circ Z{\text{||}_1} \\ {\text{subject to }}{\boldsymbol{\varTheta}} \in Z, Z \in \varPhi \\ \end{gathered} $$ (9) 该式的带拉格朗日项如公式(10)所示。
$$ \begin{gathered} {\zeta _\rho }({\boldsymbol{\varTheta}} ,Z,U) = - \lg[\det({\boldsymbol{\varTheta}})] + \text{tr}(S{\boldsymbol{\varTheta}} )+ \\ ||\lambda \circ Z||_1 + \frac{\rho }{2}||{\boldsymbol{\varTheta}} - Z + U||_F^2 \\ \end{gathered} $$ (10) $\rho $>0为ADMM惩罚系数,$U \in {R^{nw \times nw}}$为缩放对偶变量,$Z \in \varPhi $。ADMM的迭代过程可以为公式(11-13)所示。
$$ {{\boldsymbol{\varTheta}} ^{k + 1}} = \mathop {\text{argmin }}\limits_\Theta {\zeta _\rho }({\boldsymbol{\varTheta}} ,{Z^k},{U^k}) $$ (11) $$ {Z^{k + 1}} = \mathop {\text{argmin }}\limits_{Z\in \varPhi} {\zeta _\rho }({{\boldsymbol{\varTheta}} ^{k + 1}},Z,{U^k}) $$ (12) $$ {U^{k + 1}} = {U^k} + ({{\boldsymbol{\varTheta}} ^{k + 1}} - {Z^{k + 1}}) $$ (13) 其中,k为迭代次数,三个步骤迭代优化直至收敛为止。
-
卷积神经网络[28-29]在采用固定尺度的卷积核提取目标特征时只能提取到局部信息,而核电设备在发生工况切换的过程中,不同传感器的切换过程的持续时间会不同,如果只使用固定尺度的卷积核去提取核电运行数据的特征,会造成对部分变化信息的提取遗漏,无法准确地还原整个工况变化信息。为了能够更为准确地捕捉到核电运行数据的整个数据特征,可采用不同尺度的卷积核对整个核电数据进行特征提取[30],获取设备的工况信息。卷积神经网络的工作过程如图2所示。
输入为经过TICC聚类分析获得了工况标签的数据。采用不同大小的卷积核对输入数据进行特征提取,其中三个输入均会经过不同尺寸的卷积核,以保证可以充分提取到工况信息的特征。经过卷积操作以后,利用Relu函数作为激活函数加速模型训练速度。其中Relu激活函数的表达式如公式(14)所示。
$$ {{\mathrm{Relu}}} (x) = \left\{ {\begin{array}{*{20}{c}} x&{x > 0} \\ 0&{x \leqslant 0} \end{array}} \right. $$ (14) 之后再利用池化层Max pooling对卷积层对提取到的特征进行降维压缩,以加快运算速度,并降低模型过拟合的风险。完成上述工作以后,将经过处理的特征数据输入到全连接层,全连接层将最终的拼接特征进行整合,作为分类器的输入。由于Dropout层可以使全连接层中的一部分神经元不工作,从而提高了网络的泛化能力。所以可以在此过程中添加Dropout层,以达到降低模型过拟合风险的目的。最终通过了Softmax层输出分类结果。
在该网络中,训练集和测试集以8:2的比例进行划分。输入数据的尺寸为(n, 17),输出数据的尺寸为(n, 4)。其中,n为样本数。17为输入数据的维度(传感器个数),4为分类个数。
-
为了验证本研究提出算法的有效性,将利用核电厂设备RCV002PO的运行数据对方法进行验证。该设备为RCV(化学和容积控制系统)系统内部的002号上充泵,该泵的作用是将容控箱中的来水升压送入一回路。该设备的数据集记录了RCV002PO自2019年7月29日至2021年12月31日的运行数据,共含有17个相关参数,其中参数类型包括了电流、振动和温度。其具体参数如表1所示。
传感器名称 类型 2019-07-29T
14:13:192019-07-29T
14:13:20...... 2021-12-31T
23:51:272021-12-31T
23:51:28RCV002MI 电流 44.41 44.39 ...... −0.08 −0.08 RCV200MT 温度 37.96 38.02 ...... 26.37 26.37 RCV201MT 温度 42.29 42.57 ...... 26.11 26.11 RCV202MT 温度 60.64 60.86 ...... 30.47 30.47 RCV203MT 温度 54.91 55.13 ...... 30.38 30.38 RCV204MT 温度 63.69 64.06 ...... 30.81 30.81 RCV205MT 温度 46.43 46.39 ...... 24.39 24.39 RCV206MT 温度 45.51 45.51 ...... 24.57 24.57 RCV210MT 温度 71.37 71.37 ...... 24.04 24.04 RCV222MT 温度 66.73 66.76 ...... 24.18 24.18 RCV223MT 温度 61.49 61.49 ...... 24.44 24.44 RCV224MT 温度 47.77 47.77 ...... 24.35 24.35 RCV231MV 振动 0.56 0.56 ...... 0.06 0.06 RCV232MV 振动 0.51 0.51 ...... 0.05 0.05 RCV233MV 振动 0.67 0.67 ...... 0.15 0.15 RCV234MV 振动 1.20 1.21 ...... 0.06 0.06 RCV254MT 温度 75.56 75.56 ...... 23.91 23.91 Table 1. Parameter details table
-
对核电运行数据先进行归一化,消除量纲的影响。针对核电运行数据难以确定工况个数的问题,利用手肘法确定最佳聚类数K。由图3可以看到,SSE(误差平方和)在聚类数由2至3时出现了大幅的下降,由3至4时也有较大的降幅,之后再增加聚类数时,降幅趋于缓慢,因此在聚类时可以将聚类数确定为3或者4,但是为了使更加多的散点可以被归为一类,可将最佳聚类数取为4,从而使得散点可以不被错误地划分到其他工况。
对于窗口w的大小取值,不能取得过大,因为过大的窗口会导致在窗口边界上的点难以被正确分类。因此,根据运维人员的经验将窗口大小定为180。利用TICC聚类算法对数据进行聚类,为核电设备的运行数据提供了标签。将获得标签的数据输入至多尺度特征提取网络当中对网络进行训练,如图4展现了整个网络的训练过程,可以看到训练集的准确率随着迭代进行的变化过程。在训练开始以后,训练集的整个网络的损失迅速下降,而准确率迅速上升。在经过10个轮次的训练以后,整个网络的损失和准确率开始趋于稳定,整个模型的参数得到了充分的学习,在进一步的学习当中,损失和准确率均未发生较大的波动,此时可认为工况分类模型已经训练完成。
-
在获得了训练好的工况分类模型以后,可将核电设备的运行数据导入,开始进行工况分类测试,如图5所示,为本研究所提出方法与TICC聚类算法和K-means聚类算法的划分结果对比图。从图中可以清晰地看到两种方法的划分工况数均为4类,划分方式也基本一致。两个平稳的运行工况分别划归为工况1(红色)和工况2(绿色),上升段的运行状态划分为工况3(黑色),下降段的运行状态划分为工况4(蓝色)。每个工况在划分准确的前提下,应该是只有一种颜色而没有其他颜色掺杂其中的。例如在工况3(上升段)这种工况中,整段应该均为黑色,如若混入其他颜色的点,则可认为是划分错误的点。可以清晰的看到,三种方法在工况1和工况2的分类准确率上基本一致,三种方法的分类效果差异主要体现在对变化段工况的准确性上。从划分的结果图上看,可以看到本研究所提出方法相比于TICC算法对上升段工况和下降段工况有较为准确的划分,但是TICC算法在对工况3的划分上出现了较为明显的偏差。TICC算法在这一类工况划分上出现了工况穿插的情况,在本属于工况3的分类中混入了工况1的分类。造成这一现象出现的原因是因为TICC聚类算法是以窗口划分数据段的方式进行聚类的,在聚类的边界往往会出现这种工况穿插的情况。由于本研究所提出的算法是基于TICC算法所提取的标签训练来完成的,因此在本研究算法中也出现了类似的现象。
K-means算法在精确度上较本研究算法和TICC聚类方法存在一定的差距,K-means算法的划分结果在平稳段工况的表现较好,其差距主要体现在了上升段工况和下降段工况上,K-means算法的划分结果上出现了将整体的上升段工况划分至了平稳工况之中,对于下降段工况的处理也不理想,出现了非常明显的工况延伸情况,总体的精确度比较差,造成这种状况的原因在于K-means聚类算法的聚类方式,K-means聚类算法是基于划分的聚类算法,该算法通过欧式距离来完成计算,该种方式会造成下降段工况的中的部分点被错误地归纳到邻近的平稳段工况中,当下降段中的点数较少时就造成了整体工况的划分错误。
文章算法在准确率上较TICC聚类算法和K-means聚类算法的划分结果均有较为明显的提升,但是也有工况延伸的情况出现,造成这种情况的原因是因为每次送入网络的数据的数量是固定的,数量过大或过小均会造成误差的出现,在部分工况段数据点数量较少时就会出现明显的工况延伸情况,但是这种情况相较于TICC和K-means算法已经得到了较好的抑制,因此准确率也得到了提升。
除了在精确率上有所提高以外,文章算法相较于TICC算法和K-means算法的最大优势在于本研究算法的划分速度得到了大大的提高。尤其是与TICC算法的对比中,文章算法由于第一次使用时需要利用TICC算法提取工况标签,因此在耗时上与TICC相差不大。但是在获得了工况分类模型以后,当新的数据被送入划分模型之后,文章算法可以在极短的时间内划分出工况,而TICC算法需要再次经过大量的计算才可获取工况分类,因此本研究所提出的算法在划分效率上得到了大大的提升。
在准确率对比上,可采用分工况计算方式,由于划分了四种工况,以人工划分结果为基准,利用算法划分结果与人工划分结果做对比,与人工划分结果一致的为正确。最终三种算法的性能对比如表2所示。
方法 工况1
准确率工况2
准确率工况3
准确率工况4
准确率总体时间/s 划分时间/s 文章算法 98.97% 98.78% 92.61% 91.93% 4221.7 3.4 TICC算法 98.89% 98.71% 87.33% 94.78% 4218.3 4218.3 K-means算法 98.56% 98.23% 32.12% 60.24% 45.4 45.4 Table 2. Comparison of accuracy of different algorithms for working condition classification
Operating Condition Classification of Self-supervised Learning Nuclear Power Equipment Based on TICC Clustering
doi: 10.16516/j.ceec.2023-361
- Received Date: 2023-12-27
- Accepted Date: 2024-03-28
- Rev Recd Date: 2024-03-25
- Available Online: 2024-08-07
-
Key words:
- operating conditions /
- TICC clustering /
- convolutional neural network /
- working condition classification model
Abstract:
Citation: | ZHANG Dazhi, ZHENG Sheng, CUI Wenhao. Operating Condition Classification of Self-supervised Learning Nuclear Power Equipment Based on TICC Clustering[J]. SOUTHERN ENERGY CONSTRUCTION. doi: 10.16516/j.ceec.2023-361 |