0% found this document useful (0 votes)
236 views

Event Scheduler & Spreadsheet 1

Event Scheduler allows HYSYS to perform tasks while a simulation is running. Tasks can be triggered by a pre-determined simulation time, a logical expression becoming true, or a variable stabilizing to within a given tolerance. The Spreadsheet Operation allows users to perform calculations that may otherwise not be done in HYSYS.

Uploaded by

Kajer quemar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views

Event Scheduler & Spreadsheet 1

Event Scheduler allows HYSYS to perform tasks while a simulation is running. Tasks can be triggered by a pre-determined simulation time, a logical expression becoming true, or a variable stabilizing to within a given tolerance. The Spreadsheet Operation allows users to perform calculations that may otherwise not be done in HYSYS.

Uploaded by

Kajer quemar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Event Scheduler & Spreadsheet

Event Scheduler & Spreadsheet

1
2004 Aspen Technology. - All Rights Reserved.

Event Scheduler & Spreadsheet

Workshop
With the Event Scheduler, it is possible to have HYSYS perform given tasks while a simulation is running in dynamics. The tasks can be triggered by a pre-determined simulation time, a logical expression becoming true, or a variable stabilizing to within a given tolerance for a set amount of time. Examples of tasks that can be performed with the Event Scheduler would be emergency shutdown, start-up and some batch processes, among others. The Spreadsheet Operation in HYSYS allows users perform calculations that may otherwise not be done in HYSYS. Virtually any process variable can be transferred into the spreadsheet. Any user specifiable process variable can be calculated and exported. This functionality is particularly useful in Dynamics because it provides an easy way to customize the flow sheet. In this workshop, we will work with the Spreadsheet and the Event Scheduler Manager

Learning Objectives
Once you have completed this section, you will be able to: Use the Spreadsheet Use the Event Scheduler Manager Create Event Schedules Create Sequences Create Event Conditions

Process Overview

Event Scheduler & Spreadsheet

Event Scheduler Manager


The Event Scheduler Manager contains all the Event Schedules in the current HYSYS case. Each Schedule is comprised of Sequences, which in turn are made up of Events. An Event must have a Condition, which determines when the Event will be triggered. At least one action must be fully defined for each Event. Once an Event has been triggered, a series of pre-defined Actions will be executed. A variety of Actions can be performed including closing valves, switching controller modes, changing variable values and switching to other sequences. The following chart illustrates the relationship between these various items:
Figure 1

The Event Scheduler is accessed from the Simulation Menu Bar, or by using the hot key CTRL E. When you open the Event Scheduler, HYSYS displays the Event Scheduler Manager, which contains a list of the Schedules in the case.

Event Scheduler & Spreadsheet

Figure 2

The buttons in the Current Events Schedule group are used to manage the schedules for the current case: View. Allows you to view the selected schedule. This is only active when a schedule exists in the case. Add. Allows you to add new schedules to the case. Delete. Allows you to delete the selected schedule. This is only active when a schedule exists in the case. Copy. Allows you to make a copy of the selected schedule. this is only active when a schedule exists in the case. Import. Allows you to import a saved schedule from disk. Schedules have the extension.sch. Export. Allows you to export the selected schedule to disk. Once exported, a schedule can be retrieved using the Import button. This is only active when a schedule exists in the case. Sort. Allows you to arrange the schedules. This is only active when at least 2 schedules exist in the case.

The Specified field in the matrix indicates whether all the Events in the Schedule have been fully specified. If all the Events in all the Sequences which make up the Schedule have been fully specified, the Specified field will display True, otherwise it will be False. The No. Sequences field displays the number of Sequences in the Schedule.

Event Scheduler & Spreadsheet

The HYSYS Spreadsheet


The Spreadsheet's ability to import and export variables means that seamless transfer of data between the Simulation Environment and the Spreadsheet is a simple matter. Any changes in the Simulation Environment are immediately reflected in the Spreadsheet, and viceversa. The Spreadsheet has several common applications. For example, the Spreadsheet can be used to: Transfer variables between flowsheet objects. Perform mathematical operations using variables from the simulation

Importing and Exporting Variables


