Example Evaporation Correlation
Jump to navigation
Jump to search
Navigation: PGMs ➔ Example PGM Files ➔ Evaporation Correlation
Related Links: Defining a Class, Defining a Function, 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 (e.g.: Gerenal_Class.pgm). The class definition can then be inserted into a PGM file using the include file syntax. (e.g.: >>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: 3 Date: January 2023 Author: KWA Team ; updated to use PGM syntax for SysCAD 9.3 Build139.32335
; 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")
REAL WindSpeed@("Ldt", "m/s")
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_Class
;---Define variables---
TextLabel "-------------------------------------------------------"
String UnitNameTag@{Tag}, T_Liq_Tag, BPE_Tag, SodaConcTag
REAL Tank_Diameter*("L", "m") <6,15><<10>>
REAL Tank_SurfaceArea@("Area", "m^2")
REAL WindSpeedUsed@("Ldt", "m/s")
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
REAL EvapRate@("Qm", "kg/h")
Sub InitTag()
T_Liq_Tag = Concatenate(UnitNameTag, ".QFeed.T (C)")
BPE_Tag = Concatenate(UnitNameTag, ".QFeed.Props.BPE@T (C)")
SodaConcTag = Concatenate(UnitNameTag, ".QFeed.Props.TotalNa@25 (g/L)")
EndSub
Sub EvapCalc()
WindSpeedUsed = WindSpeed
T_Liq = [T_Liq_Tag]
BPE = [BPE_Tag]
SodaConc = [SodaConcTag]
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
EndSub
Sub Calc_n_SetEvapRate()
EvapCalc()
[Concatenate(UnitNameTag, ".Evap.Rate (kg/h)")] = EvapRate
EndSub
EndClass
; ---Using the Class---
PageLabel "Settler Evaporation"
; ---Creating the Class object---
Evaporation_Class HYDRATE_SETTLER
PageLabel "PPT Evaporation"
; ---Creating the Class object---
const long PPTCount = 21
Evaporation_Class #PrecipTank[PPTCount]{ez}
long i
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()
;Initialise the UnitTagNames
HYDRATE_SETTLER.UnitNameTag = "HYDRATE_SETTLER"
i=1
while i < PPTCount
PrecipTank[i].UnitNameTag = Concatenate("PC_", IntStr0(i,3))
i = i + 1
endwhile
;Initialise the Class tags
ForEachSub(Evaporation_Class, InitTag())
ForEachSub(PrecipTank, InitTag())
EndSub
; ---Calculate & Set the Evaporation Rate---
; Calc and Set Evap for Settler
HYDRATE_SETTLER.EvapCalc()
["HYDRATE_SETTLER.Evap.QmReqd (kg/h)"] = HYDRATE_SETTLER.EvapRate
; Calc and Set Evap Rate for Precip tanks.
ForEachSub(PrecipTank, Calc_n_SetEvapRate())
EndFile