ModelicaModeling_final

6

Click here to load reader

Transcript of ModelicaModeling_final

Page 1: ModelicaModeling_final

Modelica Modeling Language as a Tool on Control Engineering Education: Simulation of a Two-Tank

System João Figueiredoa, José Machadob,Vitor Carvalhoa,c and Filomena Soaresc

aIPCA-EST, Campus do IPCA, 4750-810 Barcelos, Portugal

bCT2M Research Centre, School of Engineering of University of Minho, 4800-058 Guimarães, Portugal cALGORITMI Research Centre, School of Engineering of University of Minho, 4800-058 Guimarães, Portugal

([email protected];[email protected];[email protected];[email protected])

Abstract—Engineering education requires considerable innovation in the used methodologies. In this context, attention should be given to the use of simulation programs as they provide students with the knowledge of complex physical systems before their physical implementation. Moreover, the fact that sometimes there is a reduced time to combine practical components and tutorial lectures, enables the use of virtual and remote laboratories essential tools to engineering education. Control systems are of utmost importance in industrial applications. The simulation of control systems assumes an essential role as it allows the complete previewing of the behavior of the systems in physical environment, including possible damages during operation. Thus, the costs of physical implementations can be reduced and optimized. Besides that there is a high complexity and demands in what refers to dependability of automation systems controllers because their design process is a hard and complex task. However, there are several analysis techniques that provide robust and dependable controllers. This paper presents the simulation of a two-tank system operated in closed-loop with discrete controllers. Moreover the importance of Modelica modeling language and Dymola simulation environment are highlighted to model complex closed-loop systems.

Keywords—Modelica; Dymola; Control; Education; Simulation.

I. INTRODUCTION The process of simulating physical systems is present across several areas of engineering [1]. It allows the prediction of desired or undesired behaviors that can be guaranteed or avoided before the practical implementation of the system in analysis. On the other hand, throughout the study of the system’s operation it is possible to evaluate and implement possible optimizations. The simulation allows students to better conciliate the concepts taught through theoretical and practical lessons. Moreover, it is possible to perform a more precise analysis of the system operation and to infer improvements and new possible approaches.

Currently it is denoted a strong increase in the development and delivery of solutions in order to simulate complex systems including the emergence of new programming languages and new software with several features. Regarding the teaching/learning process in Control Systems curricular unit we may have tutorial lessons, practical classroom work, virtual labs, and remote labs. In tutorial lessons the teacher exposes the subject, he/she is still the main actor. The practical classroom work is conducted during lessons where students perform experiments, usually defined by a script in for applying the learned theoretical concepts in practical terms. Virtual laboratories [1] are meant to simulate real systems, allowing the animation of the experiments on an interactive environment. The connection to the virtual server lab is performed through a remote client. The process consists of selecting the system to simulate, change the setup and the parameters and run the simulation. Typically the results are presented to the user through a graphical interface or by storing them in any other format. In what concerns remote laboratories [1], a substantial increase in the use and development of these simulation tools is denoted as the growth of available resources on the Internet and the number of user increases. In these labs, students can interact with physical systems via the Internet where intuitive interfaces are provided to the students allowing the changing of setup parameters in order to verify the behavior of the system. However, the practical teaching component should not be excluded but optimized. Thus the approach to more complex systems is promoted by using remote labs so that students feel totally familiarized with such systems. Moreover, there are important advantages in the preparation of practical works in order to predict possible failures and inherent optimizations. This project aims, through a case study, to explore the features of simulation systems for educational purposes. Through modeling and simulation, the user will be able to test several operating modes according to the change of parameters in order to test the system’s behavior. This

Page 2: ModelicaModeling_final

