Академический Документы
Профессиональный Документы
Культура Документы
PRO/II 9.3
COM Server
Reference Guide
May 2014
All rights reserved. No part of this documentation shall be reproduced, stored in a retrieval system, or transmitted by
any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of
Invensys Systems, Inc. No copyright or patent liability is assumed with respect to the use of the information
contained herein. Although every precaution has been taken in the preparation of this documentation, the publisher
and the author assume no responsibility for errors or omissions. Neither is any liability assumed for damages
resulting from the use of the information contained herein.
The information in this documentation is subject to change without notice and does not represent a commitment on
the part of Invensys Systems, Inc. The software described in this documentation is furnished under a license or
nondisclosure agreement. This software may be used or copied only in accordance with the terms of these
agreements.
For comments or suggestions about the product documentation, send an e-mail message to
ProductDocumentationComments@invensys.com.
All terms mentioned in this documentation that are known to be trademarks or service marks have been
appropriately capitalized. Invensys Systems, Inc. cannot attest to the accuracy of this information. Use of a term in
this documentation should not be regarded as affecting the validity of any trademark or service mark.
Invensys, Invensys logo, PRO/II, and SimSci are trademarks of Invensys plc, its subsidiaries and affiliates. All other
brands may be trademarks of their respective owners.
Table of Contents
Introduction --------------------------------------------------------- 1
Overview ---------------------------------------------------------------------------- 1
Notes on Syntax ------------------------------------------------------------------- 1
Notes on Examples --------------------------------------------------------------- 2
Further Reference ---------------------------------------------------------------- 2
Overview
This guide describes the Application Programming Interface (API) to the
PRO/II COM Server. The PRO/II COM Server allows full read/write
access to PRO/II simulation databases using Microsoft COM
technology. Any language or application that supports COM can use the
methods and properties described here. This includes Microsoft Visual
Basic , Microsoft Excel, and C++ applications written using the Win32
API, the MFC (Microsoft Foundation Classes) framework, or the ATL
(ActiveX Template Library) framework. The examples in this document
are written in Visual Basic (VB).
There are three types of objects available in the PRO/II COM Server:
Server Object: This singleton object is used to initialize and manage
interaction with the PRO/II COM Server.
Database Object: This object is used to interact with a specific
simulation database.
The PRO/II COM Server can open only one database at a time.
Data Object: Each data object is used to interact with a
specific object in PRO/II: components, thermodynamic systems,
streams, and unit operations. Data are read from and written to
these objects using the GetAttribute and PutAttribute methods.
Notes on Syntax
In this document, the syntax of the properties and methods is expressed
in the Visual Basic 6.0 language. This language is also used as the macro
language for Microsoft Excel.
Visual Basic allows the developer to implicitly define the data type of a
variable by ending it with a special character. This syntax is used in a
number of the examples in this document.
A variable name ending in a percent symbol, such asLevel% indicates
that the variable is of Integer type.
A variable name ending in a dollar symbol ($), such
asobjName$indicates that the variable is of String type.
The term Nothing is also used when referring to object variables.
Nothing is a reserved keyword in Visual Basic that is used to
Overview
The Server object must be created and initialized before any
simulation database can be created, opened, or solved. To create
the Server Object, use the language-specific method which
creates a COM object. For example, the Visual Basic code to create
the Server Object for PRO/II 8.3 is:
Dim P2SRV as Object
Set P2SRV = CreateObject("SimSciDbs.Database.83")
...
Where:
"SimSciDbs.Database.81" is the progid of the specific version of
PRO/II COM Server to be created. Since multiple versions of PRO/II
can be installed on a single machine, the application must specify
the specific version of PRO/II to be used. For example:
PRO/II PRO/II
progid string progid string
Version Version
Once the Server object has been created, the properties and
methods can be used as described below and in the PRO/II COM
Server Programmers Guide and Tutorial.
The Server object has the following properties:
The Server object has the two classes of methods which are as
follows:
General Server and File Manipulation methods
Error Subsystem methods
Each method is described briefly here. Detailed information is
available in the following section, Server Object Methods.
General Server and File Manipulation Methods
DbsGetAttrId Returns the numeric identifier corresponding to the
supplied class identifier and name of a PRO/II
attribute.
Syntax
level% = object.DebugLevel
INIFile
Description
Returns the path and name of the PRO/II initialization file. This file
contains information regarding configuration and default selections for
the installed version of PRO/II.
When the PRO/II COM Server is initially started, this value is set to a
default value. Typically, this file is named proii.ini and it is located in
the user directory of the PRO/II installation structure. It can also be
changed by supplying a new value in the Initialize method.
Syntax
IniFile$ = object.INIFile
MsgCount
Description
Returns the number of errors, warnings, and messages in the internal
message buffer.
Methods such as FlashStream or Commit may write detailed
informational messages or errors to the internal buffer. Use MsgCount
and MsgText to retrieve these messages.
Syntax
msgcount% = object.MsgCount
Return Value
The numeric code corresponding with the PRO/II attribute for the
specified object class.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
classid% = P2SRV.DbsGetClassId("Stream")
attrid% = P2SRV.DbsGetAttrId(classid%, "Temperature")
Set P2SRV = Nothing
DbsGetClassId
Description
Each object class in PRO/II is identified by a name such as
"StreamIn" or Valve. This method returns the numeric identifier
corresponding to the text string. The numeric identifier can be used in
methods requiring a numeric class identifier, such as DbsGetAttrId.
Return Value
The numeric code corresponding with the PRO/II object class.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
classid% = P2SRV.DbsGetClassId("Stream")
attrid% = P2SRV.DbsGetAttrId(classid%, "Temperature")
Set P2SRV = Nothing
Export
Description
Exports the specified simulation database to a keyword file.
Syntax
retCode% = object.Export(dbName, keywordFile)
Arguments
Return Value
0 no errors
5 specified simulation database was not found
Example
Dim P2SRV As Object
Return Value
<0 security missing or improperly installed
1 completed with no errors or warnings
2 completed with warnings
3 errors were generated
5 specified simulation database was not found
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
retCode% = P2SRV.GenerateReport(p2Database)
' the name of the report is R3R.OUT
Set P2SRV = Nothing
Return Value
The class name returned as a string.
Return Value
The number of PRO/II object classes in the specified group.
Return Value
The name of the object class for the specified group at the specified
index.
Return Value
The group name for specified index.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
grpcount% = P2SRV.GetGroupCount
For i% = 0 To grpcount% - 1
grpname$ = P2SRV.GetGroupNames(i%)
Next
Set P2SRV = Nothing
GetOption
Description
Returns the value of an option in the PRO/II COM server. The
recognized options are listed in the table:
Syntax
value$ = object.GetOption(optionName)
Arguments
Return Value
Value of the option. The value is returned as a text string.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Value1$ = P2SRV.GetOption("showInternalObjects")
Value2$ = P2SRV.GetOption("DoublePrecision")
Set P2SRV = Nothing
Return Value
0 no error
<0 security missing or improperly installed
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database)
' Get a security license (for better performance)
retCode% = P2SRV.GetSecuritySeat(2)
nStreams% = P2DB.GetObjectCount("Stream")
For i% = 0 To (nStreams% - 1)
objName$ = P2DB.GetObjectNames("Stream", i%)
P2DB.CalculateStreamProps (objName$)
Next
Return Value
<0 security missing or improperly installed
1 completed with no errors or warnings
2 completed with warnings
3 errors were generated
5 specified keyword file was not found
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
p2KwdFile$ = "c:\SimSci\proii81\user\Applib\R3R.inp"
retCode% = P2SRV.Import(p2KwdFile$)
Set P2SRV = Nothing
Initialize
Description
Initializes the PRO/II COM Server. This method must be called before
any other methods are invoked. To release (close) the server at the end
of the application, set the object variable to Nothing.
config Optional. The full path and name of the PRO/II initialization file. If
not specified, then it will use the installation-time default read
from the Windows Registry key
HKEY_LOCAL_MACHINE/Software/Simulation
Sciences/PRO/II/x.y/Ini_File, where x.y refers to the specific
version of PRO/II being used (such as "8.3" or "9.0").
schema Optional. The name of the PRO/II schema file. This file contains
the information on what classes and their attributes are available
in the PRO/II database. If not specified, the value is read from the
config file.
Return Value
None.
Example
Using all defaults:
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
...
' Shut down the COM Server
Set P2SRV = Nothing
Specifying the individual files
p2ConfigFile$ = "c:\SimSci\proii81\User\proii.ini"
dbsSchemaFile$ = "c:\SimSci\proii81\System\Schema.sdf"
p2DebugFile$ = "c:\SimSci\proii81\User\debug.txt"
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize p2ConfigFile$, _
Return Value
The text string of the error, warning, or message.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
P2SRV.ClearMsgs
' Perform flash and display the results
sResults$ = P2DB.FlashStream("1")
MsgBox sResults$, vbOKOnly, "Flash Results"
Return Value
The integer code for the error, warning, or message.
Example
See MsgText.
MsgSeverity
Description
Returns the severity level for an error, warning, or message in the
internal message buffer.
Syntax
severity% = object.MsgSeverity(index)
Arguments
Return Value
A Database Object.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2NewDB$ = "c:\SimSci\proii81\User\MyNewDB"
Set P2DB = P2SRV.NewDatabase(p2NewDB$)
Set P2DB = Nothing
Set P2SRV = Nothing
OpenDatabase
Description
Opens an existing PRO/II simulation database. To close the database,
set the object variable to Nothing.
Syntax
Set P2DB = object.OpenDatabase(dbname)
Return Value
A Database Object.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Set P2DB = Nothing
Set P2SRV = Nothing
ReleaseSecuritySeat
Description
Releases the software security seat previously acquired by a call to
GetSecuritySeat.
Syntax
object.ReleaseSecuritySeat
Arguments
None.
Return Value
None.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database)
Return Value
<0 security missing or improperly installed
1 simulation solved with no errors or warnings
2 simulation solved with warnings
3 simulation solved with errors
4 simulation not solved
5 specified keyword file was not found
Syntax
retCode% = object.SetOption(optionName, optionValue)
Arguments
Return Value
0 no error
1 optionName is not recognized
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
retCode% = P2SRV.SetOption("showInternalObjects", "1")
Overview
This object encapsulates a PRO/II simulation database. Use the
OpenDatabase or NewDatabase methods of the Server object to
access this object. With this object, an application can access specific
units and streams in the database using the ActivateObject method.
The Database object has the following properties:
Return Value
A Database Data Object. If the named object does not exist in the
database, the return value will be Nothing.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("Stream", "1")
dTemp = P2OBJ.GetAttribute("Temperature")
Set P2OBJ = Nothing
Set P2DB = Nothing
Set P2SRV = Nothing
BuildCompCalc
Description
Creates the calculation-time component data objects in preparation for
the FlashStream or RunCalcs method.
Note: this method is automatically called as part of the CheckData
method. If the PRO/II COM application is calling CheckData in
preparation for RunCalcs then it does not need to call BuildCompCalc.
If the application is creating a new database for the purpose of setting up
a flash calculation using FlashStream, then refer to the detailed
example XXX in the tutorial section.
Return Value
Boolean value: true = no error, false = error during calculations. Use the
Status property to retrieve the underlying error code.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Specify: To calculate:
Return Value
Boolean value: true = no error, false = error during calculations. Use the
Status property to retrieve the underlying error code.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim retCode As Boolean
retCode = P2DB.CalculateStreamProps2("1", "")
retCode = P2DB.CalculateStreamProps2("1", "all")
retCode = P2DB.CalculateStreamProps2("1", "std")
retCode = P2DB.CalculateStreamProps2("1", "std,tbp")
retCode = P2DB.CalculateStreamProps2("1", "std,rvp")
retCode = P2DB.CalculateStreamProps2("1", _
"std,tbp,bpdp")
Set P2DB = Nothing
Set P2SRV = Nothing
CalculateUnitProps
Description
Calculates output-time properties for the specified unit.
Return Value
Boolean value: true = no error, false = error during calculations. Use the
Status property to retrieve the underlying error code.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R1.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim retCode As Boolean
retCode = P2DB.CalculateUnitProps("HC1")
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("HcurveIn", "HC1")
dbObjType The Object type. Valid values are "Unit" and loop.
Return Value
The internal numeric identifier of the PRO/II object.
Example
Not available.
ConvertNumToId
Description
Returns the name of the PRO/II object specified by its internal number.
This method is required for some situations where the attribute of a
PRO/II object is returned as a number but that number needs to be
converted to an actual object name for use in ActivateObject.
Syntax
ObjName$ = object.ConvertNumToId(dbObjType, objNumber)
Arguments
dbObjType The Object type. Valid values are "Unit" and loop.
objNumber The internal object number. Specify 1 for the first object.
Return Value
The name of the PRO/II object.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
ObjName$ = P2DB.ConvertNumToId("Unit", 1)
Set P2DB = Nothing
Return Value
The converted value.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("Stream", "1")
dTemp = P2OBJ.GetAttribute("Temperature")
dPres = P2OBJ.GetAttribute("Pressure")
dRate = P2OBJ.GetAttribute("TotalMolarRate")
dTemp2 = P2DB.ConvertValue( _
totype Character code identifying what to convert the value to. One
Return Value
The converted value.
Example
See ConvertValue
CopyTrayToStream
Description
Copies the flowrate, thermal conditions, and composition data from a
column tray to a stream.
Syntax
retCode = object.CopyTrayToStream(columnname, tray, phase, subphase, net,
streamname)
Arguments
columnname The name of the column.
Return Value
Boolean value: true = no error, false = error during calculations. Use the
Status property to retrieve the underlying error code.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Return Value
A Database Data Object.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
' Create new stream object
tmpStream$ = "TMPSTR"
Set P2OBJ = P2DB.CreateObject("Stream", tmpStream$)
' Free (release) object from memory.
Return Value
None.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
' Create new stream object
tmpStream$ = "$TMPSTR"
Return Value
A text string containing the results of the flash.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
P2SRV.ClearMsgs
' Perform flash and display the results
sResults$ = P2DB.FlashStream("1")
Return Value
The object count.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
objcount% = P2DB.GetObjectCount("Stream")
For i% = 0 To objcount% - 1
objname$ = P2DB.GetObjectNames("Stream", i%)
Next
Set P2DB = Nothing
Set P2SRV = Nothing
GetObjectNames
Description
Returns the name of an object with the specified class and index. This
function is typically used with the GetObjectCount method.
Syntax
object.GetObjectNames(classname, index)
Return Value
The object name returned as a string.
Example
See GetObjectCount.
GetUOMString
Description
Returns the printable version of a unit-of-measure.
Syntax
object.GetUOMString(uomclass, type)
Arguments
Return Value
The unit-of-measure string.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("Stream", "1")
Return Value
The unit-of-measure string.
Example
Not available.
MiscChecks
Description
Performs final checks on a flowsheet in preparation for RunCalcs.
Note: this method is automatically called as part of the CheckData
method. PRO/II COM applications should call the CheckData method.
Syntax
object.MiscChecks
Arguments
None.
Return Value
Boolean value - True if an object of the specified name and class exists in
the simulation database, otherwise False.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim objExists As Boolean
objExists = P2DB.ObjectExists("Stream", "1")
objExists = P2DB.ObjectExists("Stream", "XXXXX")
Set P2DB = Nothing
Set P2SRV = Nothing
Return Value
Boolean value - True if an object of the specified name exists in the same
group as the specified class, otherwise False.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim objExists As Boolean
' Application wants to create a splitter named SS01
' Is the name already used by another unit?
objExists = P2DB.ObjectExistsInGroup("Splitter", "SS01")
Return Value
None.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Status% = P2DB.Status
P2DB.RenameObject "Stream", "1", "STREAM1"
Status% = P2DB.Status
Set P2DB = Nothing
Set P2SRV = Nothing
Return Value
Boolean value: true = no error, false = error during calculations. Use the
Status property to retrieve the underlying error code.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\G3.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim boolCode As Boolean
boolCode = P2DB.RestoreInputData(1)
retCode% = P2DB.CheckData
Set P2DB = Nothing
retCode% = P2SRV.RunCalcs(p2Database$)
Set P2SRV = Nothing
Overview
An object of this type represents a specific simulation data object in
PRO/II. All streams, components, thermodynamic methods, reaction
data sets, streams, and unit operations are Database Data Objects.
The PRO/II Object Reference documents the PRO/II data classes and
their attributes.
The Database Data objects have the following properties:
Return Value
None.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("Stream", "1")
dTemp = P2OBJ.GetAttribute("Temperature")
P2OBJ.PutAttribute 450#, "Temperature"
P2OBJ.Commit True
dTemp2 = P2OBJ.GetAttribute("Temperature")
Set P2OBJ = Nothing
Set P2DB = Nothing
Set P2SRV = Nothing
GetAttribute
Description
Returns the value of a scalar attribute, one element of an array, or an
entire array attribute.
Return Value
The value of the attribute returned as a variant. The value can be
integer, floating point, or character, depending on the attribute. Empty
will be returned if the database value is missing.
Example
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
p2Database$ = "c:\SimSci\proii81\user\Applib\R3R.prz"
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("Stream", "1")
' Scalar attribute
dTemp = P2OBJ.GetAttribute("Temperature")
' Single elements of an array attribute
fracCount = P2OBJ.UnitCount("TotalComposition")
For i% = 0 To fracCount - 1
dFracElement = P2OBJ.GetAttribute( _
"TotalComposition", i%)
Next
' Complete array attribute
dFracArray = P2OBJ.GetAttribute("TotalComposition", -1)
For i% = LBound(dFracArray) To UBound(dFracArray)
Return Value
The data type as a string. The data types are INTEGER, REAL,
DOUBLE, SINGLE, STRING, and UOM.
Example
See GetAttributeCount.
GetAttributeName
Description
Returns the name of an attribute in this object as identified by the
specified index.
Use the method GetAttributeCount to get the number of attributes in
this object.
Syntax
attrName$ = object.GetAttributeName(index)
Index The index of the object name to retrieve. Specify 0 for the
first object name.
Return Value
The attribute name returned as a string. The returned attribute name
can be used in methods such as GetAttribute and PutAttribute.
Example
See GetAttributeCount.
GetAttributeSystemDataType
Description
Returns the system data type associated with the attribute.
Syntax
systemType$ = object.GetAttributeSystemDataType(attrname)
Arguments
Return Value
The data type as a string. The data types include I (integer), R
(real), D (double), S (single), STRING, UOM, SID (stream ID) ,
COID (component ID) , RSID (reaction set ID) , MID
(thermodynamic method set ID).
Example
See GetAttributeCount.
GetAttributeUOM
Description
Returns the unit-of-measure class associated with the attribute.
Syntax
Uom$ = object.GetAttributeUOM(attrname)
Arguments
index Optional. The index of the array element. Used only for
array attributes. Specify 0 to put a value for the first
element.
Return Value
None.
Example
dbsSchemaFile$ = "c:\SimSci\proii81\System\Schema.sdf"
p2ConfigFile$ = "c:\SimSci\proii81\User\proii.ini"
p2Database$ = "c:\SimSci\proii81\user\G3.prz"
Dim P2SRV As Object
Set P2SRV = CreateObject("SimSciDbs.Database.81")
P2SRV.Initialize
Dim P2DB As Object
Set P2DB = P2SRV.OpenDatabase(p2Database$)
Dim P2OBJ As Object
Set P2OBJ = P2DB.ActivateObject("StreamIn", "1")
' Scalar attribute
dTemp = P2OBJ.GetAttribute("Temperature")
P2OBJ.PutAttribute 450#, "Temperature"
' Single elements of an array attribute
fracCount = P2OBJ.UnitCount("Composition")
newFracElement = 0.25
Return Value
The number of elements for an array attributes. A scalar attribute
will return a value of 1.
Example
See GetAttributeCount.
UnitSize
Description
Returns the size, in bytes, of a scalar attribute; or the size of a single
element of an array attribute.
Syntax
Size% = object.UnitSize(attrName)
Return Value
The size, in bytes, of a scalar attribute; or the size of a single
element of an array attribute.
Example
See GetAttributeCount.
Temperature TEMP 1
Pressure PRES 4
Mass WT 7
Time TIME 8
Length LENG 9
Area AREA 12
Velocity VELO 14
Energy ENER 24
Duty DUTY 26
Enthalpy ENTH 28
Entropy ENTR 29
Heat Capacity CP 30
Viscosity VISC 40
Basis BASI 43
Phase PHAS 44
Fraction FRAC 45
Percentage PCT 46
Angle ANGL 48
Input data for each component is stored in its own object of class "CompIn"
For example, properties for component a named "H20" are stored in the "CompIn" class
object called "H2O".
Heats of Formation
Kinematic Viscosity
Correlated Data
Tabular Data
Vapor Pressure
Latent Heat
Solid Enthalpy
Solid Density
- Saturated
liquid
viscosity
Unifac Parameters
The component PSD information (ranges) are stored in the "CompPSD" class. This class
contains only one object called "CompPSD".
The values supplied in the stream for a component correspond to the ranges supplied for that
component in this object.
The names of the general attributes for components are stored in the " CompMisc" class.
This class contains only one object called " CompMisc".
The values supplied in "StrmMiscIn" class objects correspond to the attribute names supplied
for that component in this object.
The component polymer information (ranges) is stored in the "CompPoly" class. This class
contains only one object called "CompPoly".
The calculated fixed property data for components are stored in the "CompCalc" class.
There is only one instance of this class and its name is also "CompCalc".
This object contains vectors for each component property and Property[i] belongs to
component ComponentId[i].
Default Methods
User-overridden Methods
BWRS
Data applicable for K-Value (VLE), Liquid enthalpy, Vapor enthalpy, Liquid density, Vapor
density, Liquid entropy, Vapor entropy classes
Data applicable for K-Value (VLE), K-Value (LLE), Liquid enthalpy, Vapor enthalpy, Liquid
density, Vapor density, Liquid entropy, Vapor entropy classes
Lee-Kesler-Plocker
Data applicable for K-Value (VLE), K-Value (LLE), Liquid enthalpy, Vapor enthalpy, Liquid
density, Vapor density, Liquid entropy, Vapor entropy classes
Data applicable for K-Value (VLE), K-Value (LLE), Liquid enthalpy, Vapor enthalpy, Liquid
density, Vapor density, Liquid entropy, Vapor entropy classes
SRKP, PRP
Data applicable for K-Value (VLE) and K-Value (LLE) classes only
NRTL3
NRTL5
NRTL6
NRTL8
NRTL10
Comp ID.
- Component i NRTL10Comp1 Vector NRTL10 i's
Comp ID.
- Component j NRTL10Comp2 Vector NRTL10 j's
- Number of
component pairs InT NRTL14Count
Comp ID.
- Component i NRTL14Comp1 Vector NRTL14 i's
Comp ID.
- Component j NRTL14Comp2 Vector NRTL14 j's
UNIQUAC
Data applicable for K-Value (VLE) and K-Value (LLE) classes only
UNIQUAC (4 parameter)
Azeotrope Data
Wilson
Van Laar
Data applicable for K-Value (VLE) and K-Value (LLE) classes only
Margules
Data applicable for K-Value (VLE) and K-Value (LLE) classes only
Ideal IDEAL 1
Peng-Robinson PR 102
Grayson-Streed GS 103
Chao-Seader CS 104
The particle size distribution ranges for the each component are defined in the CompPSD
object. The data supplied in streams are the values for these ranges.
The names of the general attributes are defined in CompGen object. The data supplied in
streams are the values for these general attribute names.
Zc BulkCritZFactor Real
Cp LiqCP CP Real
Liquid density,
Standard LiqDensityStd LDEN Real
Cp HCLiqCP CP Real
Cv HCLiqCV CP Real
Cp DecWatCP CP Real
Cv DecWatCV CP Real
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table 3-1.
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table Table: 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
CV
Compressibility
Factor
Efficiency
Head
Work
Aftercooler
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
NPS
Pressure drop
Temperature
Pressure
Average Velocity
Slip density
Taitel-Dunkelr-
Barnea flow regime
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Documentation, Class=UAS
Conditions, Class=UAS
Feeds, Class=UAS
Products, Class=UAS
Cp VaporMolarCp CP Real
All standard stream properties such as mole fractions and weight fractions of various
phases are accessible via the Standard Stream Class. See Table 3-1.
NumberOfPumparounds Int
PumpAroundHeaterNum 0 to PA Int PA =
-1 NumberOfPump
arounds
PumpAroundNames 0 to PA Char
If:
Number of components = 10
th
NC4 is the 7 component on the component list
Mole fraction of nC4 on tray 17 = 0.3
th
Tray 17 is the 4 tray for which vapor compositions are given
Then:
NOC =10
Index for component NOC * j + k where Int See example for vapor
cid on tray i TrayNumsCestL(j) compositions above
= i and
ComponentIds(k)=
cid
Index for component NOC * j + k where Int See example for vapor
cid on tray i TrayNumsCest1L(j) compositions above
= i and
ComponentIds(k)=
cid
Index for component NOC * j + k where Int See example for vapor
cid on tray i TrayNumsCestL2(j) compositions above
= i and
ComponentIds(k)=
cid
Value SpecValue
N=
Tray efficiency TrayEfficiency 0 to N-1 Real
NumberOfTrays
Compressibility TrayVaporEOSZ 0 to NT -
calculated from K- 1
value EOS
Number of NumComps
components
Number of NumberOf
pumparounds Pumparounds
PumpAroundEnthalpy 0 to
NP - 1
HX Input Data
Documentation, Class = Hx
Configuration, Class = Hx
Specifications, Class = Hx
Feeds, Class = Hx
Products, Class = Hx
Utilities, Class = Hx
Inlet/Outlet
temperatures for
water, air
HX Calculated Properties
Parameters, Class = Hx
Overall UA UA Real
specification UaCalc
LMTD correction
factor (FT) LmtdFactorCalc
Temperature
crossover ZoneLmtdCalc
Utilities, Class = Hx
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table 3-1
U*A UAVal
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table 3-1
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Stoichiometry StoiCoefIn 0 to NC =
Coefficients actually
NC *
used
NR -1 NumberOfComponents*
NR =
NumberOfReactions
Index =
NOC *( j - 1) + i -1
i = component number
j = reaction number
TEM Real
Inlet temperature RxIntemp P
TEM Real
Outlet temperature OutTempCalc P
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases are
accessible via the standard Stream Class. See Table: 3-1
Class = Gibbs
2 Liquid
3 - Vapor Liquid
4 Liquid Liquid
5 Vapor Liquid
Liquid
6 Calculated
(Default)
Class = Gibbs
RXNPhaseFlag Real
Calculated Phase Calc
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various
phases are accessible via the standard Stream Class. See Table 3-1.
Class = EquReactor
Class = EquReactor
Class = EquReactor
given
2 - Reactor outlet
pressure given
Approach
Class = EquReactor
* You can obtain the NOC by executing the GetObjectCount method on object
CompIn. For example: NOC = P2File.GetObjectCount(CompIn)
Class = EquReactor
EquReactor Calculated Properties
Thermal Conditions
Class = EquReactor
Class = EquReactor
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases
are accessible via the standard Stream Class. See Table: 3-1
Class = EquReactor
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
approach direction Vector direction,
2 from above
3 from below
Class = BatchDistil
Class = BatchDistil
segment
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
top tray pressure for TopTrayPolyPress PRES Real top tray pressure
policy vector for policy
Class = BatchDistil
stage for policy vector stage for policy
Class = BatchDistil
Start time for PRINT PrIntStartTime TIME Real start time for
scalar PRINT
End time for PRINT PrIntEndTime TIME Real end time for PRINT
scalar
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatchDistil
Class = BatReactor
Class = BatReactor
Class = BatReactor
Class = BatReactor
Cp VaporMolarCp CP Real
All standard stream properties like Mole Fractions, Weight Fractions of various phases
are accessible via the standard Stream Class. See Table: 3-1
Class = Depressure
Depressure Input Data
Descriptive name UnitName Char 40 char max
Depressure Configaration
Class = Depressure
Class = Depressure
Class = Depressure
Class = Depressure
Class = Depressure
Class = Depressure
Class = Depressure
Class = Depressure
Depressure Calculated Properties
Vessel volume VessVolumeCalc LIQV Real Calculated vessel
volume
Class = Depressure
Class = Depressure
Class = Depressure
Attribute
Property Index Units Type Description
Name
Class = Controller
Controller Input Data
Descriptive name UnitName Char 40 char max
Controller CalculatedProperties
Execution counter RunFlag Integer 0 = never ran
>0 = count of executed
trials (Nt)
Class = MVC
Class = Optimizer
Optimizer Input Data
Class = Optimizer
Class = Optimizer
Class = Optimizer
Class = Optimizer
Class = Optimizer
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Feeds
Class = StreamCalc
Products
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
Class = StreamCalc
HcurveInput Data
HcurveInput Data
CalcUnitID Unit Name None Calc unit id (diff than UnitID for
(Character) Array merged cols) - If 0 then source of
Hcurve is a stream
Class = HcurveCalc
HcurveInput Data
HcurveInput Data
HcurveInput Data
HcurveInput Data
HcurveInput Data