Dynamic matrix control of water tank system based on FF bus
2026-04-06 05:12:48··#1
Abstract: This paper addresses the difficulty of implementing the DMC algorithm in the monitoring software of the FF fieldbus. It proposes a scheme using the Matlab 7.0 OPC toolkit to achieve communication with the OPC server and implement DMC control, fully leveraging the advantages of the matrix computation language's simplicity and efficiency. Simulation results show that this scheme can significantly shorten the development cycle of the monitoring program and achieve the expected control effect. Introduction: The FF fieldbus system is a digital, bidirectional, multi-branch communication network connecting intelligent field devices and automation systems. Compared with existing control systems, it has the following technical advantages: ① The fieldbus uses digital signals instead of traditional analog signals, resulting in high measurement accuracy and strong anti-interference capability; ② Bus-based field instruments can remotely set the range and zero point, have self-diagnostic functions for instrument operating status, and can perform multi-parameter measurements and automatic compensation for environmental impacts; ③ Field devices integrate detection, conversion, calculation, and control functions, reducing costs while increasing safety and reliability; ④ All field devices are directly connected through a pair of transmission lines, i.e., the fieldbus, reducing the number of connections, facilitating installation and maintenance, and saving costs for debugging and repair. This experimental measurement and control system uses the JBS2GK03 process control experimental device and the FF H1 OPC server MicroCyber.FFServer.1 developed by the Shenyang Institute of Automation, Chinese Academy of Sciences, as the OPC server. This server conforms to the OPC DA 2.0 specification standard formulated by the OPC organization. Communication between the OPC client and server conforms to the OPC automation interface specification requirements. Utilizing the new features of Matlab 7.0 supporting the OPC specification, communication between the user end and the server end is realized. The dynamic matrix control algorithm is implemented on the client end using Matlab's M language, fully leveraging the advantages of the concise and efficient matrix computation language. Control Principle The JBS2GK03 process control experimental device used in this experimental measurement and control system has controlled parameters of liquid level, flow rate, temperature, and pressure. This process is a self-balancing, non-oscillating, two-capacity process with mutual influence. Its mathematical model can be described by the following transfer function: where represents the process gain, time constant, and time delay, respectively. The OPC server on the host computer acquires and dynamically displays data from the field devices via the FF fieldbus. The OPC server MicroCyber.FFServer.1 refreshes every second, enabling real-time and historical data sharing and alarm functions. Communication between the OPC client and server conforms to the OPC automation interface specification. MATLAB 7.0 leverages the new features of the OPC specification to achieve communication between the user and server. The dynamic matrix control algorithm is implemented on the monitoring end using MATLAB's M language, utilizing its powerful computational and dynamic display capabilities to perform dynamic matrix control of the water tank system. Historical data from the OPC server is stored in an array in MATLAB to enable real-time plotting of historical data curves. The controlled object used in this paper is Device1.Flow, grouped as Device1. A MATLAB client connects to the SQL2000 server via ODBC, interacting with the database in real time. Option values are read from the OPC server and can be inserted into the database server in real time to save as historical data. When needed, historical data can be retrieved at any time through options for querying, updating, deleting, or used for algorithm control and plotting historical curves. This enables distributed management of the OPC server and historical data server. The NCS-IF105 device used in this design can receive four channels of 0-20mA analog signals and convert them into FF fieldbus signals. The NCS-LD105 fieldbus gateway can be used in various control systems employing FF H1 fieldbus devices, seamlessly integrating FF H1 bus devices into Ethernet networks and expanding FF H1 applications. Program Implementation Client-OPC Server Communication: First, the Matlab client should generate OPC objects supported by the OPC server. OPC data access objects have a hierarchical structure; an OPC server object has an OPC Groups collection object as its sub-objects. Multiple OPC Group objects can be added to this OPC Groups collection object. Each OPC Group object has an OPC Tag Collection object as its sub-object, and multiple OPC Tag objects can be added to this tag collection object. Writing an OPC client program using a Matlab M-file involves the following steps: (1) Add a reference to the server, create an OPC server object, and connect the client program to the server; (2) Connect to the created OPC server object; (3) Add group objects by browsing all items in the entire server; (4) Add OPC items, select the required items, add them to the specified group, and display their values and status; (5) Start the OPC server. The procedure and comments are as follows: `hostInfo = opcserverinfo(remote/local server name); % connect to the remote/local server allServers = hostInfo.ServerID'; da = opcda(server name, OPC server name); connect(da); sawtoothItems = serveritems(da, *controlled device name*); itmIDs = {controlled device name}; grp = addgroup(da, DemGroup); % add a group itm = additem(grp, itmIDs); % add an item start(grp); % start the OPC server client to communicate with the SQL database server.` First, create a database with a specified name in the SQL database and create a table named `history`. The fields in the table include the option value, quality, timestamp, server name, and device name. Set up the ODBC data source by creating a data source with the same name as the previous database, which points to the database with the same name in the SQL database. After a successful connection test, you can establish a connection with the database in Matlab by writing an M-file, create a workspace array to store data from the database, and perform operations such as selecting and inserting data by executing commands. The key procedures and comments are shown below: First, establish a connection object to connect to the database server. conn = database(data source name, username, password); % connect to the database ping(conn); % check connection status cursor = exec(conn, select country from table name) % open cursor to execute SQL statement setdbprefs(DataReturnFormat, cellarray) % describe the format of the retrieved data cursor = fetch(curs, 10) % import data into Matlab columnnames(curs) % get column names A = curs.Data % display all data elements in the cursor object, data(:,3) is to get the element value of a certain field insert(conn, table name, field name, array name); % insert the value of the array into a certain field of the table close(curs) % close the cursor close(conn) % close the connection object The mathematical model of the controlled system of the improved DMC control program simulation is shown in formula (1). A step signal is used as a control signal to act on the controlled system. The step response output of a controlled object (flow rate) within a certain time period is acquired in real time via the FF fieldbus. The step response value at the corresponding moment is read by a Matlab program, and the time and corresponding value are stored in an array. By establishing a mathematical model of the controlled object, the parameters of the controlled system can be identified, and the output of the system after identification can be obtained. The OPC toolkit of Matlab 7.0 is used to implement communication between the client program and the OPC server. The get(itm,value) function is used to obtain the real-time value of the flow rate in the server (where itm=Device1.Flow), and then dynamic matrix control is performed. After obtaining the control quantity, the write(itm, setvalue) function is used to write the control quantity to the OPC server, thereby controlling the controlled system. The model's time domain length is set to N=10, the optimization time domain length is P=3, the error correction vector is h with a length of N, the control vector is d with a length of P, and the prediction vector is stored in the array y1. Different model time domain lengths and optimization lengths have different effects on system performance, as shown in Figure 1. When r is too large, the predicted vector will deviate significantly from the true system response, which is detrimental to prediction. When r=20 and P=3, the predicted response is consistent with the actual response value. It is evident that in the DMC control algorithm, the model time-domain length and optimization length should be reasonably selected to achieve the ideal control effect. In conclusion , compared with traditional DCS, FF fieldbus technology significantly reduces system wiring investment while greatly enhancing network functionality. Moreover, this system can fully utilize the advantages of various software, greatly improving the efficiency and flexibility of software programming. Actual operation results show that the measurement and control system based on Matlab and OPC technology of FF fieldbus operates stably and has good control effect.