Set A Table of Values Using Matrix Class
Jump to navigation
Jump to search
Navigation: PGMs ➔ Example PGM Files ➔ Set Values
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 |
Related Links: PGM Files using Class and Functions, Matrix Class, Array Class
PGM FILE - Setting the Feeder Size Distribution using Linear Interpolation
This Example shows how to set a table of values (saved in a CSV file) to SysCAD at the start of the project.
This example is used to define size distribution data in a Feeder, using the linear interpolation method. The data is saved in a csv file, and loaded into SysCAD at the start of the project.
Please note that this file only sets one compound with size data.
;--- SysCAD General Controller (PGM) file ---
; Revision: 2 Date: Jan 2023 Author: SysCAD Team
;--- variable declarations ---
PageLabel "SizeData"
TextLabel ""
MATRIX SizeData
STRING Feed_Tag{Tag}
LONG RowCount@, ColCount@
BIT MatrixOK@
BYTE i, j
REAL SizeIndex, SizeFraction
Sub PreStart()
;Loads in the size data for Linear Interpolation
MatrixOK = SizeData.Load("$Prj\SizeData.csv")
RowCount = SizeData.GetRowCount()
ColCount = SizeData.GetColCount()
;Sets the number of datapoints
[Concatenate(Feed_Tag,".Content.DSz.Fit.PointCount")] = RowCount
EndSub
Sub InitialiseSolution()
i = 0
While i <= RowCount-1
SizeIndex = SizeData.GetAt(i,0)
;Sets each size based on the linear interpolation data
[Concatenate(Feed_Tag,".Content.DSz.Fit.Sz", IntToStr(i+1)," (um)")] = SizeIndex
i = i + 1
Endwhile
j = 0
While j <= RowCount-1
SizeFraction = SizeData.GetAt(j,1)
;Sets each size fraction based on the linear interpolation data
[Concatenate(Feed_Tag,".Content.DSz.Fit.I0.", IntToStr(j+1)," (%)")] = SizeFraction
j = j + 1
Endwhile
endSub
$ ; --- end of file ---