09_eventschedulerandspreadsheet

Upload: kajer-quemar

Post on 04-Jun-2018

228 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    1/18

    Event Scheduler & Spreadsheet 1

    1

    Event Scheduler & Spreadsheet

    2004Aspen Technology. - All Rights Reserved.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    2/18

    2 Event Scheduler & Spreadsheet

    2

    WorkshopWith 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 variablecan 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

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    3/18

    ProcessOverview

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    4/18

    4 Event Scheduler & Spreadsheet

    4

    Event Scheduler ManagerThe 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 variousitems:

    The Event Scheduler is accessed from the Simulation Menu Bar, or by

    using the hot key CTRLE. When you open the Event Scheduler, HYSYS

    displays the Event Scheduler Manager, which contains a list of the

    Schedules in the case.

    Figure 1

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    5/18

    Event Scheduler & Spreadsheet 5

    5

    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 onlyactive 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 onlyactive when a schedule exists in the case.

    Copy. Allows you to make a copy of the selected schedule. this isonly 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. Onceexported, 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 activewhen at least 2 schedules exist in the case.

    The Specified field in the matrix indicates whether all the Events in theSchedule 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.

    Figure 2

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    6/18

    6 Event Scheduler & Spreadsheet

    6

    The HYSYS SpreadsheetThe 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 vice-

    versa. 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; thenpress and hold the right mouse button. Move the cursor over tothe Spreadsheet. Once over the Spreadsheet, the cursor'sappearance will change to a bulls eye type. Release the rightmouse button when the bulls eye cursor is over the desired cell.The specific information about the imported variable will appearin the Current Cell group.

    Variable Browsing. A variable may also be imported into theSpreadsheet by placing the cursor on an empty cell in theSpreadsheet and pressing (and releasing) the r ight mousebutton. Choose Import Variable from the list that appears, andselect the variable using the Variable Navigator.

    Connections Page. On the Connections page, press the Add

    Import button and select the desired variable using the VariableNavigator. After selecting the variable, choose the desired cellfrom the drop-down list.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    7/18

    Event Scheduler & Spreadsheet 7

    7

    Exporting variables from the Spreadsheet into the Simulationenvironment is also a simple procedure. The methods for doing this are

    very similar:

    Drag-and-Drop. Position the cursor over the Spreadsheet cellthat is to be exported. Press and hold the right mouse button; thecursor should now change to the bulls eye type. Move thebull's eye cursor over to the desired cell. Release the rightmouse button, the transfer should be completed.

    Variable Browsing. A variable may be exported from theSpreadsheet into the Simulation environment by placing thecursor on the exportable cell in the Spreadsheet and pressing(and releasing) the right mouse button. Choose Export FormulaResult from the list that appears, and select the desired location

    Connections Page. On the Connections page, click the AddExport button and select the desired variable using the VariableNavigator. After selecting the variable, choose the desired cellfrom the Drop Down list.

    Adding Spreadsheet Functions

    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!

    SquareRoot. Uses the @SQRT function, e.g @SQRT(A2)

    The value of anyspreadsheet cell can be

    exported, except if it is animported value.

    To view the availableHYSYS functions at any

    time, click the FunctionHelp button.

    A cells numerical value canbe copied to another cell byusing a simple formula (e.g.=A1).

    Parenthesis are mandatoryin many of the advancedspreadsheet functions andcan also be used todesignate calculation order.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    8/18

    8 Event Scheduler & Spreadsheet

    8

    Sine, Cosine, and Tangent. Use the @sin, @cos, and @tanfunctions, e.g @sin(A2). Inverse trigonometric functions are alsoavailable, @asin, @acos, and @atan. Hyperbolic functions canalso be represented in HYSYS, they use the form @sinh, @cosh,and @tanh.

    Logarithmic Functions. Represented in HYSYS with thefollowing 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 valueof 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, e.g. +A1>A2

    Less than. Uses =A2 Less than or Equal to. Uses

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    9/18

    Event Scheduler & Spreadsheet 9

    9

    An example of the completed statement follows.

    @if (B1

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    10/18

    10 Event Scheduler & Spreadsheet

    10

    6. Click OK.

    7. Import the following variables into the Fire Calculationsspreadsheet:

    8. Add the following formulas to the Fire Calculations spreadsheet:

    Figure 3

    Cell Object Variable

    B3 V-100 Vessel length or height

    B4 RV-100 Set Pressure

    B6 To Tank Temperature

    Cell Formula Variable Type Purpose of Formula

    B5 +b4-14.696 Pressure Converts the Set Pressure on therelief valve from absolute to gauge.

    B7 +(3.14*b3*b2)+2*3.14*(b2^2)/4*1.66

    Area Calculates the wetted area of thevessel.

    B8 +21000*(b7^0.82) Energy Determines the amount of energy tobe applied to the vessel under fireconditions

    D2 @if(b9=1)then(0)else(b8) Energy This logical operation determineswhether the heat should be appliedto the vessel.

    Spreadsheet formulas canbe prefixed with either + or=. Logicals are prefixedwith @.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    11/18

    Event Scheduler & Spreadsheet 11

    11

    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 Resultfrom the drop-down menu.

    12. Select Q-Fireas the object and Heat Flowas 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 energycalculated in cell B8 will be exported to Q Fire via the logicalexpression in cell D2. Otherwise cell D2 exports a value of zero to QFire.

    Adding the Event Scheduler

    15. Open the Event Scheduler. On the Event Scheduler Manager view,click theAddbutton to create a new Schedule.

    Figure 4

    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 yoursimulation to understand.

    The heat input to the vesselis determined by equationA-2 from APIRecommended Practice521.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    12/18

    12 Event Scheduler & Spreadsheet

    12

    16. In the bottom right hand corner of the Schedule view, rename thenew 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 onlyactive 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 onlyactive when a sequence exists in the schedule.

    Copy. Allows you to make a copy of the selected sequence. Thisis only active when a sequence exists in the schedule.

    Import. Allows you to import a saved sequence from disk. Aresaved in *.seq format.

    Export. Allows you to export the selected sequence to disk. Onceexported, 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 activewhen at least 2 sequences exist in the schedule.

    Figure 5

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    13/18

    Event Scheduler & Spreadsheet 13

    13

    The Sequence field contains the name of the Sequence. The Run Modefield 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 theAddbutton to create a newsequence.

    18. Rename the Sequence to Fire Relief.

    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 fullydefined

    Condition. Displays the condition name of the event

    Action List. Shows the name of the events action list

    Figure 6

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    14/18

    14 Event Scheduler & Spreadsheet

    14

    Jump When. Displays whether the Event will Jump over anyEvents 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 Behaviouris 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 theAddbutton to create anew Event.

    20. In the Condition Name field, rename the condition Pre FireShutdown.

    21. In the Wait For box, select theAn Elapsed Amount of Timeradiobutton.

    22. In the Wait For field, enter 2 minutes.

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    15/18

    Event Scheduler & Spreadsheet 15

    15

    23. Proceed to theAction Listtab. Rename the action list FireShutdown.

    24. Click theAddbutton to add a new action.

    25. Name the action Close Flow Valveand select Set Controller Modeas a Type.

    26. Click the Select Target button and select FIC-100.

    27. Select Manfrom the New Mode drop-down box. This will put thecontroller 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 PressureControl. In both cases, the action types to be selected are SetController Modeand the controllers should be put in manual modeand their respective OPs set to 0%.

    Figure 7

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    16/18

    16 Event Scheduler & Spreadsheet

    16

    30. Two additional Events should be added to the Fire Relief Sequence:

    Event 2

    Event 3

    Figure 8

    Purpose To start a simulated fire under V-100. This Event willchange the value of cell B9 such that the logic in the

    spreadsheet will evaluate to false and the heat flow to V-100 will be determined using the equations in thespreadsheet.

    Condition Name Start Fire

    Condition Elapsed Time = 10 min

    Action List Name Start Fire

    Action Name Add Heat to Vessel

    Type Specify Variable

    Target Fire Calculations, B9

    Value 2

    Purpose Once the vessel pressure has stabilized, the fire willbe extinguished and the flow, pressure, and levelcontrollers will be switched back on.

    Condition Name Post Fire

    Condition Pressure of V-100 is stable within specified bandwidth(+10%) for 30 minutes

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    17/18

    Event Scheduler & Spreadsheet 17

    17

    31. Once all of the Events have been added, return to the Fire ReliefScenario Schedule view and press the Start button at the bottom ofthe view. This will activate the selected sequence. You should notice

    that the status of Fire Relief will change from Inactive to Waiting.

    32. Start the Integrator. Be prepare to stop the Integrator as the systemruns very quickly. Stop the Integrator once a steady state conditionis reached.

    33. Observe the strip charts, the controller face plates and the Tracewindow to see how the model behaves.

    Action List Name Post Fire ActionsAction Name Fire Off

    Type Specified Variable

    Target Fire Calculations, B9

    Value 1

    Name Level Controller On

    Type Set Controller Mode

    Target LIC-100

    New Mode Auto

    New Setpoint 50%

    Name Pressure Controller On

    Type Set Controller Mode

    Target PIC-100

    New Mode Auto

    New Setpoint 85 psia (586.1 kPa)

    Name Flow Controller On

    Type Set Controller Mode

    Target FIC-100

    New Mode Auto

    New Setpoint 100 lbmol/h (45.36 kgmol/h)

    Save your case!

  • 8/13/2019 09_EventSchedulerAndSpreadsheet

    18/18

    18 Event Scheduler & Spreadsheet

    18