Example Evaporation Correlation

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Example PGM Files ➔ Evaporation Correlation

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: 26 October 2022 - SysCAD 9.3 Build 139.31866

Related Links: PGM Classes, PGM Functions, Evaporation Block, Precipitation 3 - Evaporation

NOTE: This example shows both the class definition and the use of Class in the same PGM file. In general, if the Class is useful for multiple PGM file or can be re-used, it is best to store the class definition in a separate file (eg: Gerenal_Class.pgm). The class definition can then be inserted into a PGM file using the include file syntax. (eg: >>General_Class.pgm) Please see Sharing Classes between Projects for more information on how to include the class definition into a pgm file.


;--- SysCAD General Controller (PGM) program logic file ---
; Revision: 2     Date: May 2016    Author: KWA Team

; The following example shows how to apply an fitted equation to calculate Evaporation from precipitation tanks.

; The equation solves combined heat/mass transfer problems for free/forced convection from precipitation tanks,
; typically speaking, a solution to these problems is highly non-linear and thus the results are difficult 
; to fit accurately with simple equations. 

; This correlation will estimate evaporation losses from a precipitation tank based on some environmental 
; data (T ambient, wind speed and humidity) and liquor data (temperature and BPE) 

; LIMITATIIONS OF THE EQUATION:
; model covers a range of precipitation conditions from:
;   tank diameters 6 - 15 m  
;   liquor temperature of 45 to 85 C
;   liquor  250 - 350 gpl total soda
;   ambient temperatures from 12 to 40 C
;   humidity 0 - 100 %
;   wind speed 0 - 25 m/s 
;   NB the effect of wind speed is significant and the wind speed should be that which the tank actually sees.

; The expression (detailed below) estimates evaporative losses to within about +/-29% over a wide range 
; and is within +/- 10% over most of the range.

PageLabel("Ambient Condition")
   ;--- Define Global Variable----
   TextLabel(, "  -----Ambient Conditions, from PlantModel Environment Tab-----",)
   REAL	RelativeHumidity@("Frac", "%")
   REAL	T_Ambient@("T", "dC")<12,40><<25>>
   REAL	WindSpeed@("Ldt", "m/s")<0,25><<2>>
   TextLabel(, "  -----Equation Fitting-----", "  EvapRate = Eq_Fitting_Factor * Function(RelHumidty, WindSpeed, T, D)",)
   REAL	Eq_Fitting_Factor{i, init(3.6)}

;--- Define Calculation Class ---
Class Evaporation
   ;---Define variables---
   TextLabel(, "======================================================", "-----Inputs-----")
   STR	Precip_Tank_Tag@{Tag}
   CheckBox UseLocalWindSpeed{i, comment("Off=Use Ambient Condition")}
   REAL	LocalWindSpeed*("Ldt", "m/s")<0,25><<5>>
   REAL	WindSpeedUsed@("Ldt", "m/s")
   TextLabel("  -----Tank Dimensions-----")
   REAL	Tank_Diameter*("L", "m") <6,15><<10>>
   REAL	Tank_SurfaceArea@("Area", "m^2")
   TextLabel("  -----Liquor Propertires-----")
   REAL	T_Liq@("T", "dC")<45,85><<50>>
   REAL	BPE@("dT", "dC")
   REAL	SodaConc@("Conc", "g/L") <250,330><<270>>
   REAL	RH_Factor, WS_Factor, CorrectedT, Diameter_Factor
   TextLabel(, "-----Evaporation Rate-----" )
   REAL	EvapRate@("Qm", "kg/h")
 
   Function InitTag(Str Tagname)
     Precip_Tank_Tag	= Tagname
   Return 0
   EndFunct

  Function EvapCalc()
     WindSpeedUsed    = IIf(UseLocalWindSpeed, LocalWindSpeed, WindSpeed)
     T_Liq            = [Concatenate(Precip_Tank_Tag, ".QFeed.T (C)")]
     BPE              = [Concatenate(Precip_Tank_Tag, "[email protected] (C)")]
     SodaConc	      = [Concatenate(Precip_Tank_Tag, "[email protected] (g/L)")]
     RH_Factor        = 1 - 0.00186*RelativeHumidity
     WS_Factor        = (3.1 + WindSpeedUsed)^1.15
     CorrectedT       = (T_Liq - T_Ambient)^0.5 * (T_Liq-BPE)^2
     Diameter_Factor  = (2/Tank_Diameter+0.872)
     Tank_SurfaceArea = Pi * (Tank_Diameter/2)^2
      	
     EvapRate = (Eq_Fitting_Factor * 1e-5 * RH_Factor * WS_Factor * CorrectedT * Diameter_Factor) * Tank_SurfaceArea 
  Return 0
  EndFunct
EndClass		

; ---Using the Class---
PageLabel("Thickener Evaporation")
; ---Creating the Class object---
   Evaporation Thickener

PageLabel("PPT Evaporation")
; ---Creating the Class object---
   Evaporation  PPT[5]
   ExcludeWatch PPT[0]

Sub InitialiseSolution()
   RelativeHumidity = PM.RelativeHumidity()*100  ;Plant model class returns value in fractions
   T_Ambient        = PM.AmbientT()-273.15       ;Plant model class returns value in Kelvin
   WindSpeed        = PM.WindSpeed()
   Thickener.InitTag("Settler")
   PPT[1].InitTag("P_TK010")
   PPT[2].InitTag("P_TK020")
   PPT[3].InitTag("P_TK030")
   PPT[4].InitTag("P_TK040")
EndSub

; ---Calculate & Set the Evaporation Rate--- 
   Thickener.EvapCalc()
   ["Settler.Evap.QmReqd (kg/h)"] = Thickener.EvapRate 	
   
   PPT[1].EvapCalc()
   PPT[2].EvapCalc()
   PPT[3].EvapCalc()
   PPT[4].EvapCalc()
   ["PPT-001.Evap.Rate (kg/h)"] = PPT[1].EvapRate
   ["PPT-002.Evap.Rate (kg/h)"] = PPT[2].EvapRate
   ["PPT-003.Evap.Rate (kg/h)"] = PPT[3].EvapRate
   ["PPT-004.Evap.Rate (kg/h)"] = PPT[4].EvapRate

EndFile