Plant Model Class

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Classes ➔ Plant Model Class

SysCAD Pre-Defined Classes and Examples EXAMPLES: User Defined Classes
Sp Databse
Class
PSD
Class
Array
Class
StrArray
Class
Matrix
Class
Tag Select
Class
Plant Model
Class
Noise
Class
Time
Class
Agitator
Power
Reaction
Finder
Aq Feed Conc
Calculator
Evaporation
Correlation
Bayer Liquor
Class
Check
Element Bal

Latest SysCAD Version: 03 May 2021 - SysCAD 9.3 Build 138.28537


Description

The Plant Model Class, provides a member function to retrieve global values defined in the Plant Model.

Values that can be retrieved with the Plant Model Class include the Environmental Global values as well as the User Defined Global Values (PUV).

The Plant Model Class can be used in PGM or Model Procedures files.

Data Members

None

Member Functions

Call Functionality Return Type Parameters Example
Functions to return Plant Model | Project Tab - Global User Defined Values (PUV)
SetPUV(Index,Value) Sets the User Defined Variable,
usually done during Sub PreStart() or Sub InitialiseSolution()
- Index: Integer, 1 - 12
Values: type Real
PM.SetPUV(1, 3)
PM.SetPUV(2, 20)
PUV(Index) Retrieves the User Defined Variable Real Index: Integer, 1 - 12 Design_Vel_Liq = PM.PUV(1)
Design_Vel_Vap = PM.PUV(2)
Functions to return Plant Model | Environment Tab .
NormalT() Retrieves the Normal Temperature in Kelvin (defined in the project configuration file) Real - PM.NormalT()
SDB.SpDensity(H2OIndex, PM.NormalT(), PM.NormalP())
NormalP() Retrieves the Normal Pressure in kPa absolute (defined in the project configuration file) Real - PM.NormalP()
SDB.SpDensity(H2OIndex, PM.NormalT(), PM.NormalP())
StandardT() Retrieves the Standard Temperature in Kelvin (defined in the project configuration file) Real - PM.StandardT()
SDB.SpDensity(H2OIndex, PM.StandardT(), PM.StandardP())
StandardP() Retrieves the Standard Pressure in kPa absolute (defined in the project configuration file) Real - PM.StandardP()
SDB.SpDensity(H2OIndex, PM.StandardT(), PM.StandardP())
ProjectMinT() Retrieves the Minimum Temperature allowed for the project in Kelvin (defined in the project configuration file) Real - PM.ProjectMinT()
ProjectMaxT() Retrieves the Maximum Temperature allowed for the project in Kelvin (defined in the project configuration file) Real - PM.ProjectMaxT()
ProjectMinP() Retrieves the Minimum Pressure allowed for the project in kPa absolute (defined in the project configuration file) Real - PM.ProjectMinP()
ProjectMaxP() Retrieves the Maximum Pressure allowed for the project in kPa absolute (defined in the project configuration file) Real - PM.ProjectMaxP()
Elevation() Retrieves the elevation defined for the project in meters Real - PM.Elevation()
AmbientT() Retrieves the ambient Temperature defined for the project in Kelvin Real - PM.AmbientT()
AtmosP() Retrieves the atmospheric pressure in kPa Absolute (based on elevation defined in project) Real - PM.AtmosP()
AtmosPatElev(elevation) Returns the atmospheric pressure at elevation in kPa Absolute Real elevation in meters PM.AtmosPatElev(100)
AirWetBulbT() Retrieves the air wet bulb Temperature defined for the project in Kelvin Real - PM.AirWetBulbT()
WindSpeed() Retrieves the wind speed defined for the project in m/s Real - PM.WindSpeed()
RelativeHumidity() Retrieves the relative humidity in fractions defined for the project Real - PM.RelativeHumidity()
Latitude() Retrieves the latitude in radians for the project Real - PM.Latitude()
AveEvapRate() Retrieves the average evaporation rate for the project in m/s Real - PM.AveEvapRate()
AveRainfallRate() Retrieves the average rainfall rate for the project in m/s Real - PM.AveRainfallRate()
Functions to return Plant Model | System Tab - SysCAD Version Numbers
Version(Index) Retrieves the SysCAD version or build number.
Index = 0 : SysCAD Major Version Number
Index = 1 : SysCAD Minor Version number
Index = 2 : SysCAD Major Build number
Index = 3 : SysCAD Minor Build number
Integer Index type Integer
Valid Range 0 -3
Eg: SysCAD 9.3 Build136.18187

MajorVersion = PM.Version(0) ; Returns 9
MinorVersion = PM.Version(1) ; Returns 3
MajorBuild = PM.Version(2) ; Returns 136
MinorBuild = PM.Version(3) ; Returns 18187

Example

;--- SysCAD General Controller (PGM) program logic file ---
; Revision: 1     Date:     Author:
PageLabel("PlantModelVariables")
   TextLabel(,"GlobalVaraibles")
   Real [email protected]("T", "K")
   Real [email protected]("P", "kPa")
   Real [email protected]("T", "K")
   Real [email protected]("P", "kPa")
   Real [email protected]("T", "K")
   Real [email protected]("T", "K")
   Real [email protected]("P", "kPa")
   Real [email protected]("P", "kPa")
   Real [email protected]("L", "m")
   Real [email protected]("T", "K")
   Real [email protected]("P", "kPa"), [email protected]("P", "kPa")
   Real [email protected]("T", "K")
   Real [email protected]("Ldt", "m/s")
   Real [email protected]("Frac", "Frac")
   TextLabel(,"SysCAD Version")
   long [email protected], [email protected]
   Checkbox BuildOK
   TextLabel(,"SideCalc")
   Long [email protected]
   Real[email protected]("Rho", "kg/m^3"), [email protected]("Rho", "kg/m^3")

;--- variable declarations ---
Sub PreStart ()
  ;--- Logic executed early before first iteration,
  ;For example to turn PIDs/units on or off
   PM.SetPUV(1, 100)
   PM.SetPUV(2, 100)
   H2OIndex = SpI ("H2O(l)") 
   H2ORho_Normal_Cond     = SDB.SpDensity(H2OIndex, PM.NormalT(), PM.NormalP()) 
   H2ORho_StdCond 	  = SDB.SpDensity(H2OIndex, PM.StandardT(), PM.StandardP()) 
   NormalTemperature      = PM.NormalT()
   NormalPressure         = PM.NormalP()
   StandardTemperature    = PM.StandardT()
   StandardPressure       = PM.StandardP()
   ProjectMinTemperature  = PM.ProjectMinT()
   ProjectMaxTemperature  = PM.ProjectMaxT()
   ProjectMinPressure     = PM.ProjectMinP()
   ProjectMaxPressure     = PM.ProjectMaxP()
   Elevation              = PM.Elevation()
   AmbientTemperature     = PM.AmbientT()
   AtmosPressure          = PM.AtmosP()
   AtmoPressure2	  = PM.AtmosPatElev(100)
   AirWetBulbTemperature  = PM.AirWetBulbT()
   WindSpeed              = PM.WindSpeed()
   RelativeHumidity       = PM.RelativeHumidity()
   SysCADMajorBuildNumber = PM.Version(2)
   SysCADMinorBuildNumber = PM.Version(3)
   BuildOK = SysCADMajorBuildNumber >=136 AND SysCADMinorBuildNumber >=18187
endSub 

$ ; --- end of file ---



PlantModelClassExample.png