An Introduction to HYSYS (Univ. de Rice)

download An Introduction to HYSYS (Univ. de Rice)

of 97

Transcript of An Introduction to HYSYS (Univ. de Rice)

  • An Introduction to HYSYS

    The purpose of this and the following pages is to introduce you to the primary tool that you will be using in the design classes, HYSYS. Now HYSYS comes with a number of excellent reference and tutorial manuals. The Design Lab should be equipped with two complete sets of the manuals. Each set contains the following books: Getting Started, Quick Reference, Tutorials, Applications, Reference Volume 1, and Reference Volume 2. PLEASE do not remove these from the room. The same six volumes may be accessed electronically in Adobe Acrobat format either from the start menu as shown below or via the World Wide Web.

    Getting Started and Tutorials are available at http://www.hyprotech.ab.ca/support/dox.htm. The Applications book is available at http://www.hyprotech.ab.ca/support/examples/hysysappexamp.htm. It is far easier to look at the actual books than to worry through the Acrobat Reader, so, again, please don't take them from the room. Note that all referals to manuals are in yellow and if the manual in question is on the HYSYS web page, like the Tutorials Book, then the reference will also be a link.

    Because I don't believe in duplication of effort (especially my own), this web page is intended to be complimentary to those manuals. Here on the web page, I hope to fill in the blanks left by the books, serve as a quick reference for some items, and give pointers and links as to the places in the manuals to look immediately for the answers to your questions. Most importantly, however, these pages will provide you with the tips you will need to get your specific tasks done on the specific computer system you will be working with and with this specific version of HYSYS. These tips will include information for both CENG403, where you learn to design individual units, and CENG404, where you will design an entire plant (in fact, this is the only place that you will find many tips for 404, so don't forget to come back and read them again when you start needing them). HYSYS is not the best program for group work (Aspen isn't any better believe me), therefore an entire section has been devoted towards teaching you the best way to work in groups. By the way, NT will allow two different users to edit the same file at the same time. This is bad. If you do this, only one person's work will get saved.

    A Little About HYSYS

    The goal of programs like HYSYS and Aspen is, of course, to provide you with the capability to design an entire process as completely and accurately as possible. Most (though not all) of the differences between the two lie in their user interfaces. Having gone through the design class with Aspen, I am of the personal opinion that HYSYS has a much better and intuitive interface than Aspen. You have the option of using either simulation package, but I recommend using HYSYS unless you run against something that only Aspen will do. I will try to warn you of all the limitations of HYSYS that you might encounter in advance. Unlike Aspen, HYSYS does not wait until you've entered everything before beginning calculations. It always calculates as much as it can at all times and results are always available, even during calculations. Any changes that you make to the data are automatically propagated throughout the program to anywhere that entry appears and all necessary recalculations are instantly carried out. It tends to be a lot easier to catch errors this way as you build your simulation. However, there are times when you will not want HYSYS

  • calculating the entire flowsheet over again every time you make a small change. Hence, the existence of the environments. While you are in one environment, calculations in the other environments are placed on hold. Every case (as HYSYS calls each individual simulation file) has two or more environments. The one that contains all the items you expect to see, the streams, unit operations such as reactors, separators, columns, mixers, etc., and various utilities, is the simulation environment. At the top of that environmental hierarchy (and the only one required) is the Case environment and the Main flowsheet. (Aside: both the name "Case" and the tag "Main" are defaults and can be changed in the "Main Properties" view under the Simulation menu). Though the entire simulation may be placed in the Main flowsheet, columns and templates are automatically brought in as Sub-flowsheets. Sub-flowsheets can be thought of as modular programs. You can have as many as you like, nested as deep as you like (though you tend to not need to put additional sub-flowsheets under a column flowsheet). The other environment, and the one you actually have to deal with first when you start a case, is the basis environment. The basis environment is the place that you define the thermodynamic package you wish to use (Peng-Robinson, Margules, etc.), the components that will be used in your simulation and any reactions that may occur. If dealing with a Petrochemical application, there is also an oil environment that may be reached only from the basis environment. There are two files that HYSYS reads whenever you start HYSYS. One of these is the Preferences File, the other is the workbook format file. The preferences file tells HYSYS many important things like which units you want to use, where to look first for your stored files etc. You can have multiple preference files saved (or you can just build up various unit sets, etc., in one file you alter upon need), but the one that is loaded upon startup is the file named hysys.prf in the directory from which HYSYS is started. If you launch HYSYS from your start menu, your user's profile has been configured with Y:\Hysys as the start directory (note that if you are not in a design class group, you won't have a Y drive, because the purpose of theY drive is to save group work). If you look at the contents of that directory you will see, in addition to some other stuff, that I have placed a hysys.prf file in there for you. That is the file that must be overwritten if you want to make changes to your default preferences (though changes are automatically saved to the preference file when you save your simulation, so overwriting should not often be necessary). You may have noticed the other file I put there, hysys.wrk. That file is responsible for the appearance of your workbook. The workbook shows you the contents of every stream in your process and the connections of every unit (if you really wanted to you could make your entire simulation using the Workbook and never even look at the PFD). Without the hysys.wrk file, unless the file has undergone changes to its workbook which got saved with that particular case, the default is for the workbook to only show two pages: Streams and Unit Ops. Now, if you've done any reading of the manuals or working of the tutorials you were propably expecting four pages: Material Sreams, Compositions, Energy Streams, and Unit Ops. The Workbook is much harder to work with without the extra info these pages provide. The file I provided restores these other pages, but again it is only automatically loaded if the Start Menu was used to launch HYSYS. Why am I telling you all this? Because there are a number of cases where you will not be able to use the start menu to do what you want. If you start a file by double clicking it (your simulations should all be stored under Y:\Hysys\Cases), without a hysys.prf file present, HYSYS will use the default file located on the NTserver called Hartsook. It is not configured for you and you cannot save changes to it. HYSYS will also fall back on that file if you do not have a Y drive. Moreover, any time you want to run one of HYSYS' or my example files, because of a failure of HYSYS to handle links or networks well, the only way you'll be able to see Hartsook (where all the sample files are located), is to double-click on one of your own files (causing HYSYS to "start in" a directory on Hartsook), then turn right around and close that file. Then, you may Open the example file. Note that HYSYS' examples are located in \\Hartsook\Hysys\SAMPLES, not in CASES as the manuals say, and that my examples are located in \\Hartsook\Hysys\SAMP403. What ever you are trying to do, if you used one of the above methods, HYSYS will not open with the correct Preference File. The first thing you should do once HYSYS opens is open Preferences under the Tools Menu. Then press Load Preference Set... . Load Y:\Hysys\Hysys.prf. At that point you may or may

    not need to import your workbook format. Push the Workbook button , on the toolbar to find out. If you do need to, then choose Import under the Workbook Menu and import the file hysys.wrk under

  • Y:\Hysys.

    Note: Should you somehow create a Hysys.prf file under your cases directory, DELETE or move it, as you will not be able to get to the example files on Hartsook with it there. An automatic way of telling if your preference file is based on the one I started you with or if it is HYSYS' default is the color of the background. HYSYS' preference file makes the background the same brown color as your desktop. My preference file uses a deep purple as the background color.

  • Reactions in HYSYS

    There are currently five different types of reaction that may be simulated in HYSYS and a number of reactor types that they may be used with (and one special reactor that does not require any equations). Reactions may also be used in Columns and Separators (though there are some limitations on the phases that may be used by the reactions in those cases). The five reaction types are as follows:

    Conversion

    This reaction type does not require any thermodynamic knowledge. You must input the stoichiometry and the conversion of the basis reactant. The specified conversion cannot exceed 100%. The reaction will proceed until either the specified conversion has been reached or a limiting reagent has been exhausted. Conversion reactions may not be grouped with any other form of reaction in a reaction set. However, they may be grouped with other conversion reactions and ranked to operate either sequentially or simultaneously. Lowest ranking occurs first (may start with either 0 or 1). Just as with single reactions, simultaneous reactions cannot total over 100% conversion of the same basis. Conversion reactions cannot be used with Plug Flow Reactors or CSTRs. In general, they should only be used in Conversion Reactors.

    Equilibrium

    Equilibrium reactions require that you know some sort of relation between the reaction's equilibrium constant, Keq, and temperature. You may specify Keq in a number of ways:

    As a constant. Enter either Keq or Ln(Keq) As a function of Temperature. You specify A-D in the equation below

    Ln(Keq) = A + B/T + C*Ln(T) + D*T

    o IMPORTANT: No matter what the units in your preferences, the T's used for this equation are in Kelvin and thus your coefficients A-D must be adjusted accordingly if the T's for the information you have are not also in Kelvin. If it becomes complicated to do so, you might choose to generate a table of K vs. T and enter that as tabular data.

    As tabular data of Keq vs. T (as suggested in the note above and from which HYSYS fits the above equation)

    Have HYSYS determine Keq from the Ideal Gas Gibbs Free Energy Coefficients. This is similar to, but not exactly like what you get by attaching any equilibrium reaction to a Gibbs Reactor (which just takes the stoichiometry). The difference depends on the property package because the Gibbs reactor will take into account any non-ideal behavior predicted by a thermo package such as Peng-Robinson. An essentially ideal thermo package like Antoine would give almost exactly the same results for the two different methods.

    You may also search for the reaction among the pre-defined reactions in the HYSYS library (reached from the Library Page of the Equilibrium Reaction window)

    Supposedly, like Conversion reactions, equilibrium reactions may be calculated either sequentially or simultaneously. I actually did not see any means by which reactions might be designated sequential and suspect an error in the reference manuals in stating that it could be so. Equilibrium reactions also cannot be used with Plug Flow Reactors or CSTRs. In general, they should only be used in Equilibrium Reactors or General Reactors. They can, however, also be used in the special Gibbs Reactor. When a reaction set is attached to a Gibbs reactor, the stoichiometry involved in the reactions is used in its calculations.

    Kinetic

  • All three of the remaining reaction types can be considered kinetic, in that they deal with an expression for the rate of the reaction. Differentiating between the three becomes simply a matter of

    formulation. In this first and simplest form, the rate equation is the one to the left (this picture is taken from the Parameters Page of the Kinetics Reaction window). The first term on the right hand side refers to the forward reaction, the second term to the optional backward reaction. The k's are the reaction constants for which you must enter on the Parameters Page the activation energies, E and E', and the pre-exponential factors, A and A' (which are basically all of the constants lumped out front). The basis functions are not just functions of the Base Component (which you set on the Basis Page -- see Chapter 11 of RV1 for an explanation of the Base Component or anything else having to do with reactions), but are the products of the concentrations (or partial pressures, etc.) of any of the reactants or products to whatever power (negative numbers and decimals are fine). For example, it just so happens that for the reaction

    CO + Cl2 --> COCl2 the rate law might be rCO = k[CO][Cl2]3/2

    You actually enter the form of the basis functions on the first page, Stoichiometry, of the reaction window. In the columns to the right of the one in which you enter the stoichiometric coefficients, you must enter the forward and reverse order. The HYSYS default is to assume an elementary reaction the stoichiometry parallels the order. Therefore for this reaction you would leave the forward order of CO at 1 and enter 1.5 for the forward order of Cl2. Though it is assumed there is no reverse reaction, you might, if you chose, leave a 1 for the reverse order of the COCl2. As long as you did not enter a value for the reverse E and A, no reverse reaction would take place. The Chemicals Tutorial in the Tutorials Book will take you through an example of the use of a Kinetics reaction in a CSTR.

    Kinetic (Rev Eqm)

    This form of the rate equation is fairly similar to the standard kinetic form. The difference is that instead of getting information about the reverse rate constant, we use the relation:

    Keq = kforward/kreverse

    or, as is actually substituted into the standard form,

    kreverse = kforward/Keq

    Of course, in doing so we have implicitly assumed an elementary reaction as that is inherent in the definition of Keq. Therefore there is no place to enter reaction orders. Keq is determined by HYSYS in the same it was done for the equilibrium reaction above, except that this time you are forced to enter the data in the Ln(K') format (again, if that's not what you have, don't despair. Try creating an equilibrium reaction, defining it how you are able and then copy over the constants that HYSYS generates). For an example of the use of this type of reaction, see my Plug Flow Example.

    Langmuir-Hinshelwood

    This is the most complicated of all the reaction forms and is therefore the one that is not even mentioned in any of the manuals (either on-line or off). Therefore it falls to me to explain it. I go through all of this in detail in the Plug Flow Example, so if you decide you do need to use this form, I recommend you work through that. Langmuir-Hinshelwood is mainly used to model heterogeneous catalysis. The rate of reaction is slowed when you have a finite number of active sites on the catalyst, some of which may become blocked to

  • reaction by the products being formed. Hence, to the standard rate equation is added a denominator (this is almost exactly like the form for enzyme catalysis for those of you who have had Biochemistry).

    General Information on Reactions

    If you are looking for a step by step instruction on every stage of the creation of a reaction and the use of reaction sets, you won't find it here. You will find explanations of that stuff in any of my reactor examples (Plug Flow Example, Gibbs and Equilibrium Reactors, Conversion Reactor), or you may look in Chapter 11 of Reference Volume 1 (does an excellent job with this kind of stuff), or work through the Chemicals Tutorial in the Tutorials Book. What I am going to list here are the little pearls of wisdom I picked up while working through the reactions myself and that may or may not be mentioned in the manuals.

    1. You do not need to go back to the basis environment every time you want to edit reactions. You can create or change reactions in the simulation environment using the Reactions Package under the Flowsheet menu. You cannot, however, import or export reactions except from the basis environment.

    2. Modifications can be made to reactions on a specific reactor's property view pages that are local only and do not apply globally. Local changes always take precedence over the global settings. (Not an option in PFR). See Section 13.13 of RV2.

    3. The components you have in a reaction need not have been previously included in the fluid packages' component list. When you finally associate a reaction set with the fluid package, whichever of its reaction's components are not already there will be added then to the fluid package.

    4. There are places (such as when entering the kinetics parameters) where you shall find that no matter how many significant digits you enter in, only 2 sig. figs will be displayed. This is a short coming of HYSYS and will be fixed in future versions. The extra unseen digits are used in the calculations, but the only way to see them is to export them to a Spreadsheet (using the secondary mouse button, simply drag the number from the reaction window to a cell of the Spreadsheet Page of the Spreadsheet).

    5. Under the Stoichiometric Page of a reaction window, the item called "Reaction Heat" is not the Heat of Reaction as we know it. In fact, they have opposite signs (an exothermic reaction has a positive Reaction Heat).

    6. Remember whenever defining an Equilibrium constant using Ln(Keq) = A + B/T + C*Ln(T) + D*T, that T is in Kelvin.

    7. HYSYS does not show you the units of the Activation Energy it displays. If you would like to display it in the same units you entered, you must go into your preferences set and set the units of Molar Enthalpy to the units you would like Activation Energy displayed in, as Activation Energy does not have its own category. Reaction rate does have its own category. The Pre-exponential factor has the same units as Reaction rate (the units set on the basis page, NOT necessarily the units set in the preferences which seem to only be for reporting purposes) divided by the Basis Units.

  • Reactors

    Though I plan to tell you about all of the reactors, pay special attention to the info on the Plug Flow and Gibbs Reactors, as they are the ones you will likely use the most. With the exception of the Plug Flow Reactor, the property views of the various reactors are essentially the same. You must specify a liquid and/or vapour product stream for all reactors (again, except for plug flow which has one and only one product stream). All reactors are assumed adiabatic until an energy stream is attached (at which point some further specification such as outlet temp or energy input is required).With the exception of the Plug Flow Reactor and the Gibbs Reactor, all of the reactors also have a number of pages in their property views related to the reactions in them. There you may make changes to the reactions that only take effect in that particular reactor. Local changes always take priority over global changes (so make sure you are aware of whether the change you are making is local or global).

    Appearance in PFD / Object Palette Button

    Description

    The Plug Flow Reactor can be used with Kinetics, Kinetics (Rev. Eqm.), or Langmuir-Hinshelwood reactions (any number and combination of the three types can be used in the reaction set). An excellent description of each of the PFR's inputs can be found in Section 13.10 of RV 2. You can also get a good idea of the way to go about setting up a PFR in your simulation by working through my Plug Flow Example.

    Quirks of the PFR: HYSYS "integrates" over the length of the reactor by dividing it into a number of sub-volumes (like a series of CSTRS). The default is 20 sub-volumes. The most noticeble effect of this to the user is in the reactor profiles. The various characteristics are given as values vs reactor length. The lengths listed are the midpoimts of the subvolumes. For example, a 10 m length reactor with 20 subdivisions would give profiles starting at .25 m and incrementing by .5 m (the size of a subdivision), finishing with 9.75 m. Not realizing this at first I was irritated that the profiles were not showing me the entering and exiting values (0 and 10 m). Not to worry, the .25 and 9.75 m values are, in fact, the same as 0 and 10 m. Everything within a subvolume is the same (like a CSTR). Another quirk of PFR is that on very rare occasions (see the note in the gibbs reactor example). The integration mechanism gets confused. To fix the problem, try looking at the Reactions page of the reactor property view. Under "Initialize segment reactions from:" make sure the re-init radio button is chosen. Normally, you would not pick this option as it takes the longest time to run. For details on how HYSYS handles the three options see Section 13.10 of RV2 (p. 464).

  • The CSTR can be used with Kinetics, Kinetics (Rev. Eqm.), or Langmuir-Hinshelwood reactions (any number and combination of the three types can be used in the reaction set). An excellent description of each of the CSTR's inputs can be found in Section 13.13.3 of RV 2. You can also get a good idea of the way to go about setting up a CSTR in your simulation by working through the Chemicals Tutorial in the Tutorials Book. In addition you might want to take a look at my Case Studies Example, where I build on the tutorial by adding a case study. I use the Spreadsheet feature to access the actual conversion % of the CSTR in the tutorial.

    Quirks of the CSTR: CSTR is primarily for liquid reactions, of course, but HYSYS will conduct the gaseous reactions as well. The less the "liquid" volume, the more of the total volume available for the vapour phase reactions (i.e. HYSYS uses the total volume minus the volume you set for the liquid to calculate the volume of the gas, whether or not any liquid is actually present in the stream).

    opens

    then,

    The Gibbs Reactor (like the one in Aspen) is unique among the reactors in that you are not required to enter a reaction set for it to work. The Gibbs reactor works by finding the equilibrium state with the lowest Gibbs Free Energy. It appears to be akin to finding all the possible equilibrium reactions and allowing them all to equilibrate. It's nice because you do not need to know anything about the individual equilibrium constants. On the Composition page you can set the production of components or set any of them to be inert. You may also set, on the Reactions page, the Gibbs reactor to behave like an equilibrium reactor (you must then attach an equilibrium reaction set, also see quirks below), or like a separator (no reaction). See the example which will teach you about the Gibbs reactor, the Equilibrium Reactor, and my "switch" technique. The "switch" is also mentioned on my tools and tricks page.

    Quirks of the Gibbs Reactor: There is something very important to note when attaching equilibrium reactions to the Gibbs reactor. The Gibbs reactor takes only the stoichiometry of the attached reactions and applies its own free energy minimization technique to it. Only components listed as reacting in the reaction set undergo any reaction. Note that HYSYS will not allow you to attach a reaction set which would include all of the possible independent reactions as that would simply duplicate the effect of setting the reactor to full Gibbs reactions. The part of this that is important to you in the design classes is that the results of the Gibbs calculations come extremely close to the values obtained in the equilibrium reactor using correct data, while not making use of any data on Keq. Thus if you need to simulate a reactor in which you want certain reactions equilibrated, but not others (for instance, because a certain catalyst is employed allowing

  • those particular reactions to equilibrate quickly, but not aiding any other reaction) and yet have no or untrustworthy data on the equilibrium constants, you are better off using the Gibbs reactor set on "Specify Equilibrium Reaction" than using the Equilibrium Reactor. Two postscripts on this: 1) If you use the above technique, it doesn't matter what you set the equilibrium constant, a fixed constant of 1 is fine, because you only need the stoichiometry. 2) Before using the above technique, check the equilibrium reaction library. The one you need may already be there, in the temperature range you desire (even then, however, the Gibbs way may still be better).

    One last note, there appears to be a minor bug in HYSYS, in that, when operating the Gibbs Reactor in Equilibrium Reactor mode, a button appears that would show you the % conversion, reaction extent, etc. Unfortunately, even when the Gibbs Reactor had completed its calculations, the matrix remained blank.

    If you would like to experiment with the similarities and differences between the Gibbs reactor and the Equilibrium Reactor yourself, see the example for a good way to go about it.

    opens

    then,

    The Equilibrium Reactor uses reaction sets with only, surprise, equilibrium reactions in it. You can read more about it in Section 13.13.4 of RV 2. You can also see the example in which I compare it to a Gibbs Reactor. In general, I recommend making use of the Gibbs Reactor over the Equilibrium Reactor.

    The Conversion Reactor deals with, yep, you guessed it, conversion reactions. You use it when you know how much of the reactants will be converted into products. As mentioned in the section on conversion reactions, it can handle multiple reactions which may be ranked to occur simultaneously or sequentially. Reactions with the same ranking are simultaneous and the total conversion of the same reactant can not exceed 100% (all subject to limiting reagents, of course). The product of one reaction can be the reactant of

  • opens

    then,

    another reaction.

    Quirks of the Conversion Reactor: Though the specified conversion cannot exceed 100%, the actual conversion can. This is because the actual conversion is the percentage conversion over the original amount of base component present. However, if that base component is the product of a lower ranked (meaning reacts first) reaction, there may be more available than was originally there. This allows the actual conversion to exceed the specified conversion (it's still behaving correctly, so don't panic). The conversion could thus be much greater than 100%. You can see this in my conversion example. If none of the base component was initially present, the actual conversion field will remain blank. Conversely, if the base component of a reaction is a reactant in an earlier occuring reaction, or if there are limiting reagents, the actual conversion will be less than the specified conversion. If the reaction producing the base component of another reaction is ranked equally with it, the second reaction would not convert any of the component produced by the first reaction, but would only convert the specified percentage of the original amount present. Ranking cannot be changed locally in the reactor. It may only be altered in the reaction set on the global level.

    Not Accessible from the Object Palette. Can only be reached via the Unit Ops View (obtainable by pressing , "Add an Operation" under the Flowsheet Menu, or from the Unit Ops Page of the Workbook.

    The General Reactor is like a combination of the CSTR and the Equilibrium Reactor. If you put in all kinetic style reactions, it acts like a CSTR. If you put in all equilibrium reactions, it acts like an Equilibrium Reactor. The General Reactor, unlike any other type of reactor available to you, will also allow you to mix equation types. You can combine kinetic and equilibrium reactions into one reaction set (you still cannot combine conversion reactions with any other type, though you can attach a conversion reaction set to the general reactor as well). That set will then be a mixed type and can be attached to the general reactor. Unfortunately, verifying the accuracy and method is somewhat involved (though not necessarily difficult). I leave it to you to investigate this. Rather than create an example for you. This time I simply added the General Reactor to my file comparing all the other reactors. That way, you may use all the reactions and reaction sets that were created for the other examples as a way of exploring the results that the General Reactor gives you. The name of the file is AllReactors.hsc and it is located under \\Hartsook\Hysys\SAMP403.

    Quirks of the General Reactor: A strange problem, somehow tied into the number of product streams attached, results if you try to attach an equilibrium set immediately after a conversion set. It fails to find a solution even if it had done so before. If something like this happens to you click off then back on again the Act as a Separator when cannot solve button and it should solve.

  • The same quirks of the CSTR apply when using any kinetic reactions in your reaction set.

  • Plug Flow Reactor Example

    This example will take you through the entire process of setting up multiple reactions and creating a plug flow reactor in HYSYS (as shown in the picture above). The same example problem has been worked in Aspen and Matlab. A completed case has been pre-built and is located in the file PlugFlowEx.hsc in the \\Hartsook\Hysys\SAMP403 directory, though I recommend you work through the example yourself so that you do not miss anything.

    The reactions that we are going to model are those encountered in the early stages of the production of such chemicals as ammonia and methanol, both of which may start with a Natural Gas feed. Here are the two reactions that we shall consider:

    CH4 + H2O --> 3H2 + CO CO + H2O H2 + CO2

    The first reaction is the reforming reaction in which the natural gas (here modeled entirely as methane) is reacted with steam to form hydrogen and carbon monoxide. The second reaction is the Water Gas Shift Reaction in which yet more hydrogen is produced and the CO changed to CO2 (this is especially important in ammonia sysnthesis as both CO and CO2 will poison the catalyst used to make ammonia from hydrogen and nitrogen, and the CO is harder to remove than CO2). Note that the Water Gas Shift is an equilibrium reaction and is modeled as a reversible reaction. The reactor that we will model is like one of the Water Gas Shift Reactors in the ammonia process (occurs after the reforming reactors), and at the considerably lower temperature at which we shall be operating, we should expect to see mostly the second reaction and little of the first. In fact, we won't see any, but if we were modeling this whole process, we would need to account for the possible effects of both reactions in the shift reactors as well as the reforming reactors. Here, the purpose is to demonstrate another kinetic form in HYSYS.

    To start, open a new case in HYSYS and add a new fluid package. Choose Antoine for the Property Package.

    The example calls for an ideal system (we'd like to be able to compare to Matlab and Aspen which we cannot do if differing thermodynamics are used). Unfortunately, HYSYS does not have a package labeled ideal. However, according to Chapter 8 of RV1 (link only good from AL-C126), the vapour pressure models (such as Antoine) are for essentially ideal systems. Alternatively, you might try comparing those results to the results of an activity coefficient model like Margules with its vapour model set to ideal and all of its binary coefficients (both Aij's and Bij's) set to zero.

    Switch to the Components Page and install the following components into the fliud package:

  • Return to the Simulation Basis Manager window and switch to the Reactions page. The first thing that must be done is tell HYSYS which components are to be available for reaction, so push the button marked Add Comps... . A window should open that looks like this.

    Press Add This Group of Components and then close the window. Note that if you had not already created the fluid package, you could simply have switched to the Library radio button in the add components group and added the components as you had added them to the fluid package. In fact, when the reaction is later associated with a specific fluid package, if the reaction components were not already listed among the package's components, they would be added then.

    Now on the Reactions page of the Simulation Basis Manager, press the Add Rxn... button.

    This is the window that comes up. There are five forms of reaction that you can enter in HYSYS. To know which ones to use you must know the form of the kinetic data you have. In this example we will be looking at the last two forms of reaction. For a description of all of the different reaction types, see Chapter 11 of RV1 (link only good from AL-C126). Reaction 1 is the reforming reaction and is in the form that may be modeled easily by Langmuir-Hinshelwood. The Langmuir-Hinshelwood equation you may (or may not) remember from CENG 390 is the form used for heterogeneous catalysis when you must worry about products or inerts using up active sites on the solid catalyst. Reaction 2, the Water Gas Shift reaction, uses the standard Kinetic (Rev Eqm) form, in which you know the forward reaction constant and use the equilibrium constant to get the reverse

  • nature of the reactions.

    r1 = DBED*km*e(-Ea1/(R*T))*P*ym/(1+Kh*P*yh) r2 = DBED*A*e(-Ea2/(R*T))*(yc*yw - yd*yh/Keq2)

    Variable Abbreviation Value Units Bed Density DBED 1200 kg/m3

    Pre-exponential Rate Constant km 5.517e6 mol/kg/s/atm Activation Energy of Reaction 1 Ea1 1.849e8 J/mol Gas Constant R 8.314 J/mol/K Pressure P 30.0 atm Absorption Parameter Kh 4.053 atm-1

    Mole fraction of CH4 ym Varies Unitless Mole fraction of H2 yh Varies Unitless Mole fraction of CO yc Varies Unitless Mole fraction of H2O yw Varies Unitless Mole fraction of CO2 yd Varies Unitless Pre-exponential Rate Constant A 4.95e8 mol/kg/s Activation Energy of Reaction 2 Ea2 1.163e5 J/mol Equilibrium Constant1 Keq2 e-4.946 + 4897/T Unitless (T in K)

    As mentioned above, the first reaction is Langmuir-Hinshelwood, so highlight that in the Reactions window and press Add Reaction. Fill out the form that appears with components and coefficients so that it looks like the picture below then press the Basis tab to move to that page.

    Note that unlike the second reaction (which has an equal number of moles on both sides and therefore shouldn't), the first reaction contains pressure terms. You will note, however, that in each instance it is a singular mole fraction multiplied by the overall pressure. This is equivalent to the partial pressure of the species. Therefore you should change your basis to Partial Pres. You may leave the base component as Methane (note the base component of a reaction must always be a reactant for that reaction, though it may

  • The reaction phase, as you might guess, tells HYSYS in which phase the reaction is to take place. Your options for this are:

    Overall -- reaction occurs in all Phases Vapour Phase -- reaction only occurs in the Vapour Phase. Liquid Phase -- reaction only occurs in the Light Liquid Phase. Aqueous Phase -- reaction only occurs in the Heavy Liquid Phase. Combined Liquid -- reaction ocurs in all Liquid Phases.

    Since we anticipate that these reactions will only take place at temperatures where the entire process stream is gaseous, a reaction phase of either Vapour Phase or Overall is fine. Now we want to enter the units for the rate and the basis. These units do not have to have anything in common with the units you have set in your preferences. Instead they should correspond to the units used in the kinetic equations you are provided with. If you look back above to the table of variables, you will see that for everything to work out correctly, Pressure, and therefore Partial Pressure, must be in atm and the rate of reaction must be in mole/m3/s (gotten by multiplying the units of DBED, km, and P; the exponential term, the y term, and the denominator all being unitless). It is no problem to enter atm for the Basis Units. The closest we can get for the Rate Units, however, is kgmole/m3-s. Thus we will have to adjust the rate constant later to match.

    When you are all finished the Basis Page should look like this:

    On the Numerator Page, you shall begin filling in the information that will tell HYSYS the actual form of the rate equation. If you have not already done so, I suggest that you push Kinetics Help, which will call up the following window:

  • The various basis functions in the reaction I have colored yellow and the parts that become the A's are in red.

    r1 = DBED*km*e(-Ea1/(R*T))*P*ym/(1+Kh*P*yh)

    You can see that in this numerator there is no reverse reaction and that the forward reaction is first order in methane and zero order in steam (the latter is a trifle suspect and indicates that some assumptions were probably made about the ratio of steam to carbon and that the steam partial pressure was probably incorporated into the rate constant). Therefore, in the components matrix, you should change it so that all orders for both forward and reverse reactions are zero, except for the forward order of Methane which should remain 1. The Activation Energy, Ea1 = 1.849e8 J/mol, of the reaction may be entered as E of the forward reaction. There are a couple of things to note at this point. The first is that HYSYS does not show you the units of the Activation Energy it displays. If you would like to display it in the same units you entered (in this case, J/mol), you must go into your preferences set and set the units of Molar Enthalpy to the units you would like Activation Energy displayed in. The second item is that despite the fact that you entered 4 significant digits, HYSYS only displays 2. Calculations are based on 4 digits, but you cannot see them unless you export the number to a Spreadsheet (using the secondary mouse button, just drag the number from the reaction window to a cell of the Spreadsheet Page of the Spreadsheet). Per my request, HYSYS has added the ability to adjust this formatting to their wishlist for future versions. The same problem will result when you enter in the Pre-exponential Factor. The number you enter into A for the forward reaction, must be the product of DBED and km divided by 1000 (remember the units need to be in kgmole/m3/s, not gmole/m3/s), which is equal to 6620400. You may leave all the reverse reaction info blank (we don't hae one so you don't need it). Your window should look something like this:

  • Note that the status has changed to Ready. Do not believe it! Though HYSYS does not require it, we still need to input the Denominator (and it would be kind of silly to use the Langmuir-Hinshelwood form if you didn't have a Denominator).

    Moving to the denominator page, the form of input changes slightly. It is now in matrix form, because you have the ability to put in as many terms as you want into the denominator, each with differing A's, E's, and bases to go with them. Enter Kh = 4.053 into A, set E equal to 0, and put a 1 under Hydrogen.

    You are done entering the data for the first reaction. You may close this window. Go back to the little Reactions window and add a Kinetics (Rev Eqm) reaction. If you closed the Reactions window you may get it back by going to the Simulation Basis Manager and pushing Add Rxn on the Reactions Page.

    Add the components and the stoiciometric coefficients like we did for the first reaction, then move to the Basis Page.

  • On the Basis Page, set the basis to Mole Fraction, the reaction phase to Overall or Vapour Phase, and the reaction units to kgmole/m3-s.

    Moving on to the Parameters Page, we see that this time the Kinetics Help is already on the page. Below I have copied the second reaction rate equation. This time, as with the first reaction, the pre-exponential factor is in red and the bases are in yellow.

    r2 = DBED*A*e(-Ea2/(R*T))*(yc*yw - yd*yh/Keq2)

    Note that this time, however, you are not asked for information on the orders of the components in the forward and backward reaction. That is because this formulation of rate equation can only be used with elementary reactions (remember those are reactions where the orders are equal to the coefficients). The reason being that that is how Keq's are defined. Enter A = 5.94e8 (DBED*A/1000, the thousand is for the units to come out) and E = 1.163e5 J/mol. For the rest we need to use the expression in the chart for Keq2: Keq2 = e-4.946 + 4897/T. Note that the natural log of this is what we want to enter into HYSYS. Therefore, A' = -4.946 and B' = 4897. IMPORTANT: the T used in their expression is always in Kelvin, no matter what your unit preferences are in. Luckily, this was the form we were provided with.

  • You are now finished entering the second and final reaction. You may close this window and return to the Reactions Page of the Simulation Basis Manager.

    Now that you are done creating your reactions, you must add them to a reaction set. Reaction Sets are groups of one or more reactions. They may be exported and imported. They must be attached to fluid packages to be used in the flowsheets to which those fluid packages are associated. You can attach as many as you like to a fluid package, and thus use different sets on different units within the flowsheets. Reaction Sets may be used with reactors, columns, and separators. Conversion reactions cannot be placed in the same set as other types of reaction. For more information on Reaction Sets see Section 11.4 in RV1 (link only good from AL-C126).

    To start, press the Add Set button in the Reaction Sets Group, add both of your newly created reactions to the Active List. Note that the Global Rxn Set already contains the two reactions created, but practice is good for you and this way you get to see the Reaction Set window.

    Close the above window and look back at the Simulation Basis Manager, which should now look like this:

  • Make sure your reaction set is highlighted and press Add to FP. A window will pop up listing all the available fluid packages (in this case, there should be only one). Select it and press Add Set to Fluid Package. Your fluid package should now appear under Assoc. Fluid Pkgs when your reaction set is selected.

    You have now completed everything you need to do in the basis environment. You may now enter the Simulation Enironment.

    Begin by creating two material streams on the PFD. Name one Feed and the other Product. On Feed's property view, set the temperature to 350o C, the pressure to 30 atm, and the total flowrate to 2110 moles/s (7596 kgmoles/hr). Fill out the compositions as shown below.

  • Now, from either the Oblect Palette or the Unit Ops Page of the Workbook, add a Plug Flow Reactor to the flowsheet and connect the Feed and Product streams (remember a shortcut for toggling into and out of the connecting mode is to hold down ). Your PFD should look like

    the one below.

    Open the property view of the reactor. If you have already connected the streams to the reactor then the Connections Page will be completed (note that unless you connect a heat stream, the reactor is assumed to be adiabatic by HYSYS). You may move to the Parameters Page. The only thing you need to do there is set the Pressure Drop to 0. Move two tabs over to the Dimensions Page. Fill in the settings as they are below.

    These are the same dimensions as those used in the Aspen example (with the same correction in the diameter for porosity that you can read about there). The next page over is the Reactions Page. All you need to do there is enter your reaction set and HYSYS will begin to integrate your reactor. It may take a little while, but when it's done, your window will look like mine below and your PFD will look like the picture at the beginning of the example (all blue and happy like).

  • To see some of the results of your reactor, click on the Profiles button at the bottom of its Property View.

  • Above is one of the reactor profiles you can choose. It is important that you note -- it's easier to see in table mode than graph mode -- that the data points at the ends say they are for .25 m and .95 m, not 0 m and 10 m like you might expect. You have to remember that HYSYS integrates over the length of the reactor by dividing it into 20 sub-volumes (that was the default on the Reactions Page of the Property View and we left it at that). Ten meters divided into twenty groups means .5 m per division. The point that HYSYS records is thus halfway between the divisions, but is valid in HYSYS for the whole sub-volume. Thus the temperature, composition, etc. of the product stream contains the same values as 9.75 m down the reactor. In other words, don't worry that HYSYS is leaving off its charts the first and last values. The first point corresponds to the reactor inlet and the last point to the reactor outlet. Below are the results you should have gotten for your Product stream.

  • Compare these to the results we found in the Aspen simulation. Agreement is good in both the mole fractions and the final temperature (off by about a degree). These results correspond to a thermodynamic package of Antoine. If you were to go back and change this to Margules, set the vapour model to ideal, and delete all the binary parameters, you would find that the results hardly change at all (the final temperature changes by 0.2 degrees Celcius). Thus, it is likely that the difference between the HYSYS and Aspen models are the result of column integration differences versus property package differences.

  • Gibbs vs. Equilibrium Reactor

    In order to save time and make it possible for you to campare the results of the various reactors, this example will begin by using the same components and reactions that were employed in the Plug Flow Reactor Example. It is recommended, but not necessary, that you work through that example first (or at least glance at the component list and reactions). If you do not have a version of your own of that example from which to start this example, I have made available a completed version of that example entitled PlugFlowEx.hsc located in the \\Hartsook\Hysys\SAMP403 directory. There is also a file containing this and all other completed reactor examples called AllReactors.hsc in the same directory.

    The Gibbs Reactor

    We will begin by installing the Gibbs Reactor. Set up your Process Flow Diagram (PFD) like you see below (remember the button is great for quick connecting as it toggles you in and out of Connect Mode). The Gibbs Reactor is available from the Unit Ops menu or from the Object Palette by pressing the General Reactors button

    which opens this menu . Press for the Gibbs Reactor.

  • Note that it is not necessary to attach a liquid product stream to the reactor. All of the reactors may be run with only one product stream (vapour or liquid). Should both phases be present in the product and only one or the other product stream available, HYSYS will tell you it needs another product stream. At that point, you must add another stream, but do not be dismayed. Remember, you can always mix them back together again. Also note that you may add an energy stream to the reactor. That we have not indicates that we intend the reactor to be adiabatic.

    Since we desire the Gibbs Feed stream to be the same as the Plug Flow Feed stream, the easiest method is to double-click on the Gibbs Feed, opening the property view, and switch to the Utilities Page. There, press the button marked "Copy Stream Specs From ..." and choose the Plug Flow Feed stream.

    You'll find that this is all that is required for the Gibbs reactor to work. If you so wished, you could now open the reactor's property view and add a pressure drop on the Parameters Page. You can also switch to the Reactions Page where you will see a couple more options. Currently selected should be Gibbs Reactions Only. This is the choice that gives total equilibrium of all components (excluding those labeled

  • the option that allows you to attach an equilibrium reaction set. We shall return to this option later in the example. The last option is to have No Reaction occur at all. The reactor then would simply act as a separator (provided both vapour and liquid product streams were connected).

    Changing nothing, however, we find our product stream looks like this

    Note these are extremely different results than we obtained in the Plug Flow Example. The main difference is that where in the PFR the reforming reaction was not occuring, here it is occuring in great quantity, backwards. At this temperature, the equilibrium is to the left (something we did not even allow for in the kinetic equations we defined for the reforming reaction), and methane is formed in what is called the Sabatier reaction (same reaction, two names, go figure. We are ready to start putting in the Equilibrium Reactor.

    The Equilibrium Reactor

    We cannot install a working equilibrium reactor without first creating the reactions it will use. Therefore the first thing you must do is enter the basis environment. On the Simulation Basis Manager, switch to the Reactions Page (close any other windows that might have been left open there). Before continuing any further, if they are not already, I suggest that you change the names of the existing two reactions to ReformingLH and WGSkin for consistency with my examples and to prevent confusion later (you will begin to collect many very similar reactions). You should also probably change the name of the reaction set containing those reactions to Kinetic. That completed, your window should look something like this

  • Now, in the Reactions Sub-Group, press the Add Rxn ... button. Choose Equilibrium Reaction and name the reaction that appears ReformormingEq. Since this is a very common reaction of interest, before beginning to fill out coefficients we will check the Library Page to see if it is already stored in HYSYS. Luckily for us, it is, as no one was kind enough to provide us with any equilibrium data on this reaction. As you can see it is second on the list and the Water Gas Shift reaction that we will be adding next is first.

    Highlight the reforming reaction and press the Add Library Reaction button. You will find the reaction is now completely defined. HYSYS inputed for you a table of Keq vs. Temp values (from which it also fitted the equation it uses to interpolate and extrapolate -- speaking of which, be aware of the temperature range of the table from which HYSYS will draw its information). To learn more about ways of inputing your own data into the form read the section on Equilibrium Reactions back on my Reactions page or Section 11.3.3 of RV1. Now that we are done with the reforming reaction, close this window and add a new equilibrium reaction called WGSeq. Again, go to the Library Page and choose this time the first reaction on the list. Close the window of the completed second equilibrium reaction.

  • Our next job is to create a reaction set for our two new reactions. Though, HYSYS will allow you to put kinetic and equilibrium equations in the same reaction set (see the General Reactor), you could not put these in the same reaction set with the others because they refer to the same two reactions (evaluated in different ways). Create a new reaction set from the reactions page of the Simulation Basis Manager and call it Equilibrium. Add the two reactions you just created to the active list. It should now look like this:

    Close the window. Back again on the Simulation Basis Manager, highlight the reaction set you just created and push the Add to FP button as we must associate the reaction with our fluid package before it can be used in the flowsheet. There should be only on fluid package listed (if there is more than one, pick the one that is used on your main flowsheet). Select it, then push Add Set to Fluid Package. The completed Reactions Page of the Simulation Basis Manager should look like this:

    Note the Assoc. Fluid Package box only shows those Fluid Packages associated with the highlighted reaction set.

    You may now return to the simulation environment as we are ready to install the equilibrium reactor.

  • The Process "Switch"

    Rather than simply create another feed stream for the Equilibrium Reactor copied from the PFR or Gibbs Reactor, let us assume that you wish to compare the results of the two different reactors on the rest of an involved process. You could simply use Save As to make a copy of the file and substitute one reactor for the other, but that makes comparison of results difficult and cumbersome. You could also use the Logical Operation Balance to dynamically copy the feed to one reactor to another stream which would then become the feed to the other reactor. That way you can have the upstream of the plant duplicated to both reactors on the same flowsheet. Unfortunately, to get the downstream part of the plant, you would have to copy every stream and unit, a difficult prospect in itself, which would clutter your PFD, and then you would have to make every future adjustment to the downstream section twice, a tedious business at best and heaven help you if you have a downstream stream affecting an upstream stream. Basically, this option is out for any but the simplest of flowsheets or unless you only care about the immediate output after the divergence.

    Your last, and I think best option (though there are times when a Save As might well be the most expedient solution), is a technique which I find HYSYS well suited to take advantage of, but which I found curiously missing from the manuals. I call it the Process "Switch". It takes advantage of a lesser used option in the preferences allowing you to make multiple connections to the same stream and the ability of HYSYS to "ignore" unit operations without you deleting them.

    Therefore to start, open the Preferences from under the Tools menu. On the first page, marked Simulation, check the box marked Multiple Stream Connections. You may then close the Preferences window.

    Since there is no point tempting fate by upsetting HYSYS and to make things clearer to you, we will go ahead and make HYSYS ignore the Gibbs Reactor. Open that reactor's property view and switch to the Parameters Page. Check the box that says Ignore This Unit Op During Calculations. The reactor should now turn yellow and the product stream to a pale blue, indicating it is not solved.

    It is time to place the Equilibrium Reactor on the PFD. Either do so from the Unit Ops Menu or as follows from the Object Palette.

  • Push which opens this menu . Press for the Equilibrium Reactor.

    Your PFD should look something like this:

    Now from the Equilibrium Reactor's Property View, go to the Connections Page and for the Feed stream, go to the drop down menu and choose FeedG or whatever you called the feed to the Gibbs Reactor (if you had not already changed the multiple streams option in the preferences, that feed stream would not be a listed option). Now if you were to go right to the Vapour Outlet and attempt to connect ProductG, you would get this error:

  • I believe this is due to the similarity of the two units you are trying to "switch" out. When I tried this first with a Gibbs Reactor and a PFR, I did not get the error. There is an easy way around it, however. Simply

    attach a valve with zero pressure drop (don't forget this) to the Equilibrium's Vapour Outlet, then in the valve's property view, set the outlet to be ProductG or whatever you called the Gibbs Outlet.

    Note: When I was experimenting with the "switch" and the PFR, the PFR began having trouble doing its integration and I was forced to set the segment initialization to Re-initialize for it to work.

    When you are finished connecting, your reactors should look like this:

    Now all that remains is to specify the Equilibrium Reactor. All you need to do is open the Equilibrium Reactor Property View, move to the Reactions page and attach the Equilibrium Reaction Set. HYSYS will do the rest.

  • You may now switch back and forth between the two reactors. I recommend that you try to have one of the two "ignored" at all times (though in this simple case nothing crazy happens and you should observe what happens if you break this "rule"), thus you would start a "switch" by going to the Parameters Page of the Equilibrium Reactorand setting it to be ignored. Then go to the Gibbs Reactor and remove the command to ignore.

    If you examine the product stream as you are switching back and forth, you will see that the results of the two reactors, as they are currently configured, are almost identical. This kind of confirmation is good to see as the reactors go about this calculation in completely different ways. You can see this for yourself by going into the reaction manager and changing one of the equilibrium reactions (or a copy) to have a fixed K of, say, 1. (I leave it to you to remember how to do it). You will then find that while the results for the Equilibrium Reactor change drastically, the Gibbs Reactor continues to give the same "correct" values. This same technique can be used later to show that when an equilibrium reaction set is attached to the Gibbs Reactor, that it is truly only taking the stoichiometry info. Another important thing to note about the similar results is that the thermodynamic property set we are using is Antoine. This is one of the thermodynamic packages that has essentially ideal vapour and liquid phases. You'll find that if you change your thermo package to one of the non-ideal ones, like Peng-Robinson, that the results of the Gibbs Reactor begin to diverge from those of the Equilibrium Reactor (remember the equalibrium reactions set Keq as a function of T only). More so in other examples than this one. (You may also have noticed that for whatever reason, the PFR takes a lot longer to re-calculate in Antoine than in PR). To see a case where the difference caused by the thermo package is more severe see the file called methpuz.hsc in \\Hartsook\Hysys\SAMP403.

    Now we are ready to experiment with attaching reactions to the Gibbs Reactor. Open its property view and go to the Reactions Page. Switch the Reactor Type to Specify Equilibrium Reactions. Try attaching one of the reaction sets to the reactor. You probably were not suprised to see that you could not select the Kinetic set, but you might have been suprised to discover that you also could not attach the Equilibrium set! Located down at the bottom, in the Trace Window, is this explanation:

    "There is no need to specify reactions if all of them are equilibrium type. Gibbs Reactor will take care of attaining equilibrium by itself"

    Remember that in the standard setting on the Gibbs Reactor, the reactor will solve for the equilibrium of all possible reactions (element balance is maintained). As it turns out, with the limited number of components in this example, the two reactions we are exploring compose the entirety of possible independent reactions. HYSYS will not allow you to attach a set containing both reactions as it could accomplish the same thing better by simply forcing you to choose Gibbs Reactions Only.

    Frequently, however, you do not want all possible reactions to go to equilibrium. Suppose instead you wish to model a system that normally does not go to equilibrium quickly (there is a large activation energy). You, however, know that there is a catalyst which will lower the activation energy for the reaction you want and only the reaction that you want. You know that eventually a PFR will be used, but for whatever reason, you do not wish to model one yet. It is sufficient to assume that the Plug Flow would sufficiently near equilibrium that you may model the reactor as if it went all the way to equilibrium. In a case such as this, you would want to use an Equilibrium or Gibbs Reactor with only the one reaction attached. This is the time to use the Specify Equilibrium Reactions option in the Gibbs Reactor.

    For this example, we must first de-activate one of the reactions in the Equilibrium Set before we may use it. Let us assume that we wish to focus on the Water Gas Shift reaction and expect to see little or no Reforming (at the temperatures we are operating at, a not unreasonable assumption). Under the Flowsheet menu, select Reaction Package. This will open a window showing the available reactions and reaction sets.

  • Double-click on Equilibrium and its window will open. Highlight ReformingEq and push the Make Inactive -> button.

    Note that in my file AllReactors.hsc, instead of de-activating the reaction from Equilibrium, I made a new reaction set called GibbsEquil, which I set up with the one equation active and the other equation inactive.

    Now, attach the modified reaction set to the Gibbs Reactor. It should work without a hitch. (Note that if you attempt to use the Composition Page now, the reactor will automatically revert back to Gibbs Reactions Only). Compare the results you get now with the results from the Equilibrium Reactor using the same reaction set. Yet again they are almost exactly the same.

    Two final notes:

    1. Unless you are given specific Equilibrium data to use, your results are more likely to be accurate using the Gibbs Reactor than with the Equilibrium Reactor.

    2. When defining Equilibrium Reactions realize that you may choose to have HYSYS determine Keq from the Ideal Gas Gibbs Free Energy Coefficients. This is nearly the same as what it does with equilibrium reactions in the Gibbs Reactor. The difference is that Gibbs will take in non-ideal effects from the thermodynamic package whereas the equilibrium reaction so defined will remain for the ideal case.

  • Logicals

    There are four logical unit ops that are used primarily in steady-state mode. These are SET, ADJUST, BALANCE, RECYCLE, and the Spreadsheet. The rest of the logical unit operations are used primarily in Dynamic Mode and will not be discussed here. The Chapeter in the Reference Volumes which covers all of logical ops is Chapter 14 in RV2. Much of what is said here may also be found there, as well as a more thorough explanation of each option available.

    The SET Operation

    SET is used to set the value of a specific process variable (PV in the manuals) in relation to another PV. The relation must be of the form Y = mX + b and the process variables must be of the same type. For example, you could use the SET to set one material streams temperature to always be 20 degrees hotter than another material stream's temperature. SET may work both ways (i.e. if the target is known and not the source, the target will "set" the source). You can see an example on SET's use that includes an example of the Spreadsheet in my Set Example. You may also read more about it in Section 14.7 in RV2.

    As a small aside. You can use the Spreadsheet to set the multiplier, m, or increment, b, of the SET operation (similar to what I mention with the ADJUST below). But I don't see much point, since, if you're going to invoke the Spreadsheet anyway, you might as well just import the source variable, do your necessary calculations, and export the result directly to the target without ever bothering with SET.

    The ADJUST Operation

    Use the ADJUST operation when you want HYSYS to adjust one variable until a target variable reaches a user specified value or matches a specification. That source of that specification can be yet a third variable (of the same type as the target and offset by a constant if you so wish). The Gas Processing Example in the Tutorials Book uses an ADJUST to vary one stream's temperature until another stream's dew point equals a specified value. One irritating little feature is that if you are using another object as the source of the target value, the menu of objects will include objects that you cannot actually use that way. I tried to connect the results of a spreadsheet that way, but it did not work.

    You can use the results of Spreadsheets, however (which is good, since it greatly increses the power and flexibility of ADJUST). It must be done by exporting the variables from the Spreadsheet itself to the ADJUST. You can export to the target value or to the offset used whenthe target value is another object. If you export to the target value, the number will appear in the user specified box (the radio button must therefore be set to that). Before installing the ADJUST module, it is often a good practice to inialtize the independent variable, allow the flowsheet to solve, and note the value on the dependent variable.Then self-adjust the independent variable and make sure that the dependent variable is actually affected by it. This should also give you an idea of the step size you will require. The step size is set on the Parameters Page and is the initial step size employed until the solution is bracketed. Note that too small a step size and you may not bracket the solution before exceeding the maximum number of iterations (you may change that number as well though).For a description of the rest of the items on the Parameters Page, another example, and a discussion on the use of multiple ADJUSTs simultaneously (involves a change in the Solving Method), see Section.14.1 of RV2.

  • The BALANCE Operation

    This is one of the most interesting and deceptively useful of the logical units. Remember way back when you took CENG 301. You had to do Mass and Energy Balances over sections of or entire plants to solve for unknowns in composition, flow, energy, or whatever. Well, that is what this operation will do for you. You tell it what streams of material and/or heat are crossing the imaginary boundary into your system of interest and what streams are exiting. You know that HYSYS shares information both forward and backward throughout the PFD at all times. However that is not always enough for HYSYS to know when the situation is entirely specified but in a more unorthodox manner. The Mole and Heat Balance example in Section 14.2 of RV2 shows a single stream passed through two coolers in series. Though you know the composition and the temperature of the stream both before the first cooler and after the second cooler, you do not know the flowrate or the temperature in between. You do, however, know the duties of the two coolers, which gives us enough information to figure out the unknowns. The balance is set up so that the two coolers are the system, which thus has one material inlet stream, one material outlet stream, and two outlet heat streams. (Note: when setting up balances, even when the flow is negative -- something you are more likely to see with energy than with material streams -- choose which streams are inlet and which streams are outlet from the direction of the arrows, into or out of the system, on the PDF. HYSYS will handle the signs correctly then.)

    There are a total of 5 different types of Balance available to you, they are:

    Mole and Heat Balance - I mentioned this one already. It is the most commonly used and is good for calculating ONE unknown based on the total material balance and ONE unknown based on a total energy balance. It should not be used in conjunction with a reactor as the balance is on a molar basis. The material balance is conducted first and will complete even if the energy balance is under- (or worse, over-) specified. Though it does not conduct individual component balances like the General Balance, you may leave the composition of one stream empty and HYSYS will know how to fill it. Actually, I am not absolutely sure about this type's limitations. It seems to be able to handle more than the manuals say it should (I suspect that it really does do some sort of individual component balance). It was able to handle the example I made up for the General Balance below, but it couldn't handle the example for the General Balance contained in the Reference Manuals.

    Mole Balance - There is another way to use the Balance Operation. The "system" for which you have inlets and outlets need not be part of the process at all. You can use the balance to create new streams with characteristics of streams in your process. In the HYSYS' Gas Processing Tutorial, they use the Mole Balance to create a stream with the same composition and flow as a process stream, but then they give the new stream a different pressure and a vapor fraction of 1 to see what the stream's dew point would be (remember, when you specify vapor fraction of 1 or 0, HYSYS assumes you want saturated vapor or liquid and solves for the corresponding temperature or pressure).

    Mass Balance - The Reference Manual says that this is good for non-stoichiometric reactors like alkylation units and hydrotreaters. The compositions of all streams must be specified and all but one flowrate. Be aware that the only thing this balance passes is a Mass Flowrate. Note that there is no sort of elemental balance. You could have five streams of pure nitrogen as inlets and one stream of CO2 as the outlet, and HYSYS will gleefully pass the sum of the mass flowrates of the nitrogen to the CO2. So, be careful with this one.

    Heat Balance - You know, I'll be honest. I cannot think of a good use for this one, but hey, I can't do all your thinking for you.

    General Balance - This is the really good one. In addition to conducting individual component balances, and thus being able to solve a greater variety of problems that way, you can specify ratios between components within a stream (unfortunately not between streams). It could even handle inputing flowrates for some of the components but leaving the rest of the composition , this

  • was a little tricky though. Take a look at my neat, little example and you'll see what I mean. As with the Mole and Heat Balance, the material balance is conducted independently of the energy balance and will complete even if the energy balance is under- (or worse, over-) specified. A warning, though. Either balance may surprise you by making the other balance overspecified, if you are not watching for that possibility when inputting data.

    For all Balances, the balance will not start to calculate until the Auto Calculation box is checked, but don't check it until all is ready.

    The RECYCLE Operation

    Use this operation every time you need to recycle a stream. The logical block connects the two streams around the tear (remember the tear does not have to be the official "recycle" stream itself, but instead should be the best place in the loop to make the break for convergence purposes). Before you can install the RECYCLE the flowsheet must have completed. That means there need to be values for both the assumed stream and the calculated stream. Once the Recycle is attached and running, HYSYS compares the two values, adjusts the assumed stream, and runs the flowsheet again. HYSYS repeats this process until the two streams match within specified tolerances. Those tolerances are set on the Parameters Page. There are tolerances for Vapour Fraction, Temperature, Pressure, Flow, Enthalpy, and Composition. The tolerances you enter are not absolute. They are actually multipliers for HYSYS' internal convergence tolerances. For example, the internal value for Temperature is .01 degrees (note that is in Kelvin, because HYSYS does all of its calculations in an internal unit set), so a multiplier of ten means the two streams must be within a tenth of a degree of each other. On the Numerical Page, among other things, you may set the RECYCLE to either Nested (the Op is called whenever it is encountered in the flowsheet) or Simultaneous (all of the RECYCLEs are invoked at the same time -- use with multiple inter-connected recycles).

    There is far more to this Operation. I cannot really do it justice. See Section 14.5 in RV2 for much more information on the options available to you as well as two excellent examples which include strategies on reducing the number of recycles and convergence time.

    The Spreadsheet

    You must have noticed me raving about this operation on occaision. This is by far one of the most powerful and flexible of the tools available to you. You may import almost any variable to the Spreadsheet, do a variety of calculations there (including boolean logical operations like if ... then statements), and then export results to any specifiable field in your simulation. It serves the same basic Function as the FORTRAN blocks do in Aspen, but again, no surprise, it's a heck of a lot more user friendly an interface. Besides reading about in Section 14.8 in RV2 and looking at their example which shows how you may use the Spreadsheet to calculate the pressure drop across a heat exchanger (at least they calculate the Reynolds Number), I have made two different examples showing further uses for the Spreadsheet.

    One example was mentioned earlier in this page, SetEx. The other example shows how the Spreadsheet may be used to calculate reaction conversion for use with a Case Study.

    In the first example, I import and export via the Connections Page. In the second example, I do it by directly dragging the variables into and out of the spreadsheet.

  • Set and Worksheet Example

    In this example, I am going to show you two different ways to solve the same dilemma. Let me start by defining the problem. You need to mix a stream of natural gas with steam before sending them to the natural gas reformer where they will react to form CO and CO2. You cannot just mix them in any proportion, however. Though stoichiometry might suggest you could use nearly a 1:1 ratio, you must avoid a possible side reaction whereby solid carbon (coke) is formed, choking the reactor. To avoid this reaction you are told to maintain at least a 3:1 Steam to Carbon Ratio (i.e. for every carbon atom entering the reactor, there should be 3 molecules of water). This wouldn't mean much if you always had the same starting flow of natural gas, but chances are high you are going to have to make many, many adjustments to the feed flow. You do not want to have to recalculate the flow of steam and enter a new value, every time you do so. Don't panic! There are a couple of easy ways to get HYSYS to maintain that steam to carbon ratio automatically.

    But before we get to that, let's go ahead and set up our property package. Start a new case and push the Add button on the Fluid Pkgs Page of the Simulation Basis Manager to create a new fluid package. In the window that opens up, pick PR for the thermodynamic package (it doesn't really matter what you pick, as we shouldn't be doing anything that requires thermo information, but there are a few packages that limit what components you may use and I'd rather avoid them). Move to the Components Page and add as your first component: H2O. Then add Methane, Ethane, Propane, i-Butane, and n-Butane. Finally add Nitrogen to the list, then close the fluid package window and enter the simulation environment.

    Add a material stream to your PFD, name it Methane. As the name probably suggested to you, we are going to start by assuming that the natural gas stream is entirely made of methane. Set the Stream as shown below (actually the Temp and Pressure don't matter much either to this example, do set the molar flow to 1 in whatever units you're in as that will making viewing the results easier):

  • Now make a stream called Steam. Set the temperature and pressure as you wish (as long as it stays steam). Set the molar flow to 3 for now. For the composition, you guessed it, 100% H2O.

    The Logical Unit SET

    Place the Set Unit on your PFD between your two streams (if you take it from the Object Palette, it's the one that looks like a grey diamond with a green S in it -- you're surprised, aren't you. Go ahead, admit it. You would never have guessed which one it was). Sarcasm out of my system, go ahead and hold down the button to toggle into Connect Mode and place your cursor over the two connection points on the Set diamond. One should say "Target Object" and the other should say "Source Object". Since we are using information from the Methane stream to set properties of the Steam stream, Methane must be the Source and Steam the Target. Go ahead and connect each point on the Set box to a green box on its respective stream (this is a logical Op so we use green connections rather than blue for material streams or red for energy).

    When you connect the target to the Set, a window will appear like the one below. For this example, choose Molar Flow.

  • You should have gotten a Consistency Error from this. This is because you actually inputed a value for the flow and then told Set to input a different value (you haven't finished with Set yet, so it is still using a multiplier of one and tried to set the flow to 1). HYSYS isn't sure which one to believe. Go ahead and open Steam's property view and delete the flow you entered before. Then, do not forget to go up to the toolbar and push GO to start the calculations up again, with the consistency error resolved.

    Your PFD probably looks something like this now

    To fix the streams to look better, you can either select the Set with the right mouse button and choose transform and Rotate by 90, or you can select it (with the usual left mouse button) and push the number 3 which has the same effect. To move the SET-1 out of the way, push (with the SET box still selected). This switches the selection to the label of the unit only.

    Open the Set's Property View. Connections are all finished so switch to the Parameters Page. You can set the target to be any first order function of the source (basic Y = mX + b format).We want three times as much steam as methane, so set the multiplier to 3. We do not need an offset, so leave it as 0. Voila! We're done. If you open Steam now you will see a Molar Flow of 3 which is what we wanted. If you change the flow of Methane to 2, then Steam will automatically change to 6.

    So much for the easy case, now let's move on to something more complicated. Create a stream called Steam2 and define it exactly the way you did Steam, though this time leave the Molar Flow field empty. Also create the following stream:

  • This is at least a little more representative of a Natural Gas stream (I still made up the numbers to be a little rounder). For this we need the flow of water to equal the flow of methane plus 2 times the flow of ethane plus 3 times the flow of propane, etc. Now to be honest, if we knew that the composition of the natural gas stream would be relatively fixed (with only the overall flowrate subject to adjustment), then we could still use the Set Op with a multiplier equal to

    3*(.5 + 2*.3 + 3*.05 + 4*.025 + 04*.025) = 4.35

    However, we are going to assume that either the composition may be subject to change or that I am trying to teach you something for your own good to use when an even more complicated situation arises. Therefore, we are going to solve the problem this time by using ...

    The Spreadsheet

    Begin by starting a new spreadsheet (for once, it doesn't matter where you place it on the PFD). If you

    are using the Object Palette, the button for the Spreadsheet is . Open the Property view, if it isn't already. We begin on the Connections Page by importing the variables we wish to work with. Start by pressing Add Import and making the selections in the window that appears as shown:

  • Press OK.. Then, import the rest of the Natural Gas component flow rates. When you have finished that go back and change each cell from A to B. Be careful with this part. HYSYS can be irritatingly unforgiving about this, so, in the future, you'll want to think carefully before deciding which cell you want each variable in as well.

    Now, switch over to the Spreadsheet Page and add the text shown below.

  • The next step is to start entering formulas. You know that in MS Excel you start all formulas with an = . Here we start all formaulas with a + . In cells C2 through C6 enter the following cells respectively: +B2, +2*B3, +3*B4, +4*B5, +4*B6. Then, in cell B8, write "Total Carbon Flow" and in B9 "Required Steam Flow". In C8, enter +C2+C3+C4+C5+C6. In C9, enter +3*C8. When finished the spreadsheet should look like this:

    Return now to the Connections Page (glance at the other two pages on the way). Press Add Export. Select Steam2 and then Molar Flow. After you have done so, change the cell to C9, to match the one we actually wish to Export. Again, POOF, we're done. Steam2 now has a flowrate of 4.35 as we expected.

  • You can develop much more complex expressions in the Spreadsheet. To get an idea of your options, take a look at the window that opens when you press Function Help ...

    My Case Studies Example also demonstrates another use of the Spreadsheet.

  • Case Studies Example

    This example will build on the simulation you made for the Chemicals Tutorial Case from Chapter 4 of the Tutorials Manual. You did complete that example, didn't you? Hint, hint, wink, wink, nudge, nudge. Well just in case you didn't, the example consisted of using a CSTR to react Propylene Oxide with Water to make Propylene Glycol, then separating that out as a product. Now we would like to explore that reaction a little more, from a plant design stand point. Utility costs, and other issues, are directly tied to the temperatures we use for various operations. In this case, the temperature we set for our reactor determines how much coolant is required and has a direct effect on how well the column runs, and of course, it has a critical effect on the reaction itself. Another big issue is Capital Costs. Since the general rule goes, the bigger the piece of equipment, the more expensive it is, we'd like to see how sensitive the reaction is to the size of the reactor.

    Now we could plug about 200 different combinations of temperature and size in by hand, but what would be the point when HYSYS has so thoughtfully provided us with a tool to do just that. It's called a Case Study (very similar to Sensitivity Runs in Aspen) and is available as part of the DataBook.

    Start by opening up the file you made from the Tutorial. If you do not have such a file you may start from my version entitled ChemicalsEx.hsc in my sample directory or use TUTORIAL3.hsc from HYSYS' sample directory located on the server HARTSOOK. When you begin, your PFD should look approximately like this

    The first thing we should do is refresh ourselves on the current conditions, so open the Reactor's Property View. On the Worksheet Page, you can see that currently the entire contents of the reactor are exiting via Reactor Prods (Reactor Vent has zero flow) at 140 o F. Note that I am using the same Units Set that was used in the Tutorial (essentialy Field, with Liquid Volume Flow set to USGPM, but any Field based set should be fine for this example). On the Reactions Page, you can see that the current Liquid

  • reaction occurs in the liquid phase). Since we will be varying the liquid volume by changing the Liquid Level percentage and we like even numbers, go ahead and change the Vessel Volume to 300 ft3. Note that the Liquid Volume didn't change because HYSYS adjusted the liquid level to keep it constant. In general it is a good idea to be aware of your settings before running a case study as the Case Study will not return you to your original state afterwards. Perhaps, you might want to develop the habit of always making a record in the Data Recorder (also part of the DataBook) right before running your Case Studies.

    Go ahead and open up the DataBook now (under the Tools menu). On the Variables Page, you should see three variables already defined. One of these, Reactor Temp, we will actually use ourselves. We will need two more variables: the liquid level and the reaction conversion (conversion is a much better measure of the efficiency of a reactor than just looking at the flow or concentration of product in the product stream). Press Insert ... . The Variables Navigator will appear. Select Reactor from the Object List.

    Perhaps, you've noticed our first problem. Yep, Conversion is nowhere to be found on that list of Variables. All right, we'll worry about that in a second. Let's go ahead and get the Liquid Percent while we are here. What's this! There are two variables called Liquid Percent: Liquid Percent SP and Liquid Percent Level. Well, the SP probably means "Set Point" which sounds like a Dynamics thing, not a Steady-State variable, plus the title of the variable we want to affect on the Reactions Page of the CSTR's Property View, called it "Liquid Level", so let's choose Liquid Percent Level (I'll show you later why this is the wrong choice).

    Blissfully, unaware that we just made a mistake, let us now proceed to doing something about the Conversion. See HYSYS just gave us that conversion as a little helpful bonus. It doesn't actually consider it a variable and heaven forbid you should actually want to use it for something. Therefore we must make our own Conversion calculation. And where do we get to make our own calculations? That's right girls and boys, the Spreadsheet (and your profs complain you don't pay attention -- Well, actually they complain that you don't come to class, but that is neither here nor there).

    Begin by adding a Spreadsheet to the simulation ( on the Object Palette). We are going to do things a little differently from the way we did things in the SET example with the Spreadsheet. Instead of importing variables on the Connections Page, we are going to do it directly (sometimes it may take just as long though, because of all the windows you'll have to wade through to display the number you want). First we need the Molar Flowrate of Propylene Oxide entering the reactor. For that, double-click on the Mixer Out stream and switch to the Compositions Page. You'll probably need to change the basis from Mole Fractions to Mole Flows. Now make sure the Spreadsheet Property View is on the Spreadsheet Page

  • (yes, you'll need to push the little "pin" on the stream's window to switch out of Modal View). Now position your cursor over the 12C3Oxide's Molar Flow and using the secondary mouse button, drag the number to cell B2 of the Spreadsheet. You should see a Bull's Eye when you are over a place you may "drop" it. Oh, and make sure the Spreadsheet is also not in Modal View (push the little "pin"). 150.0000 lbm/hr in black shoul