Getting Started#

Warning

This project is under active development

This guide will help you install and set up BC Combined Modelling on your system.

Prerequisites#

  • Python 3.8+: Required for all components

  • Git: For cloning repositories and version control

  • Conda or pip: For environment management

  • Sufficient disk space: ~10GB for full installation including data

Installation#

1. Clone the Repository#

git clone https://github.com/DeltaE/BC_Combined_Modelling.git
cd BC_Combined_Modelling

2. Set Up the Environment#

Option B: Using conda#

# Create conda environment
conda create -n bc_combined python=3.9
conda activate bc_combined

# Install dependencies
pip install -e .

3. Verify Installation#

import bc_combined_modelling
print("BC Combined Modelling installed successfully!")
print(f"Version: {bc_combined_modelling.__version__}")

Project Structure#

BC_Combined_Modelling/
├── bc_combined_modelling/     # Main package
│   ├── __init__.py
│   ├── cli.py                 # Command-line interface
│   ├── clews_to_pypsa.py     # Data linking utilities
│   └── utils.py              # Utility functions
├── config/                    # Configuration files
│   ├── config.yaml           # Main configuration
│   └── dashboard.yaml        # Dashboard settings
├── data/                      # Data directory
├── docs/                      # Documentation
├── notebooks/                 # Example notebooks
├── results/                   # Results output
└── workflow/                  # Workflow scripts

Configuration#

BC Combined Modelling uses YAML configuration files for flexible setup:

Main Configuration (config/config.yaml)#

# Example configuration structure
project:
  name: "BC Combined Analysis"
  region: "BC"
  base_year: 2020
  
bc_nexus:
  model_path: "path/to/bc_nexus"
  scenarios: ["baseline", "high_renewable"]
  
pypsa_bc:
  model_path: "path/to/pypsa_bc"
  network_file: "bc_network.h5"
  
linking:
  data_exchange_format: "csv"
  temporal_resolution: "hourly"

Data Configuration (config/data.yaml)#

Configure data sources and paths for the integrated workflow.

Quick Start Examples#

1. Basic Combined Analysis#

from bc_combined_modelling import CombinedWorkflow

# Initialize workflow
workflow = CombinedWorkflow(
    config_file='config/config.yaml'
)

# Run integrated analysis
results = workflow.run_combined_analysis(
    scenarios=['baseline', 'high_renewable'],
    years=[2020, 2030, 2040]
)

# Access results
bc_nexus_results = results['bc_nexus']
pypsa_results = results['pypsa_bc']

2. Data Linking Between Models#

from bc_combined_modelling.clews_to_pypsa import CLEWSPyPSALinker

# Initialize data linker
linker = CLEWSPyPSALinker(
    clews_output_path='results/bc_nexus/',
    pypsa_input_path='data/pypsa_inputs/'
)

# Convert CLEWS outputs to PyPSA inputs
linker.convert_renewable_profiles()
linker.convert_demand_profiles()
linker.convert_storage_parameters()

3. Command Line Interface#

# Run combined analysis
bc-combined run --config config/config.yaml --scenario baseline

# Convert data between models
bc-combined link --from clews --to pypsa --data-path results/

# Generate dashboard
bc-combined dashboard --config config/dashboard.yaml

Working with Notebooks#

The project includes several Jupyter notebooks for demonstration:

  • notebooks/combined_workflow_example.ipynb: Complete workflow example

  • notebooks/data_linking_example.ipynb: Data conversion examples

  • notebooks/results_analysis.ipynb: Results visualization and analysis

To start Jupyter:

jupyter lab
# or
jupyter notebook

Component Setup#

BC_Nexus Integration#

from bc_combined_modelling.bc_nexus import BCNexusInterface

# Initialize BC_Nexus interface
bc_nexus = BCNexusInterface(
    model_path='path/to/bc_nexus',
    config_file='config/bc_nexus_config.yaml'
)

# Run scenarios
results = bc_nexus.run_scenarios(['baseline', 'policy_scenario'])

PyPSA_BC Integration#

from bc_combined_modelling.pypsa_bc import PyPSABCInterface

# Initialize PyPSA_BC interface
pypsa_bc = PyPSABCInterface(
    network_file='data/bc_network.h5',
    config_file='config/pypsa_config.yaml'
)

# Optimize network
results = pypsa_bc.optimize_network(
    snapshots=pd.date_range('2020-01-01', periods=8760, freq='H')
)

Data Requirements#

Input Data Structure#

data/
├── clews_data/              # BC_Nexus input data
│   ├── demand/             # Energy demand data
│   ├── resources/          # Renewable resource data
│   └── infrastructure/     # Infrastructure data
├── pypsa_data/             # PyPSA_BC input data
│   ├── networks/          # Network topology
│   ├── generators/        # Generator data
│   └── loads/             # Load data
└── processed_data/         # Processed/linked data

Required Data Files#

  1. Regional boundaries and administrative data

  2. Renewable resource time series

  3. Electricity demand profiles

  4. Transmission network topology

  5. Generator characteristics and costs

Troubleshooting#

Common Issues#

  1. Import Errors

    # Ensure the package is installed in development mode
    pip install -e .
    
  2. Configuration Errors

    # Validate configuration files
    bc-combined validate-config --config config/config.yaml
    
  3. Data Path Issues

    # Check data directory structure
    bc-combined check-data --data-dir data/
    

Getting Help#

Next Steps#

Development#

Contributing#

See the Contributing Guide for information on:

  • Code style guidelines

  • Testing procedures

  • Documentation standards

  • Submission process

Development Installation#

# Clone with development dependencies
git clone https://github.com/DeltaE/BC_Combined_Modelling.git
cd BC_Combined_Modelling

# Install in development mode with all dependencies
pip install -e ".[dev,docs,test]"