The contents of any cell in the Simulation Environment can be added to the Spreadsheet. The contents of any Spreadsheet cell can be exported to any specifiable (blue) cell in the Simulation Environment. Note that the contents of any Spreadsheet cell cannot be simultaneously imported and exported. There are three ways of importing values into the Spreadsheet: Drag-and-Drop. Position the cursor over the desired item; then press and hold the right mouse button. Move the cursor over to the Spreadsheet. Once over the Spreadsheet, the cursor's appearance will change to a bulls eye type. Release the right mouse button when the bulls eye cursor is over the desired cell. The specific information about the imported variable will appear in the Current Cell group. Variable Browsing. A variable may also be imported into the Spreadsheet by placing the cursor on an empty cell in the Spreadsheet and pressing (and releasing) the right mouse button. Choose Import Variable from the list that appears, and select the variable using the Variable Navigator. Connections Page. On the Connections page, press the Add Import button and select the desired variable using the Variable Navigator. After selecting the variable, choose the desired cell from the drop-down list.

Event Scheduler & Spreadsheet

Exporting variables from the Spreadsheet into the Simulation environment is also a simple procedure. The methods for doing this are very similar: Drag-and-Drop. Position the cursor over the Spreadsheet cell that is to be exported. Press and hold the right mouse button; the cursor should now change to the bulls eye type. Move the bull's eye cursor over to the desired cell. Release the right mouse button, the transfer should be completed. Variable Browsing. A variable may be exported from the Spreadsheet into the Simulation environment by placing the cursor on the exportable cell in the Spreadsheet and pressing (and releasing) the right mouse button. Choose Export Formula Result from the list that appears, and select the desired location Connections Page. On the Connections page, click the Add Export button and select the desired variable using the Variable Navigator. After selecting the variable, choose the desired cell from the Drop Down list.

The value of any spreadsheet cell can be exported, except if it is an imported value.

Adding Spreadsheet Functions


To view the available HYSYS functions at any time, click the Function Help button.

The HYSYS Spreadsheet has extensive mathematical and logical function capabilities. Users familiar with common Spreadsheet programs will immediately recognize the form of the HYSYS functions as similar to the form used by these other programs. All functions in the HYSYS Spreadsheet must be proceeded by either a + or an @ depending on the type of function. Plus signs (+) are used for straight mathematical functions: addition, subtraction, multiplication, and division. The ampersand (@) is used before special functions such as logarithmic, trigonometric, and logical functions. Some examples of the HYSYS functions and their form: Addition. Uses the + sign, e.g. +A1+A2 Subtraction. Uses the - sign, e.g. +A1-A2 Multiplication. Uses the * sign, e.g +A1*A2 Division. Uses the / sign (not the \) e.g. +A1/A2 Power. Uses the ^ sign, e.g. +A2^4 Factorial. Uses the ! sign, e.g +A2! Square Root. Uses the @SQRT function, e.g @SQRT(A2)

A cells numerical value can be copied to another cell by using a simple formula (e.g. =A1). Parenthesis are mandatory in many of the advanced spreadsheet functions and can also be used to designate calculation order.

Event Scheduler & Spreadsheet

Sine, Cosine, and Tangent. Use the @sin, @cos, and @tan functions, e.g @sin(A2). Inverse trigonometric functions are also available, @asin, @acos, and @atan. Hyperbolic functions can also be represented in HYSYS, they use the form @sinh, @cosh, and @tanh. Logarithmic Functions. Represented in HYSYS with the following forms: @ln, @log, and @exp. Pi. Simply enter +pi to represent the number 3.1416....

Logical Operators
The HYSYS Spreadsheet supports Boolean logic, essentially a true/false logic. A true statement has a value of 1, and a false statement has a value of 0. For example, suppose that the cell A1 has a value of 10, and the cell A2 has a value of 5. If the logical statement +A1<A2 were entered into cell A3. The cell would display a value of 0 because the logic statement is false. The following logical operators can be used in Boolean logic statements: Equal to. Uses ==, e.g +A1==A2 Not Equal to. Uses !=, e.g. +A1!=A2 Greater than. Uses >, e.g. +A1>A2 Less than. Uses <, e.g. +A1<A2 Greater than or Equal to. Uses >=, e.g. +A1>=A2 Less than or Equal to. Uses <=, e.g. +A1<=A2

IF/THEN/ELSE Statements
The HYSYS Spreadsheet also supports the basic IF/THEN/ELSE Statement. The form of this statement is: @if (condition) then (if true) else (if false)
The else portion of the statement is not optional. An if/then statement is not valid.

