Tips and Tricks: Easy Automation
Easy Automation with VMGSim Part 1: And I didn’t code a line!
By Chris Arthur – VMG Calgary
How to Integrate VMGSim and Microsoft Excel.
Automation with VMGSim
VMGSim has the ability to easily exchange data with Microsoft Excel. VMGSim automation can be used to perform many useful functions ranging from running multiple case studies and interacting with sophisticated spreadsheets to automating data entry from plant historians. Automation is the tool to use when you want to push the boundaries of what you can get out of a VMGSim model.
VMGSim’s automation options have formed the basis for plant economic optimisation, soft sensors, operating set points and warning systems that maximise existing data and minimise user effort.
This article will demonstrate the Excel Case Study automation example included with VMGSim. This and numerous other automation examples are provided both to be used as sample cases for creating your own automation cases, and also to be useful tools in of themselves. The Excel Case Study automation example is particularly useful to evaluate many scenarios and collect the results in a convenient format directly in Excel for easy integration into other work flows. A good example of this is being able to evaluate a process under winter and summer conditions.
Case Study Example
The Excel Case Study automation example can be found by navigating to the folder: …\VMGSimPkg\Documentation\VMG Automation\Excel Examples\Case Study and loading the Excel file Case Study.xls.
The spreadsheet is configured to interact with the VMGSim case HCRefrigerationLoop.vmp. Part 2 of this series will explain how to adapt the spreadsheet to run alternative cases. HCRefrigerationLoop.vmp represents a propane cooling loop that receives heat through the energy stream Q1.
In the Excel sheet, under Input, the paths of the simulation variables are listed. S1.In.T, for example, is the path of the temperature variable of the stream S1, which is the set point of the temperature of the stream leaving the condenser. CP1.Adiabatic.Eff is the path of the adiabatic efficiency variable of the compressor.
The values for these variables are written to the excel sheet to be imported to the VMGSim case. In the excel sheet are 4 case studies with different variable values: Design, Data1, Data2 and Data3. It can be seen that the cases Design and Data1 differ as the variable represented by the path Chiller.Out.T is set to 5°F rather than 0°F in the case Data1. It is notable that because compositions are a vector they are parenthesised between the cells containing <Vector> and </Vector>. The compositions also differ between the cases.
The Run button will populate the case HCRefrigerationLoop.vmp with the values in the Excel sheet. The 4 cases will be run sequentially and the processed data returned to Excel with the results listed by variable for each case. The paths of the returned variables can be seen under Results.
Winter and Summer Cases
To evaluate the performance of the cooling loop in winter and summer, add Winter and Summer to cells G20 and H20, G28 and H28 to extend the number of simulation runs.
In this example plant data shows that the temperature of the cooling fluid in stream S1 was 100°F in winter and 120°F in summer. Compressor efficiency was approximately 75% throughout the year. The temperature of the working fluid leaving the chiller was 0°F in winter and 5°F in summer.
The purpose of the investigation is to determine the rate of cooling fluid required to remove 300,000 Btu/hr from the process and check the temperature of the coolant in stream S2. The changes to the Excel sheet can be seen above. The vector of components are to remain constant, so the rows have been removed as redundant information. The temperature of the stream S2 has been added to the results by including the variable path S2.In.T to cell A35. Click Run to see the results!
VMGSim’s ability to exchange data through automation creates a versatile tool that brings the process simulation capabilities of VMGSim into existing workflows such as Excel spreadsheets. Automation makes projects, for example, running simulations with large quantities of data, comparing plant data to simulation results or incorporating physical property information into spreadsheets and data systems simple, robust and efficient.
Variable paths can be discovered by enabling Copy Path in VMGSim. To enable Copy Path navigate to Tools – Options in the menu bar:
And select Enable Copy Path in the Options form.
Right click any variable in VMGSim to see the option to copy the variable path. After selection, the path can be pasted directly to the relevant Microsoft Excel cell.