DWSIM User Guide PDF
Document Details
Uploaded by ImmensePlateau2100
2024
Daniel Wagner Oliveira de Medeiros
Tags
Related
- Basic Flowsheeting in Chemical Process Engineering PDF
- Basic Flowsheeting in Chemical Process CH160-2 PDF
- Basic Flowsheeting in Biological Processes PDF
- Experiment - Simulation of a Distillation Column PDF
- SPM-500 Flash Tank Operator Training Manual PDF
- SPM-700 Distillation Operator Training Manual PDF
Summary
This document is a user guide for DWSIM, an open-source chemical process simulator. It covers various aspects of using the software, including the classic and cross-platform user interfaces, process modeling, and dynamic simulation. It's useful for chemical engineers and professionals in the field.
Full Transcript
DWSIM - Open Source Chemical Process Simulator User Guide Version 8.8.0 July 2024 License DWSIM is released under the GNU General Public License (GPL) version 3. Contact Information Developer: Daniel Wagner Oliveira de Medeiros Offical Website: https://dwsim.org Source Code: http://github.com...
DWSIM - Open Source Chemical Process Simulator User Guide Version 8.8.0 July 2024 License DWSIM is released under the GNU General Public License (GPL) version 3. Contact Information Developer: Daniel Wagner Oliveira de Medeiros Offical Website: https://dwsim.org Source Code: http://github.com/DanWBR/dwsim Support: https://github.com/DanWBR/dwsim/discussions Contents I. Introduction 8 II. Classic User Interface (Classic UI) 12 1. Welcome Screen 12 2. Simulation 13 2.1. User Interface........................................ 13 2.2. Configuration......................................... 13 2.2.1. Components/Compounds.............................. 14 2.2.2. Basis......................................... 15 2.2.3. Systems of Units................................... 19 2.2.4. Behavior....................................... 20 2.2.5. Information...................................... 21 2.2.6. Property Tables.................................... 22 2.3. Process Modeling (Flowsheeting).............................. 24 2.3.1. Inserting Flowsheet Objects............................. 26 2.3.2. Process data management.............................. 33 2.3.3. Cut/Copy/Paste objects................................ 35 2.3.4. Simulation....................................... 36 2.3.5. Results........................................ 36 2.4. Sensitivity Study....................................... 38 2.5. Flowsheet Optimization................................... 39 2.6. Mass and Energy Balance Summary............................ 42 2.7. Utilities............................................ 43 2.8. Chemical Reactions..................................... 46 2.9. Characterization of Petroleum Fractions........................... 48 3. Compound Creator 51 3.1. Introduction.......................................... 51 3.2. Data Input Constant Properties............................... 52 3.3. Temperature-dependent Properties............................. 54 3.4. Importing Data from Online Sources............................. 55 3.5. Creating the Compound................................... 56 3.6. Adding the Compound to a Simulation............................ 58 3.6.1. Loading Compounds from XML Databases..................... 58 3.6.2. Loading Compounds from JSON files........................ 58 3.6.3. Remarks....................................... 59 4. Data Regression 60 4.1. Data Regression - How To.................................. 61 Contents Contents 5. General Settings 66 5.1. Solver............................................. 67 5.2. Flowsheet.......................................... 67 5.2.1. Cut/Copy/Paste Flowsheet Objects.......................... 67 5.2.2. Undo/Redo...................................... 67 5.2.3. Object Editors..................................... 67 5.3. User Datasets........................................ 68 5.4. User Compounds....................................... 68 5.5. Backup............................................ 68 5.6. Other............................................. 68 5.6.1. Messages....................................... 68 5.6.2. Debug mode..................................... 69 5.6.3. UI Language..................................... 69 5.6.4. CAPE-OPEN..................................... 69 5.6.5. Compound Constant Properties........................... 69 5.6.6. DWSIM/Python Bridge Settings........................... 69 III. Cross-Platform User Interface (CPUI) 70 6. Main Interface 70 7. Configuring a Simulation 71 7.1. Components/Compounds.................................. 71 7.2. Property Packages...................................... 72 7.3. Systems of Units....................................... 75 8. Process Modeling (Flowsheeting) 77 8.1. Inserting Flowsheet Objects................................. 77 8.2. Connecting/Disconnecting objects.............................. 80 8.2.1. Auto-Connect Added Objects............................. 80 8.3. Process data management.................................. 80 8.3.1. Entering process data................................ 80 8.4. Running a Simulation..................................... 81 8.5. Viewing Results....................................... 82 8.6. Flowsheet Utilities...................................... 83 8.6.1. Pure Component Properties............................. 83 8.6.2. Phase Envelope................................... 84 8.6.3. Binary Envelope................................... 85 1 Contents Contents IV. Unit Operation Models 87 9. Streams 87 9.1. Material Stream....................................... 87 9.1.1. Calculation Method.................................. 88 9.1.2. Output parameters.................................. 88 9.2. Energy Stream........................................ 89 10. Unit Operations 89 10.1.Mixer............................................. 89 10.1.1. Splitter........................................ 89 10.2.Separator Vessel....................................... 90 10.3.Tank............................................. 90 10.4.Pipe Segment........................................ 90 10.5.Valve............................................. 92 10.5.1. Opening (OP)/Flow Coefficient (Kv[Cv]) Relationship Types............. 92 10.6.Pump............................................. 93 10.7.Compressor/Expander.................................... 94 10.8.Heater/Cooler........................................ 95 10.9.Shortcut Column....................................... 96 10.10.Rigorous Column (Distillation/Absorption).......................... 97 10.11.Heat Exchanger....................................... 98 10.12.Air Cooler........................................... 99 10.13.Component Separator.................................... 100 10.14.Orifice Plate......................................... 100 10.15.Custom Unit Operation.................................... 101 10.16.Solids Separator....................................... 101 10.16.1.Continuous Cake Filter................................ 102 10.17.Excel Unit Operation..................................... 103 10.18.Flowsheet Unit Operation.................................. 104 10.19.PEM Fuel Cell........................................ 105 10.20.Water Electrolyzer...................................... 106 10.21.Hydroelectric Turbine..................................... 107 10.22.Wind Turbine......................................... 108 10.23.Solar Panel.......................................... 109 11. Reactors 110 11.1.Input Parameters....................................... 111 11.2.Output Parameters...................................... 111 11.3.Calculation Methods..................................... 111 11.3.1. Conversion Reactor.................................. 111 11.3.2. Equilibrium Reactor................................ 111 11.3.3. Gibbs Reactor................................... 114 11.3.4. Gibbs Reactor (Reaktoro).............................. 115 2 Contents Contents 11.3.5. PFR/CSTR...................................... 116 12. Logical Operations 116 12.1.Recycle............................................ 116 12.2.Energy Recycle........................................ 117 12.3.Adjust............................................. 117 12.4.Specification......................................... 117 V. Dynamic Modeling and Simulation 119 13. Introduction 119 14. Dynamic Simulation Structure and Configuration 120 14.1.Dynamic Model Setup.................................... 120 14.2.Event Sets.......................................... 120 14.3.Cause-and-Effect Matrices.................................. 121 14.4.Integrators.......................................... 121 14.4.1. Monitored Variables.................................. 121 14.5.Schedules.......................................... 121 15. Dynamic Simulation Flowsheet Blocks 121 15.1.Analog Gauge........................................ 121 15.2.Digital Gauge......................................... 121 15.3.Level Gauge......................................... 122 15.4.PID Controller........................................ 122 15.4.1. Introduction...................................... 122 15.4.2. Fundamental Operation................................ 122 15.4.3. Mathematical form.................................. 124 15.4.4. Selective use of control terms............................ 124 15.4.5. Overview of tuning methods............................. 124 15.4.6. DWSIM Implementation............................... 125 15.5.Python Controller....................................... 127 15.6.Input Box........................................... 127 15.7.Switch............................................ 127 16. Dynamic Simulation Tools 127 16.1.Control Panel Mode..................................... 127 16.2.PID Controller Tuning..................................... 128 17. Supported Unit Operations 129 VI. Technical Basis: Methods and Procedures 130 18. Introduction 130 3 Contents Contents 19. Thermodynamic Properties 131 19.1.Phase Equilibria Calculation................................. 131 19.1.1. Fugacity Coefficient calculation models....................... 132 19.1.2. Chao-Seader and Grayson-Streed models...................... 135 19.1.3. Calculation models for the liquid phase activity coefficient.............. 136 19.2.Enthalpy, Entropy and Heat Capacities............................ 141 19.3.Speed of Sound....................................... 143 19.4.Joule-Thomson Coefficient.................................. 144 20. Transport Properties 144 20.1.Density............................................ 144 20.2.Viscosity........................................... 147 20.3.Surface Tension....................................... 148 20.4.Isothermal Compressibility.................................. 148 20.5.Bulk Modulus......................................... 149 21. Thermal Properties 150 21.1.Thermal Conductivity..................................... 150 22. Aqueous Solution Properties 152 22.1.Mean salt activity coefficient................................. 152 22.2.Osmotic coefficient...................................... 152 22.3.Freezing point depression.................................. 152 23. Specialized Models / Property Packages 152 23.1.IAPWS-IF97 Steam Tables.................................. 152 23.2.IAPWS-08 Seawater..................................... 153 23.3.Black-Oil........................................... 154 23.4.CoolProp........................................... 155 24. Reactions 155 24.1.Conversion Reaction..................................... 155 24.2.Equilibrium Reaction..................................... 156 24.2.1. Solution method................................... 156 24.3.Kinetic Reaction....................................... 157 25. Property Estimation Methods 157 25.1.Petroleum Fractions..................................... 157 25.1.1. Molecular weight................................... 157 25.1.2. Specific Gravity.................................... 159 25.1.3. Critical Properties................................... 159 25.1.4. Acentric Factor.................................... 160 25.1.5. Vapor Pressure.................................... 160 25.1.6. Viscosity....................................... 160 25.2.Hypothetical Components.................................. 161 4 Contents Contents 26. Other Properties 162 26.1.True Critical Point....................................... 162 26.2.Petroleum Cold Flow Properties............................... 163 26.2.1. Refraction Index................................... 163 26.2.2. Flash Point...................................... 163 26.2.3. Pour Point....................................... 163 26.2.4. Freezing Point.................................... 164 26.2.5. Cloud Point...................................... 164 26.2.6. Cetane Index..................................... 164 26.3.Chao-Seader Parameters.................................. 164 VII. How-To Tutorials 165 27. Methane Steam Reforming 165 27.1.Introduction.......................................... 165 27.2.Background.......................................... 165 27.3.Problem Statement...................................... 167 27.4.DWSIM Model (Classic UI).................................. 167 27.5.DWSIM Model (Cross-Platform UI).............................. 175 28. Extractive Distillation 182 28.1.Introduction.......................................... 182 28.2.Background.......................................... 182 28.3.DWSIM Model (Classic UI).................................. 183 28.4.DWSIM Model (Cross-Platform UI).............................. 191 29. Flowsheet Control with Python Scripts 202 29.1.Introduction.......................................... 202 29.2.DWSIM Model (Classic UI).................................. 202 29.3.DWSIM Model (Cross-Platform UI).............................. 206 30. Basic Dynamic Simulation Tutorial 209 30.1.Introduction.......................................... 209 30.2.DWSIM Model (Classic UI).................................. 209 30.2.1. Model Building.................................... 209 30.2.2. Dynamic Simulation.................................. 212 30.2.3. Adding a PID Controller................................ 212 30.2.4. PID Controller Tuning................................. 213 30.3.Real-Time Mode....................................... 214 VIII.Advanced Topics 216 31. Python Scripting 216 31.1.Python Interpreters...................................... 216 5 Contents Contents 31.2.IronPython Interactive Console (Classic UI)......................... 217 31.2.1. Available Functions.................................. 217 31.2.2. Changing object properties.............................. 218 32. Model Customization 218 32.1.Introduction.......................................... 218 32.2.Unit Operation / Material Stream Calculation Routine Override............... 218 32.2.1. Unit Operations.................................... 218 32.2.2. Material Streams................................... 221 32.3.Property Package Fugacity Coefficients / Enthalpy / Entropy Calculation Routine Override. 221 32.3.1. Fugacity Coefficients................................. 221 32.3.2. Enthalpy/Entropy................................... 224 32.4.Overriding Flash Algorithms................................. 227 33. Overriding Calculated Properties 233 33.1.Accessing the feature.................................... 233 33.2.Override Script Samples................................... 234 33.2.1. Solid Density..................................... 234 33.3.Water/Hydrocarbon Emulsion Viscosity........................... 235 34. Automation 237 34.1.Automation support in DWSIM................................ 237 34.2.Registering DLLs for COM Automation............................ 238 34.3.API Reference Documentation................................ 238 34.4.DWSIM Flowsheet Class Structure.............................. 239 34.5.Sample Automation...................................... 239 34.5.1. About Cavett’s Problem................................ 240 34.5.2. Excel VBA...................................... 241 34.5.3. VB........................................... 242 34.5.4. C#........................................... 243 34.5.5. Python........................................ 244 35. Excel Add-In for Thermo Calculations 246 35.1.Introduction.......................................... 246 35.2.Installation.......................................... 246 35.3.Usage............................................ 247 35.4.Overriding Interaction Parameters.............................. 249 36. Property Package Methods and Correlation Profiles 250 37. CAPE-OPEN Subsystem 252 37.1.Introduction.......................................... 252 37.2.Using external components................................. 254 37.2.1. Property Packages.................................. 254 37.2.2. Unit Operations.................................... 257 6 Contents Contents 37.2.3. Flowsheet Monitoring Objects............................ 257 37.3.Other features........................................ 257 37.3.1. Using DWSIM as a CAPE-OPEN Property Package Manager (Thermo 1.1).... 257 37.3.2. Using the Script Unit Operation in CAPE-OPEN compliant simulators........ 258 IX. Additional Resources 261 38. Online Courses and Videos 261 39. Learning Resources 261 40. Programming Help 261 References 268 7 Part I. Introduction This document gives a detailed description about how to setup, run, modify and view results of a basic process simulation in DWSIM. The document is organized according to the sequence of execution of a simulation. Each step/task is explained with the help of images and descriptions of the associated windows. DWSIM has two Graphical User Interfaces: Classic UI and Cross-Platform UI. ➙ The Classic UI is based on the Windows Forms graphical class library (link), which has been used since the initial versions of DWSIM. The Windows Forms graphical library was created for Windows applications. A port of this library exists for Linux, but it has some issues and, since it mimics the Windows look-and-feel, it doesn’t look ”native” on systems other than Windows: Figure 1: Classic UI on Windows 10 +.NET Framework 4.8. 8 Figure 2: Classic UI on Ubuntu Linux 16.04 + Mono 5.10. ➙ The Cross-Platform UI is based on a library called Eto.Forms (link), which is a cross-platform graphical class library, supporting Windows, Linux, macOS and some mobile systems. This UI was created from scratch using the C# language, and looks native when executed on systems other than Windows, since it runs under the GTK (link) backend on Linux and Cocoa (link) on macOS. On Windows, the Cross-Platform UI runs under the Windows Presentation Foundation backend, though it is recommended to use the Classic UI on Windows systems, since it is more stable and reliable due to the fact that it has been in development for much more time. 9 Figure 3: Cross-Platform UI on Linux 16.04 + Mono 5.10 (GTK backend). Figure 4: Cross-Platform UI on Windows 10 (WPF backend). 10 Figure 5: Cross-Platform UI on macOS Mojave (Cocoa backend). 11 1 WELCOME SCREEN Part II. Classic User Interface (Classic UI) 1. Welcome Screen When DWSIM is opened, the welcome screen is shown (Figure 40): Figure 6: DWSIM’s welcome screen. The welcome screen provides the user with shortcuts to open existing simulations, create new ones, create new compound creator and data regression cases and open the samples folder. The following items are displayed on DWSIM’s main window: ➙ Menu bar , with buttons to open/save/create simulations, component creator and data regression cases, configure the active simulation, general preferences, launch tools, configure the child win- dows view mode, etc.; ➙ Button strip, to open, save and create new steady-state simulations, component creator and data regression cases. There are various ways to access the most commonly operations with simulation files and component creator/data regression cases - open, save and create. In the next sections you will be guided through some necessary steps to create and configure a steady-state simulation, a compound creator and/or a data regression case. 12 2 SIMULATION 2. Simulation 2.1. User Interface The "Create a new steady-state simulation" button in the welcome window can be used to create a new simulation. After the simulation is created, the configuration window (Figure 40) is shown. The simulation configuration interface consists in a tabbed window: ➙ Compounds - Add or remove compounds to/from the simulation and petroleum fractions (pseudo- compounents) utilities. ➙ Basis - Property Package configuration, phase equilibrium flash algorithm selection and other ad- vanced thermodynamic model settings. ➙ System of Units - Management of Systems of Units. ➙ Behavior - Options to control certain behaviors of the flowsheeting environment. ➙ Object Properties - Definition of objects properties to be shown on flowsheet floating tables. ➙ Information - Simulation info (title, author and description), number formatting and password set- tings. 2.2. Configuration Figure 7: Simulation Configuration Wizard. 13 2.2 Configuration 2 SIMULATION Since DWSIM 3.3, a new Simulation Configuration Wizard (Figure 40) is opened as soon as a new sim- ulation is created, and will display the interfaces described in the following sections in a more streamlined way. The older simulation configuration window can be accessed anytime during the simulation or through a button located in the first page of the config wizard. Figure 8: Simulation Configuration window. The simulation configuration window (Figure 40) is the interface where all the functions for configuration and personalization of a simulation in DWSIM can be found. In this window, the user can manage the sim- ulation components, the property package (thermodynamic model), configure the reactions environment, units system and number format, among other options. The simulation configuration window can be accessed anytime when a simulation is opened in DWSIM. The changes made through it have immediate effect on the simulation. 2.2.1. Components/Compounds There are two essential information required by DWSIM in order to correctly start a simulation. The first refers to the available components (or compounds). DWSIM comes with six default compound databases (DWSIM, ChemSep, Biodiesel, CoolProp, ChEDL and Electrolytes), with a total of more than 1500 compounds available for your simulation. To add a compound to the simulation, select it from the list on the left and click on Add >. To remove an added compound, select it on the right-hand list and click < Remove. To view the data from a compound from on a list, click on the appropriate View Data button. 14 2.2 Configuration 2 SIMULATION DWSIM also features full compound data importing from Online Sources or from JSON files, using the appropriate buttons on the Simulation Configuration Wizard or on the Simulation Settings panel. If you manage to find a compound from these sources with a minimum set of data, they can be added directly to the simulation without further action. JSON files are exported from the Compound Creator utility or from the Pure Compound Property Viewer tool. 2.2.2. Basis 2.2.2.1. Property Packages The Property Package consists in a set of methods and models for the calculation of physical and chemical properties of material streams in the simulation. It is composed of a thermodynamic model - an equation of state or a hybrid model - and methods for property calculation, like the surface tension of the liquid phase. The figure 40 shows the interface for configuration of the property package. DWSIM allows multiple Property Packages to be added to a single simulation. The Property Packages can be associated to any unit operation and material stream on a individual basis. Each property package has its own settings, even if two or more packages are of the same type. Figure 9: Property Package configuration interface. If the selected property package has any editable property, the "Configure" button becomes clickable and the user can click on it to show the property package configuration window. 15 2.2 Configuration 2 SIMULATION Figure 10: Property package configuration window (1). Property Package configuration options Some Property Packages have extra configuration options in order to allow a deeper control of the thermodynamic calculations for the user. They are: ➙ Use Peneloux Volume Translation correction (PR/SRK EOS only) This option is available for PR and SRK Property Packages. It enables correction of EOS-calculated densities by the inclusion of a correction factor named volume translation coefficient. This option will be effective only if the EOS is selected as the calculation method for Liquid Density. ➙ Ignore maximum salinity limit (IAPWS-08 Seawater Property Package only) Ignores the maximum supported salinity value (0.12 kg/kg) for calculations and doesn’t display any warnings. Use 0 to disable, 1 to enable this option. If enabled, the calculated salinity will be send directly to the property calculation routines without further check. If disabled, the maximum value of 0.12 will be used if the calculated salinity is higher, and a warning message will be displayed in the flowsheet log window. ➙ Calculate Bubble and Dew points at stream conditions Check this box if you want the DWSIM to calculate bubble and dew points at conditions specified on each material stream. The calculated values will be shown only if the stream is at VLE equilibrium. The calculations are not exactly fast, so use this option with caution and only if needed. 16 2.2 Configuration 2 SIMULATION Figure 11: Property Package Equilibrium Calculation Settings. Property Package Flash (Equilibrium) Calculation Settings ➙ Phase Equilibria Calculation Type The default calculation type considers one vapor and two liquid phases. Check the "Handle Solids" box to include the solid phase in the Default equilibrium calculation mode. Change this setting to a different value if the default setting gives you convergence errors in the simula- tion. ➙ Numerical Method You can choose from three different approaches to calculate phase equilibria: Nested Loops (default), Inside-Out and Gibbs Minimization. If an external optimizer is available, you can select one from the External Solver drop down list to use when in Gibbs Minimization mode. ➙ Fail-Safe Procedure Select a fail-safe calculation mode if the main phase equilibria calculation fails. You can select one of the following options: 1. Rigorous VLE: does a VLE calculation using the currently selected Property Package. 2. Ideal VLE: does a VLE calculation using the Raoult’s Law Property Package. 17 2.2 Configuration 2 SIMULATION 3. Do Not Calculate Equilibrium: doesn’t perform any equilibrium calculation. 4. Throw error/exception: this was the default behavior on older DWSIM versions. ➙ Force Pressure-Enthalpy (PH) Flash calculations If enabled, all requests by unit operations for Pressure-Temperature Flashes will be replaced by Pressure- Enthalpy ones. ➙ Validate Equilibrium Flash Calculation Results If enabled, DWSIM will check the mixture Gibbs energy before and after the equilibrium flash calculation. If the gibbs energy increases after the calculation (it should always decrease when there is a phase split), an error message will be shown and the flowsheet calculation will be aborted. ➙ Apply a Phase Identification Algorithm after Equilibrium Calculations Check this to apply an identification algorithm to each phase after the equilibrium calculation is finished. This can be useful for supercritical compounds which behave as liquid at high pressures and tempera- tures, or special mixtures which exhibit LLE behavior at low temperatures, incorrectly identified as VLE by the flash algorithms. Visit DWSIM’s wiki for more information about the phase identification algorithm. Forced Solids Use the Forced Solids option to define the compounds which will always be in the Solid Phase. Property Overrides Since DWSIM Version 5.1, you can override the calculated phase properties through Python scripts. This can be useful if the calculated property is far from the expected value, or if you need to include advanced mixing rules when calculating mixed phase properties. For more information, go to the Overriding Calculated Properties page on the Wiki. 2.2.2.2. Property Package Selection Guide Most thermodynamic models have binary interaction pa- rameters which are fitted to match experimental data. Always check if the selected thermodynamic model has interaction parameters for the compounds in the simulation, if required. To view the list of IPs, open the Property Package Configuration Window and go to the Interaction Parameters tab. Whenever possible, one should either use experimental data to check the predicted properties, or to use these data to fit suitable thermodynamic models. DWSIM has a tool to regress experimental data and calculate binary interaction parameters for various thermodynamic models. Non-polar gases at low pressures (< 10 atm) Use the Raoult’s Law Property Package. It assumes that both phases (gas and liquid) are ideal. Non-polar gases at high pressures (> 10 atm) Use one of the Equation of State models like Peng- Robinson, Soave-Redlich-Kwong and PRSV2. 18 2.2 Configuration 2 SIMULATION Polar gases at high pressures (> 10 atm) Use the PRSV2 Property Package. Check if it has the required parameters for your system as DWSIM lacks many parameters for this model. If it doesn’t, fallback to an EOS model like PR or SRK. Systems with high Hydrogen content You can use the Chao-Seader, Grayson-Streed or Lee- Kesler-Plöcker model. The LKP model is very slow but can be more reliable depending on the system. The LKP model is very sensitive to the interaction parameter values being used. Air Separation / Refrigeration systems Use the CoolProp Property Package. Steam/Water simulations Use the Steam Tables Property Package. Polar chemicals Use one of the activity coefficient models like NRTL or UNIQUAC. If no interaction parameters are available for your system, you can fallback to one of the UNIFAC-type models. Modified UNIFAC (NIST) is recommended. Salt/Water systems Use the Seawater Property Package. 2.2.3. Systems of Units Three basic units systems are present in DWSIM: SI System (selected by default), CGS System and English (Imperial) System. The simulation’s units system can be viewed/modified in the "Units System" section of the "Options" tab in the simulation configuration window (Figure 40). 19 2.2 Configuration 2 SIMULATION Figure 12: System of Units configuration interface. There are buttons available on this interface to create custom units systems and save/load them. It is worth remembering that the units systems can also be modified at any time during the simulation - the changes are applied immediately. 2.2.4. Behavior 2.2.4.1. Behavior options for Flowsheet Objects ➙ Skip Equilibrium Calculation in Well-Defined Streams Tells the Flowsheet Solver to avoid doing unnecessary work and skip equilibrium calculations in Material Streams connected to specific ports like Separator Vessel and Distillation Column outlets. ➙ Force Material Stream Phase You can override the equilibrium phase for all Material Streams in the flowsheet by setting this property property to the desired value (Vapor, Liquid or Solid. The default value is Do Not Force. When this property is set to one of the phase names (Vapor, Liquid or Solid), the equilibrium calculation for all Material Streams is bypassed and all compounds are put into the selected phase with the same composition as the mixture. ➙ Force object calculation even when input parameters don’t change This is the main feature of the Smart Object Solver added in v8.4. You can turn it off by unchecking the corresponding box. 20 2.2 Configuration 2 SIMULATION ➙ Specification Blocks calculation mode You can define how and when the specification blocks are calculated in the flowsheet. 2.2.4.2. Number Formatting ➙ Numerical Values Formatting Scheme: select the formatting for general numbers. ➙ Stream Composition Formatting Scheme: select the formatting for stream compositions. 2.2.4.3. General ➙ Enable Undo/Redo: allows the flowsheet to quickly return to a previous state. ➙ Include flowsheet messages when saving file: for debugging purposes, the log messages are added to the flowsheet file by default. Figure 13: Behavior settings interface. 2.2.5. Information In the "Description" group box it is possible to edit some information about the active simulation (title, author and description). You can also define a password to prevent the simulation of being opened by anyone, but this feature only works with the Compressed XML simulation file format (*.dwxmz). 21 2.2 Configuration 2 SIMULATION Figure 14: Information settings interface. 2.2.6. Property Tables In the "Property Tables" section you can define which properties are going to be shown for each object type when you hover the mouse over the objects on the flowsheet. The property list is saved in a per- simulation basis. 22 2.2 Configuration 2 SIMULATION Figure 15: Property Tables settings interface. 23 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 16: Selected properties on the previous image are shown on the flowsheet for the Material Streams. 2.3. Process Modeling (Flowsheeting) After configuring the simulation, the user is taken to the main simulation window (Figure 40). In this window we can highlight the following areas: 24 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 17: DWSIM simulation window. ➙ Menu Bar : file handling, window arrangement, help, simulation settings, solver controls, undo/redo buttons. ➙ Flowsheet Objects Palette window: shows objects which can be added by dragging them into the PFD; ➙ Flowsheet Objects List window: contains a searchable list of the flowsheet objects, including shortcuts to edit, rename and delete items; ➙ Material Streams window: lists the material streams in the flowsheet and their calculated proper- ties; ➙ Flowsheet window: process flowsheet building and editing area; ➙ Information window: general information about the active simulation; ➙ Spreadsheet window: shows the spreadsheet, a utility to do math operations with data provided by the objects in the current simulation; ➙ Charts window: used to create and view charts from flowsheet objects or from spreadsheet data; ➙ Script Manager window: displays the script manager, which can be used to write Python scripts to automate certain simulation tasks. When running DWSIM on a Windows platform, the simulation windows can be freely repositioned, with the arrangement information being saved together with the rest of simulation data. To reposition a window, the user should click with the left mouse button in the window’s top bar and drag it to the desired place. A preview of how the window will be is shown in blue (Figure 40). 25 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 18: Window repositioning. When running DWSIM on Mono (Linux), use the context menus (right-click with the mouse on the window caption bar) on each window to reposition/dock its contents. 2.3.1. Inserting Flowsheet Objects To add an object to the flowsheet, you can: ➙ Use the Insert > Flowsheet Object menu item (keyboard shortcut: Ctrl+A): 26 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 19: Inserting an object to the flowsheet. ➙ Drag an item from the Object Pallette window located on the bottom of the flowsheet panel: 27 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 20: Inserting an object to the flowsheet by dragging from the Object Pallette window. The elements of a simulation (objects) which can be added to the flowsheet are: ➙ Material Stream: used to represent matter which enters and leaves the limits of the simulation and passes through the unit operations. The user should define their conditions and composition in order for DWSIM to calculate their properties accordingly; ➙ Energy Stream: used to represent energy which enters and leaves the limits of the simulation and passes through the unit operations; ➙ Mixer: used to mix up to three material streams into one, while executing all the mass and energy 28 2.3 Process Modeling (Flowsheeting) 2 SIMULATION balances; ➙ Energy Mixer: mix up to three energy streams into one; ➙ Splitter: mass balance unit operation - divides a material stream into two or three other streams; ➙ Valve: works like a fixed pressure drop for the process, where the outlet material stream properties are calculated beginning from the principle that the expansion is an isenthalpic process; ➙ Pipe: simulates a fluid flow process (mono or two-phase). The pipe implementation in DWSIM provides the user with various configuration options, including heat transfer to environment or even to the soil in buried pipes. Two correlations for pressure drop calculations are available: Beggs & Brill and Lockhart & martinelli. Both reduces to Darcy equation in the case of single-phase flow; ➙ Pump: used to provide energy to a liquid stream in the form of pressure. The process is isenthalpic, and the non-idealities are considered according to the pump efficiency, which is defined by the user; ➙ Tank : in the current version of DWSIM, the tank works like a fixed pressure drop for the process; ➙ Separator Vessel: used to separate the vapor and liquid phases of a stream into two other distinct streams; ➙ Compressor: used to provide energy to a vapor stream in the form of pressure. The ideal process is isentropic (constant entropy) and the non-idealities are considered according to the compressor efficiency, which is defined by the user; ➙ Expander : the expander is used to extract energy from a high-pressure vapor stream. The ideal process is isentropic (constant entropy) and the non-idealities are considered according to the expander efficiency, which is defined by the user; ➙ Heater: simulates a stream heating process; ➙ Cooler : simulates a stream cooling process; ➙ Conversion Reactor: simulates a reactor where conversion reactions occur; ➙ Equilibrium Reactor: simulates a reactor where equilibrium reactions occur; ➙ PFR: simulates a Plug Flow Reactor (PFR); ➙ CSTR: simulates a Continuous-Stirred Tank Reactor (CSTR); ➙ Shortcut Column: simulates a simple distillation column with approximate results using shorcut calculations; ➙ Distillation Column: simulates a distillation column using rigorous thermodynamic models; ➙ Absorption Column: simulates an absorption column using rigorous thermodynamic models; ➙ Refluxed Absorber: simulates a refluxed absorber column using rigorous thermodynamic models; ➙ Orifice Plate: model to simulate an orifice plate, used for flow metering; 29 2.3 Process Modeling (Flowsheeting) 2 SIMULATION ➙ Component Separator: model to simulate a generic process for component separation; ➙ Custom Unit Operation: an user-defined model based on Python scripts; ➙ CAPE-OPEN Unit Operation: External CAPE-OPEN Unit Operation socket for adding CO Unit Operations in DWSIM; ➙ Spreadsheet Unit Operation: Unit Operation where the model is defined and calculated in Spread- sheet (XLS/XLSX/ODS) files; ➙ Solids Separator: model to simulate a generic process for solid compound separation; ➙ Continuous Cake Filter: continuous cake filter model for solids separation; ➙ Air Cooler 2: unit operation that is used to cool a material stream using air; ➙ Water Electrolyzer: electrolysis model for H2 generation from water; ➙ PEM Fuel Cell: Proton-exchange Membrane Fuel Cell model for energy generation from H2 and O2; ➙ Hydroelectric Turbine: generates energy from a water stream; ➙ Wind Turbine: generates energy from wind; ➙ Solar Panel: generates energy from solar energy; ➙ Gibbs Reactor (Reaktoro): general-purpose chemical reactor based on Reaktoro. Additionally, the following logical operations are available in DWSIM: ➙ Controller: used to make a variable to be equal to a user-defined value by changing the value of other (independent) variable; ➙ Specification: used to make a variable to be equal to a value that is a function of other variable, from other stream; ➙ Recycle: used to mix downstream material with upstream material in a flowsheet, ➙ Energy Recycle: used to mix downstream energy with upstream energy in a flowsheet. ➙ Input Box: use to quickly change a property of an object; ➙ Switch: used to switch the value of a property of an object between two values; Figure 40 shows a material stream added to the flowsheet by one of the method described above. It can be observed that the stream is selected and that its property editor is shown as a panel on the left part of the main window. 30 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 21: A material stream in the flowsheet. Connecting objects The material streams represent mass flowing between unit operations. There are two different ways in which a material stream can be connected to a unit operation (or vice-versa): ➙ Through the context menu activated with a right mouse button click over the object (Figure 40); Figure 22: Selected object context menu. ➙ Through the property editor window - Connections section. 31 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 23: Connection selection menu. ➙ Through the "Create and Connect" buttons on the object editors. When you click on these but- tons, DWSIM will automatically create and connect streams to the associated ports on the selected object. Figure 24: Create and Connect tool. An expander system with its connections is shown on Figure 40. 32 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 25: Expander with all connections correctly configured. Disconnecting objects Tools to disconnect objects from each other can be found on the same locations as the connecting ones. Removing objects from the flowsheet The selected object can be removed from the flowsheet by pressing the DEL keyboard button or by using the context menu - "Delete" item (Figure 40). 2.3.1.1. Auto-Connect Added Objects This is a new feature in DWSIM v7.4.0. It enables automatic connections between added objects and nearby ones. There are three different options for this setting: ➙ No: No automatic connections are made when you add an object to the flowsheet. ➙ Yes: When you add a new unit operation, streams are automatically added to the flowsheet and connected to its ports. ➙ Smart: When you add a new unit operation, nearby streams are connected to it, and new streams are created to connect to the remaining ports. 2.3.2. Process data management Entering process data The objects’ process data (temperature, pressure, flow, composition and/or other parameters) can be entered in the property editor window (Figure 40). Properties that cannot be edited (read-only) are grayed-out. 33 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 26: Viewing object properties in the editor window. Most properties can be edited directly by typing a value in the textbox and pressing ENTER. DWSIM will then commit the new property value and trigger the flowsheet solver. Figure 27: Direct editing of a property. You can also use the inline units converter to convert the value of a property from the desired units to the current selected units. Type the value of the property on the textbox and select the unit to convert from at the combobox on the right. DWSIM will then convert the value from the selected units on the combobox to the actual units of the simulation system of units. 34 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 28: Converting 50 C to the current temperature units (K). Figure 29: Converted temperature value (323.15 K). If all object properties were correctly defined, it will be calculated by DWSIM and its flowsheet represen- tation will have a blue border instead of a red one, indicating that the object was calculated successfully (Figure 40). Figure 30: Calculated objects. 2.3.3. Cut/Copy/Paste objects DWSIM also supports cutting, copying and pasting flowsheet objects inside a flowsheet or between different flowsheets. When copying objects between flowsheets, DWSIM may also copy compounds and property packages from one flowsheet to another. Cut/Copy/Paste behavior is an application setting and can be set in the General Settings menu (Section 5.6). 35 2.3 Process Modeling (Flowsheeting) 2 SIMULATION 2.3.4. Simulation DWSIM is a sequential modular process simulator, that is, all calculations are made in a per-module basis, according to the connections between the objects. The calculator checks if an object has all of its properties defined and, if yes, passes the data for the downstream object and calculates it, repeating the process in a loop until it reaches an object that doesn’t have any of its dowstream connections attached to any object. This way, the entire flowsheet can be calculated as many times as necessary without having to "tell" DWSIM which object must be calculated. In fact, this is done indirectly if the user define all the properties and make all connections between objects correctly. DWSIM’s calculation starts when the user edits a property which defines an object. For example, editing a stream mass flow when its temperature, pressure and composition are already well-defined activates DWSIM‘s calculator. It is possible to control DWSIM’s calculator by using its button bar (Figure 40). Clicking on the button activates or deactivates the calculator. The button performs a full flowsheet recalculation. DWSIM’s calculator is enabled by default - if it is disabled, modifying of a property is accepted, but does not recalculate the object nor the ones that are downstream in the flowsheet. The button stops the any ongoing calculation. Figure 31: DWSIM’s calculator control bar. As DWSIM’s calculator does its job, messages are added to the "Information" window. These messages tell the user if the object was calculated successfully or if there was an error while calculating it, among others (Figure 40). Figure 32: A DWSIM’s calculator message. 2.3.5. Results Results can be viewed in reports, generated (Figures 40 and 40) for printing. Report data can also be saved to ODT, ODS, XLS, TXT or XML files. 36 2.3 Process Modeling (Flowsheeting) 2 SIMULATION Figure 33: Results report configuration. 37 2.4 Sensitivity Study 2 SIMULATION Figure 34: Results report. 2.4. Sensitivity Study You can use the Sensitivity Study Utility in order to study the influence of up to 2 variables into other dependent flowsheet variables. The changes in variables are defined by a value range and a number of equally spaced points within this range. For example, you can analyze the influence of temperature and pressure in the enthalpy of a mixture, from 200 to 400 K and from 100 to 1000 kPa, nine points for temperature and 5 points for pressure, totaling 45 points on which the enthalpy will be calculated at different temperatures and pressures. This also means that the flowsheet will be recalculated 45 times (!), so be careful with the number of points you choose as the calculation time can be prohibitive. 38 2.5 Flowsheet Optimization 2 SIMULATION Figure 35: Sensitivity Analysis Utility (1). The sensitivity analysis utility is based on case studies. In a single simulation one can define a number of cases, each one with its own variables, ranges and results. These cases will be saved together with the simulation, and cannot be exported to other ones. The results are shown in a table, so the data can be copied and pasted into another specialized data analysis software or sent directly to the data regression plugin. 2.5. Flowsheet Optimization The Multivariate Optimizer in DWSIM handles single and multivariate optimization problems with or without bound constraints. The objective function can be either a variable in the flowsheet or an expression as a function of as many variables as you need. The interface is very similar to Sensitivity Analysis’s one. One can define a number of cases, each one with its own variables, ranges and results. These cases will be saved together with the current simulation, and cannot be exported to other simulations. 39 2.5 Flowsheet Optimization 2 SIMULATION Figure 36: Multivariate Optimization Utility (1). There are some options to choose from in DWSIM’s Multivariate Optimizer. It is possible to select the type of the optimization (minimization or maximization of the objective function), choose if the indendent variables will have lower and/or upper bounds and if the objective function will be a flowsheet variable or an expression based on flowsheet variables. One can also define a maximum number for the iterations and a tolerance for the variation of the calculated value for the objective function - if the variation is less than the defined value, the flowsheet is considered optimized and the process stops. There is also an option to choose if the flowsheet will be returned to its original state after optimization, so the results will be shown only in the current window, and the flowsheet initial configuration will remain intact. In order to define variables to be used in the optimization process, a variable can be added by clicking on the "+" button. With the variable row added to the list, one chooses an object, then the desired property and the type of variable (IND for independent, AUX for auxiliary or DEP for dependent variables). If necessary, one can define a lower and/or upper limit for the IND variables, according to the current unit system. The variable name is the one which will be used in the expression. DWSIM only considers bounds for independent variables. Also, if the objective function is a DEP vari- able, and you defined multiple DEP variables, only the first one will be used. AUX variables are used by an expression when the objective function is set to evaluate the expression. To remove a variable, a row must be selected by clicking at the row header before pressing the "-" button. 40 2.5 Flowsheet Optimization 2 SIMULATION Figure 37: Multivariate Optimization Utility (2). With all the variables defined and the case configured, the optimization can be carried out by clicking on the appropriate button - the button will become disabled. After some time, if the optimization converges, the button will become active again, indicating that the the optimization process is over. 41 2.6 Mass and Energy Balance Summary 2 SIMULATION Figure 38: Multivariate Optimization Utility (3). 2.6. Mass and Energy Balance Summary You can find the Mass and Energy Balance Summary tool in the Flowsheet Analysis menu: Figure 39: Mass and Energy Balance Summary tool location. This tool gives you an overall view of the equipments and their energy consumption/generation, as well as the defined or calculated efficiencies, if applicable. There is also a list of all material streams and their associated energy flows (in SI, energy flow = enthalpy x mass flow = kJ/kg x kg/s = kJ/s = kW). At the bottom of the tool window, you’ll find the overall flowsheet mass balance residue and total flow- sheet energy consumption/generation. 42 2.7 Utilities 2 SIMULATION Figure 40: Mass and Energy Balance Summary tool. 2.7. Utilities DWSIM includes some utilities which provides the user with more information about the process being simulated. Utilities can be added and attached to Flowsheet objects (Utilities > Add Utility menu item). After being attached, they will be saved together with simulation data and restored upon reopening. Some data from the attached utilities will be available to be displayed on property tables and used on sensitivity analysis and optimization studies. Figure 41: Attaching Utilities through the "Add Utility" window. 43 2.7 Utilities 2 SIMULATION Figure 42: Attaching Utilities through the object editors. Added/Attached Utilities will be visible on the context menu located on the object editors, on the right of the Object’s Name textbox. Figure 43: Accessing attached Utilities. ➙ True Critical Point - utility to calculate the true critical point of a mixture (Figure 40). Figure 44: Utilities - True Critical Point. ➙ Phase Envelope - Material stream phase equilibria envelope calculation (Figure 40); 44 2.7 Utilities 2 SIMULATION Figure 45: Utilities - Phase Envelope. ➙ Binary Envelope - special envelopes for binary mixtures (Figure 40). Figure 46: Utilities - Binary Envelope. 45 2.8 Chemical Reactions 2 SIMULATION ➙ Petroleum Cold Flow Properties - special properties of petroleum fractions, like cetane index, flash point, refraction index, etc. (Figure 40). Figure 47: Utilities - Petroleum Cold Flow Properties. Utilities calculate their properties for one object only, which is selected inside their own windows. In the majority of cases, this object must be calculated in order to be available for selection in the utility window. Please view DWSIM’s Technical Manual for more details about the models and methods used by the Utilities. 2.8. Chemical Reactions DWSIM classifies chemical reactions in three different types: Conversion, where the conversion of a reagent can be specified as a function of temperature; Equilibrium, where the reaction is characterized by an equilibrium constant K, and Kinetic/Heterogeneous Catalytic, where the reaction is led by a velocity expression which is a function of concentration of reagents and/or products and/or a catalyst. 46 2.8 Chemical Reactions 2 SIMULATION Please view DWSIM’s Technical Manual and Equipment and Utilities Guide for more details about chemical reactions and reactors, respectively. Chemical reactions in DWSIM are managed through the Chemical Reactions Manager (Simulation Settings > Reactions panel) (Figure 40): Figure 48: Chemical Reactions Manager. The user can define various reactions which are grouped in Reaction Sets. These reaction sets list all chemical reactions, and the user must activate only those he/she wants to become available for one or more reactors, since the reactor’s parameter is the reaction set and not the chemical reactions them- selves. In the reaction set configuration window it is also possible to define the reaction ordering. Equal indexes define parallel reactions (Figure 40): 47 2.9 Characterization of Petroleum Fractions 2 SIMULATION Figure 49: Reaction Set editor. When the reactions and their respective reaction sets are correctly defined, the sets will be available for selection in the property window of a reactor in the simulation. When requested for a calculation, the reactor will then look for active reactions inside the selected set. 2.9. Characterization of Petroleum Fractions DWSIM provides three tools for characterization of petroleum fractions. One of them characterizes C7+ fractions from bulk properties (Figure 40). The other characterizes the oil from an ASTM or TBP distillation curve (Figure 40). There is also a tool to create pseudocompounds from tabular data. - Characterization from bulk properties The method itself requires a minimum of information to generate the pseudocomponents, though the more data the user provides, the better will be the results (Figure 40). It is recommended that the user provides the specific gravity of the C7+ fraction at least. Viscosity data is also very important. 48 2.9 Characterization of Petroleum Fractions 2 SIMULATION Figure 50: C7+ petroleum fraction characterization utility. - Characterization from distillation curves This tool gets data from an ASTM or TBP distillation curve to generate pseudocomponents. It is also possible to include viscosity, molecular weight and spe- cific gravity curves to enhance the characterization. The interface has a wizard-like style, with various customization options (Figure 40): 49 2.9 Characterization of Petroleum Fractions 2 SIMULATION Figure 51: Characterizing petroleum from distillation curves. After the pseudocomponents are created, a material stream with a defined composition is also created, which represents the characterized petroleum fraction. The hypo and pseudocomponents are available for use only in the simulation in which they were generated, even if there is more than one opened simulation in DWSIM. Nevertheless, the user can export these components to a file and import them into another simulation. - Bulk/Batch creation of pseudocomponents/pseudocompounds The Bulk Create Pseudocom- pounds tool can be used to create pseudocompounds in a batch when you have the required data in a tabular format, or only part of the data. If some data is missing, DWSIM can estimate it before exporting the compounds to XML, JSON or add them to the Flowsheet (Figure 40). 50 3 COMPOUND CREATOR Figure 52: Bulk creation of pseudocomponents/pseudocompounds. 3. Compound Creator 3.1. Introduction The new Compound Creator Utility is an all-in-one replacement for the User Compound and Hypo- thetical Creator utilities in DWSIM. It enables usage of experimental data as well as UNIFAC structure information to calculate and/or estimate all constant and temperature-dependent properties for a com- pound that isn’t available on any of the default databases (DWSIM and ChemSep). 51 3.2 Data Input Constant Properties 3 COMPOUND CREATOR To open the utility, you can use the corresponding button on the Welcome screen or go to File > New > Compound Creator Study. 3.2. Data Input Constant Properties Enter an unique ID for the compound. It can be any integer number (a random 5-digit integer is ok). Enter a name for the compound. DWSIM makes it easier to calculate most properties if you enter some UNIFAC structure information. With UNIFAC structure info, DWSIM will calculate all properties that have its adjacent checkbox checked. Nothing stops you from entering your own value on these textboxes, but if the checkbox is checked and you change the UNIFAC structure info, DWSIM will update the value with its own calculation. 52 3.2 Data Input Constant Properties 3 COMPOUND CREATOR Property textboxes that have a blue background are not essential, but are required if you’re planning to use your compound in a simulation with PC-SAFT, Chao-Seader and/or Grayson-Streed models, for example. 53 3.3 Temperature-dependent Properties 3 COMPOUND CREATOR 3.3. Temperature-dependent Properties By default, temperature-dependent properties will be calculated by internal DWSIM routines, but if you have some tabulated data available, you can use it to make DWSIM generate coefficients and use them instead. For instance, let’s say that you have some liquid density data available. You can input it on the Liquid Density table (just make sure that the current units are the same as yours) and click on "Regress". DWSIM will let you know if anything went wrong during the regression on the textbox below the buttons. 54 3.4 Importing Data from Online Sources 3 COMPOUND CREATOR To view the regressed data, click on "View Regression". You should see your points and a line repre- senting the fitted equation that will be used by DWSIM on your simulations. 3.4. Importing Data from Online Sources You can import compound data from some online sources like the Korean KDB Thermo Database, the Cheméo Database and UNIFAC/MODFAC Structure Data from the Dortmund Data Bank Online Interface. Go to Compound > Import Data from Online Sources and explore the available options. After you finish importing data from the online sources, any data previously input on the textboxes will be overriden for the properties you’ve selected. 55 3.5 Creating the Compound 3 COMPOUND CREATOR 3.5. Creating the Compound If everything is ok, you can save your compound data to a XML database file. Go to Compound > Export Data to XML Database. The XML database has the advantage of handling multiple compounds in a single file. You can also export your compound to a single JSON file. The JSON file format is very easy to edit if you need to: 56 3.5 Creating the Compound 3 COMPOUND CREATOR You can also save your compound creator data to a file if you think you’ll need to change it later, or use it as a starting point for another compound (File > Save As): 57 3.6 Adding the Compound to a Simulation 3 COMPOUND CREATOR 3.6. Adding the Compound to a Simulation 3.6.1. Loading Compounds from XML Databases To load your compound into a simulation, go to Settings > General Settings > User-Defined Datasets and click on Add User Dataset. Select your XML database file and click Open. Create a new simulation and check if your compound is on the list (it should be the last one): 3.6.2. Loading Compounds from JSON files You can load a compound from a JSON file directly through the Compounds section in the Simulation Configuration Wizard and in the Simulation Settings Panel. 58 3.6 Adding the Compound to a Simulation 3 COMPOUND CREATOR 3.6.3. Remarks When you add your compound to the simulation, you can use the Pure Compound Property Utility to edit the data, but those changes will be made only for the current simulation. If you need to make perpertual changes, you’ll have to use the Compound Creator Utility to save your compound, or edit the XML or the JSON file directly and reload it. If you input tabulated liquid density data to create an experimental curve, remember to activate the "Use Experimental Liquid Density Data" option on the Property Package configuration window, otherwise DWSIM will use the Rackett correlation for liquid density estimations. 59 4 DATA REGRESSION 4. Data Regression The Data Regression Utility supports regression of experimental binary data for determination of inter- action parameters for the following models: ➙ PC-SAFT ➙ Peng-Robinson ➙ Peng-Robinson-Stryjek-Vera 2 ➙ Soave-Redlich-Kwong ➙ UNIQUAC ➙ NRTL ➙ Lee-Kesler-Plöcker The following data sets are supported: ➙ VLE Temperature and mole fractions (Txy) ➙ VLE Pressure and mole fractions (Pxy) 60 4.1 Data Regression - How To 4 DATA REGRESSION ➙ VLE Temperature, Pressure and mole fractions (TPxy) ➙ LLE Temperature and mole fractions (Txx) ➙ LLE Pressure and mole fractions (Pxx) ➙ LLE Temperature, Pressure and mole fractions (TPxx) The Data Regression Utility also has some handy additional features like: ➙ Calculation of initial values for the binaries using UNIFAC/MODFAC structure information ➙ Calculation of missing experimental data using known models/binaries for determination of param- eters for other models ➙ Optimization method selection ➙ Objective Function selection (Least Squares of temperature/pressure plus vapor fractions) The Data Regression Utility also supports loading and saving of a regression study/case for later use. Currently, there is no way to export the generated binaries for a simulation or a database - you’ll have to do this manually. 4.1. Data Regression - How To In this example we will regress Txy experimental data for determination of UNIQUAC interaction param- eters for the 1-Propanol/Water binary. Title and Description Enter a title and a description for you regression case. Compound Selection Select the compounds 1-Propanol and Water on the corresponding combo boxes. Model Selection Select UNIQUAC in the combobox for the Thermo Model. In the table below you can input your own initial estimates for the binaries, in order to help the optimizer on finding the values that minimize the difference between calculated and experimental values. You can also use the UNIFAC structure information to estimate initial values through UNIFAC and/or Modified UNIFAC models. If the Use Ideal Vapor Phase Model is checked, DWSIM will calculate the vapor phase fugacities using the ideal model (ϕ = 1), otherwise it will do it using the Peng-Robinson EOS. 61 4.1 Data Regression - How To 4 DATA REGRESSION Experimental Data Input In the ’Experimental Data’ section, select your data type (Txy), and the units for Temperature and Pressure. x1, x2 and y1 will always be in mole fractions. Input your experimental data in the table below. If you selected the Txy data type, the pressure only needs to be informed on the first cell of the corresponding column. The same applies for Pxy data, you’ll input all pressures and the temperature only has to be informed on the first cell. Clearing cell and rows DWSIM will only accept the last line as a blank one. If you want to remove data from the table, press the "Del" key after selecting the cells that you want to clear. To remove an entire row, select all cells on the row and press "Shift+Del". Calculating missing data DWSIM can "complete" your experimental data set by using models with known interaction parameters. Say, for example, that you want to add a few data pairs but you only have the liquid phase mole fraction and pressure information. In this case you can use DWSIM to estimate the missing vapor phase mole fraction and temperature. 62 4.1 Data Regression - How To 4 DATA REGRESSION To estimate the missing data, just select the corresponding cells and click with the right mouse button, selecting the model that you want to use to calculate the values. DWSIM will then fill the selected cells with the calculated data. Regress data In the "Regression Parameters" section, select the optimization method from the "Method" combobox and the Objective Function from the corresponding combobox. Currently, only the 63 4.1 Data Regression - How To 4 DATA REGRESSION Least Squares obj. function is available. Here, You’ll have the follwing options: ➙ Least Squares (min T/P): minimizes the difference between calculated and experimental pres- sures/temperatures ONLY ➙ Least Squares (min y): minimizes the difference between calculated and experimental vapor phase mole fractions ONLY ➙ Least Squares (min T/P+y): minimizes the difference between calculated and experimental pres- sures/temperatures plus vapor phase mole fractions Now click on "Run Regression". DWSIM will then run the optimizer in order to find the optimum values for the binaries using the data you provided. DWSIM will tell you when it is done, and after that you can save your regression case for later use. IMPORTANT: the calculated interaction parameters are not copied to the BIP databases - their values are only "shown" in the results textbox. You’ll have to input them manually on your simulation. 64 4.1 Data Regression - How To 4 DATA REGRESSION DWSIM Data Regression files have the ".dwrsd" file extension. 65 5 GENERAL SETTINGS 5. General Settings The application settings can be accessed through the Edit > General Settings menu item (Figure 40): 66 5.1 Solver 5 GENERAL SETTINGS Figure 53: General Settings section. 5.1. Solver The Solver configuration tab display a group of settings to control the behavior of DWSIM’s solver. Check the Wiki articleSolver Configurationfor more details. 5.2. Flowsheet 5.2.1. Cut/Copy/Paste Flowsheet Objects ➙ Compounds: controls how compounds are handled during cut/copy/paste operations. ➙ Property Packages: controls how Property Packages are handled during cut/copy/paste opera- tions. 5.2.2. Undo/Redo ➙ Recalculate flowsheet: defines if the flowsheet is to be recalculated after undo/redo operations. 5.2.3. Object Editors ➙ Enable multiple editors: allows displaying of multiple object editors at once. ➙ Close editors on deselecting: closes the editors once the object being edited is deselected. ➙ Default initial placement: default location for displaying the object editors. 67 5.3 User Datasets 5 GENERAL SETTINGS 5.3. User Datasets In the database tab, you have options to remove, add and edit user-defined compound and interaction parameter datasets. 5.4. User Compounds Add references to JSON files containing pure compound data, so they are available on startup for all existing and new flowsheets: 5.5. Backup The Backup tab has options to control the frequency of the backup file saving. You can also configure the option to save an existing file with another name instead of overwriting it. 5.6. Other 5.6.1. Messages ➙ Show tips: displays context-sensitive tips on the flowsheet information (log) window. ➙ Show ”What’s New”: displays a window with information about what’s new on the running version. 68 5.6 Other 5 GENERAL SETTINGS 5.6.2. Debug mode ➙ Debug level: controls the amount of information written to the flowsheet information (log) window when solving the simulation. ➙ Redirect console output: redirects the output of the console to the console window inside DWSIM. 5.6.3. UI Language ➙ Language: sets the UI language. Requires a restart. 5.6.4. CAPE-OPEN ➙ Remove solid phases...: This is for ChemSep compatibility. If enabled, DWSIM will hide the solid phase in Material Streams from CAPE-OPEN Unit Operations. 5.6.5. Compound Constant Properties ➙ Ignore compound constant properties...: If enabled, this will prevent DWSIM from using com- pound constant data from the loaded simulation files and use the data from the compound databases themselves. 5.6.6. DWSIM/Python Bridge Settings ➙ Python Binaries Path: Set the path where the GNU Octave binaries are located. This is only required if you’re running DWSIM on Windows. ➙ Python Process Timeout: Set the timeout for the Octave processes, in minutes. 69 6 MAIN INTERFACE Part III. Cross-Platform User Interface (CPUI) 6. Main Interface When DWSIM is opened, you’ll see a launcher menu, where you can create a new simulation or open a saved one, among other functions. Figure 54: DWSIM Launcher. If you create a new simulation, you’ll get a mostly blank screen with a menu bar at the top and a Log Panel on the bottom part. The Simulation Setup Wizard will then appear. 70 7 CONFIGURING A SIMULATION Figure 55: DWSIM Main Flowsheet Window with Simulation Setup Wizard. 7. Configuring a Simulation In order to run a simulation/flowsheet, you need to add some Compounds, setup a Property Package, add Objects to the Flowsheet and connect them to each other following the process flow. 7.1. Components/Compounds There are two essential information required by DWSIM in order to correctly start a simulation. The first refers to the available components (or compounds). To add a compound to the simulation, select it on the list. To remove an added compound, just deselect it. 71 7.2 Property Packages 7 CONFIGURING A SIMULATION Figure 56: Selecting a Compound with the Simulation Setup Wizard. 7.2. Property Packages The Property Package consists in a set of methods and models for the calculation of physical and chemical properties of material streams in the simulation. It is composed of a thermodynamic model - an equation of state or a hybrid model - and methods for property calculation, like the surface tension of the liquid phase. 72 7.2 Property Packages 7 CONFIGURING A SIMULATION Figure 57: Selecting a Property Package with the Simulation Setup Wizard. If the selected property package has any editable property, the "Configure" button becomes clickable and the user can click on it to show the property package configuration window. 73 7.2 Property Packages 7 CONFIGURING A SIMULATION Figure 58: Viewing Property Packages on the Simulation Basis panel. Figure 59: Editing Property Package Settings. 74 7.3 Systems of Units 7 CONFIGURING A SIMULATION Multiple Property Packages DWSIM allows multiple Property Packages to be added to a single simulation (Figure 40), which can be associated with each unit operation and material stream on an individual basis. Skip Equilibrium Calculation in Well-Defined Streams Tells the Flowsheet Solver to avoid rework and skip equilibrium calculations in Material Streams connected to specific ports like Separator Vessel and Distillation Column outlets. Force Material Stream Phase You can override the equilibrium phase for all Material Streams in the flowsheet by setting this property property to the desired value (Vapor, Liquid or Solid. The default value is Do Not Force. When this property is set to one of the phase names (Vapor, Liquid or Solid), the equilibrium calculation for all Material Streams is bypassed and all compounds are put into the selected phase with the same composition as the mixture. 7.3. Systems of Units Three basic units systems are present in DWSIM: SI System (selected by default), CGS System and English (Imperial) System. The simulation’s units system can be viewed/modified in the "Units System" section of the "Simulation Settings" panel. 75 7.3 Systems of Units 7 CONFIGURING A SIMULATION Figure 60: Viewing the Systems of Units on the Flowsheet Settings Panel. You can also create a custom system of units. It is worth remembering that the units systems can also be modified at any time during the simulation - the changes are applied immediately. 76 8 PROCESS MODELING (FLOWSHEETING) Figure 61: Creating a new System of Units. 8. Process Modeling (Flowsheeting) 8.1. Inserting Flowsheet Objects To add an object to the flowsheet, go to ’Object’ > ’Add New Simulation Object’, or drag the icons from the Object Palette to the PFD. 77 8.1 Inserting Flowsheet Objects 8 PROCESS MODELING (FLOWSHEETING) Figure 62: Add New Simulation Object. Figure 63: Dragging Objects from the Object Palette to the Flowsheet PFD. The elements of a simulation (objects) which can be added to the flowsheet are: ➙ Material Stream: used to represent matter which enters and leaves the limits of the simulation and passes through the unit operations. The user should define their conditions and composition in order for DWSIM to calculate their properties accordingly; ➙ Energy Stream: used to represent energy which enters and leaves the limits of the simulation and passes through the unit operations; ➙ Mixer: used to mix up to three material streams into one, while executing all the mass and energy balances; ➙ Splitter: mass balance unit operation - divides a material stream into two or three other streams; ➙ Valve: works like a fixed pressure drop for the process, where the outlet material stream properties are calculated beginning from the principle that the expansion is an isenthalpic process; 78 8.1 Inserting Flowsheet Objects 8 PROCESS MODELING (FLOWSHEETING) ➙ Pipe: simulates a fluid flow process (mono or two-phase). The pipe implementation in DWSIM provides the user with various configuration options, including heat transfer to environment or even to the soil in buried pipes. Two correlations for pressure drop calculations are available: Beggs and Brill and Lockhart and martinelli. Both reduces to Darcy equation in the case of single-phase flow; ➙ Pump: used to provide energy to a liquid stream in the form of pressure. The process is isenthalpic, and the non-idealities are considered according to the pump efficiency, which is defined by the user; ➙ Separator Vessel: used to separate the vapor and liquid phases of a stream into two other distinct streams; ➙ Compressor: used to provide energy to a vapor stream in the form of pressure. The ideal process is isentropic (constant entropy) and the non-idealities are considered according to the compressor efficiency, which is defined by the user; ➙ Expander: the expander is used to extract energy from a high-pressure vapor stream. The ideal process is isentropic (constant entropy) and the non-idealities are considered according to the expander efficiency, which is defined by the user; ➙ Heater: simulates a stream heating process; ➙ Cooler: simulates a stream cooling process; ➙ Conversion Reactor: simulates a reactor where conversion reactions occur; ➙ Equilibrium Reactor: simulates a reactor where equilibrium reactions occur; ➙ PFR: simulates a Plug Flow Reactor (PFR); ➙ CSTR: simulates a Continuous-Stirred Tank Reactor (CSTR); ➙ Shortcut Column: simulates a simple distillation column with approximate results using shorcut calculations; ➙ Distillation Column: simulates a distillation column using rigorous thermodynamic models; ➙ Absorption Column: simulates an absorption column using rigorous thermodynamic models; ➙ Heat Exchanger: simulates a countercurrent heat exchanger using rigorous thermodynamic mod- els. ➙ Component Separator: model to simulate a generic process for component separation. ➙ Solids Separator: model to simulate a generic process for solid compound separation. Additionally, the following logical operations are available in DWSIM: ➙ Adjust: used to make a variable to be equal to a user-defined value by changing the value of other (independent) variable; ➙ Recycle: used to mix downstream material with upstream material in a flowsheet. 79 8.2 Connecting/Disconnecting objects 8 PROCESS MODELING (FLOWSHEETING) 8.2. Connecting/Disconnecting objects The material and energy streams represent mass and energy flowing between unit operations. You can connect/disconnect streams to/from Unit Operations or Logical Blocks by selecting the object and working with the Combo Boxes on the ”Connections” panel within the Object Editor. 8.2.1. Auto-Connect Added Objects This is a new feature in DWSIM v7.4.0. It enables automatic connections between added objects and nearby ones. There are three different options for this setting: ➙ No: No automatic connections are made when you add an object to the flowsheet. ➙ Yes: When you add a new unit operation, streams are automatically added to the flowsheet and connected to its ports. ➙ Smart: When you add a new unit operation, nearby streams are connected to it, and new streams are created to connect to the remaining ports. Figure 64: Editing the Connections of an Object. 8.3. Process data management 8.3.1. Entering process data The objects’ process data (temperature, pressure, flow, composition and/or other parameters) can be entered in the property editor window, accessible through the ’Edit Properties’ context menu item. 80 8.4 Running a Simulation 8 PROCESS MODELING (FLOWSHEETING) Figure 65: Entering process data. 8.4. Running a Simulation DWSIM is a sequential modular process simulator, that is, all calculations are made in a per-module basis, according to the connections between the objects. The calculator checks if an object has all of its properties defined and, if yes, passes the data for the downstream object and calculates it, repeating the process in a loop until it reaches an object that doesn’t have any of its dowstream connections attached to any object. This way, the entire flowsheet can be calculated as many times as nece