You are on page 1of 71

SimSci™

SimCentral™ Simulation Platform

Model Writing Guide

Version 3.2
March 2019
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

No part of this documentation shall be reproduced, stored in a ret rieval system, or transmitted by any
means, electronic, mechanical, photocopying, rec ording, or otherwise, without the prior written
permission of AVEVA. No liability is assumed with respect to the use of the information contained herein.
Although precaution has been taken in the preparation o f this documentation, AVEVA assumes no
responsibility for errors or omissions. The information in this documentation is subject to change without
notice and does not represent a commitment on the part of AVEVA. The soft ware described in this
documentation is furnished under a license agreement. This soft ware may be used or copied only in
accordance with the terms of such license agreement.
ArchestrA, Aquis, Avantis, Citect, DYNSIM, eDNA, EYESIM, InBatch, InduSoft, InStep, Int elaTrac,
InTouch, OASyS, PIPEPHASE, PRiSM, PRO/II, PROV ISION, ROMeo, SIM4ME, SimCentral, SimSci,
Skelta, SmartGlance, Spiral Software, Termis, WindowMaker, WindowViewer, and Wonderware are
trademarks of AVEVA and/or its subsidiaries. An extensive listing of AVEVA trademarks can be found at:
https://sw.aveva.com/legal. All other brands may be trademarks of their respective owners.
Publication date: Monday, March 18, 2019
Contact Information
AVEVA Group plc
High Cross
Madingley Road
Cambridge
CB3 0HB. UK
https://sw.aveva.com/
For information on how to cont act sales, customer training, and technical support, see
https://sw.aveva.com/contact.
Acknowledgements
CSPARSE
To analyze and report proper variable specification, SimCent ral Simulation Platform makes use of
CSPARSE, a library of direct methods for sparse linear systems by Timothy Davis. CSPARSE is free
software and is distribut ed under the GNU Lesser General Public License
(http://www.gnu.org/licenses/lgpl.html) as published by the Free Software Foundation.
The source code for CSPARSE is available at
http://people.sc.fsu.edu/~jburkardt/c_src/csparse/csparse.html.
KLU
SimCent ral Simulation Platform us es KLU as its linear equation solver. KLU is an open-source solver
package with a focus on solving sparse linear systems of equations. Timothy A. Davis distributes K LU as
part of the SuiteSparse software (http://www.suitesparse.com) under the GNU Lesser General Public
License and a University of Florida copyright.
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Contents
Acknowledgements .................................................................................................................. 3
Chapter 1 Introduction to Model Writing............................................................................. 7
Chapter 2 Getting Started..................................................................................................... 9
Chapter 3 Roles ................................................................................................................... 11
Filtering Capabilities by Role.................................................................................................... 11
Opening the Roles Manager .............................................................................................. 11
Creating or Modifying a Role .............................................................................................. 11
Creating a Quick Filter for a Role ........................................................................................ 12
Viewing a Hidden Model, Submodel or Port .............................................................................. 13

Chapter 4 Model Library ..................................................................................................... 15


Managing Model Libraries........................................................................................................ 16
Importing and Exporting Model Libraries ................................................................................... 16
Managing Model, Fluid, and Port Types .................................................................................... 17
Writing Documentation ............................................................................................................ 19
Showing and Hiding Model Libraries ........................................................................................ 20

Chapter 5 Model Editor ....................................................................................................... 21


Opening the Model Editor ........................................................................................................ 22
Adding a Variable to a Model Type or Port Type ....................................................................... 22
Adding an Equation to a Model Type ........................................................................................ 23
Adding a Real Parameter to a Model Type ................................................................................ 24
Managing Enumerat ed Paramet ers .......................................................................................... 24
Tearing Variables in an Equation ............................................................................................. 25
Changing Variable Properties Using Conditions ........................................................................ 25
Connecting P arameters (Configuring a Fluid State Submodel) ................................................... 27
Connecting V ariables .............................................................................................................. 28
Connecting P orts .................................................................................................................... 29
Defining Favorite Variables and Parameters ............................................................................. 30
Defining Invariant Parameters and Variables ............................................................................ 30
Defining Global Parameters and Variables ................................................................................ 31
Returning to Previously Specified Invariant Values .................................................................... 31
Adding a Model Type as a Submodel ....................................................................................... 32
Assigning a Default Fluid Ty pe to a Model ................................................................................ 32

Version 3.2 5
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Contents

Using Fluid Type Parameters as Default Values ........................................................................ 33


Clearing a Default Enumerated or Fluid Type Parameter ........................................................... 33
Adding a Port to a Model Type ................................................................................................. 33
Adding a Multi-Port.................................................................................................................. 34
Connecting to a Model with Multiple Ports................................................................................. 34
Adding a Condition to a Model Type ......................................................................................... 38
Adding Multiple Thermodynamics Components to a Model ........................................................ 39
Creating Custom Messages ..................................................................................................... 40
Operators for Custom Messages .............................................................................................. 41
Examples and Limitations of Logical Statements for Custom Messages ...................................... 42
Associating an Icon with a Model Type ..................................................................................... 43
Defining a Conditional Icon ...................................................................................................... 44
Hiding a Model or Port ............................................................................................................. 45

Chapter 6 Groups ................................................................................................................ 47


Creating and Configuring a Group ............................................................................................ 47
Adding Variables and Parameters to a Group ........................................................................... 48
Adding Submodel Variables and Parameters to a Group ........................................................... 48

Chapter 7 Port Editor........................................................................................................... 51


Opening the Port Editor ........................................................................................................... 52
Adding a Variable to a Model Type or Port Type ....................................................................... 52
Associating a New Icon with a Model Type, Fluid Type, or Port Type .......................................... 53
Defining Connector Prefix Naming and Numbering .................................................................... 54

Operators and Functions....................................................................................................... 55


Condition Operators ................................................................................................................ 55
Equation Operat ors ................................................................................................................. 55
Equation Functions ................................................................................................................. 56
Flow Square Root ................................................................................................................... 59

Model Writing Best Practices ............................................................................................... 61


Writing Models for B ackwards Mode Transition ......................................................................... 61
Writing Equations for Robust Solving ........................................................................................ 62

Glossary of Terms .................................................................................................................. 65

6 Version 3.2
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 1
Introduction to Model Writing
Model Writing Characteristics and Advantages
SimCent ral Simulation Platform offers you the following characteristics and advant ages:
 Allows you to modify existing Model Ty pes and create custom Model Types for new processes
 Allows you to organize models in Model Libraries so that you can share them with other us ers
 Allows you to define variables and equations in models that represent chemical proc ess equipment.

Version 3.2 7
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 2
Getting Started
This section provides a high-level overview on using SimCentral Simulation Plat form to write custom
models. It refers to the various concepts and topics in this document.
For information on building simulations, refer to the SimCent ral Simulation Platform Simulation Building
Guide.
Defining Your Role
Based on your Filtering Capabilities by Role on page 11, you can begin writing Models or creating
Simulations. When you select a Role, certain elements will be filtered out of the UI. You can creat e a
custom Role or switch Roles using the Role Manager.
Writing Models
You can write custom Models and save them to a Model Library in the Repository.
Understanding the Model Writing Components
The Model Library is where SimCentral Simulation Platform stores Model Types, Fluid Types, Port
Types, and Curve Types. The Model Library is housed within a Repository that is specific to your user
account on your local machine. You can access one or more Model Libraries to build a single simulation.
One of the key benefits of a Model Library is that you can work with other people to create and share
custom, company-specific Model Types that contain propriet ary equations. See Model Library on page
15 for more information.
The Model Editor is where you create and modify Model Types representing process equipment,
controls, and other mathematical relationships. You can create custom, company -specific Model Types
that include proprietary equations and save them to Model Libraries stored in the Repository. The Model
Editor allows you to define variables and equations in Model Types that mathematically represent
chemical process relationships. See Model Editor (on page 21) for more information.
The Port Editor is where you create and edit Port Types, which are used inside Model Types to define
how the model can be connected to other models on the Canvas. If you create new Model Types, you
can use the Port Type included with SimCentral to define input and output ports used for process stream
connections. If no suitable Port Type exists, you can create a new P ort Type. When y ou edit a P ort Type,
you can specify a name, variables and their types, the Canvas connection (line) style to use, and a
description. The variables defined in the Port Type define the specific information that will be transferred
between models when they are connected on the Canvas. See Port Editor on page 51 for more
information.
The Fluid Editor is where you modify Fluid Types representing the fluids used in your simulation. A Fluid
Type describes the thermodynamic behavior assigned to model instances in a simulation. You can copy
existing Fluid Types and edit them to create custom Fluid Types that include the default conditions of the
fluid and the equations of state that represent the fluid properties, and save them to Model Libraries
stored in the Repository or to a Simulation -specific Model Library. See Fluid Editor in the SimSci
SimCent ral Simulation Platform Simulation Building Guide for more information.
The Curve Editor is where you create independent and dependent variables that you can use for a pump
performance curve. A curve is tabular data with interpolations bet ween the points defined. The
independent variable(s) that you define are on the horizontal axis; for example, flow. The dependent
variable(s) that you define are plotted on the chart; for example, head or efficiency. See Curve Editor in
the SimSci SimCentral Simulation Platform Simulation Building Guide for more information.

Version 3.2 9
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Getting Started

Saving Your Work


When you make a change to a model or simulation, it is automatically saved to the Repository.
Sample Model Writing Tasks
The following list includes a selection of basic Model Writing tasks:
 Managing Model Libraries on page 16
 Managing Model, Fluid, and Port Types on page 17
 Adding a Variable to a Model Type or Port Type on page 22
 Adding an Equation to a Model Type on page 23
 Adding a Real Parameter to a Model Type on page 24
 Connecting P arameters (Configuring a Fluid State Submodel) on page 27
 Adding a Port to a Model Type on page 33
 Adding a Model Type as a Submodel on page 32

10 Version 3.2
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 3
Roles
This chapter describes how you can select a specific role and filter out content that is not relevant to you.

In This Chapter
Filtering Capabilities by Role ......................................................................................................... 11
Viewing a Hidden Model, Submodel or Port .................................................................................... 13

Filtering Capabilities by Role


SimCent ral Simulation Platform uses roles to hide unnecessary detail and capabilities that you will likely
not need. You can change your role selection, or remove role filtering at a later time, from the Start tab.
SimCent ral Simulation Platform comes with three built-in roles:
 No Role: For users who will be writing models and writing simulations.
 Simulation Building: For users who will be using existing Model Libraries to build and solve
simulations
 Model Writing: For users who will be creating or modifying Model Types in Model Libraries
To select a role:
Click the Start tab and select a different role from the Roles section. If you do not want to define a role,
you can select No Role.

If you select a task-specific role, the capabilities of SimCentral Simulation Platform outside of the role will
be filtered out.
When you create a role, it is saved in the <drive>:\ProgramData\SimSci\Custom directory, and will be
retained if you uninstall and reinstall SimCentral Simulation Platform.

Opening the Roles Manager


To display the Roles Manager:
1. Click the Start tab.

2. In the Roles group, click Create and modify Roles .

Creating or Modifying a Role


You can create or modify a role to hide unnecessary detail and capabilities you will likely not perform.

Version 3.2 11
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Roles

To create or modify a role:


1. Open the Roles Manager.

2. Click or select an existing role.

3. Enter the Name of the role.


4. Select the appropriat e check box to show the Process tab, Fluid Flow tab, or Dynamics tab in the
user interface.
5. Select the appropriat e check box to show editing options for Model Library help and properties.
6. Select the appropriat e check box to show hidden Model Types in the Library Manager.
7. Select the appropriat e check box to allow editing in the Model Library.
8. Select the appropriat e check box to display only favorites in your simulation.
9. Click the Sim Manager Filter list, and select Simulation Building, Model Writing, the name of a
previously saved filter, or Create Filter.
 If you select Simulation Building, Model Writing, or a previously saved filter, the settings for
the role will automatically be applied to the Simulation Manager view. You may then close the
Roles Manager.
 If you select Create Filter, refer to Creating a Quick Filter for a Role on page 12. After creating
your Quick Filter, select it from the Sim Manager Filter list for your new role.

Creating a Quick Filter for a Role


The Simulation Manager Quick Filter can be used to configure what is shown by the Simulation Manager,
based on your chosen role.

12 Version 3.2
Roles SimSci™ SimCentral™ Simulation Platform Model Writing Guide

To create a new Quick Filter for a role:


1. From within the Roles Manager, click the drop-down field in the Sim Manager Filter column to which
you want to apply a filter and select Create Filter.... The Quick Filter dialog displays:

Note: If you do not see the options shown above, first select an existing Quick Filter from the
drop-down at the top of the Quick Filter dialog.

2. Define your filter:


a. Check a category's checkbox to include all items within that category, or uncheck to hide them.
b. To include or exclude specific items, expand a category by clicking the chevron (>) first. You may
then select individual items within that category for inclusion or exclusion.
c. You may also check the box marked Show/Hide All to display all item types regardless of other
selections/checkboxes, or uncheck it to rely on the individual selections below it.
3. Enter a name for this Quick Filter in the Save Quick Filter as: text box.
4. Click Save.
Your Quick Filter is now ready to be applied to the Simulation Manager based on the role from the Roles
Manager's Sim Manager Filter drop-down.

Viewing a Hidden Model, Submodel or Port


The Roles Manager allows you to show or hide a specific model, submodel, or port in the Model Library
that is marked as hidden in the Model Editor or Port Editor.
To view a hidden model, submodel or port:
1. Launch the Roles Manager from the application ribbon.

2. Select the role for which you want to view a model, submodel or port, and ensure that the
checkbox is checked.

Version 3.2 13
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 4
Model Library
About the Model Library
The Model Library is where Model Types, Fluid Types, and Port Types are stored. The Model Library is
housed within the Repository on your local machine. You can access one or more Model Libraries to
build a single Simulation. One of the key benefits of a M odel Library is that you can work with other
people to create and share custom, company-specific Model Types that contain proprietary Equations.
The information housed in the Model Library is current and always accessible by you and those working
within the same Repository.

Concepts
 Multiple people can contribute to a Model Library
 Standard Model Libraries store SimSci-designed Model Types, Fluid Types, and Port Types shipped
with the product, and those that you customize or create from scratch
 You can access multiple Model Libraries to build a single Simulation
 You can copy a Model Type, Fluid Type, or Port Type from one Model Library to another
 Changes you make are aut omatically saved to the Model Library in the Repository, and are
automatically propagated to all Simulations that use them
Actions
 Create, delete, rename, copy and paste a Model Type, Port Type or Fluid Type
 Import and Export a Model Library
 Add a Model, Fluid or Port Type to a Simulation

In This Chapter
Managing Model Libraries ............................................................................................................. 16
Importing and Exporting Model Libraries ........................................................................................ 16
Managing Model, Fluid, and Port Types ......................................................................................... 17
Writing Documentation .................................................................................................................. 19
Showing and Hiding Model Libraries .............................................................................................. 20

Version 3.2 15
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Library

Managing Model Libraries


This section describes creating, renaming, deleting, and organizing Model Libraries.

Activity Directions

Creating a Model Library


Click beside an existing Model Library.

Renaming a Model Library Right -click a Model Library and select Rename
Library.

Deleting a Model Library Right -click a Model Library and select Delete
Library.

Example: Deleting a Model Library


1. Display the Model Library.
2. Right -click a Model Library, and then click Delete Library.

3. Click Yes on the dialog that displays.


If you delete a Model Library from a shared Repository, it will no longer be available to other us ers.
Ensure that the Model Library you want to delete does not contain Model Types that may be required by
other users.

Importing and Exporting Model Libraries


This section describes importing and exporting Model Libraries. Both options are available from the
Model Library pane.

16 Version 3.2
Model Library SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Activity Directions

Exporting a Model Library Right -click a Model Library, and then click Export
Library. Choose a location and filename for the
exported XML file.

Importing a Model Library


Right -click the button next to an existing
Model Library, then click Import Library. Choose
the Library XML file from the provided file
browser.
If the Library you are importing already exists, you
will be prompted and the Library will be given a
different name.

Example: Exporting a Model Library


1. Right -click a Model Library and select Export Library.

2. Define the folder where you want to export the library to, give the Model Library a name, and click
Save.

Managing Model, Fluid, and Port Types


This section describes creating, copying, renaming, deleting, and organizing Model Types, Fluid Types,
and P ort Types; and adding Model Ty pes, Fluid Types and Port Types to a simulation. Thes e actions are
available from the Model Library pane.

Activity Directions

Creating Model Types Right -click a blank space in the Model Library
pane, and then click Create New Model.

Creating Port Ty pes Right -click a blank space in the Model Library
pane, and then click Create New Port.

Version 3.2 17
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Library

Activity Directions

Creating Fluid Types Right -click a blank space in the Model Library
pane, and then click Create New Fluid.

Renaming Model, Fluid and Port Types Right -click the Type you wish to rename, and then
click Rename. Enter a new name, and press
Enter.

Deleting Model, Fluid and Port Types Right -click the Type you wish to delet e, and then
click Delete.

Reordering Model, Fluid and Port Types Click and drag a Model Type, Fluid Type or Port
Type to a new location in the Model Library

Adding Model Ty pes to a simulation Click and drag the Type ont o the simulation
Canvas.

Changing the order of the Model, Fluid and Port Click and drag the Type to the desired position.
Types

Copying Model, Fluid and Port Types to Another Click and drag the Type in the source Model
Model Library Library and drag it to the destination Model Library

Copying Model, Fluid and Port Types to the Same Click a Model Type, Fluid Type or Port Type,
Model Library press the CTRL key and drag the Model

Replacing a Model on the simulation Canvas with From the Model Library, click and drag the Model
another Model Type Type on top of the model on the Canvas. Click
Ye s when prompted.

Note s: When you make a change to a Model Type, Fluid Type or Port Type, it is automatically saved to
the Model Library and, subsequently, the Repository. Since the Model Library you are working in may be
accessible by a number of users, it is important to ensure that you do not delete a Model Type, Fluid Type
or Port Type that may be referenced in ot her simulations.
Model, Port and Fluid Types that have a bad status will have a red exclamation (!) badge overlaid on
them in the Model Library. You can still drag and drop the type onto the canvas and work with a model as
you normally would. If you correct the error(s) associated with the type, the badge will disappear.

Example: Creating a Model Type


From the Model Library pane:
1. Right -click a blank space in the Model Library pane, and from the menu that displays, select Create
New Model. A new model with a placeholder name will be created; for example, Custom1.
2. To rename the Model Type, simply select it in the Model Library, and enter a new name.
3. To modify the properties of the model, right-click it in the Model Library, and from the menu that
displays, select Edit.
The Model Type will be created and automatically persisted to the Model Library.

18 Version 3.2
Model Library SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Example: Adding a Model Type to a Simulation


From the Model Library pane, select a library, and drag the Model Type you want to add to a simulation
onto the simulation Canvas.

Writing Documentation
If you are running SimCentral Simulation Plat form with the Model Writing role, you can write Model
Library and model-specific documentation, and save what you write with your Model Libraries and
models. If you are running SimCent ral Simulation Platform with the Simulation Building role, you will be
able to view the documentation, but not edit it.
It is important to note that any documentation you write in the documentation editor will not be mirrored in
the online help shipped with SimCentral Simulation Plat form; documentation you write is direct ly saved
with the Model Library or model you choose to edit.
To view or modify Model Library or model-specific help:
1. Right -click on one of the Model Libraries or models shipped with SimCent ral Simulation Platform and
select Help.
The Help dialog displays:

1. To edit the help, ensure that you the Model Writing mode is enabled, and click the Pencil icon.

Version 3.2 19
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Library

The Help dialog displays:

2. Make your changes in the Help Editor. You can change the font, style and layout of the
documentation you write in addition to adding links and images.
3. Click the Save icon.
4. Close the editor.
The next time you load the Model Library or model, the help you wrote will display.

Showing and Hiding Model Libraries


You can show or hide Model Libraries in your simulation. This allows you to quickly access the libraries
that you use most often and hide libraries that you rarely use. Typically, you should use as few libraries
as possible for a single simulation.
Note that if all the models in the Model Library are hidden from simulation builders, you cannot show the
Model Library when you are working under the Simulation Building role. See Hiding a Model or Port on
page 45 for more information.
To show or hide Model Libraries:
1. On the Model Library pane, right-click the tab for a Model Library, and then click Show/Hide
Library. The Show/Hide Library dialog box appears.
2. Select or clear the Show check box for the appropriate Model Library.

20 Version 3.2
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 5
Model Editor
About the Model Editor
The Model Editor is where you create and modify Model Types representing process equipment,
controls, and other mathematical relationships. You can create custom, company -specific Model Types
that include proprietary Equations and save them to Model Libraries stored in the Repository. The Model
Editor allows you to define variables and Equations in Model Types that represent chemical process
models.

Concepts
 You can define new Model Types using the Model Editor if no suitable model exists
 You can modify an existing SimSci Model Type to make slight changes to fit your specific
requirements
 Model Types are stored in Model Libraries
 You can build complex Model Types out of smaller Model Types by adding them as submodels
 Changes you make to a Model Type are automatically propagated to all simulations in which the
Model Type is used
 Changes you make to a Model Type are automatically saved
Actions
 Import an icon and associate it with a Model Type
 Add variables based on Variable Types which define their units of measure
 Define how variables are automatically specified for Proc ess, Fluid Flow and Dynamics simulation
Modes
 Add equations that define mathematical relationships
 Add a Model Type as a submodel to make more complex Model Types
 Add a Port to a Model Type to define how the Model Type connects to other Model Types
 Add time derivative equations so that you can model dynamic behavior
 Add enumerated parameters and conditions to create optional or configurable Model Type behavior

Version 3.2 21
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

 Copy equations from one Model Type to another

In This Chapter
Opening the Model Editor .............................................................................................................. 22
Adding a Variable to a Model Type or Port Type ............................................................................. 22
Adding an Equation to a Model Type .............................................................................................. 23
Adding a Real Parameter to a Model Type ..................................................................................... 24
Managing Enumerat ed Paramet ers ................................................................................................ 24
Tearing Variables in an Equation ................................................................................................... 25
Changing Variable Properties Using Conditions .............................................................................. 25
Connecting P arameters (Configuring a Fluid State Submodel) ......................................................... 27
Connecting V ariables .................................................................................................................... 28
Connecting P orts .......................................................................................................................... 29
Defining Favorite Variables and Parameters ................................................................................... 30
Defining Invariant Parameters and Variables .................................................................................. 30
Defining Global Parameters and Variables ..................................................................................... 31
Returning to Previously Specified Invariant Values .......................................................................... 31
Adding a Model Type as a Submodel ............................................................................................. 32
Assigning a Default Fluid Ty pe to a Model ...................................................................................... 32
Using Fluid Type Parameters as Default Values ............................................................................. 33
Clearing a Default Enumerated or Fluid Type Parameter ................................................................. 33
Adding a Port to a Model Type....................................................................................................... 33
Adding a Multi-Port ....................................................................................................................... 34
Connecting to a Model with Multiple Ports ...................................................................................... 34
Adding a Condition to a Model Type............................................................................................... 38
Adding Multiple Thermodynamics Components to a Model .............................................................. 39
Creating Custom Messages .......................................................................................................... 40
Operators for Custom Messages ................................................................................................... 41
Examples and Limitations of Logical Statements for Custom Messages ........................................... 42
Associating an Icon with a Model Type........................................................................................... 43
Defining a Conditional Icon ............................................................................................................ 44
Hiding a Model or Port .................................................................................................................. 45

Opening the Model Editor


To open the Model Editor:
1. Browse to the Model Library.
2. Right -click a Model Type and select Edit.
The Model Editor will display.

Adding a Variable to a Model Type or Port Type


You can add a variable to a Model Type or Port Ty pe in the Model Editor or Port Editor, associate a
condition with it, and specify it for particular Simulation Modes.
To add a variable:
1. Open the Model Editor or the Port Editor for the Model Ty pe or Port Type, respectively.
2. Expand the Variables section.

3. Click the button.


4. Select the Condition name, if applicable. Refer to Adding a Condition to a Model Type on page 38
for more information on conditions.

22 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

5. Change the variable Name from the default name.


6. Select the variable Type to define the unit of meas ure. This will also set the default, min, and max
values, which you may change.
7. Define if the variable should be invariant. See Defining Invariant Parameters and Variables on page
30.
8. Define if the variable should be global. See Defining Global Parameters and Variables on page 31.
9. Enter the Default value to be used when you first place the Model Type in a simulatio n.
10. Select a Dimension if you want to change the variable to an array.
11. Enter the Min and Max values of the variable or accept the Variable Type default values.

12. Check the (Process Mode), (Fluid Flow Mode) or (Dynamics Mode) check boxes if
you want to specify the variable for a Simulation Mode. Unchecked boxes are calculated.
13. Define if any of the simulation mode specifications should be locked. When locked, the specification
cannot be changed the simulation is built. You can lock any of the specification settings by clicking
the arrow next to the check box and selecting Lock Specification.

If the variable is an array you can select Lock Specification or Lock at least one Specification.

14. Enter a De scription of the variable to help ot hers understand what the variable is.

Note: You cannot change the Variable Units. Variable Units are defined by the Variable Ty pe and, to
ensure consistency of all equations that use them, cannot be changed. The units are listed to document
the internal UOM that is used by the equations. The units are displayed as a matter of convenienc e so
you know what they are when you write an equation.

When the Variable Type is valid, the variable Status will change from red to green.

Adding an Equation to a Model Type


You can add an equation to a Model Type in the Model Editor.
To add an Equation:
1. Open the Model Editor for the Model Type.
2. Expand the Equations section.

3. Click the button.


4. Rename the equation.
5. Select the Condition name, if applicable. Refer to Adding a Condition to a Model Type on page 38
for more information on conditions.
6. Enter the equation Name.

Version 3.2 23
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

7. Define the equation Formula, using variables and real parameters. Equations must be written to use
the internal units of the Variable Ty pe that is listed in the Units column in the Variables section.
8. Enter a Description of the equation that can help you diagnose the problem if the equation does not
solve.
When the expression syntax is valid, the equation Status will change from red to green. See Operators
and Functions on page 55 for more information.
Example: Adding a Time Derivative Equation
You can use the function der() to write differential equations. The example demonstrat es how to add a
time derivative equation to a Model Type.
1. Expand the Variables section, and add a variable; for example, X.
2. Expand the Equations section and enter the Formula der(X) = 1-X. After the equation is created,
SimCent ral Simulation Platform automatically creates a dXdt variable in the Variables section.
3. Drag the Model Type onto the Canvas, expand the Simulation Manager view, and verify that the
model is solved. X should equal 1 and dXdt should equal 0.

Adding a Real Parameter to a Model Type


You can add a parameter to a Model Type. SimCentral Simulation Plat form allows Fluid Type, Curve
Type, integer, real, and enumerated parameters. Real parameters use the same Variable Types as
variables.
To add a real parameter by using a predefined Variable Type:
1. Open the Model Editor for the Model Type.
2. Expand the Parameters section.

3. Click the button.


4. Change the Name of the parameter.
5. From the Type list, on the Real submenu, select the Variable Type that you want to add.
6. Define if the parameter should be invariant. See Defining Invariant Paramet ers and Variables on
page 30.
7. Define if the parameter should be global. See Defining Global Parameters and Variables on page 31.
8. Modify the default values included with the Variable Type.
9. Enter a De scription of the parameter.

Managing Enumerated Parameters


Enumerations provide named options that Simulation Builders who are using your Model Type can
select. You can create a new parameter in the Model Editor and create an enumeration Parameter Type.
To add an enumerated parameter:
1. Open the Model Editor for the Model Type.
2. Expand the Parameters section.

3. Click the button.


4. Enter the Name of the parameter.

24 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

5. From the Type drop-down menu, select Enumeration.


6. Define if the parameter should be invariant. See Defining Invariant Paramet ers and Variables on
page 30.
7. Define if the parameter should be global. See Defining Global Parameters and Variables on page 31.
8. Enter an enumerated value in the Values column and press Enter aft er each one.
9. To set the default enumeration value, select a value from the Default drop-down list. The list is
populated from the values you entered in step 6.
10. Enter a De scription of the enumeration.
The enumeration will be created and saved to the Model Type.
To remove a value from the list of enumerated values:
1. Open the Model Editor for the Model Type.
2. Expand the Parameters section.
3. In the Values list for t he enumerated parameter, select the value that you want to remove. The value
appears in the Values column.
4. Right -click the value, and then click Delete.

Tearing Variables in an Equation


In some systems of equations, tearing a variable is a way of simplifying problems that need to be solved
by reducing the block size of the equation set. The solver then solves the smaller blocks separately,
updates the tear variable by substituting the new value, and iterating until a solution is found; for
example, you may want to tear the friction factor in a pipe model so that equations, such as the
complicated Colebrook equation, can be solved separately from the rest of the pipe equations. Good
candidates for tearing are variables with values that are not expected to change from iteration to
iteration.
By adding the tear function fx = tear(f ) to an equation, you can identify a specific variable to tear.
Attempting the following will res ult in an error:
 Tearing a derivative, such as dXdT
 Tearing a variable that appears inside a der operator (also known as a state variable)
 Tearing a variable set to a constant value, such as tear(x) = 1

Changing Variable Properties Using Conditions


You can use conditions to creat e duplicate variables with the same name so that the condition can set
the properties of the variable. You can change the variable's Type, Favorite, Required, Default Mode
Specification, Default Value, Min and Max. This feature is known as replaceable variables, sin ce the
condition is used to replace the variable with a different one with the same name with different properties.
The example below will instruct you how to creat e three replaceable variables with conditions that will
allow you to switch between pressure, temperature or mass flow.
Example: To create a replaceable variable
1. Edit or create a new Model Type in the Model Edit or.
2. Expand the Parameters section and add a new parameter.
3. Enter Type as the parameter Name.

Version 3.2 25
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

4. Select Enumeration as the Type.


5. Select a Default value.
6. Add Pressure, Temperature and MassFlow as Values. Press the Enter key aft er typing each
value to save your entry.

7. Expand the Conditions section.


8. Add PC as a condition Name, with an Expre ssion of Type = Pressure.
9. Add TC as a condition Name, with an Expre ssion of Type = Temperature.
10. Add WC as a condition Name, with an Expre ssion of Type = Mass Flow.

11. Expand the Variables section.


12. Add PC as a Condi tion, PV as its Name, and Pressure as the Type.
13. Add TC as a Condi tion, PV as its Name, and Temperature as the Type.
14. Add WC as a Condi tion, PV as its Name, and Mass Flow as the Type.
15. Set the Min, Max and Default values for each variable.

16. In the Property Inspector, Keyword View or Simulation Manager, change the Variable Type and note
that the PV value's UOM will change dy namically.

26 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Connecting Parameters (Configuring a Fluid State Submodel)


You can connect Parameters so that the value of one parameter can be automatically propagated to
another parameter.
The example below illustrates how to create suitable "connections" so that the Fluid Type to be used by
a model can be automatically set based on the Fluid Type used by the upstream model.
To pass the upstream Model's Fluid Type to a Fluid State submodel, and subsequently
to downstream models:
1. Edit or create a new Model Type.

In this example, the Model Type represents a process equipment, like a valve, containing an input
port, an output port, and a "fluid state" submodel so that it links to thermodynamic calculations.
2. Expand the Models section.

3. Drag and drop the FluidState Model onto the Models section to make it a submodel.
4. Expand the Ports section.

5. Add a port with In as the Direction and FluidPort as the Type.


6. Add a port with Out as the Direction and FluidP ort as the Type.
7. Expand the Connections section. The connections that will be added will allow the Fluid Type to be
propagated from the In port to the FluidStat e Fluid1 and also to the Out Port. This allows the Fluid
Type to be propagated through the simulation based on Canvas connectivity.

8. Add a new connection (the Type will automatically be set to Parameter) with the following From and
To connections:

From: Port1.FluidType
To: Port2.Fluid Type

This connection propagates the value of the FluidTy pe parameter from the input port to the output
port.

Version 3.2 27
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

9. Add another connection (the Ty pe will automatically set to Parameter) with the following From and
To parameters:

From: Port1.FluidType
To: <Submodel_name>.FluidType

This connection propagates the value of the FluidTy pe parameter from the input port to the
FluidState submodel where it defines what thermodynamic calculations will be used.
You can now add the model to a simulation and the Fluid State submodel will use the Fluid Type of the
upstream model.

Connecting Variables
You can connect two variables so that they behave as a single variable called a Variable Connection.
The specification status and badges of the connected variables will always be the same, making it easier
to specify your simulation and to find specification changes. The solver will treat the connected variables
as one variable, reducing the number of equations to solve to make the simulation run faster.
If two variable connections share a common variable, then all three variables act as one connected
variable. Many variable connections may be made to connect any number of variables in a model and its
ports and submodels.
Variable Connection Model Input Checks
When you add a variable connection in the Model Editor, the connection you create must satisfy the
following requirements or a red bad status indicator will appear next to the connection:
 Both variables must be of the same Variable Type
 Both variables be scalar or bot h must be array with the same dimension.
 If you connect variables that are dimensioned over a Fluid Type component list, the Fluid Types can
be different, but the component names in each Fluid Type must match. The components in the Fluid
Types can be in different orders.
Variable Connection Attribute Rules
The variables that you connect will have different attributes in the variables section of the Model Editor.
The following rules are used to select a common set of attributes for the connected variable:
 If any of the variables are specified, then all of the connected variables will be specified.
 If any of the variables are required, then all of the connected variables will be required.
 If any of the variables are specified, then that variable's default value will be used.
 If no variable is specified, then the largest of the default values will be us ed.
 The smallest of the maximum values will be used.
 The largest of the minimum values will be used.
 If the smallest of the maximum values is less than the largest of the minimum values, the largest of
the maximum values will be used and the smallest of the minimum values will be used.
The following display attributes remain unique:
 Each connected variable will follow its individual Favorites attribute
 Each connected variable will dis play its individual Description
The From and To order of variable connections does not matter.

28 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

To connect two variables:


1. Edit or create a new Model Type.
2. Expand the Models section.
3. Expand the Connections section.
4. Add a new connection and select Variable as the Type.
5. Select the From and To Variable types.

Connecting Ports
You can connect two ports within a Model Type by using a Port Connection. When you connect two
ports, all the variables and parameters in one port are connected to the corresponding variables and
parameters in the other port as a set of variable and parameter connections.
When you add a port connection in the Model Editor, both ports must be of the same Port Type or a red
bad status indicator will appear next to the connection.
You can iterate over port connections in a Model Type that contains a series of submodels of the same
type. For example, the following Pipe (from the Pipe in the optional Transient Flow library) contains an N
number of Wall and Flow submodels with ports that connect by using the following iterative port
connections.

Normally, the Model Editor does not allow you to create two port connections with the same definition
(that is, the same From and To ports). However, the Model Editor allows you to do this if you specify a
Condition for the identical port connections.
To connect two ports:
1. Edit or create a new Model Type.
2. Expand the Connections section.
3. Add a new connection and select Port as the Type.
4. Select the Condition, if applicable. See Adding a Condition to a Model Type on page 38 for more
information.
5. In the From and To column, enter the names of the ports.
6. If the port connection uses an iterator, ent er the Start and End values.

Version 3.2 29
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

Defining Favorite Variables and Parameters


While in the Model Writing role, you can identify certain parameters and variables to be available as
"favorites" to Simulation Builders. When you switch to the Simulation Building role, you will only see the
favorites you define when you edit or view models in the Simulation Manager, Property Inspector, Mini
Inspector, Keyword View or Canvas. In the Properties Inspector, you can also turn favorites off to see all
variables and parameters. You can then customize the list of favorites for that model.
To define a favorite:
1. Ensure that the Model Writing role is selected. See SimCentral Roles.
2. Load the Model Editor for the desired Model Type.
3. Expand the Variables section.

4. Click the Favorite icon to flag the variable for Simulation Builders.

Defining Invariant Parameters and Variables


While in the Model Writing role, you can identify certain parameters and variables as invariant
parameters and variables, respectively. Invariant parameters and variables do not change values or
badging when you revert the simulation to a snapshot that you captured. Note that this applies to both
model writers and simulation builders.
Typically, parameters and variables that do not change with operating conditions are good candidates for
invariant parameters and variables. For example, the length of a pipe does not change with opera ting
conditions. You may want to define the length of a pipe as an invariant variable. Conversely, the flow
through a pipe and the pressure in the pipe depend on operating conditions and should not be invariant
variables.
Note that the solver changes the values of calculat ed variables even if you identify them as invariant
variables. If a Model Type has connections with any invariant parameters or variables, SimCentral
Simulation Plat form treats all parameters and variables in the connection as invariant paramet ers and
variables.
To define a parameter as an invariant parameter:
1. Ensure that the Model Writing role is selected. See SimCentral Roles.
2. Load the Model Editor for the desired Model Type.
3. Expand the Parameters section.

4. Click the Invariant icon to flag the parameter as an invariant parameter.


To define a variable as an invariant variable:
1. Ensure that the Model Writing role is selected. See SimCentral Roles.
2. Load the Model Editor for the desired Model Type.
3. Expand the Variables section.

4. Click the Invariant icon to flag the variable as an invariant variable.

30 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Defining Global Parameters and Variables


A global parameter or variable is a paramet er or variable that has the same value for all model instances
on the Canvas. For example, if you define the ambient temperature, Tamb, as a global parameter, you
can update its value for one model instance and SimCent ral Simulation Platform applies that change to
all model instances on the Canvas that contain the Tamb parameter.
Only Model Editors can define a parameter or variable as a global parameter or variable. However,
Simulation Builders can turn on or turn off the tracking for a global parameter or variable for any model
instance on the Canvas. For example, if you define the pipe size as a global variable, you can choose
whet her a Pipe on the Canvas tracks and uses the value of this global pipe size or maintains its own
value for the pipe size separate from the global pipe size.

On the Mini Inspector and the Properties Inspector, the Global badge appears next to global
parameters and variables. The color of this badge indicates the tracking status of t he global parameter or
variable for the associated model instance. If the badge is colored, the model instance tracks and uses
the global value. If the badge is blank, the model instance maintains its own value separate from the
global value.
You can turn on or turn off the tracking for a global parameter or variable by using the P roperties
Inspector for a model instance. Pleas e see Changing the Tracking for Global Parameters and Variables
in the SimSci SimCentral Simulation Platform Simulation Building Guide for more information.
If you have more than one Model Type that contains a parameter or variable that you want to define as a
global parameter or variable, you should define that parameter or variable as a global parameter or
variable in all the Model Types. Otherwise, the global parameter or variable won't track across to the
model instances that are based on a Model Type that does not include the global definition for that
parameter or variable.
Currently, you can define only Real and Enum erat ed parameters as global parameters.
To define a parameter as an Global parameter:
1. Ensure that the Model Writing role is selected. See SimCentral Roles.
2. Open the Model Editor for the desired Model Type.
3. Expand the Parameters section.

4. Click the Global icon to flag the parameter as a global parameter.


To define a variable as a Global variable:
1. Ensure that the Model Writing role is selected. See SimCentral Roles.
2. Open the Model Editor for the desired Model Type.
3. Expand the Variables section.

4. Click the Global icon to flag the variable as a global variable.

Returning to Previously Specified Invariant Values


In some cases, you may want to return the invariant values in a simulation to those in a snapshot. For
example, you temporarily changed some invariant Pipe lengths to see the impact on the simulation and
you now want to change the Pipe lengt hs back to their previous values.
The Snapshot Manager provides a Special option to control whether SimCentral Simulation Platform
overrides the values for invariant parameters and variables with the values in the snapshot.

Version 3.2 31
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

To override the invariant values with the snapshot values:


1. Open the Snapshot Manager.
2. Select the snapshot to which you want to revert the simulation.
3. Click Special.
4. Select the Invariant Values check box.
5. Click Load.

Adding a Model Type as a Submodel


You can add a Model Type as a submodel of another Model Type. Submodels are beneficial as they can
be used as building blocks to create larger and more complicated Model Types.
To add a submodel to a Model Type:
1. Open the Model Editor for the Model Type.
2. Expand the Models section.
3. Click and drag a Model Type from the Model Library and drop it into the Model s section.
Or

Click the button in the Model s section.


4. Give the submodel a De scription.
5. If applicable, select a new Condition from the drop-down list.
6. Enter the submodel Name.
7. Select the Model Type (if you did not drag it from the Model Library.)
If all of the model requirements have been satisfied, the model Status will change from red to green.

Assigning a Default Fluid Type to a Model


You can assign a default Fluid Type to a Model Type in the Model Editor.
To assign a default Fluid Type:
1. Edit a model in the Model Library.
2. Expand the Parameters section.
3. Click the Default drop-down beside a Fluid Type paramet er, and select the default Fluid Ty pe to use.
If you have not already added a Fluid Type, refer to Configuring a Fluid Type.

32 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Using Fluid Type Parameters as Default Values


You can use the parameters from the associated Fluid Type as the default values in a Model Type. You
can also use the parameters from the Fluid Ty pe as the Min or Max values for the variables and real
parameters in the Model Ty pe. You must use t he FluidType.<par> naming convention to reference these
parameters, where <par> is the system name for the parameter. You can find the system name for a
Fluid Type parameter by hovering over the parameter in the Fluid Editor.

When you add the model to the Canvas, SimCentral Simulation Platform sets the value of the model
variable to the value that you specify in the Fluid Editor for the Fluid Type parameter. It uses the values
from the Fluid Type that you specify as the default Fluid Type for the Model Type.
Note that different Fluid Types have different parameters. All Fluid Types have the
FluidType.Temperature and FluidType.Pressure parameters, which are the starting values of the Fluid
Type.
To use a Fluid Type parameter as a default value:
1. Open the Model Editor for the Model Type.
2. Expand the Variables section.
3. In the Default column for the desired variable, type the system name of the Fluid Type parameter
and then press Enter.

Clearing a Default Enumerated or Fluid Type Parameter


You can clear the default value for an enumerated or Fluid Type paramet er.
To clear a default value:
1. Open the Model Editor for the Model Type.
2. Expand the Parameters section.
3. In the Default column, delete the default parameter value using the backspace key and press Enter.
The default parameter will be cleared.

Adding a Port to a Model Type


You can add a new port to a Model Type to define how it connects to other Model Types. You can create
a port and reference it in multiple Model Types.
To add a port to a Model Type:
1. Open the Model Editor for the Model Type.
2. Expand the Ports section.
3. Click and drag the port from the Model Library and drop it in the Ports section.

Or

4. Click the button.

Version 3.2 33
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

5. If applicable, select a new Condition from the drop-down list.


6. Change the port Name from the default name.
7. Define the port Direction by selecting In or Out.
8. Define the number of Connections by selecting Single or Multiple. For information on Multiple ports,
refer to Adding a Multi-Port on page 34.
9. Select the port Type (if you did not drag it from the Model Library.)
10. Expand the Icon section, select the port you added and drag it to the location you want it to display
when you add the model to the Canvas. If you want to specify the location more precisely, you can
manually enter the X and Y coordinates. You can also specify the orientation (direction) of the
stream connection when it is connected to the port. Go to the Orientation column and select Auto,
Left, Right, Top, or Bottom.
11. Give the port a De scription.
If the port requirements have been met, the port Status indicator will change from red to green.

Adding a Multi-Port
You can define a port as a multi-port, and connect multiple streams to the same input or output port; for
example, when working with a mixer or drum model.
To define a port as a multi-port:
1. Create a model or edit an existing one.
2. Expand the Ports section.
1. Edit an existing port, or add a new one.
2. Click the Connections drop-down, and select Multiple.
3. Give the port a De scription.

When you connect a model to the port, the port will contain the variables from the connected model.

Connecting to a Model with Multiple Ports


As a Model Writer, you can write models with multi-port variable and parameter connections, so as a
Simulation Builder, you do not have to specify the number of ports the model has.
This topic will illustrate how to connect models with multi-port variable and parameter connections.
Before reviewing the example below, refer to the Adding a Multi-Port on page 34, Connecting
Parameters (Configuring a Fluid State Submodel) on page 27, and Connecting Variables on page 28
topics.

34 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Example: Connecting to a Model with Multiple Ports


1. Drag two Sources from the Model Library onto the Canvas.

2. Drag a Mixer onto the Canvas that is configured with an "in" multi-port. For information on
multi-ports, refer to to Adding a Multi-P ort on page 34.

3. Connect the first and second Source mod els to the Mixer.

Version 3.2 35
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

4. Drag a Sink model onto the canvas, and connect it to the Mixer.

36 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Note that the Fluid Type from SRC1 is propagated to SNK1:

Version 3.2 37
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

Adding a Condition to a Model Type


You can add a condition to a Model Type in the Model Editor and write an expression.
Conditions cause the creation, non -creation, or removal of affected variables, equations, models, ports,
connections and external equations. Furthermore, conditions accept all parameter types and must
evaluate to a boolean, that is, a value of true or false. Before you can add a condition, you must first
create a parameter.

Note: Conditions are similar to IF statements in typical computer programming.

SimCent ral Simulation Platform evaluates conditions when you first place a Model Type on a Flowsheet,
when you change a parameter value, and when you modify a Model Type in the Model Editor.
Some Model Types may have a complex system of conditions to accou nt for the various configurations of
variables, equations, submodels, ports, and connections that the Model Type must support. For these
Model Types, you can simplify the system of conditions by using nested conditions. A condition is nested
when you use it as part of the expression of another condition. You can use the same conditional
operators that you use for compound conditional expressions, such as AND, OR, and NOT.
For example, you can write a conditional expression as FlowType== Compressible AND Isentropic,
where Isentropic is a nested condition. For this condition to be true, the FlowType parameter must be set
to Compre ssible and the Isentropic condition must also be true.

38 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

To create an enumerated parameter and add a condition:


1. Open the Model Editor for the Model Type.
2. Expand the Parameters section.

3. Click the button.


4. Enter the Name of the parameter; for example, FlowType.
5. From the Type drop-down menu, click Enumeration.
6. Enter a value in the Values column and press Enter; for example, Compressible. To add more
values, you must type in the value and press Enter each time.

7. To set the default enumeration value, select a value from the Default drop-down list. The list is
populated from the values you entered in step 5.
8. Enter a De scription of the parameter.
9. Expand the Conditions section.

10. Click the button.


11. Change the condition Name from the default name.
12. Using the supported Condition Operators on page 55 as a guide, write an ex pression for your
condition that will evaluate to a boolean; for example, FlowType==Compressible.

13. Give the condition a De scription.


When the expression syntax evaluates to a boolean, the condition Status will change from red to green.
Connections, variables, equations, models and ports are now conditionally created when the condition
expression evaluations to true.

Adding Multiple Thermodynamics Components to a Model


To create a model that uses multiple Fluid Types in a single model:
1. Edit the model to which you want to add multi-component Thermo.
2. Expand the Parameters section.
3. Add a new parameter, click the Type drop-down and select Fluid Type.
4. Name the Parameter; for example, Hot.
5. Add another Parameter, click the Type drop-down and select Fluid Type.
6. Name the Parameter; for example, Cold.

Version 3.2 39
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

7. Add the model to your simulation.


8. Right -click the model on the Canvas and select Full Properties to display the Properties Inspector.
9. Expand the Parameters section.

10. Beside each parameter, click the Value drop-down menu, expand Fluids and select a fluid.
11. In the Model Edit or, expand the Variables section.

12. Add a new variable.


13. Name the Variable; for example, Z.
14. Select a Variable Type.
15. Click the Dim drop-down, and select the appropriate Components List (CompList) for each
parameter you created; for example, Hot.CompList. This defines Z as an array variable of the
Hot.CompList Dimension.
The CompList for a Fluid Type is built in the Fluid Editor.

Creating Custom Messages


In addition to the error and warning messages that come with SimCentral Simulation Platform, you can
add custom messages to your models. The custom messages allow you to set your own conditions at
which your models should give an error or warning. For ex ample, you may want to set an error or warning
message on a valve model when the valve position approaches or surpasses a physical constraint, such
as a valve that cannot open more than 95%.
You can define a custom message as an error or as a warning. Errors prevent the simulation from solving
successfully. Warnings allow the simulation to solve successfully, but still identify potential errors in the
simulation.
The custom messages use the same badges that the default error and warning messages do. When the
model meets the specified criteria for a custom message, you will see a visual representation (the badge)
of that error or warning next to the model icon on the Canvas.

40 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

The custom messages use logical statements to determine when they appear on the Canvas. These
logical statements require a strict syntax and support a limited number of operat ors. See Operators for
Custom Messages on page 41 and Examples and Limitations of Logical Statements for Custom
Messages on page 42 for more information.
To create a custom message:
1. Open the Model Editor.
2. Expand the Me ssage s area.

3. Click Add Custom message . A new custom error message appears in the list.
4. If y ou want the message to be a warning instead of an error, in the Severity column, select Warning.
5. Optionally, in the Condition column, select the predefined condition under which the message
should appear. See Adding a Condition to a Model T ype on page 38 for more information.
6. Optionally, in the Name column, change the name of the custom message. Note that this appears in
the tooltip for the error or warning badge.
7. In the Te st column, type the logical statement that defines when the custom message appears on
the Canvas.
8. In the Me ssage column, type the message text that will appear in the tooltip for the error or warning
badge.
9. In the De scription column, type text that describes the custom message. You may want to include
information on the situations in which you ex pect the message to appear and why you need the error
or warning.

Operators for Custom Messages


You can use a limited number of operators in the logical statements for custom messages.
The following table lists the relational operators that you can use in the logical statements. Each logical
statement must include at least one relational operator, ex cept in c ases that involve variable attributes or
text strings that resolve to a true or false value. See Examples and Limit ations of Logical Statements for
Custom Messages on page 42 for more information.

Operator Description

== The values on either side of the operator must be equal.


=

<> The values on either side of the operator must not be equal.

< The first value must be less than the second value.

> The first value must be greater than the second value.

<= The first value must be less than or equal to the second value.

>= The first value must be greater than or equal to the second value.

The following table lists the logical operators that you can use in the logical statements. They must
appear between two independent relational statements. Note that these operators are not case
sensitive.

Version 3.2 41
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

Operator Description

AND Both the first relational statement and the second relational statement must be
true
&&

NOT The relational statement must be false

OR Either the first relational statement or the second relational statement must be true
||

Currently, you cannot use mathematical operators in the logical statements.


In addition to the operat ors, you can append a variable name wit h .calculated to return a true or false
value bas ed on the calculated status of that variable. Similarly, you can append a variable name with
.specified to return a true or false value based on the specified status of that variable. In these cases,
you may not need to include a relational operator in your logic al statement.

Examples and Limitations of Logical Statements for Custom


Messages
The logic al statements require the following syntax:
 Each logical statement must contain at least one relational operator, and thus one relational
statement. The exceptions to this rule ar e:
o You append a variable name with a .calculated or .specified suffix to ret urn a value of
true or false based on the specified or calculat ed status of that variable.
o You manually set the Test value to true or false.
 Logical operators must appear between relational statements.
 You can use any combination of numerical values, relational operators, and model variables and
parameters to define your relational statements.
 You can use only variables that are in the model.
 You can use parameter that are in the model as well as the following special parameters:
o MODE: This built-in parameter allows you to refer to the current simulation mode.
o <Port>.NumberOfConnections: This integer paramet er allows you to refer to the number
connections that exist for a port in the model, where <Port> is the name of the port.

 You can enclose relational statements in parentheses for readability. You cannot use braces or
brackets in place of parentheses.
 You cannot enclose logical operators in parentheses.
 You must separate logic al operators from relational statements by using either blank spaces or
parentheses.
 Variables names and logical operators are not case sensitive.
Note that a green badge appears in the Status column when the syntax for your logical statement is
correct.

42 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

The following example directly sets the Test value to true for a defined condition so that the model gives
a warning when it is in the specified condition:

The following example appends a variable name with the .specified suffix to give a warning when the
variable is specified.

The following examples are simple error and warning messages that uses only relational operators.

The following examples use both relational operators and logical operat ors.

Currently, you cannot use mathematical operators in the logical statements.

Associating an Icon with a Model Type


You can associate an icon wit h a Model Type, Fluid Type or Port Type. The icon is used only in the Model
Library. The icon that you want to associate must be in the form of an Extensible Application Mark up
(XAML) file. Many software applications on the market let you create XAML icon files or convert
traditional icons to XAML.

Version 3.2 43
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Editor

To associate an icon:
1. From the editor you are in, expand the Icon section.

2. Click Select Icon.


3. Select an XAML file.
The icon will be visible in the Icon section.

Defining a Conditional Icon


You can choose to display a specific icon for a model based on a condition in the Model Editor.
To define a conditional icon:
1. Create a new Model Type or edit an existing one in the Model Editor.
2. Create parameters and conditions, as instructed in the Adding a Condition to a Model Type on page
38 topic. The condition you creat e will be us ed to determine the icon that will display.
3. Expand the Icon section. The default icon will appear in the Model Library and will display when the
condition has not been triggered.
4. Add a new icon.
5. Select a Condition, and press the Select Icon button to select an icon that will display when the
condition occurs.
6. Position the ports for the icon.

44 Version 3.2
Model Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

7. Repeat steps 4-6 for any other conditions which have unique icons.

When the condition occurs, the icon will change on the Canvas.

Hiding a Model or Port


As a Model Writer, you can indicate that some models or ports are hidden in the Model Library. A typical
reason for hiding models and ports is that they are not meant for direct use on the Canvas; for example,
a model is used only as a submodel and is not meant to be placed directly on the canvas by the Model
Writer.
To hide a model, submodel or port:
1. In the Model Library, select a model or port you want to hide, and edit it.
2. Browse to the General section and check Hide in Model Library based on Role .
The model or port will be hidden in the Library Manager. If you hide all models and ports in a Model
Library, the Model Library will be hidden as well.

Version 3.2 45
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 6
Groups
About Groups
A Group is a collection of related variables and parameters. Groups appear on the Mini Inspector and
provide a way for you to organize the variables and parameters within the Mini Inspector so that you can
quickly locate the variables and parameters that you are most interested in.
Concepts
 The order in which the Groups appear on the Mini Ins pector is the same as the order in which the
Groups appear on the Model Editor
 Only Model Writers can create and configure Groups
 Model Writers can add both variables and parameters to a Group
 If a model does not contain Groups, you will see a flat list of the favorite variables and parameters on
the Mini Inspector
 If a model contains Groups, on the Mini Inspector, you will see a collapsible and expandable section
for each Group and the variables and parameters appear under their associated Groups
 Many models in the standard Model Libraries include a default set of Groups
 The Property Inspector sorts variables and parameters by Groups only if you sort the view based on
the Group value
Actions
 Create a Group
 Rename a Group
 Reorder the Groups
 Add a variable to a Group
 Add a parameter to a Group
 Delet e a Group
 Sort the Property Inspector by Groups

In This Chapter
Creating and Configuring a Group.................................................................................................. 47
Adding Variables and Parameters to a Group ................................................................................. 48
Adding Submodel Variables and Parameters to a Group ................................................................. 48

Creating and Configuring a Group


You must use the Model Writer role or a custom role with model writing permissions to create Groups.
To create and configure a Group:
1. Open the Model Editor for the model that you want to create a Group for.

Version 3.2 47
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Groups

2. Expand the Groups area.

3. Click Add Group . A new Group appears in the list.


4. Click the Name column, type the name of the Group, and then press Enter.
5. Select the Expand check box for the Group if you want to expand that Group by default in the Mini
Inspector.

6. If there is more than one Group in the Groups area, select your new Group and then use the
following buttons to move your Group in the list:

o Move First

o Move Up

o Move Down

o Move Last

Adding Variables and Parameters to a Group


You must use the Model Writer role or a custom role with model writing permissions to create Groups.
To add a variable to a Group:
1. Open the Model Editor for the model that contains the Group that you want to add variables to.
2. Expand the Variables area and locate the variable that you want to add to the Group.
3. In the Group list for that variable, select the Group.
To add a parameter to a Group:
1. Open the Model Editor for the model that contains the Group that you want to add parameters to.
2. Expand the Parameters area and locat e the parameter that you want to add to the Group.
3. In the Group list for that parameter, select the Group.

Adding Submodel Variables and Parameters to a Group


The Mini Inspector also displays the Groups that you have defined in your submodels. The variables and
parameters from the submodels appear at the same level as the variables and parameters from the
parent model. That is, you will see a flat list of variables and parameters for each Group. Parameters and
variables from the parent model appear before the parameters and variables from the submodels.

48 Version 3.2
Groups SimSci™ SimCentral™ Simulation Platform Model Writing Guide

If you configure a submodel as an array of submodels in its parent model and you add scalar variables
and parameters from that submodel to a Group, the scalar variables and parameters from eac h
submodel array element appear in the Group under an expandable and collapsible node that has the
name of the scalar variable or parameter.
If you want the parameters and variables from the submodels to appear in the same Group as your
parameters and variables from the parent model, you must create that same Group in the submodels.
To add submodel parameters and variables to a Group in the parent model:
1. Open the Model Editor for the submodel.
2. Expand the Groups area.

3. Click Add Group . A new Group appears in the list.


4. Click the Name column, type the name of the Group, and then press Enter.
All Groups that you create for the submodel also appear in the parent model. If you want the
submodel paramet ers and variables to appear in an existing Group in the parent model, the name of
the Group in the submodel must be the same as the name of the Group in the parent model.

Tip: Groups that exist only in the submodels always appear at the bottom of the list of Groups in the
Mini Inspector. If you want to move a Group from a submodel up or down in the list, you can can
create an empty Group of the same name in the parent model and move that Group up or down in
the list of Groups.

5. Expand the Parameters area and locat e the parameters that you want to add to the Group.
6. In the Group list for those parameters, select the Group.
The submodel parameters now appear in the Mini Inspector for the parent model, under the specified
Group.
7. Expand the Variables area and locate the variables that you want to add to the Group.
8. In the Group list for those variables, select the Group.
The submodel variables now appear in the Mini Inspector for the parent model, under the specified
Group.

Version 3.2 49
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 7
Port Editor
About the Port Editor
The Port Editor is used to create and edit Port Types, which are used inside Model Types to define how
the model can be c onnected to other models in a simulation. If you create new Model Types, you can use
the Port Type included with SimCentral Simulation Platform to define input and output ports used for
process stream connections. If no suitable Port Type exists, you can create a new Port Type. When you
edit a Port Type, you can specify a name, variables and their types, the Canvas connection (line) style to
use, and a description. Once a Port Type is defined you can then add ports to Model Ty pes using the
Model Editor. Ports are saved in Model Libraries whic h are stored in the Repository.

Concepts
 Port Types define the variables that will be transferred between models when a connection is made
on the Canvas
 The Port Editor allows you to define process stream connections between models
 You can add Port Ty pes to Model Types (using the Model Editor) to define the connections that can
be made to a model
 You can create a new Port Type or modify an existing standard Port Type to make slight changes so
it fits your specific requirements
 Connections between models on the Canvas can only be made bet ween ports of the same type
 Port Types are stored in Model Libraries
 Changes you make to a Port Type are automatically saved
Actions
 Create a new Port Type
 Add and specify Variable Ty pes used by the port
 Define characteristics specific to Port Types (name, line style, etc.)
 Import an icon file and associate it with a Port Type

Version 3.2 51
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Port Editor

In This Chapter
Opening the Port Editor ................................................................................................................. 52
Adding a Variable to a Model Type or Port Type ............................................................................. 52
Associating a New Icon with a Model Type, Fluid Type, or Port Type ............................................... 53
Defining Connector Prefix Naming and Numbering ......................................................................... 54

Opening the Port Editor


To open the Port Editor:
1. Browse to the Model Library.
2. Right -click a Port Type and select Edi t or right-click on a blank space and select Create New Port.
The Port Editor will display.

Adding a Variable to a Model Type or Port Type


You can add a variable to a Model Type or Port Ty pe in the Model Editor or Port Editor, associate a
condition with it, and specify it for particular Simulation Modes.
To add a variable:
1. Open the Model Editor or the Port Editor for the Model Ty pe or Port Type, respectively.
2. Expand the Variables section.

3. Click the button.


4. Select the Condition name, if applicable. Refer to Adding a Condition to a Model Type on page 38
for more information on conditions.
5. Change the variable Name from the default name.
6. Select the variable Type to define the unit of meas ure. This will also set the default, min, and max
values, which you may change.
7. Define if the variable should be invariant. See Defining Invariant Parameters and Variables on page
30.
8. Define if the variable should be global. See Defining Global Parameters and Variables on page 31.
9. Enter the Default value to be used when you first place the Model Type in a simulation.
10. Select a Dimension if you want to change the variable to an array.
11. Enter the Min and Max values of the variable or accept the Variable Type default values.

12. Check the (Process Mode), (Fluid Flow Mode) or (Dynamics Mode) check boxes if
you want to specify the variable for a Simulation Mode. Unchecked boxes are calculated.
13. Define if any of the simulation mode specifications should be locked. When locked, the specification
cannot be changed the simulation is built. You can lock any of the specification settings by clicking
the arrow next to the check box and selecting Lock Specification.

52 Version 3.2
Port Editor SimSci™ SimCentral™ Simulation Platform Model Writing Guide

If the variable is an array you can select Lock Specification or Lock at least one Specification.

14. Enter a De scription of the variable to help ot hers understand what the variable is.

Note: You cannot change the Variable Units. Variable Units are defined by the Variable Ty pe and, to
ensure consistency of all equations that use them, cannot be changed. The units are listed to document
the internal UOM that is used by the equations. The units are displayed as a matter of convenienc e so
you know what they are when you write an equation.

When the Variable Type is valid, the variable Status will change from red to green.

Associating a New Icon with a Model Type, Fluid Type, or Port


Type
You can associate an icon wit h a Model Type, Fluid Type or Port Type. The icon is used only in the Model
Library. The icon that you want to associate must be in the form of an Extensible Application Mark up
(XAML) file. Many software applications on the market let you create XAML icon files or convert
traditional icons to XAML.
To associate an icon:
1. From the editor you are in, expand the Icon section.

2. Click Select Icon.


3. Select an XAML file.
The icon will be visible in the Icon section.

Version 3.2 53
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Port Editor

Defining Connector Prefix Naming and Numbering


You can define automatic connector (stream) naming by setting a Port Type prefix and start number in
the Port Editor.
To define automatic connecting prefix naming and numbering:
1. Edit or create a new Port Type.
2. Expand the General section and enter the Name, Prefix and Start number of the Port Type.
When you create a new connection from the port, the connection will be prefixed with the Prefix you
define and each subsequent connection will be numbered accordingly; for example, if you define a prefix
of S and a Start number of 1, the first connection you create will be prefixed wit h S1, the second will be
prefixed wit h S2, etc. If the Prefix field is left blank, the prefix S will be used and numbering will start at 1.

54 Version 3.2
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

C HAPTER 8
Operators and Functions
This chapter includes information on condition operators, mathematical equation operators and
mathematical functions.

In This Chapter
Condition Operators ...................................................................................................................... 55
Equation Operat ors ....................................................................................................................... 55
Equation Functions ....................................................................................................................... 56
Flow Square Root ......................................................................................................................... 59

Condition Operators
When you add or modify a new Model Type condition, you can write a basic expression using the
following conditional operators.

Condition Expression

= Equals
==

< Less than

<= Less than or equal to

> Greater than

>= Greater than or equal to

<> Does not equal

or Or
||

not Not

and And
&&

Equation Operators
You can write a basic expression using the following operators.

Version 3.2 55
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Operators and Functions

Operator Description

+ Add

- Subtract

* Multiply

/ Divide

= Equals

^ To the power of

Equation Functions
The following table describes some of the basic mathematical functions used by equations. If applicable,
click on the functions for additional information about each one.

Function Description Example

abs(var) Returns the absolute value of x = abs(y)


var.

arcsin(var) Returns the inverse sine in theta = arcsin(y)


radians of var.

arccos(var) Returns the inverse cosine in theta = arccos(x)


radians of var.

arctan(var) Returns the inverse tangent in theta = arctan(x/y)


radians of var.

cos(var) Returns the cosine of var with x = cos(theta)


var in radians.

der(array) Creates a series of time der(M) = fin*Zin - fout*Zout


derivative equations from an
array variable dimensioned by
fluidtype.complist.

der(var) Creates an internal time der(M) = fin - fout


derivative equation for var.

exp(var) Returns the exponential value of x = exp(y)


var.

56 Version 3.2
Operators and Functions SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Function Description Example

FSqrt(var,clip) Returns a square root of var for y = FSqrt(P1-P2, 0.001)


(Flow S quare Root on page reverse flow calculations. If var
59) is negative, the FSqrt returns a
negative value. Ret urns a linear
value if var is less than clip.

ln(var) Returns the natural logarithm of y = ln(x)


var.

log10(var) Returns the base 10 logarithm of y = log10(x)


var.

max(var1,var2) Returns the larger of var1 and y = max(var1, 4)


var2. The arguments can be a
variable, real parameter or
number value. The argument
order may be reversed.

max(array1) Returns the value of the largest y = max(array1)


array element.

max(array1, var1) Returns an array the size of Ff = max(F, 0)


array1, where every element is
max(var1, array1)
the larger of the array element or
the scalar value var1. Var1 can
be a variable, a real parameter,
or a number value. The argument
order may be reversed.

min(var1,var2) Returns the smaller of var1 an d y = min(var1, par1)


var2 or a number value.

min(array1) Returns the value of the smallest y = min(array1)


array element.

min(array1, var1) Returns an array the size of Fr = min(F, 0)


array1, where every element is
min(var1, array1)
the smaller of the array element
or the scalar value var1. Var1
can be a variable, a real
parameter, or a number
value. The argument order may
be reversed.

select(x,v1,v2) Returns v1 if x is greater than or H = select(F,Hf,Hr)


equal to0. Otherwise, returns v2.

Version 3.2 57
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Operators and Functions

Function Description Example

select(x,v1,v2,d) Returns v1 if x is greater than or H = select(F,Hf,Hr,0.001)


equal to(+d). Returns v2 if x is
less than (-d). Otherwise, returns
a*v1+(1-a)*v2, where a =
(d+x)/(2d).

sum(array) Returns a scalar value with the 1 = sum(z)


sum of all elements of any array.
SumF = sum(In.F) –
Array may be an array of
sum(Out.F)
components or an array of ports.

sin(var) Returns the sine of var where y = sin(theta)


var is in radians.

sign(var) Returns +1 if var is positive and y = sign(x)*sqrt(abs(x))


-1 if var is negative.

sum(array) Returns the sum of all elements mt = sum (m)


of an array variable dimensioned
by a fluidtype.complist.

sum(var1,var2...) Returns the sum of any number x = sum(a, b, c)


of scalar variables.

sum(portarray[ Returns an array the size of Assuming that MTotal1 and M are
].vararray) vararray, where each element variables dimensioned to a
is the value of a specific element fluidtype.CompList containing
of vararray summed over all the three elements C1, C2, and C3;
portarray elements. and MultiInPort is a port which
has two input streams, S1 and S2.
Typically used in equations that
need to sum component In that case, this equation
flowrates over a collection of
streams connected to an input or MTotal1 =
sum(MultiInPort[].M)
output port.
will be expanded as follows:
MTotal1[C1] =
sum(MultiInPort[S1].M[C1] +
MultiInPort[S2].M[C1])
MTotal1[C2] =
sum(MultiInPort[S1].M[C2] +
MultiInPort[S2].M[C2])
MTotal1[C3] =
sum(MultiInPort[S1].M[C3] +
MultiInPort[S2].M[C3])

58 Version 3.2
Operators and Functions SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Function Description Example

sum(portarray.vararr Returns an array the size of Assuming that M is a variable


ay[ ]) portarray, where each dimensioned to a
fluidtype.CompList containing
element is the value of a specific
element of portarray summed the three elements C1, C2, and C3;
over all vararray elements. and MultiInPort is a port which
has two input streams S1 and S2;
Typically used in equations that
and the variable MTotal2 is
need to sum component
flowrates over a collection of dimensioned to
streams connected to an input or MultiInPort.StreamList
output port. In that case, this equation
MTotal2 =
sum(MultiInPort.M[])
will be expanded as follows:
MTotal2[S1] =
sum(MultiInPort[S1].M[C1] +
MultiInPort[S1].M[C2] +
MultiInPort[S1].M[C3])
MTotal2[S2] =
sum(MultiInPort[S2].M[C1] +
MultiInPort[S2].M[C2] +
MultiInPort[S2].M[C3])

sqrt(var) Returns the square root of var. f = sqrt(dp)


Will return an error if var is
negative.

tan(var) Returns the tangent of var t = tan(theta)


where var is in radians.

tear(var) Tears variable var to reduc e x1 = tear(x)


solver block size.

Flow Square Root


The Flow Square Root function is used for fluid -flow applications. It is used to calculate the quadratic
relationship between flow and pressure drop while linearizing the res ults near zero to improve solver
convergence.

Version 3.2 59
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Operators and Functions

Graph

60 Version 3.2
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

A PPENDIX A
Model Writing Best Practices
This section contains best practices you may want to follow when writing new models.

In This Appendix
Writing Models for B ackwards Mode Transition ............................................................................... 61
Writing Equations for Robust Solving ............................................................................................. 62

Writing Models for Backwards Mode Transition


Simulation Builders may want to evolve simulations from Process Mode to Fluid Flow Mode to Dynamics
Mode and then back to Process Mode. However, improper selection of default specification variables for
each mode can lead to bad behavior when going back, which may overwrite calculated values. Saving a
snapshot will help overcome this problem, but the practice documented here does not require the use of
snapshots.
Example: A Model with Poor Backwards Mode Transition Behavior
The following set of equations represent flow through a valve with a first order lag for an actuator.

der(A) = ( Sig – A ) / TC (1)

W = 2.73 * A * Cv * Y * sqrt(x * P * R) / 3600 (2)

Where:
 Sig = Signal to the controller, fraction
 A = Current valve position, fraction
 TC = Time Constant, seconds
The variables A and Sig have the following definition in the variables section of the Model Editor:

Name Type Units Process Spec Fluid Flow Dynamics Spec Dynamic
Spec

A Fraction Fraction State

Sig Fraction Fraction x x x

This will only work correctly if the transition back to Process Mode is made at steady state condition when
Sig is equal to A. If the transition back to Process Mode is made during transient (not at steady state)
conditions, the valve Cv will be sized in Process Mode by using variable A, which will be at an arbitrary
condition.
Example: A Model with Good Backwards Mode Transition
Change the default specifications in Process Mode and Fluid Flow Mode so that variable A is specified
rather than Sig:

Version 3.2 61
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Model Writing Best Practices

Name Type Units Process Spec Fluid Flow Dynamics Spec Dynamic
Spec

A Fraction Fraction x x State

Sig Fraction Fraction x

In this case, the variable A used for calculating the valve Cv in Proc ess Mode will always be the expected
value set by the user.
Best Practice Recommendation
Use the dynamic state parameter or a variable algebraically related as the specified variable in Process
Mode so that the transition back to Process Mode works even if made during a transient. Do not use
variables linked through the der() function. Snaps hots are not needed if this process is followed.

Writing Equations for Robust Solving


Equations that have disparat e scaling are harder to solve than equations that are scaled consistently.
Model Writers should scale equations so that each side of the equation has approximat e unity, so that
they can all be efficiently solved together with adequate precision.
Example: Difficult Equations
The following set of equations represents compressible flow through a valve.

3600 * W = 2.73 * A * Cv * Y * sqrt(x * P * R) (1)

Y = max(Yk, 0.667) (2)

Fk = CpCv/1.4 (3)

P*X = DP (4)

When the solver attempts to solve these equations, it iterates until the residual error, as defined by the
left hand side of the equation minus its right hand side, is less than a typical convergence tolerance of
-6
about 10 .

Residual Error = LHS – RHS (5)

In the case of equation 1, the left hand side, or 3600 * W, is about 100,000 for typical industrial valve
flowrates in SimCent ral Simulation Platform units of kg/hr, while equations 2-4 have values on the order
of 1 to 100. The overall set of equations is difficult to solve as some equations are impacted more than
other equations to changes in the ot her variables.
Example: Re-Written Equation
By moving 3600 to the denominator or the right hand side, you do not change the solution, but merely
scale the equation so it is consistent with the other equations. You also preserve the significanc e of the
numbers as 3600 is a known conversion from seconds to hours.

W = 2.73 * A * Cv * Y * sqrt(x * P * R) / 3600 (1A)

With the above modification, the simulation converges in 4 iterations, compared with 45 iterations in the
non-scaled c ase. It is not advisable to plac e variables in the denominators due to t he potential of dividing
by zero.

62 Version 3.2
Model Writing Best Practices SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Best Practice Recommendations


The Model Writer should scale equations such that the each side of each equation:
 Is in approximat ely the same order of magnitude to reduce the number of iterations.
 Is around unity (1 to 100) so that values are solved with adequate precision.

Version 3.2 63
SimSci™ SimCentral™ Simulation Platform Model Writing Guide

A PPENDIX B
Glossary of Terms
The following terms are used in SimCentral, the product documentation, or the online help.
A
Application Ribbon
A horizontal ribbon that contains tabs to invoke P rocess, Fluid Flow and Dynamics simulation actions; set
simulation view preferences; and display the product help.
Auto Solve
The automatic solution of portions of a simulation when sufficient information is available.
B
Badge
A symbol next to a SimCentral object that describes its state to the user. For ex ample, in the P roperties
Inspector and Simulation Manager, objects like model instances, variables, and equations have badges
to indicate an error status with tooltips that describe the nature of the error.
C
Calculated Variable
A variable with a value that is not specified by the user and with its specification box unchecked. The
solver determines the value of calculated variables.
Canvas
The graphical representation of the Flowsheet on which models are placed and co nnected to build a
simulation.
Client
The computer us ed to run the user interfac e and that connects to the server computer.
Condition
An object defined by the Model Writer within the Model Editor which evaluates a boolean expressi on
composed of parameters. When conditions are used in a simulation, they describe the variables,
equations, and submodels that are used by the model instance based on parameter selections made by
the Simulation Builder.
Connection
An object that provides the numeric al equivalence of variables that it connects. Connections between
model Instances wit h the same Port Type define variable streams that represent the material flowing
between the models. See Variable Connections and Paramet er Connect ions.
Connection Model
A library model that looks like a connector on the Canvas. Typical connection models are Pipes and
Streams.

Version 3.2 65
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Glossary of Terms

Connector
The graphical representation of a connection on the Canvas.
D
Description
Descriptive text provided by the Model Writer for models and their parameters, variables, and equations,
or by the Simulation Builder for model instances placed on the Canvas. Descriptions can normally be
viewed by mouse-over tooltips.
Dynamic Attribute
A variable attribute for a Dynamic simulation. Possible values are state variables, operated on by the
der() function, and time-derivative variables creat ed by the der() operator.
Dynamics Mode
A Simulation Mode that solves both algebraic and time -derivative equations over successive integration
time steps.
E
Editor
See Model Editor, Port Editor, and Fluid Editor.
Enumerated Parameter
A type of parameter wit h text-based options that are selectable by the Simulation Builder.
Equation
An object that describes the mathematical relationship of variables and real parameters. Model Writers
add equations to Model Types through the Model Editor. Simulation Builders may also create
Flowsheet-level equations using the Simulation Manager.
External
An object defined by the Model Writer within the Model Editor that defines an external DLL in which
variable relationships reside.
F
Fluid Editor
A configuration editor used by Simulation B uilders to modify the fluids used by a simulation.
Fluid Flow Mode
A pressure-driven steady state Simulation Mode. Fluid Flow Mode is defined by the collec tion of variable
specifications which typically invoke a simultaneous net work solution.
Fluid State (Instance)
An instance of a Fluid State submodel whose variables represent the thermodynamic state of that fluid
instance through values such as temperature, pressure, and enthalpy.
Fluid State (Model Type)
A Model Type that represents fluid behavior. Used as a submodel in process equipment Model Ty pes.
Fluid Type
A Fluid Type describes the thermodynamic behavior assigned to model instances in a simulation.

66 Version 3.2
Glossary of Terms SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Free Variable
See Calc ulated Variable.
G
Grid
Visible, equally-s paced vertical and horizontal lines on the Canvas that can be used to align objects.
Group Box
An area within the Roles Manager, Properties Inspector, and editors to which columns are dragged to
group data. When empty, the Group Box reads "group by area" and "Drag a field here to group by that
field."
Guide Lines
A vertical or horizontal line that appears on the simulation Canvas when a model instance being moved
is adjacent to another. Used to help align model ins tances with one another.
H
History Manager
An editor that allows you t o define the frequency and quantity of simulation dat a that you want to save for
historical reference.
I
Icon
The graphical symbol that defines the appearance of all Model Types, Port Types, and Fluid Types on
the Canvas.
Integer Parameter
A Parameter that contains integer values. Integer parameters, such as the number of ports, are used to
configure models.
Invariant Attribute
A Variable and Parameter attribute that indicates the value does not change when you revert a
simulation to an earlier snapshot.
K
Keyword View
The detailed information pane of the Simulation Manager, which allows modification of a selected object.
L
Library
See Model Library.
M
Manager
See Simulation Manager, UOM Manager, Snapshot Manager, and Role Manager.
Mode
The solution mode of a simulation that includes a collection of predefined variable specifications and, in
some cases, special solvers.

Version 3.2 67
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Glossary of Terms

Model Editor
The configuration editor used by Model Writers to define Model Types.
Model (Instance)
The mathematical relations hips defined by a Model Type composed of paramet ers, variables, and
equations that define a specific unit operation, such as a valve or pump that exists within a Flowsheet.
Model Library
A collection of Model Types, Fluid Types, Curve Types, and Port Types residing in the Repository, or a
single simulation-specific Model Library residing with a simulation.
Model Library (Display)
A UI component that displays Model Libraries, shapes, and referenc es that can be dragged onto the
Canvas.
A paramet er that contains integer values. Integer parameters can be used to configure a model, such as
defining how many ports it has.
The act of writing a Model Type.
N
Not Solved Variable Attribute
A Variable attribute that indicates that the variable is invalid, stale, or otherwise incorrect and should not
be used. Not solved variables are indic ated in grey strike-through text.
P
Parameter
An object that repres ents the static values of a simulation. Model Writers can add parameters using the
Model Editor and Simulation Builders can add parameters through the Simulation Manager. See Real
Parameter, Enumerated Parameter, Integer Parameter and Fluid Type.
Parameter Connection
A parameter connection is defined in the Model Editor to directionally transfer parameter values through
port connections. Parameter connections of a special parameter type called FluidTy pe are used to
transfer fluid information to connected models.
Parameter Connection
A way of connecting parameters across ports and submodels to trans fer parameter values, such as Fluid
Types.
Port Editor
The configuration editor used by Model Writers to define Port Ty pes.
Port Type
A defined collection of variables that define the stream connection information bet ween model instances
connected by identical Port Types.
Process Mode
Process Mode performs steady state simulations to create and improve process design
Profile
An object which graphically displays scalar and vector data.

68 Version 3.2
Glossary of Terms SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Properties Inspector
A model instance property view accessed through the Canvas or Simulation Manager that allows
Simulation Builders to inspect and configure model instances.
Q
Quick Filter
A disposable Simulation Manager filter created for the immediat e search of an object in the Sim ulation
Manager. Save it if you want to use it again.
R
Real Parameter
A parameter that contains real numerical values (not integers or enumerations) and is defined using
Variable Types. Real parameters can be used in equations, but are treated as a fix ed value. A typical real
parameter could be Pi with the value 3.14159.
Repository
The storage location of simulations, Model Libraries, and Variable Types on the server to which all
SimCent ral users of that server have access.
Repository Manager
The UI component that displays simulations in the Repository.
Required Variable Attribute
A variable attribute for which a Simulation Builder must provide a numerical value.
Reset Snapshot
A function that resets only the calculated values of a previously captured Snapshot. The variable
specifications and real parameters of the simulation being reset are not changed.
Revert Snapshot
A function that reverts the variable specifications, both specified and calculated variable values, and real
parameter values of a previously captured Snapshots.
Ribbon
A set of controls at the top of the UI where common user operations are grouped.
Role
Your role wit hin SimCentral. You can select Model Writing, which is the creation and modification of
Model Types, or Simulation Building, which is the use of existing Model Types within a simulation.
Additional roles may be defined in the Role Manager.
Roles Manager
A manager used to modify default roles and add new roles.
S
Scenario Manager
An editor that allows you to manually script, automatically record and run simulation actions.
Set By User Variable Attribute
A Variable attribute that is set when the Simulation Builder enters a value for a specified variable.

Version 3.2 69
SimSci™ SimCentral™ Simulation Platform Model Writing Guide Glossary of Terms

Shapes
Primitive drawing objects, such as squares or circles, that can be dragged from the Shapes Model
Library to the Canvas.
SimCentral Button

The SimCentral Button contains options to create, import, open, rename, copy, delete, and export
simulations.
SimCentral Server
The computer us ed to host the solver and the Repository.
Simulation
A collection of Flowsheets and their connected model instanc es that define a process.
Simulation Building
The act of building a simulation using existing Model Ty pes.
Simulation Canvas
See Canvas.
Simulation Manager
A hierarchical view of a simulation that allows the Simulation B uilder to explore and modify the simulation
and its objects.
Snapshot
The collection of simulation dat a saved with the simulation that defines the variable specifications,
variable values, and real parameter values. A Snapshot is used to reset or revert a simulation state as it
existed at the point that it was saved.
Snapshot Manager
The UI component that lets you manage existing simulations and capture new ones.
Solver
The soft ware component that solves the mathematical relationships of a simulation.
Specified Variable
A variable with a value specified by the Simulation Builder and with its specification box checked. The
solver does not change the value of specified variables.
State Variable
A Variable with the dynamic attribut e "State Value," whose value is calculated by the evaluation and
integration of its time derivative.
Status Bar
The single line display at the bottom of the user interface which provides system status information.
Submodel
A Submodel is a model which is part of another model, such as a Fluid State submodel. Typically,
submodels are defined so that they can be reused across many different models.
T

70 Version 3.2
Glossary of Terms SimSci™ SimCentral™ Simulation Platform Model Writing Guide

Theme
A collection of text, background, and highlighting colors that can be selected per user preference.
Themes include Dark, Light, and Windows.
Thermo Type
The implementation that SimCentral uses to determine the Fluid State's properties, such as SimSci
Thermodynamics, an external DLL, or a named set of Equations in the Fluid State Submodel.
Trend
An object which graphically displays the time-dependent behavior of a variable during a dynamic
simulation.
Types
See Model Types, Variable Types, Port Types, and Fluid Types.
U
UOM Categories
A sortable grouping of relat ed Variable Types for the purpose of updating their display UOM in a UOM
Slate.
UOM Manager
A manager used to create and manage UOM Slates.
UOM Slate
A collection of UOM settings for all Variable Types, typically representative of a specific count ry or
industry. SI is a standard UOM Slate which comes with SimCentral.
V

Version 3.2 71

You might also like