A Real-Time Embedded Control System for Electro-Fused Magnesia Furnace

Since smelting process of electro-fused magnesia furnace is a complicated process which has characteristics like complex operation conditions, strong nonlinearities, and strong couplings, traditional linear controller cannot control it verywell. Advanced intelligent control strategy is a good solution to this kind of industrial process. However, advanced intelligent control strategy always involves huge programming task and hard debugging and maintaining problems. In this paper, a real-time embedded control system is proposed for the process control of electro-fused magnesia furnace based on intelligent control strategy and model-based design technology. As for hardware, an embedded controller based on an industrial Single Board Computer (SBC) is developed to meet industrial field environment demands. As for software, a Linux based on Real-TimeApplication Interface (RTAI) is used as the realtime kernel of the controller to improve its real-time performance. The embedded software platform is also modified to support generating embedded code automatically from Simulink/Stateflow models. Based on the proposed embedded control system, the intelligent embedded control software of electro-fused magnesium furnace can be directly generated from Simulink/Stateflow models. To validate the effectiveness of the proposed embedded control system, hardware-in-the-loop (HIL) and industrial field experiments are both implemented. Experiments results show that the embedded control systemworks very well in both laboratory and industry environments.


Introduction
Fused magnesia is an important and widely used refractory and raw material for many industries, which has lots of merits such as high melting point, antioxidation, structural integrity, and strong insulating features [1].Nowadays, highpurity fused magnesia is produced mainly by three-phase electro-fused furnace [2].Magnesia is melted by absorbing heat released by the electric arc of three graphite electrodes.Stability of the current of three electrodes is the key factor that influences product quality.Therefore, the most important object of electro-fused magnesia control system is to keep three-phase current stabilizing within a desired range through adjusting position of electrodes, thereby stabilizing the operation of smelting process and achieving corresponding control indices.However, smelting process of electro-fused magnesia furnace is a complicated process that has characteristics like complex operation conditions, strong nonlinearities, and strong couplings, which make it difficult to achieve good control performance using traditional linear control strategy [3].Consequently, nowadays, the automation level of magnesia smelting process is still low, which is controlled manually in many factories.In order to improve the control performance and enhance the automation level, many researchers [1,[3][4][5][6] recently have proposed intelligent control strategies to resolve these problems.However, due to advanced intelligent control methods often involve huge programming task, hard debugging and maintaining problems and are hard to be implemented in programmable logic controller (PLC) and distributed control system (DCS) systems, they are still not widely applied in actual industrial fields.
Recently, with the rapid development of microelectronics, computer technology, and network communication technology, embedded control system has been widely used in the fields of aerospace, automobile manufacturing, industrial process control, intelligent instrument, and robot control because of its strong real-time performance, good customizability, strong communication ability, high reliability, and low cost.However, traditional waterfall development approach which is widely used in traditional control system development procedure cannot meet the demands of nowadays embedded systems [7].With the rapid development of software engineering technology, embedded software development method based on model design technology, which has been widely used in automobile and aircraft manufacturing fields, provides an effective solution of designing complicated embedded control system.According to [8], model-based design technology can effectively enhance the development efficiency and decrease development cycle, as well as reduce later maintenance costs.Hence, this kind of embedded design method has evoked many researchers' interests.For instance, Karsai et al. [9] used model-based design technology in the control platform of automobiles.Tabbache et al. [10] proposed a hardware-in-the-loop testing platform of city electric car.Wei et al. [11] applied hardwarein-the-loop simulation and model-based control technology to the development and optimization of mathematical model of windscreen wiper.Ferrari et al. [12] introduced modelbased design technology to embedded software design of gasoline injection engine through TargetLink tool.Modelbased design method was also applied to distributed control system of aircrafts [7,13].In the education field, Hercog et al. [14] built a remote control laboratory on the basis of DSP using model-based design technology.In the industrial process control field, Mannori et al. [15] discussed the feasibility of design industrial process control systems based on SciLab and RTAI-Linux.Xu et al. [16] also designed a rapid control prototyping system for temperature control of plastic extruder.It has been widely believed that model-based design technology can improve the design efficiency and reduce the correction time of problem to minimum and decrease development cycle of whole project greatly [8].However, model-based design technology was rarely introduced to practical industrial process control fields till now, especially in the control of smelting process of electro-fused magnesia furnace.
The main contribution of this paper is that an intelligent control strategy is adopted to achieve good control performance, an embedded real-time control system is implemented using model-based design technology, and the effectiveness of the proposed system is validated through hardware-in-the-loop experiment and practical industrial experiment.The rest of this paper is organized as follows.Section 2 describes the smelting process of arm-type electrofused magnesia furnace and analyses the control difficulties.Section 3 presents the overall design of the embedded control system and the details of hardware, embedded system software, and intelligent control software.Section 4 analyses the results of hardware-in-the-loop and practical industrial experiments.Section 5 concludes the paper.

Description of Smelting Process of
Arm-Type Electro-Fused Magnesia Furnace 2.1.Description of Smelting Process.Electro-fused magnesia furnace as shown in Figure 1 is a typical high-energy consumption device, which is actually an electric arc furnace.There are three control subsystems in this equipment, namely, electrode position control system, automatic feeding system, and rotation control system.The main control object is to control the three-phase current to track the setpoint through adjusting the electrode position, which changes the temperate of the furnace indirectly.
The electric arc allows obtaining high temperatures necessary to melt raw ore and realize some chemical reactions.To obtain the electric arc, generally three graphite electrodes are used, which are supplied by a three-phase power transformer.The circuit closes through the metal mass that will be molten.The electric arc appears when the electrodes are near the metal mass.To close the circuit, the electric arc must appear at least between two electrodes and the metal mass.Usually, the distance between the electrode and the metal mass is 5-15 cm.If the length of an electric arc is larger than a certain value, the electric arc will extinguish.In this case, the positioning system must adjust the electrode position so that the electric arc reappears.During the smelting process, feeding machine automatically pours the raw material in the bin into the furnace through the feeding pipe.Therefore, the level of smelting bath rises as more raw materials are melted and filled, and the positions of electrodes have to be adjusted to keep the length of arc within suitable range.In addition, during the smelting process, the furnace is rotated at a certain frequency to ensure the heating surface to be uniform.The smelting process will complete when the level of smelting bath rises up to furnace top.

Problem Analysis of Controlling Electro-Fused Magnesia
Furnace.The main control object of electro-fused magnesia furnace is to increase the product quality and quantity and reduce its energy consumption.However, according to the study of practical industrial equipment, we found at least the following issues increasing the difficulty of accurate and robust control of electro-fused magnesia furnace.
(i) Difficult to establish accurate mathematical model.
It is very difficult to obtain accurate mathematical model of smelting process since it is a complicated physical and chemical change process, including electricity, thermodynamics, physics, and chemistry.
(ii) Few controllable variables.As for electro-fused magnesia furnace, available controllable parameters are only the A-phase, B-phase, and C-phase current and three-phase voltages, while the most important variable (inside furnace temperature) which is approximate to 3,000 Celsius cannot be measured directly.
(iii) Complicated disturbances.There exist large range and random disturbances during the smelting process, which come from the inner system rather than the outer.(iv) Strong couplings.There are strong couplings among three-phase current during the smelting process.Therefore, decoupling among three-phase current is a key question.
(v) Harsh operation environments.Tough environment with high temperature, high dust, high power, and high risk poses a higher demand to reliable and stable control system.
Due to the existence of these complicated characteristics, stabilizing the current of three-phases is not easy, and some intelligent control methods should be used to realize the desired control performance.Currently, PLC is the most used controller for control system of electro-fused magnesia furnace.But the small memory and low computation performance of traditional PLC restrict the realization of advanced control algorithms on such platform.In this paper, an embedded control system based on intelligent control method and model-based design technology is designed and developed to control the smelting process of fused magnesium furnace accurately and intelligently.

Embedded-Model-Based Control System of Electro-Fused Magnesia Furnace
Figure 2 shows the system architecture of the embedded control system (ECS) for arm-type electro-fused magnesia furnace.The ECS consists of three main components: armtype electro-fused magnesia furnace, embedded controller, and development PC.The system design is divided into three parts: hardware design, embedded system software design, and intelligent control software design.

Hardware Design.
In this paper, an industrial embedded Single Board Computer (SBC) based on PC104 Bus is chosen as the core control unit to satisfy the computation and industrial environment demands.Figure 3 shows the hardware configuration of the embedded controller.

CPU Board.
Since advanced control algorithms always involve large number of calculations, a high CPU frequency is required to ensure the real-time performance of the embedded control system.Besides, the production environment of electro-fused magnesia is very harsh, which belongs to high temperature and high dust operation area.Therefore, the controller should also have high reliability, wide temperature tolerance, low power consumption, and fanless design.
According to these demands, a CPU motherboard (Intel PMI2) from SBS Science & Technology Co. is selected in this paper.

Data Acquisition (DAQ)
Board.DAQ board is selected according to the input and output demands of practical electro-fused magnesia furnace.output, 29-channel digital input, and 9-channel digital output.Here, a DAQ board of type ADT652 from SBS Science & Technology Co. is selected.The main ports of this board are as follows: 16-analog input, 4-channel analog output, and 24-channel I/O.

Signal Processing Circuit Design.
The signals acquired from electro-fused magnesia furnace often need to be converted into standard signals by the transmitters, and then the standard signals can be acquired by DAQ card.For instance, the electrode current is about 0∼15,000 A, which is converted by the current transformer into a current signal of 0∼5 A, and then go through the current transmitter and becomes the standard current signal of 4∼20 mA.The circuit may failes due to the harsh environment of the industrial field.These failures often lead to large current impact on the DAQ card.Therefore, a signal processing circuit needs to be designed to isolate and filter the signals.The signal processing board for the arm-type electro-fused magnesia furnace is shown in Figure 4.The signal processing board can be divided into four parts: the digital input section, switch output section, analog input section, and analog output section.Both digital input and output signals are isolated by optoisolators.The digital outputs are connected to the plate relays to produce the switch output for industrial process.And the analog inputs are isolated by linear optoisolators.

Embedded System Software.
In order to make the embedded system become a hard real-time system, dual kernel architecture based on Real-Time Application Interface (RTAI) is used to improve the real-time performance.Besides, Real-Time Workshop (RTW) and Target Language Compiler (TLC) of MATLAB are used to enable automatically generating optimal, real-time embedded code from Simulink/Stateflow models.

3.2.1.
Real-Time Kernel.General Linux OS is not a hard realtime operating system.In order to improve its real-time performance to meet the industrial control demands, this paper adopts RTAI-3.7 as the real-time kernel together with Linux 2.6.24kernel to build a dual kernel hard real-time operating system.The architecture of the real-time OS is shown in Figure 5.The operating system is divided into the real-time domain and non-real-time domain.Real-time processes in the realtime domain are scheduled by the real-time kernel of RTAI, while the ordinary processes in non-real-time domain are still handled by the Linux kernel.Of course, the Linux kernel itself, as a non-real-time process, is managed by RTAI.Therefore, any real-time processes have higher priorities than Linux kernel.Only when there is no real-time process running, the Linux can be scheduled.Secondly, by creating a hardware abstraction layer (called RTHAL) between Linux kernel and hardware, RTAI can get the controllability of hardware interrupt.The RTAI parts that need to be modified in the Linux kernel are defined by RTHAL as a set of API.RTAI can simply use this set of API to communicate with Linux.

Automatic Code Generation.
In this paper, Simulink/ Stateflow is used as the development tool for developing intelligent control software.Matlab/RTW is used to generate optimized, portable and customized code from Simulink/Stateflow models.Figure 6 shows the automatic generation process.
Since our system uses real-time kernel, some customization steps of automatic code generation mechanism need to be considered.
(i) Customization of entry files of the code generation.In the System Target File (STF) of RTAI, the basic RTW default settings are adopted.And only "codegentry.tlc"file is called to generate five files such as "model.c," "model data.c," "model.h," "model private.h," and "model types.h." In the STF file, Target Language Complier (TLC) variables are configured.Since the code generated is oriented to embedded real-time platform, the "Language" variable is set as "C, " the "CodeFormat" is set as "Embedded-C, " and the "TargetType" variable is set as "RT." Other variables maintain the original configuration of RTW.
(ii) Customization of code generation process."STF make rtw hook.m" is responsible for the overall management of the entire code generation process.RTAILab uses the default configuration.
(iii) Customization of code compilation process.Template Makefile (TMF) is modified by RTAILab.In the TMF file, the rt main.c is firstly imported into the project.Secondly, it also contains some paths of RTW.Paths for the compiling process of RTAILab are listed in Table 2.

DAQ Card Driver Module.
As for the DAQ card used in this paper, two steps are required to develop a Simulink device driver.The first step is to use the "set rt ext index()" function provided by RTAI to write the code that controls the DAQ card into the real-time kernel of RTAI.Then, "RTAI LXRT()"  function is called to map the code into real-time program in the LXRT user space.The second step is writing C MEX S-Function to call the code so that the Simulink model program can control hardware.Figure 7 shows some developed device driver modules.

Intelligent Control Software.
In order to realize robust and accurate control of arm-type electro-fused magnesia furnace, this paper adopts an intelligent control strategy proposed by [3][4][5][6]17].The intelligent control strategy as shown in Figure 8 is composed of three controllers (current stabilizing controller, exhausting controller, and limit controller) and an operation condition identification module.
According to the previous intelligent control strategy, Simulink and Stateflow are used to develop operating condition identification module, three-phase current stabilizing controller module, exhausting controller module and limit controller module, as shown in Figure 9.

