Predefined Constants and Variables
Jump to navigation
Jump to search
Navigation: PGMs
PGM Syntax | Data Types | Declaring Variables | Predefined Variables | Labels |
---|
Contents
Introduction
Constants can be used in expressions and statements, they are effectively read only variables. You can declare your own constants using the Const Keyword.
SysCAD Predefined Constants are listed in the following headings.
Standard constants
Type | Predefined Constant |
Predefined Value | Conversion Units Definition |
---|---|---|---|
BIT | TRUE | = 1 | |
BIT | FALSE | = 0 | |
REAL | PI | = 3.14159265358979 | |
REAL | NAN | = * (see also IsNAN in Mathematical Functions) | |
REAL | Gc | = 9.80665 (Gravitational constant in m/s2) | ("Accel", "m/s^2") |
REAL | Rgc | = 8.314472 (Universal Gas Constant in J/mol.K) | ("S(Ml)", "J/Mol.K") |
REAL | StdT | = 25.0 (Standard Temperature in dC) | ("T", "dC") |
REAL | StdP | = 101.325 (Standard Pressure in kPa) | ("P", "kPa") |
Special constants
Type | Predefined Constant |
Predefined Value |
---|---|---|
BIT | OnInitialise | = 1 for the first iteration when the SysCAD run command is passed but before it is executed. = 0 for all subsequent iterations. This can be used to set tags that will become unchangeable once SysCAD is solving, which includes tags such as solving methods, any list boxes or tick boxes and datum in Dynamic. Note: SetDynTag(Tag, value) and GetDynTag(Tag) must be used to do this. Can still be used in SysCAD 9.3 if using the Old135Format option in the General Controller. Alternatively, the PreStart and InitialiseSolution Trigger Subroutines can be used. |
BIT | OnTerminate | = 1 for the last iteration when the SysCAD stop command is passed. = 0 for all other situations. This can be used to the check condition of the solve solution and generate user defined messages based on the results. Can still be used in SysCAD 9.3 if using the Old135Format option in the General Controller. Alternatively, the TerminateSolution Trigger Subroutine can be used. |
BYTE | SolveMode | This indicates the SysCAD solver mode. |
STR | ModelTag | This contains the tag of the model that is using the PGM. It refers to the parent or owner of the PGM code. For example, this is useful for Log messages to distinguish between different General Controller models using PGM code. |
Special variable
Type | Predefined Constant |
Predefined Value |
---|---|---|
BIT | StopSimulation | If this is set to 1 (true) then the PGM halts the SysCAD run. This is useful for running a scenario for a fixed time or for stopping SysCAD under certain conditions. |
BIT | PauseSimulation | If this is set to 1 (true) then the PGM pauses the SysCAD run. |
Reserved Variables
Some variable names are "reserved" and cannot be used when defining user defined variables. These include:
- variables listed in the Standard constants list
- variables listed in the Special constants list
- variables listed in the Special variables list
- names used by predefined functions: Mathematical Functions, String Functions, Predefined Functions
- File