Introduction to gPROMS ModelBuilder

35
1. The gPROMS ModelBuilder environment

Transcript of Introduction to gPROMS ModelBuilder

Page 1: Introduction to gPROMS ModelBuilder

1. The gPROMS ModelBuilder environment

Page 2: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The working environment of gPROMS

2

The ModelBuilder environmentcomprises four main sections

The menu bar

The tool bar

The project tree

The window area

Page 3: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The project tree

3

The project tree contains all of the entities that are required for the modelling activity. These are organised into three categories:

Library projects (blue folder icons) These are used to organise libraries of models We will not be using or developing libraries in

this course Working projects (yellow folders)

This is where you will keep all of your models and processes

Case projects (cyan folders) The results of any modelling activity –

simulation, optimisation etc.

Page 4: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The project tree – Working projects

4

The working projects may contain a number of entities, organised into several types. We will use:

Variable types (not shown) These are used to define properties of variables We will discuss these further in lesson 3

Models These are used to characterise the behaviour

of process equipment mostly using equations Processes

These define what models you want to use in a simulation and the specific details of the equipment and operation E.g. the volume of a reactor, flowrate and

temperature of the feed, length of operation

Page 5: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The project tree – Case projects

5

Case projects contain the results of a modelling activity:

Original entities A copy of everything that was used to create

the simulation Trajectories

The results of the simulation I.e. the values of all of the variables over

time They can be viewed as tables or graphs

directly in the ModelBuilder environment Execution output

This contains information about the solution of the problem

It is very useful for debugging!

Page 6: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The menu bar

6

File menu

The file menu has a list of fairly standard menu items, including:

New/Load/Save projects Workspaces

• ModelBuilder can remember sets of open projects and can load them automatically when you load a workspace

Printing options List of previously opened projects

Page 7: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The menu bar

7

Edit menu

The Edit menu also has several standard items:

Undo/Redo Cut/Copy/Paste/Delete Select all Find… search for a text string Go to… go to a line number

It also has some gPROMS-specific functions:

Properties Shows details about the selected entity

ModelBuilder preferences… Allows you to customise many aspects of

ModelBuilder

Page 8: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The menu bar

8

View menu

The View menu controls the visibility and appearance of some elements of the ModelBuilder environment:

Link with editor Links the editor window with the project tree

Project tree Palette

Shows the model palette: useful for flowsheeting Diagnostics console

Used in debugging – we shouldn’t need this Overview

Shows an overview of the flowsheet Collapse project tree

Collapses all the branches in the project tree File IO console – not useful at all!

Page 9: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The menu bar

9

Entity menu

The Entity menu has three main uses:

Create a new entity in the project tree A new Model, Process etc. This can also be done with the context menu

Check the syntax entity you’re working on This has a very useful keyboard shortcut: F4

Rename an entity This can also be done with the context menu

The other menu items won’t be needed in this course

Page 10: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The menu bar

10

The last four menu items are fairly straight forward:

Activities Used to perform a modelling activity on the

selected process: simulation, optimisation etc. Tools

There are many advanced features here Two very useful features:

Search and replace Compare (two models or two processes)

Window Organise windows – tile, switch windows etc.

Help The full gPROMS documentation List of gPROMS functions (very useful!)

Page 11: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The tool bar

11

The tool bar contains a set of commonly used tools (most of which are available in the menus). The useful ones are:

1. New/open/save project2. Cut/copy/paste3. Undo/redo4. Find5. Switch windows6. Check syntax7. Run an activity (simulation, optimisation etc.)

1 2

3

5

6

74

Page 12: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Workflow – Starting from scratch

• Create a new Project– Use the File menu or the button on the toolbar

• Create a new Model– Use the Entity menu or context menu (see slide 14)– Enter the code for the Model (this will be covered in lesson 3)

• In particular, you will need to declare Variables and these must be associated with Variable Types, so:

• Create new Variable types– Use the Entity menu or context menu (see slide 18)

12

Page 13: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Workflow – Starting from scratch

• Create a new Process– Use the Entity menu or context menu– Enter the code for the Process (also covered in lesson 3)

• Run a Simulation– Select the Process you want to simulate in the project tree– Use the Activities menu or press the button on the tool bar– Choose any further options in the dialog

• View the results using gRMS

13

Page 14: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating a new Model – menu bar

14

1. Choose New entity… from the menu

2. Select MODEL

3. Enter the nameof the Model

4. Uncheck if desired

5. Press OK

Page 15: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating a new Model – context menu

1. Left click on the Models folder2. Right click to enable the context menu3. Left click on New entity…

The rest is the same exceptMODEL is already selected, so:

4. Enter the name of the Model5. Uncheck if you don’t want a template6. Press OK

If checked, the Model will bepopulated with commentedcode that you can modify anduncomment

15

Page 16: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating a new Model – preliminaries

New Model window appears

Click the gPROM language tab to start editing

All new Models starton the Topology tab(for flowsheeting, whichwe will not be using)

16

Page 17: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating a new Model – preliminaries

Language tab withtemplate present –use as a starting pointfor your Model

Set default tab usingthe Properties tab(the Model will always openon the gPROMS language tab)

17

Page 18: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating new Variable Types

• Variable Types are created in two ways– The first time you want to create one, you have to use the

