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 <empty>, 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.

 Return to the HYSYS Page | Return to the CENG 403 homepage