MP Example Files
Jump to navigation
Jump to search
Navigation: PGMs ➔ Model Procedures ➔ MP Example Files
Model Procedures | MP Example Files |
---|
Related Links: Example PGM Files, Example Model Procedure Files, Evaluation Blocks
Example projects using MP file: Demo Nickel Copper Project, Model Procedure Example
Model Procedure Example: Tank Volume
Model Procedure Example: Set Demand Flow as Volume Flow
Model Procedure Example: Agitator Power
Model Procedure Example: Crusher Power
Model Procedure Example: Pipe Sizing
The following example shows the use of Global User Defined Variables, located on the Plant Model access window, Project Tab. To make use of these variables, user can use the Predefined Plant Model Class to read in the values.
Model Procedure Example: Thickener
;EXAMPLE MODEL PROCEDURE SUBROUTINE
PageLabel "UserDefinedThickener"
TextLabel , "Requirements"
REAL RqdUFSolids*("Frac", "Frac")<0.001, 0.99>
REAL RqdOFSolids*("Frac", "Frac")<0, 0.5>
REAL SolidsFeed, LiquidsFeed
REAL SolidstoUF, LiquidstoUF, SolidstoOF, LiquidstoOF
REAL FracSolidstoUF, FracLiquidstoUF
TextLabel , "Results"
REAL UFSolids@("Frac", "Frac")
REAL OFSolids@("Frac", "Frac")
REAL UFSolRec@("Frac", "Frac")
; --- procedure declarations ---
Sub MP_Eval_AfterEB()
; calculate the massfrac split of solids and liquids to underflow
SolidsFeed = Get("QFeed.SQm (kg/s)")
LiquidsFeed = Get("QFeed.LQm (kg/s)")
SolidstoUF = 0.0
if (SolidsFeed > 0.001)
SolidstoUF = Range(0.0, (SolidsFeed*(1.0-RqdOFSolids) - RqdOFSolids*LiquidsFeed)/(1.0-RqdOFSolids - RqdOFSolids/RqdUFSolids*(1.0-RqdUFSolids)), SolidsFeed)
endif
LiquidstoUF = Range(0.0, SolidstoUF * (1.0-RqdUFSolids)/RqdUFSolids, LiquidsFeed)
FracSolidstoUF = iif(SolidstoUF > 0.001, SolidstoUF/SolidsFeed, 0.0)
FracLiquidstoUF = iif(LiquidstoUF > 0.001, LiquidstoUF/LiquidsFeed, 0.0)
; Split to UF:
Set("GM.IOs.[P_003].Splt.Solids (%)", FracSolidstoUF * 100)
Set("GM.IOs.[P_003].Splt.Liquids (%)", FracLiquidstoUF * 100)
; send all gases to overflow
Set("GM.IOs.[P_003].Splt.Gasses (%)", 0)
EndSub
; ------------------------------------------------------------
Sub MP_Eval_After()
; calculate some results
SolidstoOF = SolidsFeed - SolidstoUF
LiquidstoOF = LiquidsFeed - LiquidstoUF
UFSolids = iif((SolidstoUF + LiquidstoUF) > 0.001, SolidstoUF / (SolidstoUF + LiquidstoUF), 0)
OFSolids = iif((SolidstoOF + LiquidstoOF) > 0.001, SolidstoOF / (SolidstoOF + LiquidstoOF), 0)
UFSolRec = FracSolidstoUF
EndSub
$ ; --- end of file ---