Template:PGM Class Example - calculate the Agitator Power required in a Vessel

From SysCAD Documentation
Jump to navigation Jump to search

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:

[math]\displaystyle{ \mathbf{\mathit{P = P_o\;N^3\;D^5\;Density}} }[/math]
where:
P - Agitation Power;
Po - 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    Class_AgitatorPower
  Textbreak
  ClassGridColumnWidth 12
  ClassGridMaxColumns 5
  TextLabel "Inputs"
  String   UnitName{Tag}*
  real     Po*<<1>>
  real     N<<0.3>>{i, comment("Rotation per second")}
  real     D<<1>>{i, ("L", "m"), comment("ImpellerDiameter")}
  TextLabel "Results"
  string   DensityTag@@{ Tag}
  real     Density@("Rho", "kg/m^3")
  real     Power@("Pwr", "kW")

  Sub Init()
	UnitName = ClassTag()
    DensityTag = Concatenate(UnitName, ".QProd.SLRho (kg/m^3)")
  EndSub

  Sub Exec()
    Density = [DensityTag]
    Power = Po * N^3 * D^5 * Density
  EndSub
EndClass
  • The class instance name is assumed to be the same as the SysCAD unit tag. This is done inside the Sub Init().
PageLabel "Agitators" 
>>n:\Users\SysCAD Common Files\AgitatorPower.pgm
Textbreak
;Define class instances in grid format by adding "#"
Class_AgitatorPower # Cementation, NiCo_Precip, Ni_Diss_1

Sub InitialiseSolution()
  ForEachClass(Class_AgitatorPower, Init())
EndSub

ForEachClass(Class_AgitatorPower, Exec())
$ ; --- end of file ---

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

Class 1.png

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.