The condition is a logical expression, such as B1<= 10. The if true represents what the cell will show if the condition is true; it can be a number or a formula. The if false represents what the cell will show if the condition is false; it can also be a number or a formula.

Event Scheduler & Spreadsheet

An example of the completed statement follows. @if (B1<=10) then (B1*2) else (B1/10)
Suppose that the value in cell B1 is 8. What will the IF/ THEN/ELSE Statement shown above calculate? _____________________________________

Building the Simulation


Open the HYSYS case, EventShed_Starter.hsc on the disk that was supplied with this module. Under normal operation, the flow into the vessel is controlled by FIC-100, the level is controlled by LIC-100 and the pressure is controlled by PIC-100. In this module, a series of events will be added to simulate the closing of the three control valves followed by a fire in the vicinity of the unit. When the pressure reaches the set pressure, the relief valve will open to relieve the pressure built up inside the system. A spreadsheet will be used to calculate the heat added to the vessel under fire conditions. The spreadsheet has been included in the starter case but no variables or calculations have been added.

Spreadsheet Variables and Equations


1. 2. 3. 4. 5. Position the cursor in cell B2 of the Fire Calculations Spreadsheet. Click the right mouse button. Select Import Variable from the drop-down menu. Select V-100 from the Object list. Select Vessel Diameter as the Variable.

10

Event Scheduler & Spreadsheet

6.

Click OK.
Figure 3

7.

Import the following variables into the Fire Calculations spreadsheet:


Object V-100 RV-100 To Tank Variable Vessel length or height Set Pressure Temperature

Spreadsheet formulas can be prefixed with either + or =. Logicals are prefixed with @.

Cell B3 B4 B6

8.
Cell B5 B7 B8

Add the following formulas to the Fire Calculations spreadsheet:


Variable Type Pressure Area Energy Purpose of Formula Converts the Set Pressure on the relief valve from absolute to gauge. Calculates the wetted area of the vessel. Determines the amount of energy to be applied to the vessel under fire conditions This logical operation determines whether the heat should be applied to the vessel.

Formula +b4-14.696 +(3.14*b3*b2)+2*3.14*(b2 ^2)/4*1.66 +21000*(b7^0.82)

D2

@if(b9=1)then(0)else(b8)

Energy

10

Event Scheduler & Spreadsheet

11

Figure 4

The heat input to the vessel is determined by equation A-2 from API Recommended Practice 521.

9.

The contents of cell D9 need to be exported to Q-Fire.

10. Place the cursor in D9 and press the right mouse button. 11. Select Export Formula Result from the drop-down menu. 12. Select Q-Fire as the object and Heat Flow as the variable. 13. Click OK. 14. Note that the value shown in cell B9 will be changed by the Event Scheduler. If it is equal to anything other than 1, the energy calculated in cell B8 will be exported to Q Fire via the logical expression in cell D2. Otherwise cell D2 exports a value of zero to Q Fire.

Adding the Event Scheduler


15. Open the Event Scheduler. On the Event Scheduler Manager view, click the Add button to create a new Schedule.
It is important to give all objects in the Even Scheduler logical names! This will make the Schedule easier for you and anyone else using your simulation to understand.

11

12

Event Scheduler & Spreadsheet

Figure 5

16. In the bottom right hand corner of the Schedule view, rename the new Schedule to Fire Relief Scenario. In the Schedule Sequences group, seven buttons allow you to organize all the Sequences for the current Schedule: View. Allows you to view the selected sequence. This is only active when a sequence exists in the schedule. Add. Allows you to add new sequence to the schedule. Delete. Allows you to delete the selected sequence. This is only active when a sequence exists in the schedule. Copy. Allows you to make a copy of the selected sequence. This is only active when a sequence exists in the schedule. Import. Allows you to import a saved sequence from disk. Are saved in *.seq format. Export. Allows you to export the selected sequence to disk. Once exported, a sequence can be retrieved using the Import button. This is only active when a sequence exists in the schedule. Sort. Allows you to arrange the sequences. This is only active when at least 2 sequences exist in the schedule.

12

Event Scheduler & Spreadsheet

13

