This reference is part of the guide for the Kigali Sim.

QubecTalk Reference: Language Features

QubecTalk includes advanced language features for conditional logic, probabilistic modeling, and mathematical operations.

Contents

Comments

Purpose: Add explanatory text that is ignored by the interpreter.

Syntax: # Comment text

Examples:

# This is a full line comment
set domestic to 25 mt during year 2025  # This is an end-of-line comment

# Multi-line comments require # on each line
# This explains the following complex calculation
# that implements economic growth projections
change sales by 6% / year during years 2025 to 2030

Comparison Operators

Purpose: Compare values to create conditions for logical operations.

Available Operators:

Examples:

define currentYear as 2025
define targetYear as 2030

set import to 100 if currentYear == targetYear else 75 endif mt
set export to 50 if currentYear >= targetYear else 25 endif mt
set domestic to 200 if currentYear < targetYear else 150 endif mt

# Mixed comparison and logical operators
define testA as 1
define testB as 0
set domestic to 90 if testA > 0 and testB == 0 else 55 endif mt during year 6

Conditional Statements

Purpose: Execute different actions based on conditions using if-else logic.

Syntax: value if condition else alternative endif

Examples:

set domestic to 100 if testVar > 10 else 50 endif mt

# Complex nested conditions
set import to 75 if economicGrowth > 5 else 
              50 if economicGrowth > 2 else 
              25 endif endif mt

# With variable definitions
define testVar as 5
set domestic to 100 if testVar > 10 else 50 endif mt during year 2025

Logical Operators

Purpose: Combine multiple conditions using logical operations.

Available Operators:

Examples:

define testA as 1
define testB as 0
define testC as 2

# AND operation: 1 and 0 = false, uses else branch (30)
set domestic to 100 if testA and testB else 30 endif mt during year 1

# OR operation: 1 or 0 = true, uses if branch (50)
set domestic to 50 if testA or testB else 20 endif mt during year 2

# XOR operation: 1 xor 2 = false (both truthy), uses else branch (40)
set domestic to 60 if testA xor testC else 40 endif mt during year 3

# Complex with parentheses
set domestic to 70 if (testA or testB) and testC else 35 endif mt during year 4

Mathematical Operations

Purpose: Perform arithmetic calculations within expressions.

Available Operators:

Examples:

# Basic arithmetic
set domestic to (100 + 50) mt during year 2025
set import to (200 * 0.15) mt during year 2025

# Standard deviation calculation
set priorEquipment to sample normally from mean of 100000 std of (100000 * 0.1) units

# Complex calculations
define baselineConsumption as 100
define growthRate as 5
set domestic to (baselineConsumption * (1 + growthRate / 100)) mt during year 2026

Probabilistic Sampling

Purpose: Introduce uncertainty into models using probability distributions for Monte Carlo analysis.

Available Distributions:

Examples:

# Normal distribution for growth rates
change sales by sample normally from mean of 5% std of 1% / year during years 2025 to 2030

# Normal distribution for equipment populations
set priorEquipment to sample normally from mean of 1000000 std of 100000 units during year 2025

# Uniform distribution for policy effectiveness
recover sample uniformly from 20% to 40% with 90% reuse during years 2027 to onwards

Units and Measurements

Purpose: Specify quantities with proper units for consumption, time, and other measurements.

Volume Units:

Time Units:

Other Units:

Examples:

# Volume specifications
set domestic to 25 mt during year 2025
set import to 15000 units during year 2025
initial charge with 0.15 kg / unit for domestic

# GWP and energy
equals 1430 tCO2e / mt 100 kwh / unit

# Time specifications
change sales by 5% / year during years 2025 to 2030
retire 5% each year
recharge 10% with 0.15 kg / unit in all years