PGM Examples - General Calculations

From SysCAD Documentation
Jump to navigation Jump to search

Navigation: PGMs ➔ Example PGM Files ➔ Simple Calculations

Simple Examples Subroutines Examples Dynamic Examples Steady State Overall Mass Balance Array and Matrix Examples
Basic
Layout
Simple
Calculations
Initialise
PreStart
Multi-Step Trigger Checking
Project
Counter, While
and Random
Belt Filter
Wash Loss
Startup
Actions
Mass
Balance
Mass
Balance
Species
Balance
Elemental
Balance
Lookup
Value
Set
Values
Tridiagonal
System

;===================================================================================
;--- 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_001.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_001.GM.IOs.[P_002].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 = ["P_015.Qo.LQv (m^3/h)"]
  water4 = ["P_021.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_002.Qo.QEl:SPh.Cu (kg/h)"]
  CuInConc = ["P_032.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_002.Qo.QEl:SPh.Fe (kg/h)"]
  FeInConc = ["P_032.Qo.QEl:SPh.Fe (kg/h)"]
  IronRecovery = iif(Fein > 0.1, FeInConc/Fein * 100, 0)

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

PGMExample3.png