project includes the development and analysis techniques on industrial controllers, which allow the design of more reliable controllers as well as the optimization of all parameters. The Modelica [2] programming language has achieved a high success rate as it covers different technologies through specific libraries that include several systems such as hydraulic, electrical, pneumatic, mechanical and has also available a StateGraph library [3] concerning the modeling of discrete controllers behavior. This modeling language comprises a high level modeling through the composition of pre-defined mathematical equations. Dymola [4] has several examples of systems, modeled with Modelica modeling language, making it more accessible to the user. The modeling is performed via functional blocks, which correspond to a given component where there are various levels of abstraction, according to the system. In this paper it is shown how to model and simulate a closed-loop system using Modelica modeling language and Dymola simulation environment, improving industrial controllers’ dependability and robustness in operation. Furthermore, it is shown how to promote the optimization of operating conditions such as functional aspects of the system, reducing and predicting errors and solving emergency situations. In the near future this system is aimed to be used as a learning tool in Automation and Control courses. The paper is organized in six sections, as follows: Section 2 presents the case study that involves a two-tank system; Section 3 is dedicated to the controller specifications; Section 4 details the implementation in Dymola software; Section 5 presents the simulation results and the associated discussion thereof in view of a desired behavior of the system and finally, Section 6 presents the conclusions and the future perspectives of work.

II. CASE STUDY DESCRIPTION This case study is a benchmark system, proposed by Kowalewski [5], that consists in a physical plant composed by two tanks and respective control valves level sensors as well as, components related with possible dangerous behavior of the system that could lead to emergency situations. However, in the studied approach there are some adaptations when comparing this system with the original one presented at [5]. As it can be seen from fig. 1 there is a cooling system consisting of two tanks in which a solution is processed. For the solution, Tank1 must have a given concentration obtained by heating the solution via a resistance (H1), which causes the formation of steam from the heating of the liquid. Furthermore, there is a condenser (C) where cooling is triggered by circulating a cooling fluid if the valve V13 is open. There were considered two specific operation modes for this system: normal behavior and malfunction behavior. Regarding the normal operation mode, the system operates as follows: the Tank1 must be filled to its top level with a fluid by opening the valve V12. When Tank1 is full, the heating

and condensing systems are simultaneously turned on (by opening the valve V13 regarding the condenser). When the steam is produced, condensation occurs through the condenser C. When the concentration of Tank1 is desired, the heating and cooling systems of the condenser are turned off. The solution flows from Tank1 for Tank2 and should be ensured that Tank2 is always empty in this process to avoid catastrophic problems in the system.

Fig.1 – Complete scheme of the global system

As the crystallization of the fluid should be avoided, it is necessary to heat the fluid. It can be heated in a certain time interval or until a pre-defined temperature is registered by the temperature sensor in Tank2. The system malfunction occurs when the coolant fluid is in a low level which is detected by the FIS sensor. When this problem occurs, an increase in pressure and temperature values is verified in the condenser and in Tank1 if the heating system remains powered on. It is therefore necessary to ensure that the pressure in the condenser C does not exceed the maximum allowed value, in order to avoid its explosion. For this purpose, it must be ensured that Tank1 heating is switched off before opening the emergency valve V16. The H1 heating resistance must be switched off to prevent that crystallization never occurs in the fluid. There are two different ways to switch off H1: during a certain time after the sensor FIS has detected fluid reduction or via the temperature sensor TIS1. As a first approach, it is possible to infer an initial set of inputs/outputs as Table 1 indicates.

III. CONTROLLER SPECIFICATIONS The Sequential Function Charts (SFC) [6] specifications, regarding to the controller behavior in normal and malfunction modes are presented in fig. 2 and fig. 3, respectively. The behavior was translated to the library StateGraph. This SFC (fig.4) was created to comprehend the

Page 3: ModelicaModeling_final

normal and malfunction operations. As it might be observed, there is a Malf variable, which relates to the system malfunctioning. It is a Boolean variable and it turns to the logical «1» value, in a random way, because the conditions for malfunction cannot be predicted in a precise moment. So, the passage to the second stage will only happen when Tank1 and Tank2 are empty and, furthermore, Malf variable logic value is «0». In step 2, V1 and V2 are active and the next transition occurs only when Tank1 is full. In step 3, MR is actuated which corresponds to the condenser’s operation.

Table 1 – Inputs/Outputs

Inputs Function Outputs Function

LIS1 Superior level

V12 Fluid source

Tank 1 LII1 Inferior level V16 Fluid drain

TIS1 Maximum fluid

temperature (alarm)

H1 Heating resistor

V15 Fluid transfer between

tanks

Common

FIS Cooling fluid flow from the

condenser C

LII2 Superior level

V17 Heating of the tank

Tank 2 LII2 Inferior level V18 Emptying of the tank

