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 <Ctrl> 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 <L> (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.

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