Automation in the simulation of processes with Aspen HYSYS: An academic approach

Aspen HYSYS is a typical tool used in some Master in Chemical Engineering courses at the University of Castilla‐La Mancha like “Analysis and Optimization of Chemical Processes” and “Dynamic of Process: Regulation of Chemical Plants.” Automation is the process of linking commercial software to third‐parties applications built in EXCEL‐Visual Basic for Applications. The capability of automation as a powerful tool for simulating unprecedented complex processes suggests that it could be a relevant background complement to the classical one offered by a university. In this sense, a seminar about automation based on the study of two cases: a refrigeration process and a production one taken from literature, has been proposed at the University of Castilla‐La Mancha. The analysis of the survey performed for the subject evaluation resulted to be very positive. Students consider the methodology of the course and the potentiality of automation for developing their research and professional skills appropriately. However, more examples are required to better understand the automation concept and its potential application to other situations. Finally, they declare that the concept of automation requires a lot of expertise and deep knowledge of programming and the correct application of numerical methods for solving complex problems.

envisaged by them and engineering judgment [5]. Particularly, Aspen HYSYS is a process simulator widely used at an industrial level, especially for performing the conceptual design, control, optimization, and process monitoring in different stages of any project.
Despite all the advantages that simulators provide to process engineers, several requirements and restrictions related to their use can be identified. To make effective use of the simulators, process engineers must know the guidelines and assumptions of the models provided by each simulator [6]. Thus, it is important to understand in which cases they are useful and how to extract information from them. A solution to the limitations to the analysis of processes, not contemplated by commercial simulators, but that could be performed through interaction with them is to automate the simulation process with third-party software like MS Excel-Visual Basic for Applications (VBA). The use of the Excel spreadsheet and VBA results is a powerful computational tool for engineering students and practitioners for solving real-life projects in different fields, for instance, hydraulic engineering [11].
Automation permits programmers to expose objects within a program to be used by other applications. By using an automation client like VBA, embedded inside MS Excel, the end user can write the code to access these objects and interact with Aspen HYSYS. The end user does not need to see the Aspen HYSYS source code or even understand what was required to expose the objects. With a visual basic code, it is possible to send and receive information to and from HYSYS, respectively. This way, end users can introduce algorithms for solving specific problems not considered by simulators and take advantage of their extraordinary capability to estimate physical properties. Some examples of automation can be found in the literature. A straightforward method for calculating the physical and chemical energies of the material stream was proposed by linking Aspen HYSYS with MS Excel-VBA codes [1]. VBA tools were also linked with Aspen HYSYS for the safer design of heat exchanger networks [13]. An interface between the commercial software Aspen HYSYS and MS-Excel VBA was carried out to study the effects of the environmental relative humidity on the performance of the natural gas liquefaction process [15]. Very recently, two further papers have shown the capability of automation procedures based on using Aspen HYSYS for effectively simulating processes: a transcritical heat-driven compression refrigeration machine with CO 2 as the working fluid [10], and a whole green-field saturated gas plant [2]. The automation concept has been also used in engineering applications for connecting Excel-VBA with Mathlab [12] or C++ code. In a previous paper, the simulation of the gasification of animal wastes in a dual gasifier using Aspen Plus [4], and of an integrated process (pine gasification, syngas cleaning, and methanol synthesis) by using Aspen Plus [14] were performed. It also reported an energetic analysis for hydrogen production via catalytic steam and electrochemical ethanol reforming processes by using Aspen HYSYS [7]. Moreover, Aspen Plus and Aspen HYSYS were used in a learning methodology based on the simulation of a sulfuric acid plant [3]. Finally, the COSMOSAC property model has been used in Aspen Plus for studying the CO 2 absorption [17] and liquid-liquid separation of aromatic-aliphatic mixtures [9,16] with ionic liquids as solvents.
Very recently, the values of the binary interaction parameters of the e-NRTL model for different salts in the water included in the Aspen Plus database were refined [19]. The e-NRTL equation was solved by using a procedure implemented in Aspen Plus by linking the process simulator and the Excel VBA code via automation as the third-party software.
The present study reports the pedagogical methodology followed in the seminar of "Automation with Aspen HYSYS" integrated into the courses of Master in ChE at the University of Castilla-La Mancha "Analysis and Optimization of Chemical Processes" and "Dynamic of Process: Regulation of Chemical Plants." Two independent study cases were considered: a refrigeration process (similar to the process which has appeared in tutorials of the different Aspen HYSYS releases), and the production of biphenyl whose data were taken from the literature [18]. Furthermore, the evaluation of the feedback from the students concerning the learning methodology was evaluated.