TIS2 Fluid temperature

P1 Emptying pump

After two time units, it passes to step 4 where both MR and the H1 heating resistance are active. Here two alternative processes can occur: if twenty time units have passed from the last state, then both MR and V3 are actuated in the following step. The next transition refers to Tank1 emptying and thirty-two time units later V4 is actuated and then, Tank2 is drained and the process returns to start. However, if Malf is active and it did not pass twenty time units, V4 and alarm are active in the next stage; the transition occurs when Tank2 is drained, so the next state activates V3 and alarm. Next transition occurs when Tank1 is also drained and state V4 and alarm are activated. However, there is a final condition that occurs when Malf signal is active and both tanks are full, the alarm is activated but when Malf value becomes a logical «0» and both tanks are drained, the system goes back to where it started. Both SFCs, referring to malfunction and normal operation were considered to increase the pressure in the evaporator during the heating process in Tank1. The

concentration of the resulting solution will depend on the mass of the evaporated water as a consequence of the temperature increase. Finally, cooling Tank1 occurs when Tank2 is empty and the heat loss is the only significant term relating to the heat balance that promotes a decrease in temperature over time. Due to the discrete change between the two continuous systems, Tank1 and Tank2, V15 and V18, but also considering that cooling occurs when Tank2 is drained at the boiling point of water, a hybrid model was developed.

Fig. 2 – SFC specification for normal behavior

The configuration of a temperature alarm is due to the fact that it needs to fulfill two fundamental opposite properties. On one hand, the temperature must be low enough to avoid temperature that could damage the system and, on the other hand, the temperature should be high enough to prevent crystallization of fluid before Tank1 is empty.

IV. DYMOLA IMPLEMENTATION As noted above, the programming language Modelica has reached a high level of demand due to its ability in modeling

Page 4: ModelicaModeling_final

of several hybrid systems. The software used was Dymola, which provides the user an intuitive modeling environment, also allowing the manipulation of complex models. In mathematical terms, Modelica includes several types of equations such as differential ordinary equations, Petri nets, between others.

Fig. 3 – SFC specification for malfunction behavior

Given all this potential shown by Dymola, it was developed a global model of the system under study. The modeling of the general plant was carried out using the Modelica programming language. Although it was developed an overall plant, dedicated blocks were modeled and analyzed in a separate mode to avoid errors. Besides that, plant comprises three separate controllers: main, normal and failure operations. This problem could only be solved using a controller, as it will be observed in fig. 5. The main controller receives real signals and converts them into Boolean signals so they can be used in normal and emergency controllers.

Fig. 4 – SFC specification for global solution

Fig. 5 – Main plant

For the modeling of controllers it was used the Modelica library of StateGraph [7], included in Dymola. Also, in relation to the plant, the source was modeled to fill the two tanks, the heating block, the condenser and their valves. Fig. 5 presents the model corresponding to the studied system. However, given the complexity of the plant, it is plausible that it would be better to employ the SFC diagram corresponding to the integration of the malfunction

Page 5: ModelicaModeling_final

and normal modes. Fig. 6 shows the controller internal configuration obtained through the Modelica State Graph library. By this way it would just be necessary the use of a controller in what it refers to normal and malfunction operation modes. So, with this approach the system would probably become simpler and effective. Using this system, students should be able to test different controllers with several different parameterizations and setups to study its influence over the system simulation results.

Fig. 6 – Global solution, StateGraph in Dymola

V. SIMULATION RESULTS As previously mentioned in the Introduction section, the results can be presented in several data formats. Dymola allows the presentation of results through a GUI (Graphical User Interface), where by selecting the functions to observe, the system’s response is displayed through several charts and graphs regarding to each specific component. Furthermore, the possibility to observe different graphs simultaneously is provided to the user by opening more than one window of data. It is also possible to check two different variables at the same referential in order to make comparisons, as it will be presented. This section presents the simulation results in order to study the behavior of the two-tank system. These results can be seen as an overall analysis, in the point of view of the operations of filling and drainage, heating and cooling. For a correct behavior of the system, it must be ensured that the process of filling and draining of the tanks is carried out as expected for their normal operation. As such, the results concerning the operation of the valves in the modes of normal operation and malfunction are displayed. As it can be observed in fig. 7, in normal operation, the level of the tanks corresponds to the operation

