Warning

This documentation is under active development. Some sections may be incomplete.

Getting Started#

This guide will help you set up and run the Fleet Electrification BC workflow.

Prerequisites#

  • Operating System: Linux or Windows Subsystem for Linux (WSL)

  • Python Environment: Anaconda or Miniconda

  • Git: For cloning the repository and managing submodules

Installation#

1. Clone the Repository#

git clone --branch combined https://github.com/DeltaE/Fleet_Electrification.git
cd Fleet_Electrification

2. Environment Setup#

Option B: Manual Setup#

# Create conda environment
conda env create -f env/environment.yml

# Activate environment
conda activate ev_fleet_bc

# Install local package
pip install -e .

# Initialize submodules
git submodule init
bash install_submodules.sh

3. Verify Installation#

# Activate environment
conda activate ev_fleet_bc

# Check main workflow script
python fleet_electrification_BC.py --help

Basic Usage#

Running the Complete Workflow#

The main workflow script fleet_electrification_BC.py orchestrates the entire simulation:

# Example configuration
timespan = {
    'start_date': "2021-01-01",  # yyyy-mm-dd
    'end_date': "2021-01-02",    # yyyy-mm-dd
}

# Fleet pattern simulation
commercial_pattern_args = {**timespan, 'samples': 10000}

# EV load simulation
fleet_EV_args = {
    **timespan,
    'ev_charging': "coordinated",  # "v2g", "uncoordinated", "coordinated"
    'ev_population': 0.8,          # 80% EV penetration
}

# PyPSA model configuration
pypsa_model_build_args = {
    'copperplate': True,
    'update_data': False,
    'resource_options': 'full_potential',
    'total_load_scaling_factor': 1.4,
}

Using Makefile Commands#

# View all available commands
make help

# Run fleet simulation
make fleet

# Generate visualization plots
make plots

# Update environment
make update

# Clean environment
make clean

Configuration#

Core Modules#

The workflow uses three main modules:

import models.fleet_simulator.main as fleet
import models.fleet_EV_load_simulator.scripts.main as fleet_EV
from models.PyPSA_BC import run_pypsa_bc as pypsa_bc

Key Parameters#

Parameter

Type

Description

Default

ev_charging

string

Charging strategy: “coordinated”, “uncoordinated”, “v2g”

“coordinated”

ev_population

float

EV penetration rate (0.0-1.0)

0.8

copperplate

boolean

Single region simulation

true

total_load_scaling_factor

float

Load scaling multiplier

1.4

resource_options

string

Resource capacity options

“full_potential”

update_data

boolean

Update base network data

false

Configuration Files#

  • config/config.yaml - Main configuration file

  • config/data.yaml - Data source configurations

  • env/environment.yaml - Conda environment specification

Workflow Components#

1. Fleet Pattern Simulator#

Simulates vehicle movement patterns based on:

  • ICBC Vehicle Population Data: Commercial and passenger vehicle statistics

  • Travel Patterns: Realistic driving behavior modeling

  • Battery Specifications: Vehicle-specific capacity and range data

Input: Vehicle population data, travel behavior parameters
Output: Fleet movement patterns and charging demand profiles

2. EV Fleet Load Simulator#

Converts fleet patterns to electrical load:

  • EV Penetration: User-defined percentage of electric vehicles

  • Charging Strategies: Multiple approaches to charging scheduling

  • Spatial Distribution: Geographic allocation of charging demand

Input: Fleet patterns, EV penetration rate, charging strategy
Output: Temporal and spatial EV load profiles

3. PyPSA-BC Integration#

Integrates EV loads into power system model:

  • Capacity Planning: Optimal generation capacity sizing

  • Operational Analysis: Unit commitment and dispatch optimization

  • Grid Impact Assessment: System reliability and cost analysis

Input: EV load profiles, system configuration
Output: Optimal capacity expansion and operational results

Troubleshooting#

Common Issues#

Environment Creation Fails#

# Update conda
conda update conda

# Clear conda cache
conda clean --all

# Retry environment creation
make setup

Submodule Installation Issues#

# Reinitialize submodules
git submodule deinit --all
git submodule update --init --recursive

# Manual installation
bash install_submodules.sh

Import Errors#

# Ensure environment is activated
conda activate ev_fleet_bc

# Reinstall local package
pip install -e .

Getting Help#

Next Steps#

  • Explore charging scenarios for different use cases

  • Review the API reference for detailed documentation

  • Try the example notebooks in the notebook/ directory

  • Check out sample results in the vis/ directory