| Seminar description
As above mentioned, the seminar of "Automation with Aspen HYSYS" was integrated into the courses of Master in ChE at the University of Castilla-La Mancha "Analysis and Optimization of Chemical Processes" and "Dynamic of Process: Regulation of Chemical Plants." Both formal courses are mandatory six European Credit Transfer System credits course of the first semester of the ChE Master mentioned. The students at this level must accredit to have the competencies and background in both conceptual design of chemical processes and simulation with the commercial simulator Aspen HYSYS to develop both general and (heat exchanger networks) optimization strategies, and complex flowsheets which must be run in dynamic mode including different multivariable process control configurations.
Five hours is the time required to develop all the contents proposed in the seminar. First, EXCEL-VBA concepts explained in previous courses are quickly reviewed in order for the students can better understand the code used in the applications. Furthermore, students must individually work on a couple of proposed cases: evaluation of the relative gain array of a process and determination of the existence and composition of homogeneous azeotropes. These latter examples plus others like the optimization of a distillation tower with side draws, determination of the temperature and concentration profiles inside a catalyst particle by considering the reaction, and the simultaneous nonisothermal internal and external diffusion phenomena and solution of a multistage separation problem could be considered for further potential papers.

| Motivation and learning outcomes
The aim of the seminar was to introduce the students to the concept of automation with the commercial software Aspen HYSYS and its capability for tackling in a more or less simple way the simulation of complex chemical processes by accessing the exposed objects of the simulator with other commercial software (third party software) like Mathlab or homemade codes designed by users. This methodology would allow to simulation of processes that the simulator in its standard configuration could not.
The main objectives or learning outcomes of the seminar were: • To introduce the concept of automation of commercial simulators taking Aspen HYSYS as the reference one. • To develop the concept through different cases of study. • To know the objects required by VBA to interact with the simulator.
Students who were participating in the seminar had passed different courses before attending it: -Numerical methods and computer applications in ChE (BSc). -Simulation of chemical processes (BSc).
In addition, the seminar was taught at the end of the following MSc in ChE courses: -Analysis and optimization of chemical processes.
-Dynamic of the process: Regulation of chemical plants.
It is expected that the seminar contributes to decidedly improving the simulation background of the students and gives them added value to their future professional skills.

| Computational details
According to the Aspen HYSYS customization guide provided by Aspen Technology Inc. (AspenTech), "Automation is the ability to programmatically interact with an application through objects exposed by developers of that application." Aspen HYSYS V11 was employed in this study as the reference simulator. Converged process flow diagrams were defined for each of the examples considered: a refrigeration process, and the production of biphenyl whose data were taken from the literature [18]. The aim of the first case study is to demonstrate the capability of the automation process by sending specific values to the simulator and collecting data from it once the case is converged. The aim of the second one is to compute the value of the ratio of molar flows C/E in the splitter (initially set to 0.5) that leads to a value of that temperature of 1100°F, by using a VBA subroutine that runs the Regula-Falsi method.
Although the automation concept was applied in the same way for both cases of study, the strategies followed for reaching the solution demanded by each one were different. Thus, additional information was included in the next section to facilitate a better understanding of the specific strategy followed in each case. Process variables used in the different computations were imported or exported from Aspen HYSYS to MS Excel-VBA and vice versa via object linking and embedded (OLE) automation. VBA codes controlled the process and performed all the external computations out of Aspen HYSYS.
When an application is exposed for automation, a separate file is usually created that lists all the objects and their respective properties and methods. In this case, the file HYSYS 11 type library must be selected. For this purpose, one must also select the references command in the VBA tools menu, check the box next to the abovementioned file, and then click the OK button.   The block diagram used for designing the Excel-VBA application is shown in Figure 2. Students can use an Excel file template which allowed them to build the final application (Supporting Information: Figures S1 and S2). Two sheets are defined: CÁLCULOS (where students can introduce the scenarios to be analyzed) and HYSYS (where students can extract the main data of the simulation: fluid package, components, material streams, energy streams, operations and numeration, and names assigned to all of them and define the allocation and write the name of the HYSYS file used in the automation process). Regarding the block diagram, different modules must be defined:   Figures 3 and 4 show the components, the fluid package, the streams, the equipment, and the file allocation of the Aspen HYSYS simulation (sheet HYSYS) and the set of data used, and the corresponding results obtained from the Aspen HYSYS interaction (sheet CÁLCULOS), respectively.

