PGM Examples - General Calculations

From SysCAD Documentation
Jump to: navigation, search

Navigation: PGMs - Example PGM Files - Simple Example PGM Files

This Page contains examples that uses SysCAD 9.3 Syntax, for SysCAD 9.2 Syntax, please see Example PGM Files 9.2


;===================================================================================
;--- Example of a SysCAD General Controller ---
; This example does a number of calculations:
; 1. It adds or removes ore to the stream from the mine going to a milling and flotation plant.
; 2. It calculates the water usage in the plant.
; 3. It calculates the recoveries of copper, iron and sulphur across the plant.
;===================================================================================
 
;---- Define Variables ------------------------
PageLabel("Feed & Recovery") 
  TextLabel(,"Plant Feed")
  real ReqdPlantFeed*("Qm", "t/h")
  real OreFromMine@("Qm", "t/h")
  real OreFromStockPile@("Qm", "t/h")

  TextLabel(,"Water Usage")
  real WaterUsage@("Qv", "m^3/h")

  TextLabel(,"Recoveries")
  real CopperRecovery@("Frac", "%")
  real IronRecovery@("Frac", "%")
  real SulphurRecovery@("Frac", "%")

;----- Local variables (not displayed in access window)
  real water1, water2, water3, water4
  real CuIn, CuInConc
  real Fein, FeInConc
  real SulphurIn, SulphurInConc

  OreFromMine = ["P_1.Qo.SQm (t/h)"]
 
; Check if the required plant feed is greater than the ore from the mine.
  if (ReqdPlantFeed >= OreFromMine) ; If less than required, import balance of ore from the stockpile.
     OreFromStockPile = Max(ReqdPlantFeed - OreFromMine, 0)
     ["Ore_from_Stockpile.QmReqd (t/h)"] = OreFromStockPile
  else  ; If the required plant feed is less than the ore from the mine, send some ore to the stockpile.
     ["Ore_from_Stockpile.QmReqd (t/h)"] = 0
     ["X_1.GM.IOs.[P_2].Flow (t/h)"] = ReqdPlantFeed
  endif
 
 ;--- Calculate Water used in Plant
 ;Water in to repulping and launder water
  water1 = ["Mill.MU1.Makeup.Qv (m^3/h)"]
  water2 = ["Flot_Launder.MU1.Makeup.Qv (m^3/h)"]
 
 ;Water returned to water tank in thickener overflows
  water3 = ["P15.Qo.LQv (m^3/h)"]
  water4 = ["P21.Qo.LQv (m^3/h)"]

  WaterUsage = (water1 + water2) - (water3 + water4)
 
 ;--- Do calculations to find Recoveries
 ; Measure the mass flow of the element in the feed to the plant (in stream P_2)
 ; Measure the mass flow of the element in the concentrate from the plant (P_32)
 ; Calculate the recovery = (Mass in conc)/(Mass in Feed) * 100
 
  CuIn = ["P_2.Qo.QEl:SPh.Cu (kg/h)"]
  CuInConc = ["P_32.Qo.QEl:SPh.Cu (kg/h)"]
  CopperRecovery = iif(CuIn > 0.1, CuinConc/Cuin * 100, 0)
 ; The iif function has the form: iif(expression, true part, False part)

 ; Do calculations to find iron Recovery
  Fein = ["P_2.Qo.QEl:SPh.Fe (kg/h)"]
  FeInConc = ["P_32.Qo.QEl:SPh.Fe (kg/h)"]
  IronRecovery = iif(Fein > 0.1, FeInConc/Fein * 100, 0)

 ; Do calculations to find sulphur Recovery
  SulphurIn = ["P_2.Qo.QEl:SPh.S (kg/h)"]
  SulphurInConc = ["P_32.Qo.QEl:SPh.S (kg/h)"]
  SulphurRecovery = iif(SulphurIn > 0.1, SulphurInConc/SulphurIn * 100, 0)
 
$ ; --- end of file ---

PGMExample3.png