Predefined Constants and Variables

From SysCAD Documentation
Jump to: navigation, search

Navigation: PGMs

PGM Syntax Data Types Declaring Variables Predefined Variables Labels

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 OnStart = 1 for the first iteration when SysCAD run is executed.
= 0 for all subsequent iterations.
This is useful for some initialisation code. Removed in SysCAD 9.3.
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.