| OPC (OLE for Process Control) is one of the new basic technologies in the field of Process Control. It is the uniform standard of interface between any data source (such as a device on the factory floor or a database in a control room) and any client applications (such as software monitors on client computer). This standard makes it easier for client applications to access data from any data source.There are many applications of OPC technology in many large PLC control systems. In these systems, data communication is standard and convenient. However, it is a waste and even a destruction of resources to make the whole control system run in nonproductive application such as training unskilled manpower or debugging the system.This study designs a simulative PLC system. In this system, there are a simulative PLC implemented by Visual C++, and an OPC server for aforementioned simulative PLC. After the simulative PLC system is designed, it is linked with whole control system by OPC interfaces using "plug and play" characteristic of OPC. In nonproductive application, OPC client applications can access data from simulative PLC system, instead of real PLC system. This scheme can solve those problems in nonproductive application.The simulate PLC is based on several theories, in which the most important one is compiler construction principle. According to this theory, we can do lexical analysis and syntax analysis for user program written by STL language and can get the syntax structure of PLC user program. We simulate all logic functions of instructions based on the syntax structure, and then can read input points and write data outputs. In order to exchange simulated data with OPC server effectively and conveniently, dynamic link library (DLL) is designated as the file type of simulate PLC.OPC server of simulated PLC is based on OPC specification that specifies the frame of OPC objects, interfaces and even functions. Because of this, we will do more about sound code and data communications instead of building program frame. OPC servergets simulated data by linking implicitly the DLL of simulated PLC and puts simulated data into data memorizer (cache). OPC Client applications are allowed to access simulated data from memorizer (cache) or simulated DLL (device) by interrelated OPC interfaces.At last, this study gives a liquid system as a typical applied example. The liquid system's PLC user program is taken as the input file of simulated PLC program to test performance of simulated PLC and its OPC Server. The test result indicates all run well, and accordingly certifies the correctness and feasibility of the whole simulated system. |