The Sequence field contains the name of the Sequence. The Run Mode field displays the sequence mode, which can be either One Shot or Continuous. A One Shot Sequence executes all its Events in order and then its Status will change to Complete. A Continuous Sequence returns to the first Event after the last Event has been executed, in a continuous loop. The Event, Waiting For, and Pending Actions fields display the current event number with its corresponding Condition name and Action List name. 17. On the Schedule view, click the Add button to create a new sequence. 18. Rename the Sequence to Fire Relief.
Figure 6

The Schedule of Events tab shows the list of events for the schedule. The fields on this view are defined as follows: Specified. True/False indicates whether the event has been fully defined Condition. Displays the condition name of the event Action List. Shows the name of the events action list

13

14

Event Scheduler & Spreadsheet

Jump When. Displays whether the Event will Jump over any Events and, if so, under what condition Jump To. Displays the event to jump to.

At the bottom of the view the sequence name, current event number and sequence status are shown. If the event is not fully specified, the Analyze button is enabled and provides additional feedback. On the Settings tab, the sequence Run Mode is selected, a unit set global to the sequence can be chosen and different Status Window Reporting options are available. Selecting the Synchronize All Time Sensitive Conditions check box will assure execution of a particular event at an exact simulation time. This applies only when one of the two time conditions has been selected for the Event. Default Time Out Behaviour is specified here and applies to all the events unless a specific event overrides the behaviour. The Fire Relief Sequence created in this module will hold three Events to be executed at three predetermined times. The first on this list of events is the shutting of the three control valves. 19. On the Fire Relief sequence view, click the Add button to create a new Event. 20. In the Condition Name field, rename the condition Pre Fire Shutdown. 21. In the Wait For box, select the An Elapsed Amount of Time radio button. 22. In the Wait For field, enter 2 minutes.

14

Event Scheduler & Spreadsheet

15

Figure 7

23. Proceed to the Action List tab. Rename the action list Fire Shutdown. 24. Click the Add button to add a new action. 25. Name the action Close Flow Valve and select Set Controller Mode as a Type. 26. Click the Select Target button and select FIC-100. 27. Select Man from the New Mode drop-down box. This will put the controller in manual mode and allow you to set the OP to 0%, which will close VLV-100. 28. Activate the New OP check box and enter a new OP of 0%. 29. Add two more Actions, Close Level Control Valve and Close Pressure Control. In both cases, the action types to be selected are Set Controller Mode and the controllers should be put in manual mode and their respective OPs set to 0%.

15

16

Event Scheduler & Spreadsheet

Figure 8

30. Two additional Events should be added to the Fire Relief Sequence: Event 2
Purpose To start a simulated fire under V-100. This Event will change the value of cell B9 such that the logic in the spreadsheet will evaluate to false and the heat flow to V100 will be determined using the equations in the spreadsheet. Start Fire Elapsed Time = 10 min Start Fire Add Heat to Vessel Specify Variable Fire Calculations, B9 2 Name Type Target Value

Condition Name Condition Action List Name Action

Event 3
Purpose Once the vessel pressure has stabilized, the fire will be extinguished and the flow, pressure, and level controllers will be switched back on. Post Fire Pressure of V-100 is stable within specified bandwidth (+10%) for 30 minutes

Condition Name Condition

16

Event Scheduler & Spreadsheet

17

Action List Name Action Name Type Target Value Name Type Target New Mode New Setpoint Name Type Target New Mode New Setpoint Name Type Target New Mode New Setpoint

Post Fire Actions Fire Off Specified Variable Fire Calculations, B9 1 Level Controller On Set Controller Mode LIC-100 Auto 50% Pressure Controller On Set Controller Mode PIC-100 Auto 85 psia (586.1 kPa) Flow Controller On Set Controller Mode FIC-100 Auto 100 lbmol/h (45.36 kgmol/h)

31. Once all of the Events have been added, return to the Fire Relief Scenario Schedule view and press the Start button at the bottom of the view. This will activate the selected sequence. You should notice that the status of Fire Relief will change from Inactive to Waiting.

Save your case!


32. Start the Integrator. Be prepare to stop the Integrator as the system runs very quickly. Stop the Integrator once a steady state condition is reached. 33. Observe the strip charts, the controller face plates and the Trace window to see how the model behaves.

17

18

Event Scheduler & Spreadsheet

18

You might also like