same method for creating Models:• Select New entity… from the Entity menu or• Right click on the Variable Types folder and select New entity…• Enter the name of the Variable Type in the dialog (the template check

box doesn’t do anything here)

– Once one Variable Type has been defined, it is easier to create new ones using the table view

• Double click on an existing Variable Type and the table of Variable Types will appear, allowing you to edit the one on which you double clicked

– You can also then browse the whole table, edit any of the existing Variable Types and add new ones at the bottom

18

Page 19: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Creating new Variable Types

Double click any cellto edit the value of anexisting Variable Type

Double click in this cell andenter a new name to add anew Variable Type

19

Page 20: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

The Process

• Add a new Process using the same method as for Models

• The Process contains all of the data required to perform the simulation– What Models you want to simulate– Values of Parameters– Values (or functions of time) for any degrees of freedom that

must be specified– Initial conditions– The amount of time you want to simulate

• We will cover what goes in a Process in lesson 4

20

Page 21: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Performing a simulation

• Select the Process you want to simulate– Select its window or– Select it in the project tree

• There are now four ways to start the simulation– Select Simulate selected… from the Activities menu– Press the button on the tool bar– Right click on the Process in the project tree and select

Simulate…– Press F5

• A new dialog appears where you can specify additional information

21

Page 22: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Performing a simulation

22

Choose a name for the CaseDefault is the name of the Processplus a date stamp

Choose where to send the results

Choose how often to send the results– must be small enough to show

interesting dynamics on the graphs

Press OK to proceed

Page 23: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

During a simulation

23

Information about the progress of the simulation is shownin this window. This is essential for debugging!

If you close it, the simulation willcontinue in the background.

Double click here toview again.

Page 24: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

During a simulation

24

Information about the progress of the simulationis shown in this window.

If you close it, the simulation will continue in the background.

Page 25: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

During a simulation

25

Cancel the simulation.This is extremely important – if your simulationcontinues to run indefinitely, then you must endit by pressing this button.

This is because gPROMShas to run on a commonserver and if too manyjobs are being run at thesame time, it may run outof memory. Should thishappen, users will not beable to save their workuntil the jobs are killed.

This happens every year!

Page 26: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Viewing results

• There are two main ways to display results of a simulation– Directly in gPROMS ModelBuilder

• Results are stored in the Case• View values of Variables as tables or graphs• Graphs are configured automatically – not much scope for

customisation• View stream tables

– Using gRMS• Results are stored in Processes• More flexible and much more customisable• Less automation• Better-looking results – much more suitable for use in reports

26

Page 27: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Viewing variable results in Case projects

27

Open up the Variablesfolder in the Case.

Double click on theVariable to plot.

The results, in tabularformat, are shown inthis new window.

Page 28: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Viewing variable results in Case projects

28

Choose which indepen-dent Variables to assignto each axis and whichto fix.

For most of our models,which will be lumped, wewon’t need to set this –default values are fine.

Clicking on the Graphtab displays a graph.

Page 29: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Saving results in Case projects

29

Right-click and choose Save or Save as… to save the CaseThis is worth doing once you have a working simulation becauseyou then have a backup of the models and process that wereused to produce the simulation – you can always go back to aworking project in case anything further developments do not work

Everything needed to recreate the results is stored here

Any entity can be copied into an existing Project, ora new project can be created by right clicking on the Case nameand choosing Create gPROMS project

Page 30: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Viewing results in gRMS

• Results are organised in Processes– receive data from gPROMS during activity execution– Management tools: open, save...

• Provides facilities for creating 2D & 3D plots– formatting tools and templates– management tools

• print, save, export• viewing and exporting data sets

30

Page 31: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Constructing a plot in gRMS (Windows)

31

Press the 2D button toadd a 2D plot.

Press the “line” buttonto start adding lines tothe plot.

Page 32: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Constructing a plot in gRMS (Windows)

32

Select the Variable to plot andpress the Add button (or double-click on the Variable).

Page 33: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Constructing a plot in gRMS (Windows)

33

In the new dialog, select whichindependent Variable should beassigned to each axis

Provide a label for the lineIf left blank, the full Variable pathname will be used, which is notsuitable for graphs that appear inreports

Select which y-axis to use

Press OKIf you change your mind, pressRemove; otherwise the line willstill be added to the graph

Page 34: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Constructing a plot in gRMS (Windows)

34

The graph with one line added

Axis titles need to be updated:- y axis needs a proper name and units- x axis needs units

Do this using the Format menu

Default legend label is not good- change it using the Line menu:

select the Variable and chooseProperties…- this is the 2D Line Properties

Dialog shown on the last slide

In this case, since there is only oneline, the legend can be disabled usingthe Format menu

Page 35: Introduction to gPROMS ModelBuilder

The gPROMS ModelBuilder environment

Other useful features

35

Other plot types are 3D and x-y, where you plot one variableagainst another (rather than against time or a spatial coordinate)

Open a Template

This applies a savedgraph layout (i.e. all ofthe settings for lines,axes, titles etc.) to anew simulation.

The Graph menu is used to save a templateusing the settings of the selected graphor apply these setting immediately to a newset of results

The Edit menu allows you to copya graph to the clipboard (and then,e.g., paste into a report)

The Graph menu also contains manyother commands. The useful onesare: Export Data…, Export Image…and Print…

The Process menu allows you toorganise the results of gPROMSSimulations (stored in processes):save any process, close unwantedones, load saved processes etc.