Operating Condition Identification Module.
As shown in Figure 9, the inputs of this module contain three-phase current and voltage ("Current A, " "Current B, " "Current C, " and "Voltage") and exhausting and feeding flag ("exh mark" and "pad mark").The outputs of this module are "Cond, " "Param, " and "Addition, " which represent conditions, parameters and the current fluctuation range, respectively.The internal details are shown in Figure 10, where the "spec cond" submodule is responsible for analyzing the padding and exhausting conditions, and the "cond analysis" submodule is used to identify other special conditions.The two submodules are developed by rule-based reasoning algorithm using Stateflow.Take the "cond analysis" submodule as an example; the padding working condition is conducted regularly, and there exists a timer in the "cond analysis" submodule.When it comes to the fixed time, the "Cond" is outputted as 1, and the "Param" is set up as the relevant parameters of padding working condition.Similarly, when it comes to the exhausting working condition that is conducted regularly, the "Cond" is outputted as 2, and the "Param" is set up as the relevant parameters of exhausting working condition.

Three-Phase Current Stabilizing Controller Module.
As shown in Figure 11, three-phase feedback current and the set value of the current are the inputs of this module, and the outputs are the current error "e" and error derivative "ec".Here, a fuzzy control method is adopted to achieve robust control performance [17].Simulink Toolbox "Fuzzy Logic Toolbox" is used to create Fuzzy Logic Controller.In Matlab, rules editor is used to program the fuzzy rules defined as "fuzzy fm.fis." In order to prevent large movement of electrode which will cause abnormalities, a saturation module is added.[4] is shown in Figure 12.The inputs of this module are the upper and lower limits and the parameters from the operation condition identification module.The "Chart" submodule is used to adjust three electrodes up and down to exhaust gas.

