The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Navigation: Main Page ➔ PGMs
Latest SysCAD Version: 19 March 2024 - SysCAD 9.3 Build 139.35102
Related Links: General Controller, Model Procedures, Example PGM Files, Frequently Asked Questions, Notepad++ Auto-complete Functions and Keywords
PGM LANGUAGE
|
Introduction |
The built in programing language referred to as a PGM (Programmable Module) is often used to extend the functionality of SysCAD models. It is used by the General Controller Model and can be edited with any text editor, however VS Code or Notepad++ with colour syntax highlighting is recommended. The PGM syntax is similar to other programming languages like VB.
|
Declaring and Managing Variables
|
Data Types
|
|
Variable Status
|
- Declared variables can be appended with:
- Examples:
REAL SolidFeedRate*("Qm","t/h")<10,20><<18>>
REAL FeedSolids{i,Range(0,100),Comment("Percent")}
|
Formatting
|
|
PGM Programming and Conventions
|
PGM Syntax
|
|
Predefined Variables
|
|
Operators
|
|
Trigger Subroutines
|
|
Keywords & Functions
|
SysCAD Tag Functions
|
- SysCAD GetTag Functions
Variable = ["SysCAD Tag"]
Variable = GetTag("SysCAD Tag")
Variable = GetDynTag("SysCAD Tag")
String = GetDynStrTag("SysCAD Tag")
- SysCAD SetTag Functions
["SysCAD Tag"] = Variable OR [str "SysCAD Tag"] = String
SetTag("SysCAD Tag", Value)
SetDynTag("SysCAD Tag", Value)
SetDynStrTag("SysCAD Tag", String)
- Check for Valid Tag
Variable = DynTagExists("SysCAD Tag")
|
Defining a Function |
|
Defining a Subroutine |
|
Predefined Functions
|
- If Statements: If, ElseIf, Else, Endif ;
- Conditional If: iif() ; iifStr()
- While Statements: While, Endwhile
- Time Keywords: Time(), DeltaTime()
- Miscellaneous Functions: Random()
- Species Functions: MW(), SpI()
- Conversions: Cnv(), CnvVal()
- Conceal state: SetConcealedState
- SolverAction: StopSolver(), PauseSolver()
- Messages: LogError(), LogWarning(), LogNote()
- Conditions: ConditionError(), ConditionNote()
- Sound: Beep(), Sound()
|
Maths Functions
|
- Sqrt | Cbrt
- Pow
- Exp
- Abs
- Sin | aSin
- Cos | aCos
- Tan | aTan
- ATan2
- Degrees
- Radians
- Ln
- Log
- Max
- Min
- Range
- IsNAN
- Floor
- Ceil
- Trunc
- Round
- RoundTo
- RoundUp
- Mod
- Div
- Erf
- IsClose
- IsCloseTol
- IsCloseError
- IsCloseTolError
|
String Functions
|
- Left
- Right
- Mid
- StrCat/Concatenate
- StrStr/StrFind
- StrStrFrom/StrFindFrom
- StrInsert
- StrReplace
- StrReplaceFrom
- StrErase
- StrCmp
- StriCmp
- StrLen
- StrUpr
- StrLwr
- IntToStr
- IntStr / IntStr0
- FltToStr
- FltStr
- StrToInt
- StrToFlt
- Trim
- TrimWhiteSpace
- IsEmpty
- IsAlpha
- AlphaToNum
- NumToAlpha
- iifStr()
|
Classes
|
Defining and Using a Class |
- Syntax for defining a class: Class, EndClass
- Special functions available within class functions and subs: ClassTag(), ClassName()
- Class instances display options: ExcludeWatch, ClassComment and class definition formatting keywords ClassAsGroup, ClassAsPageLabel, ClassAsTextLabel
- Class grid display options: ClassGrid and class definition formatting keywords ClassGridColumnWidth, ClassGridMaxColumns, ClassGridHideComment, ClassGridHideText
- Working with Classes: ClassList, ExcludeClass and Macros ForEachSub(), ForEachFn(), ForEachVar(), ForEachVarSet() and Macro Functions ForEachFnCalc(), ForEachVarCalc(), ForEach(), ClassCount()
|
Global Class Instances
|
|
Predefined Classes
|
|
OTHERS
|
Examples
|
|
Frequently Asked Questions |
Some frequently asked questions and answers.
|
PGM Error Codes |
This gives some explanation for the error codes used by SysCAD when reporting problems with PGM file syntax.
|