| Case of Study 2: Production of biphenyl
Similarly, Figure 5 shows the example considered in this study. The variables listed in the flowsheet also allow for converging the case. Soave-Redlich-Kwong was considered as the fluid package. The value of the temperature of Stream A is for this set of variables equal to 907.5°F. First, it was verified that the searched ratio C/E was in the interval 0.7 (T A = 1033°F) and 0.9 (T A = 1188°F).
In this case, a spreadsheet is used since through the spreadsheet operation is possible to access nearly every property or value in HYSYS even if the object associated with that property is not exposed as an automation interface. Figure 6 shows how the spreadsheet was designed in the simulation. The value to be modified by the VBA application is in cell B2 while cell B1 was associated with the former as shown in the figure.
The block diagram used for designing the Excel-VBA application is shown in Figure 7. Again, students can use a file template which allowed them to build the final application ( Figures S9 and S10). Two sheets were also defined with the same purpose as that of Case 1: CÁLCULOS and HYSYS. Regarding the block diagram, different modules must be also defined. Modules BORRAR1 y HYCONEXION in Case 2 is equal to that of Case 1 so they will be not described next. This way: -WAYIN: This is the module that makes the Automation. It calls module BORRAR which clears the cells in sheet CÁLCULOS. Then, it calls module DEFHYSYS and module FALPOSICION which performs the iterative procedure.  Figures 8 and 9 show the components, the fluid package, the streams, the equipment, and the file allocation of the Aspen HYSYS simulation (sheet HYSYS) and the objective temperature, the initial estimations of the C/E ratio and the results obtained from the Aspen HYSYS interaction (sheet CÁLCULOS), respectively. As observed in the latter figure, the value of the C/E ratio that led to a temperature of the A stream equal to 1100°F resulted to be 0.852. The result was obtained after eight iterations.

| Academic results
The effectiveness of the training activities and methodology used were assessed by an anonymous online survey performed by the 14 students attending the seminar. This F I G U R E 6 Configuration of the spreadsheet in Case 2. The value of the ratio C/E to be modified by the VBA application is in cell B2 while cell B1 was associated with the former. VBA, Visual Basic for Applications. survey was based on enunciating questions in a positive way and included the general assessment of the seminar and the learning methodology based on study cases used in the seminar (Table 1). To collect qualitative feedback on their experience, the survey was rated on a scale of 0-5: strongly disagree, disagree, neutral, agree, and strongly agree. In addition, the response rate was higher than 90% of the total students. The responses to the survey for questions shown in Table 1 are shown in Figure 10. All the questions but question 12 ("The knowledge acquired is easy to transfer to other situations") reached marks higher than 4 and close to 4.5 (between agree and strongly agree). That means that students consider the methodology of the course and the potentiality of automation for developing their research and professional skills appropriately. In addition, the results obtained clearly demonstrate that more examples are required to better understand the automation concept and its potential application to other situations. Students also consider that both cases of study are well presented and a basic knowledge of both VBA programming and simulation with Aspen HYSYS is required. The low mark obtained with question 12 could be related to the complexity of the automation procedure for being translated to other cases because it requires a lot of expertise and a deep knowledge of programming and the correct application of numerical methods for solving complex problems. Questions 5 ("Analysis of more cases is required to better understand Automation") and 6 ("The proposed cases allow us to understand the potential of the use of Automation") were the next less rated. This information will be used as a reference for improving the performance of the students in future editions of the seminar.

| CONCLUSIONS
The capability of automation as a powerful tool for simulating complex processes suggests that it could be a relevant background for future chemical engineers. This work summarizes the seminar about automation organized by the University of Castilla-La Mancha (UCLM). Two study cases were considered: A refrigeration process and a production one taken from the literature. This pilot seminar has been initially taught at UCLM. Detailed information about the correct way to implement automation by combining the commercial simulator Aspen-HYSYS and Excel-VBA is reported. All the questions raised in the survey but question 12 ("The knowledge acquired is easy to transfer to other situations") reached marks higher than 4 and close to 4.5 (between agree and strongly agree). That means that students consider the methodology of the course and the potentiality of automation for developing their research and professional skills appropriately. In addition, the results obtained clearly demonstrate that more examples are required to better understand the automation concept and its potential application to other situations. Students also think that the concept of automation requires a lot of expertise and deep knowledge of programming and the correct application of numerical methods for solving complex problems. In general, because the survey results for the subject evaluation conducted by UCLM resulted to be very positive, in terms of the degree of satisfaction F I G U R E 9 Set of input data y results corresponding to Case 9. Input data: Set point of the temperature of Stream A, initial estimations of ratio C/E and the corresponding temperatures used by the Regula-Falsi method. Output data: The value of the ratio C/E that leads to a temperature of Stream A equal to the set point, the value of the function that must be close to 0 when a solution is reached, and the number of iterations required by the Regula-Falsi method. F I G U R E 10 Survey results for questions listed in Table 1 VALVERDE ET AL.
| 385 and achievement by students, it is expected the seminar to be repeated in the future. For those purposes, more challenging cases of study as the following ones: evaluation of the relative gain array of a process and determination of the existence and composition of homogeneous azeotropes, will be considered.