Limit Controller
Module.The state of position limit switch can be determined by the parameters from operation condition identification module.According to the states of the three-phase electrode's position limit switch, the electrodes are slightly lifted up or down to decrease the pressure on the mechanical structure.For example, when the A phase electrode's position limit switch is triggered for upper limit, the A phase electrode should be lifted down slightly.The internal details can be seen in Figure 13.

HIL Experiment.
The HIL simulation platform of armtype electro-fused magnesia furnace uses one industrial computer based on BP neural network as a virtual armtype fused magnesia furnace model to simulate the practical operation of arm-type fused magnesia furnace.In the HIL simulation platform, control system considers the values of current and voltage from virtual arm-type electro-fused magnesia furnace model on the industrial computer as its inputs then calculates the action values according to the control algorithm and passes action values to responding actuator (6-group electrical relays).We can verify control effect through watching the relay actions and the output current of the virtual furnace model.The wiring diagram and HIL experiment system are shown in Figures 14 and  15, respectively.Our control object is to control the threephase current around 15,000 A. Since it is very difficult to establish an accurate mathematical model of electro-fused magnesia furnace, the HIL experiment is mainly to test the feasibility of the proposed control algorithm and the basic performance of the controller hardware.Figure 16 shows the current control performance.From the result, we can see that, though the control accuracy is not very good in the HIL test, the intelligent controller can realize automatic control of the virtual furnace which is based on BP neural network.

