PGM Examples - Simple PGM file

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Example PGM Files ➔ Basic Layout

Simple Examples Subroutines Examples Dynamic Examples Steady State Overall Mass Balance Array and Matrix Examples
Basic
Layout
Simple
Calculations
Initialise
PreStart
Multi-Step Trigger Checking
Project
Counter, While
and Random
Belt Filter
Wash Loss
Startup
Actions
Mass
Balance
Mass
Balance
Species
Balance
Elemental
Balance
Lookup
Value
Set
Values
Tridiagonal
System

;======================================================================================
; This is a sample PGM file.  The aim is to set the recycle flowrate 
; (from tank3 to tank1) to be half the feed flowrate.
;======================================================================================

;---- Define Variables ------------------------
  PageLabel "Flow"
  TextLabel ""
  Checkbox UseDefaultSetPoint*            
  Real     FeedSetPoint*("Qm","kg/s")<<1000>>
  Real     ActualFeedRate@("Qm","kg/s")
  Real     RecycleFlowRate@("Qm","kg/s")
  Real     RecycleRatio{r,init(0.5),Comment("FeedSetPoint / RecycleFlowRate")}

;---Logic--------------------------------

; Allows user to change the FeedSetPoint and RecycleRatio back to default values 
  if (UseDefaultSetPoint) 
     FeedSetPoint = 1000 ;kg/s
     RecycleRatio = 0.5  ;FeedSetPoint / RecycleFlowRate
     UseDefaultSetPoint = 0
  endif
 
; Performs calculations and sets values to SysCAD  
  ["Source1.QmReqd (kg/s)"] = FeedSetPoint                  ;Sets the feed rate in Feeder Source1
  ActualFeedRate= ["pipe1.Qm (kg/s)"]                       ;Gets the flowrate from Pipe1
  RecycleFlowRate = ActualFeedRate * RecycleRatio           ;Calculates the recycle flowrate
  ["Tank3.GM.IOs.[Recycle].Flow (kg/s)"] = RecycleFlowRate  ;Sets the recycle flowrate to tank 3 output

$ ;END OF FILE

PGMExample1.png