| In recent years,the rise of industrial Internet of Things technology has led to further development of industrial control systems.As one of the most important equipment in the industrial control system,Computerized numerical control(CNC)machine tools play an indispensable role in the production of vehicle manufacturing,aerospace and other industries.The work of CNC machine tools is completely controlled by numerical control(NC)codes.The abnormality of the NC code will cause the abnormality of the numerical control system.To realize the protection of the CNC system,it is necessary to ensure the correctness of the NC code.NC code has two notable features: First,because of the large variety of CNC machine tools,there are multiple programming requirements for NC code;secondly,the use of NC code is relatively high,and the requirements for NC programming are strict,unless programmers who work for a long time are in When writing large NC codes,there is no guarantee that the codes are completely correct.In order to realize the protection of the numerical control system,the system mainly designed two modules in this NC code detection method.The first part is to classify the NC code according to the type,brand,and model of the CNC system to which it belongs.This article uses the optimized K proximity algorithm as a classifier to classify the NC code according to the type,brand,and model of the CNC system to which the NC code belongs;the second part classifies the subsequent NC code has been automatically tested.In the automatic code testing,this article uses model-checking technology.Using linear timing logic,the NC code program simulates the operation and detects the correctness of the code by judging the state of the running system.The work results of these two parts finally realize the anomaly detection for most NC codes of CNC systems.It has been verified that this system can identify 98% of the CNC system types and models when the NC commands are complete,and the recognition accuracy rate has reached95.25%.Then input the NC code and its recognition result into the code detection system,use C to formally model it,and use linear sequential logic to model the NC code.Finally,it is verified through experiments that this method can realize the detection of five types of abnormalities in NC code. |