Plant Model Class

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Classes ➔ Plant Model Class

Global Pre-Defined Class Instances SysCAD Pre-Defined Classes
Sp Database
SDB Class
Particle Size Defn
PSD Class
Plant Model
PM Class
Array
Class
StrArray
Class
Matrix
Class
TagSelect
Class
Time
Class
Noise
Class

Latest SysCAD Version: 25 October 2024 - SysCAD 9.3 Build 139.36522

Related Links: Defining a Class, Example PGM Files


Description

The name of the single global instance of the Plant Model class is PM and can be referenced directly.

The Plant Model Class (PM), provides member functions to retrieve various global values defined in Plant Model including:

  • Environmental Global values.
  • User Defined Global Values (PUV).

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 Build139.29552

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

Example

 ;--- SysCAD General Controller (PGM) program logic file ---
; Revision: 1     Date:     Author:
PageLabel("PlantModelVariables")
   TextLabel(,"GlobalVaraibles")
   Real NormalTemperature@("T", "K")
   Real NormalPressure@("P", "kPa")
   Real StandardTemperature@("T", "K")
   Real StandardPressure@("P", "kPa")
   Real ProjectMinTemperature@("T", "K")
   Real ProjectMaxTemperature@("T", "K")
   Real ProjectMinPressure@("P", "kPa")
   Real ProjectMaxPressure@("P", "kPa")
   Real Elevation@("L", "m")
   Real AmbientTemperature@("T", "K")
   Real AtmosPressure@("P", "kPa"), AtmoPressure2@("P", "kPa")
   Real AirWetBulbTemperature@("T", "K")
   Real WindSpeed@("Ldt", "m/s")
   Real RelativeHumidity@("Frac", "Frac")
   TextLabel(,"SysCAD Version")
   long SysCADVersionNumber@, SysCADBuildNumber@
   Checkbox BuildOK
   TextLabel(,"SideCalc")
   Long H2OIndex@
   RealH2ORho_Normal_Cond@("Rho", "kg/m^3"), H2ORho_StdCond@("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