# PGM Example - PGM Class to calculate the Agitator Power required in a Vessel

Navigation: PGMs ➔ Example PGM Files ➔ Agitator Power 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

## Agitator Power Calculation

The user wants to calculate the required agitator power in a number of vessels in a project. This functionality will be used in a number of different projects, and hence the file with the class will be stored on the network where it can be accessed by a number of users and projects.

A formula that may be used to calculate the agitator power for turbulent flow is:

$\displaystyle{ \mathbf{\mathit{P = P_{0} N^{3} D^{5} Density}} }$

where:
P - Agitation Power;
P0 - the dimensionless power number, which is a function of impeller geometry;
N - agitator rotational speed;
D - Diameter of the impeller;
Density - Density of the material in the vessel.

The class is saved in a file called AgitatorPower.pgm and is saved on the network at n:\Users\SysCAD Common Files\

 The Class file is as follows: The main pgm file may have the following structure: Class AgitatorPower TextLabel() String UnitName{Tag}* real Po*<<1>> real N<<0.3>>{i, comment("Rotation per second")} real D<<1>>{i, ("L", "m"), comment("ImpellerDiameter")} string [email protected]{ Tag} real [email protected]("Rho", "kg/m^3") real [email protected]("Pwr", "kW") Sub Init() DensityTag = Concatenate(UnitName, ".QProd.SLRho (kg/m^3)") EndSub Sub Exec() Density = [DensityTag] Power = Po * N^3 * D^5 * Density EndSub EndClass  User needs to initialise the unit name, either enter the name directly into the access window or add in some lines in the PGM file (eg: in the "Sub initialiseSolution()" section). PageLabel(Agitators) >>n:\Users\SysCAD Common Files\AgitatorPower.pgm AgitatorPower Tank1, Tank2, StorageTank1 Sub InitialiseSolution() ForEachClass(AgitatorPower, init) EndSub ForEachClass(AgitatorPower, Exec) \$ ; --- end of file --- ; ------------------------------------------------------------------------------ ; the ForEachClass function is only available in Build 139.30094 or later. ; For older versions of SysCAD, use the following lines: Sub InitialiseSolution() Tank1.Init() Tank2.Init() StorageTank1.Init() EndSub Tank1.Exec() Tank2.Exec() StorageTank1.Exec() 

And the access window of the controller will show the following fields:

Notes:

1. The user may follow the same rules for individual functions that may be useful in a number of pgms or in separate projects.