Industrial Field Experiment.
The designed embedded control system was applied to an electro-fused magnesia factory in LiaoNing province, China.The practical furnace and its parameters are shown in Figure 17 and Table 3, respectively.The proposed embedded control system was applied to practical industrial production to test its performance for one week.During the test, in nearly 85% percent of time, the furnace can be controlled very well without any manually control in one production process.Only at the start-up stage, operators need to control the furnace manually.Our control object is to control the three-phase current around 15,000 A. Figure 18 shows the three-phase currents during the production after the furnace is started up manually by the operator and switched to automatic control.As it is can be seen, three-phase current can be stabilized within the range from 14,000 A to 16,000 A during most time.And, once actual current exceeds the desired range, the controller can adjust the position of corresponding electrode to let current go back to the desired range quickly.

Conclusion and Discussion
In this paper, a model-based embedded control system is designed and developed for the process control of the electrofused magnesia furnace.The embedded controller is based on industrial Single Board Computer and is a hard real-time system based on dual kernel architecture.In the embedded controller, an intelligent control strategy of electro-fused magnesia furnace is developed using model-based design technology.The real-time embedded control software is generated directly from the Simulink/Stateflow models.To validate the performance of the designed embedded controller, HIL experiment and industrial field experiment are both implemented, which demonstrated that our embedded control system works well in both laboratory and industry environments.In the future, the safety and reliability of the controller will be improved to adapt the high dust and strong electromagnetic disturbance environment.Besides, some optimal operation control algorithm, fault diagnosis, and faulttolerant control algorithms will also be implemented on this embedded control system to further improve the control performance.

Figure 4 :
Figure 4: Functional structure of signal processing board.

Figure 5 :
Figure 5: Dual kernel hard real-time system.

Figure 9 :
Figure 9: Simulink model of intelligent control strategy.

Figure 10 :
Figure 10: Internal details of operating condition identification module.

Figure 11 :
Figure 11: Internal details of three-phase current stabilizing controller module.

Figure 12 :
Figure 12: Internal details of exhausting module.

Figure 13 :
Figure 13: Internal Details of Limit Controller Module.

Figure 14 :
Figure 14: Wiring Diagram of Hardware-in-the-loop Simulation Platform.

Figure 15 :Figure 16 :
Figure 15: Practical HIL Simulation Platform and the Embedded Controller.

Figure 18 :
Figure 18: Current curve of intelligent control strategy.

Table 1
shows the required inputs and outputs: 11-channel analog input, 4-channel analog

Table 1 :
Inputs and outputs of the controller.

Table 2 :
Paths for the compiling process of RTAILab.