Tag Select Class

From SysCAD Documentation
Jump to: navigation, search

Navigation: PGMs -> Classes -> Predefined Classes

Species Database Class Particle Size Definition Class Array Class StrArray Class Matrix Class Tag Select Class Plant Model Class Noise Class TimeClass

This class only exists in SysCAD 9.3 Build 136 and later.


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. New to Build 137 a list of all SubType tags, for example reaction blocks, can be returned.

The main Exec function is used to perform the query. 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 Example
Exec(Criteria,WithGraphic,WithUnitType)

This is the main function call.

Bit

  • Criteria is a string variable which contains the query criteria
  • WithGraphic is a bit variable to indicate if the graphic will be included in the results
  • WithUnitType is a bit variable to indicate if the unit type will be included in the results

TS.Exec("[UnitType] == 'Pipe-1'", true, false)

GetLen()

The number of items found by the query.

Integer

None

TS.GetLen()

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)

TS.Tag(i)

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)

TS.Graphic(i)

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)

TS.UnitType(i)

StatusString()

The status of the query:

  • "OK" if successfully completed
  • Blank if not performed
  • Error message if problem with Criteria

String

None

TS.StatusString()

CriteriaString()

The query criteria returned as a string.

String

None

TS.CriteriaString()

GetValues(VariableTag, ValueArray)

Sets the contents of ValueArray are based on VariableTag provided. The length of ValueArray is always set to number of items found by the TagSelect.Exec function call (which is equal to TagSelect.GetLen() function). The number returned is the count of found full tags and may be equal or less than the array length. If less then this means that the specified full tag is not found for one or more of the entries. For the entries corresponding to invalid tags the corresponding result value in the returned ValueArray is zero.

This function is available in SysCAD 9.3 Build 137 and later.

Long

VariableTag is a String.

  • This variable tag is combined with the Returned Unit Tag to form a valid SysCAD Tag.
  • The tag will start with a dot, eg: ".QProd.Qm (t/h)"

ValueArray is an Array

  • The array is used to store values for all tags meeting the Exec Function call criteria.

TS.GetValues(".QProd.Qm (t/h)", Flows)

See: GetValue Function Examples.

Examples

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:

  1. These criteria will capture both connected and disconnected feeders and sinks.
  2. This assumes that Makeup Sources are only used on the flowsheets they themselves are on.
  3. The Page name of each flowsheet (eg. Page1, Page2, etc) can be found on the Plant Model-Flowsheets tab page. Alternatively, the full flowsheet name could be used eg. [Graphic]=='05_Flowsheet'