described in the SFC shown in fig. 2. Regarding the heating of the Tank1, it was effected using a circuit in which it was employed a heating resistor. As it can be seen from fig. 8, there is an increase in temperature with a considerable good speed rate compared to the ambient temperature (283K). To increase the temperature value it is important because it is through this heater that it is possible to control the temperature increase in Tank1. The condenser block has a key role in this system and requires special care during its operation because it is susceptible to explosions when its maximum value of operation is exceeded so it needs to be guaranteed that the heating of Tank1 is switched off before the opening of the safety valve. In the condenser block it occurs the phenomenon of condensation, namely the passage of the gaseous to the liquid state. As such, a high temperature decrease before a subsequent heating is required. This block also takes into account a prior increase of temperature carried a significant lowering. As it can be observed in fig. 9, the rate of temperature decrease in speed is quite high so that the occurrence of this phenomenon is as reliable as possible in order to avoid the crystallization of the fluid.

Fig. 7 – Tanks filling and draining normal operation

Fig. 8 – Heating resistor temperature increase

Page 6: ModelicaModeling_final

Fig. 9– Heat capacitor temperature decrease for cooling purposes

VI. CONCLUSION AND FUTURE WORK The simulation assumes a key role in the education of various engineering-related areas such as Electrical, Mechanical or even Aerospacial. Thus, it is possible to predict possible problems and study optimizations inherent to the studied system such as the definition of a failure operation controller. Moreover, the process of simulation allows students to gain further experience for complex physical systems. Thus, the use of virtual laboratories and remote laboratories becomes quite advantageous as it allows students to acquire a critical spirit relative to control systems. In addition, the simulation offers a more complete education, enabling student to take part of theoretical, practical and simulated scenarios. This paper presents the simulation of a benchmark two-tank system considering its operation requisites using Modelica modeling language and Dymola simulation environment. An efficient modeling and simulation has been achieved. It was possible to obtain a plant model using specific blocks and their controllers in a closed-loop system behavior. Some parameters have been optimized in order to prevent possible occurrences of damage in terms of physical implementation. This simulation tool

seems to have a high potential as a learning tool for students of control engineering, enabling to test different control strategies and different setup parameterizations within an immediate feedback over the simulation results. As future work, the physical model of the system will be built, in order to allow a real observation of the simulation parameterization. Moreover, using this tool the feedback from the students will be collected in order to allow its further development and to infer about its learning effectiveness.

Acknowledgments

The authors of this paper are grateful to national funds by FCT – Fundação para a Ciência e Tecnologia in the scope of the project: PEst-OE/EEI/UI0319/2014.

REFERENCES

[1] Balamuralithara B., Woods P. C., Virtual Laboratories in Engineering

Education: The simulation lab and remote lab, Computer Application in Engineering Education; February 2009; 17(1):108-118.

[2] Fritzson, Peter, Vadim E. Modelica, a general object-oriented language for continuous and discrete event system modeling and simulation, 12th European Conference on Object-Oriented Programming (ECOOP’98).Brussels, Belgium, 1998.

[3] Otter M., Årzén K., Dressler I., StateGraph – A Modelica Library for Hierarchical State Machines. Modelica 2005 Processdings, 2005.

[4] Online (acessed in 11th June 2014): http://www.inf.ethz.ch/personal/cellier/Lect/MMPS/Refs/Dymola%206.pdf

[5] S.Kowalewski, O.Stursberg,M.Fritz, H.Graf, I.Hoffman, J.Preußig, M-Remelhe, S.Simon, H.Treseler A case study in tool-aided analysis of discretely controlled continuous systems: The Two Tanks Problem. In: P. Antsaklis, W. Kohn, M. Lemmon, A. Nerode, and S. Sastry (eds.): Hybrid Systems V, Vol. 1567 of Lecture Notes in Computer Science, 1999, pp. 163-185.

[6] EN (2002). European Standard 60848: SFC specification language for sequential function charts.

[7] Online (accessed in 11th June 2014): http://www.maplesoft.com/documentation_center/online_manuals/modelica/Modelica_StateGraph_UsersGuide.html

time