DATA AVAILABILITY STATEMENT
The data that support the findings of this study are available from the corresponding author upon reasonable request.
ORCID Jose L. Valverde http://orcid.org/0000-0001-6939-9820 analysis-mass spectrometer, steady-state and dynamic simulation, and modeling of chemical processes by using home-made computer applications and commercial software: HYSYS, ASPEN, UNISIM, and PROMAX and thermodynamics of electrolytes in solution and their application to the analysis of ion exchange systems. He has led more than 60 projects funded by the European Union, the Spanish Government, the Regional Government of Castilla-La Mancha, and contracts with private companies. He was the coordinator from January 2015 to June 2018 of the H2020 European Project H2020: NANOLEAP-646397: Nanocomposite for building constructions and civil infrastructures: European network pilot production line to promote industrial application cases, which is participated by 18 partners from 10 European countries. He has supervised 19 PhD students and is supervising 4 more. He has paid stays in the Universities of Leeds (UK), Kentucky (USA), and Claude Bernard-Lyon 1, among. He has been invited professor by the latter in the academic years: 2009-2010 and 2015-2016. Since 2000, he has been a teacher of all the courses related to numerical methods in chemical engineering and steady-state and dynamic simulation of chemical processes in the BSc and Master's degree curricula.
Victor R. Ferro is currently a professor of chemical engineering at the Universidad Autonoma de Madrid, Spain. He was initially formed in physical chemistry acquiring experience in different experimental techniques of synthesis, electrochemistry, and spectroscopy. Later, he worked on themes related to the use of solar energy and, for several years on the molecular modeling and the design of molecules with specific properties by chemical-theoretical methods of quantum-mechanical nature. In 2001, he professionally reoriented himself towards chemical engineering where he began to work in process simulation and optimization. In the corresponding tasks, he takes advantage of previous experience in molecular modeling for the development of a methodology that integ rates COSMO methods of chemical-quantum and thermodynamic-statistical basis to commercial process simulators. This development has made him possible to apply the advantages of process simulation to the selection and design of ionic liquids with optimized properties for certain applications of interest and to the development of biotechnological processes. It has also allowed him to work in the conceptual design of separation processes based on the use of ionic liquids, deep eutectic, and other processes such as the production of biodiesel, wet oxidation, and hydrothermal carbonization as a way for water treatment. More recently he has worked in the modeling and simulation of industrial processes aimed at the use of different biomasses (chicken feathers, lignocellulosic material, microalgae, pig slurry, and others) that present significant difficulties when defining the components, estimating their properties, and also in the selection of thermodynamic models. He is currently working on issues related to digitization and extensibility in chemical engineering. Since 2000, he has been teaching different matters related to applied chemical thermodynamics, process engineering, projects in chemical engineering, and process simulation and optimization, both with Bachelor's and Master's degrees.
Anne Giroir-Fendler has been a full professor of chemistry at the University Claude Bernard Lyon 1 since 2013. With more than 230 publications and H factor 39, her current research is focused on the development of catalytic processes for environmental applications. Their principle objectives were initially achieved in the fine chemical reaction in order to well understand the factors which govern the selectivity in the catalytic hydrogenation of cinnamaldehyde. Then, she worked in the field of membranes. The aim of this work was to develop a catalytic membrane reactor to enhance conversion in several chemical processes like dehydrogenation, hydrogenation, or partial oxidation. Since the early 96s, she has obtained a permanent position at the University Claude Bernard Lyon 1 (France) in the Laboratory of Applied Environmental Chemistry and have worked in the application of the catalytic process to reduce NOx and COV of exhaust gases. Since January 2007, she has been with the IRCELYON laboratory, and her current scientific activity is focused on the development of catalytic materials, their characterization, and their implementation in catalytic processes for the reduction of gaseous pollutants and for energy production. She has led more than 25 projects funded by the European Union, French Government, Regional Government, and contracts with private companies. She teaches kinetics, catalysis, and environmental processes for the