TagSelect Class
Navigation: PGMs ➔ Classes ➔ TagSelect Class
Global Pre-Defined Class Instances | SysCAD Pre-Defined Classes | |||||||
---|---|---|---|---|---|---|---|---|
Sp Database SDB Class | Particle Size Defn PSD Class | Plant Model PM Class | Array Class | StrArray Class | Matrix Class | TagSelect Class | Time Class | Noise Class |
Latest SysCAD Version: 25 October 2024 - SysCAD 9.3 Build 139.36522
Related Links: Defining a Class, Example PGM Files
Description
The TagSelect class, provides a member function to retrieve a list of model tags meeting a SQL type select query, similar to the Excel Tag Select Reports. A list of all SubType tags, for example reaction blocks, can be returned.
The main Exec function is used to perform the query. The OrderBy cannot be specified, the tags returned will be in ascending order. The other functions can then be used to find the results of the query.
The query is a computationally expensive function and is not intended to be carried out every iteration. It is best carried out once per run, such as during initialisation or termination of the model solution using the Trigger Subroutines.
Data Members
None
Member Functions
Call | Functionality | Return Type | Parameters |
---|---|---|---|
Exec(Criteria,WithGraphic,WithUnitType) |
This is the main function call. |
Bit |
|
GetLen() |
The number of items found by the query. |
Integer |
None |
Size() |
The number of items found by the query. |
Integer |
None |
Tag(Index) |
The Tag of the query result corresponding to the specified Index. |
String |
Index is an integer variable, valid values are 0 to the result of (GetLen()-1) |
Graphic(Index) |
The Graphic (flowsheet) for the query result corresponding to the specified Index. |
String |
Index is an integer variable, valid values are 0 to the result of (GetLen()-1) |
UnitType(Index) |
The UnitType of the query result corresponding to the specified Index. |
String |
Index is an integer variable, valid values are 0 to the result of (GetLen()-1) |
StatusString() |
The status of the query:
|
String |
None |
CriteriaString() |
The query criteria returned as a string. |
String |
None |
GetValues(VariableTag, ValueArray) |
|
Long |
VariableTag is a String.
ValueArray is an Array
|
Examples
Simple examples for calling the tag select functions in the above table:
TagSelect TS
Array Flows
OK = TS.Exec("[UnitType] == 'Pipe-1'", true, false)
ResultState = TS.StatusString()
CriteriaUsed = TS.CriteriaString()
TagCount = TS.GetLen()
TheTag = TS.Tag(i)
TheGraphicPage = TS.Graphic(i)
TheUnitType = TS.UnitType(i)
FoundCount = TS.GetValues(".QProd.Qm (t/h)", Flows)
GetValue Function Examples
These examples uses the GetValue function call for the mass summation calculations.
Steady-State Project Mass Balance
The following examples show how the Tag Select Class could be used to perform a simple mass balance in a steady-state project.
Dynamic Project Mass Balance
The following example shows how the Tag Select Class could be used to perform a simple mass balance in a dynamic project. The main difference to the steady-state mass balance shown above is that is needs to take account of material in surges and tears (in dynamic, tears can have surge).
Species Mass Balance
See How to perform a Species Mass Balance
See also Example PGM - Species Check for how to check if the species is used in the project.
Elemental Mass Balance
See How to perform an Elemental Mass Balance
Mass Balance per Flowsheet
To perform a mass balance per flowsheet, the logic would be identical to the Project Mass Balance above except the Criteria statements would change to something similar to the following:
"(([UnitType]=='FeederSink' AND ([State]==1 OR [State]==3)) OR [UnitType]=='MakeupSource') AND [Graphic]=='Page1'"
"[UnitType]=='FeederSink' AND ([State]==2 OR [State]==4) AND [Graphic]=='Page1'"
Notes:
- These criteria will capture both connected and disconnected feeders and sinks.
- This assumes that Makeup Sources are only used on the flowsheets they themselves are on.
- The Page name of each flowsheet (Page1, Page2, etc.) can be found on the Plant Model-Flowsheets tab page. Alternatively, the full flowsheet name could be used e.g. [Graphic]=='05_Flowsheet'