🎓 Lesson 13 D5

Deswik Scripting for Automated Grade Boundary Updates

Deswik Scripting is a way to write small programs that automatically update ore grade boundaries in mining software, saving time and reducing human error.

🎯 Learning Objectives

  • Explain how Deswik Scripting interfaces with block models and grade shells to automate boundary updates
  • Design a Python script that reads new assay data and recalculates the economic cut-off grade for a defined domain
  • Analyze script output logs to validate grade shell integrity and detect topological inconsistencies
  • Apply conditional logic (e.g., min/avg grade thresholds, dilution buffers) to enforce grade control policies in scripted updates

📖 Why This Matters

In high-frequency grade control environments—like underground stoping or selective open-pit mining—manual grade boundary updates introduce delays, inconsistencies, and reconciliation errors. At the Cadia East copper-gold operation, a 12% reduction in grade reconciliation variance was achieved after deploying Deswik Scripts to auto-update stope shells within 15 minutes of assay receipt. This lesson bridges AI-powered orebody modeling with operational execution: scripting isn’t just coding—it’s enforcing discipline in grade fidelity.

📘 Core Principles

Deswik Scripting operates on three foundational layers: (1) Data Context—accessing Deswik’s internal object model (e.g., BlockModel, GradeShell, Domain) via the Deswik API; (2) Logic Layer—applying domain-specific rules (e.g., ‘update shell only if >95% of assay composites exceed 0.8 g/t Au’); and (3) Interoperability Layer—triggering downstream actions (e.g., updating Scheduler production schedules or exporting updated shells to MineSight). Critically, scripts execute in a transaction-safe environment: failed updates roll back automatically, preserving data integrity. Students must understand that scripting replaces *procedural* workflows—not geostatistical models—and must align with JORC/NI 43-101 reporting requirements for transparency.

📐 Economic Cut-off Grade Update Logic

While no single 'formula' governs grade shell updates, the core decision logic uses a modified break-even grade equation adapted for automated re-evaluation. This logic determines whether a block remains inside the grade shell based on real-time cost and price inputs.

Dynamic Cut-off Grade (COG)

COG = (Cₚ / (P × R − Cᵣ)) × 1000

Calculates minimum economically recoverable grade (g/t) given processing cost, metal price, recovery, and refining cost.

Variables:
SymbolNameUnitDescription
COG Cut-off grade g/t Minimum grade required for economic extraction
Cₚ Processing cost USD/tonne Cost to crush, grind, and process one tonne of ore
P Metal price USD/gram Market price converted from USD/oz using 31.1035 g/oz
R Metallurgical recovery decimal Fraction of metal recovered during processing (e.g., 0.92)
Cᵣ Refining cost USD/gram Cost to refine recovered metal to saleable form
Typical Ranges:
Underground high-grade gold: 4.0 – 12.0 g/t
Open-pit porphyry copper: 0.25 – 0.65 % Cu
Platinum group elements (PGE): 1.5 – 3.5 g/t 3E

💡 Worked Example

Problem: Given: metal price = USD 1,850/oz Au, processing cost = USD 28/tonne, recovery = 92%, smelting/refining cost = USD 45/oz, and conversion factor = 31.1035 g/oz; calculate COG in g/t for a new assay batch.
1. Step 1: Convert metal price to USD per gram: 1850 ÷ 31.1035 = USD 59.48/g
2. Step 2: Calculate net revenue per gram recovered: 59.48 × 0.92 = USD 54.72/g
3. Step 3: Subtract refining cost per gram: 45 ÷ 31.1035 = USD 1.45/g → 54.72 − 1.45 = USD 53.27/g
4. Step 4: Compute COG: (28 USD/t) ÷ (53.27 USD/g) × 1000 g/kg = 0.526 g/t
Answer: The dynamic COG is 0.53 g/t Au, which falls within the typical range of 0.4–0.7 g/t for low-cost porphyry operations.

🏗️ Real-World Application

At Evolution Mining’s Red Lake Complex, engineers deployed a Deswik Script triggered daily at 06:00 UTC to ingest the prior day’s underground face assay CSV. The script: (1) filters assays by stope ID and date, (2) computes weighted average grades per stope domain using inverse-distance weighting, (3) compares against pre-defined minimum mining widths and continuity rules, and (4) regenerates grade shells only where ≥3 consecutive assays exceed 8.5 g/t Au. Shell changes are logged with user ID, timestamp, and delta volume—enabling full audit trail for MINEDEX reporting. This reduced manual grade reconciliation effort by 7.2 hours/week per planner.

📋 Case Connection

📋 Copper Mine Block Model Refinement Using Neural Kriging

Traditional kriging over-smoothed high-grade chalcocite zones, causing 8.2% reserve underestimation

📋 Gold Mine Real-Time Grade Control at Development Drift Face

Manual chip sampling caused 24–48 hr delay in stope boundary decisions, leading to 14% dilution

📋 Limestone Mine Digital Twin for Karst-Related Grade Uncertainty

Solution cavities caused unpredictable grade drops (CaCO₃ purity <85%) in otherwise uniform deposits, resulting in 11% p...

📚 References