From SysCAD Documentation
Jump to navigation Jump to search

Navigation: Main Page ➔ PGMs

Latest SysCAD Version: 28 June 2022 - SysCAD 9.3 Build 139.31157

Related Links: General Controller, Model Procedures, Example PGM Files, Frequently Asked Questions, Notepad++ Auto-complete Functions and Keywords

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 NotePad++ with colour syntax hi-lighting is recommended. The PGM syntax is similar to other programing languages like VB.
Declaring and Managing Variables
Data Types
Variable Status
Declared variables can be appended with:
  • Read/write enabled *, read only @, concealed @@;
  • with Engineering units - eg:("Qm","t/h") and range limits <Min, Max>.
  • REAL FeedSolids{i,Range(0,100),Comment("Percent")}
  • REAL SolidFeedRate{*,("Qm","t/h"),<<18>>,<10, 20>}
  • PageLabel()- used to add tabs to the PGM access window,
  • TextLabel() - used to add description to the PGM access window
PGM Programming and Conventions
PGM Syntax
  • Semicolon(;) marks the comments.
  • >>filename loads in another include file.
  • Dollar Sign($) or EndFile marks the End of the file.
  • SetChangeTagOn and SetChangeTagOff control if Change Tag should apply to the file.
Predefined Variables
  • Pi
  • Gc
  • Rgc
  • StdT
  • StdP
  • NAN
  • True
  • False
  • MaxLong
  • MinLong
  • StopSimulation
  • PauseSimulation
  • ModelTag
Trigger Subroutines
Keywords & Functions
SysCAD Tag Functions
SysCAD GetTag Functions
  • Variable = ["SysCAD Tag"]
  • Variable = GetTag("SysCAD Tag")
  • Variable = GetDynTag("SysCAD Tag")
  • String = GetDynStrTag("String")
SysCAD SetTag Functions
  • ["SysCAD Tag"] = variable OR [str "String1"] = String2
  • SetTag("SysCAD Tag", value)
  • SetDynTag("SysCAD Tag", value)
  • SetDynStrTag(String1, String2)
Check for valid Tag
  • variable = DynTagExists(string)

Defining a Function
  • Function, Return, EndFunct
  • StrFunction, Return, EndFunct
Defining a Subroutine
  • Sub, EndSub
Predefined Functions
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
String Functions
  • Left
  • Right
  • Mid
  • StrCat/Concatenate
  • StrStr
  • StrCmp
  • StriCmp
  • StrLen
  • StrUpr
  • StrLwr
  • IntToStr
  • IntStr / IntStr0
  • FltToStr
  • FltStr
  • StrToInt
  • StrToFlt
  • Trim
  • TrimWhiteSpace
  • IsEmpty
  • IsAlpha
  • AlphaToNum
  • NumToAlpha
  • iifStr()
Defining and Using a Class
  • Syntax for defining a class: Class, Endclass
  • Syntax for using a Class: ClassTag(), ClassName(), ForEachClass()
Species Database Class This class gives access to information about species and phases within a project. For example, users can obtain species Density, Saturated Temperature or Pressure, number of solid species in a project, etc.
Particle Size Definition Class This class gives access to information about the Particle Size Definition (PSD) within a project. For example, users can find the number of Size Intervals in a PSD, the Top and bottom Size, etc.
Predefined Classes
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.