# BC_Nexus Integration

## Overview

BC_Nexus is the CLEWs (Climate, Land-use, Energy, Water, and Food Security Nexus) component of the BC Combined Modelling framework. It provides comprehensive renewable energy resource assessment and system-wide analysis for British Columbia.

## Key Features

### Renewable Energy Resource Assessment
- **Solar Resource Mapping**: High-resolution solar irradiance and photovoltaic potential analysis
- **Wind Resource Analysis**: Wind speed and wind power generation potential assessment
- **Hydro Resource Evaluation**: Existing and potential hydroelectric generation capacity
- **Storage Integration**: Battery and pumped hydro storage modeling

### Land Use and Constraints
- **Protected Areas**: Integration of conservation and protected land designations
- **Infrastructure Constraints**: Transmission line proximity and grid connection costs
- **Environmental Factors**: Ecological and environmental constraint mapping
- **Urban and Agricultural Land**: Exclusion of incompatible land uses

### Temporal Analysis
- **Multi-Year Assessment**: Analysis across multiple meteorological years
- **Seasonal Patterns**: Seasonal renewable energy generation patterns
- **Hourly Resolution**: High temporal resolution for detailed system analysis
- **Extreme Events**: Assessment of extreme weather impacts on renewable generation

## Integration with Combined Framework

### Data Outputs to Linking Tool
BC_Nexus provides several key data products that are processed by the linking tool:

```python
# Example BC_Nexus outputs
bc_nexus_outputs = {
    'renewable_profiles': {
        'solar_pv': 'hourly generation profiles by region',
        'wind_onshore': 'hourly generation profiles by wind class',
        'hydro_run_of_river': 'hourly generation profiles'
    },
    'capacity_potentials': {
        'technical_potential': 'MW by technology and region',
        'economic_potential': 'MW considering cost constraints',
        'constrained_potential': 'MW after land use constraints'
    },
    'cost_parameters': {
        'capex': 'Capital costs by technology',
        'opex': 'Operating costs by technology',
        'connection_costs': 'Grid connection costs by location'
    }
}
```

### Scenario Framework
BC_Nexus supports multiple scenario dimensions:

#### Technology Scenarios
- **Current Technology**: Based on existing technology performance
- **Advanced Technology**: Improved efficiency and reduced costs
- **Breakthrough Technology**: Emerging technologies with high potential

#### Policy Scenarios
- **Business as Usual**: Current policy framework
- **Enhanced Targets**: Increased renewable energy targets
- **Carbon Pricing**: Various carbon price trajectories

#### Infrastructure Scenarios
- **Existing Grid**: Analysis with current transmission infrastructure
- **Enhanced Grid**: Planned transmission expansions
- **Optimized Grid**: Optimal transmission development

## Model Configuration

### Basic Configuration
```yaml
bc_nexus:
  region: "BC"
  base_year: 2020
  analysis_years: [2020, 2025, 2030, 2035, 2040, 2045, 2050]
  
  technologies:
    solar_pv:
      enabled: true
      efficiency_improvement: 0.02  # per year
      cost_reduction: 0.05  # per year
    
    wind_onshore:
      enabled: true
      turbine_classes: ["IEC_1", "IEC_2", "IEC_3"]
      hub_heights: [80, 100, 120]  # meters
    
    hydro:
      run_of_river: true
      small_hydro: true
      storage_hydro: true
  
  constraints:
    protected_areas: true
    urban_exclusion: true
    transmission_distance_limit: 50  # km
```

### Advanced Configuration
```yaml
bc_nexus:
  spatial_resolution: 1  # km
  temporal_resolution: "hourly"
  weather_years: [2012, 2013, 2014, 2015, 2016]
  
  land_use:
    exclusion_layers:
      - protected_areas
      - urban_areas
      - agricultural_land_reserve
      - water_bodies
    
    buffer_distances:
      airports: 3000  # meters
      urban_areas: 500  # meters
      highways: 100  # meters
  
  economics:
    discount_rate: 0.07
    project_lifetime: 25  # years
    capacity_factor_threshold: 0.15  # minimum CF
```

## Running BC_Nexus Analysis

### Command Line Interface
```bash
# Run BC_Nexus analysis
make nexus

# Run specific scenario
python workflow/scripts/BCNexus.py --scenario CNZ_1 --timeslices 96

# Generate BC_Nexus plots
make nexus_plots SCENARIO=Base_CNZ_noCCS TIMESLICES=24
```

### Python API
```python
from bc_combined_modelling.bc_nexus import BCNexusInterface

# Initialize BC_Nexus interface
nexus = BCNexusInterface(
    config_file='config/bc_nexus_config.yaml',
    scenario='high_renewable'
)

# Run renewable resource assessment
results = nexus.run_resource_assessment(
    technologies=['solar_pv', 'wind_onshore'],
    regions=['lower_mainland', 'vancouver_island', 'peace_river']
)

# Access results
solar_potential = results['solar_pv']['technical_potential']
wind_profiles = results['wind_onshore']['generation_profiles']
constraint_maps = results['spatial_constraints']
```

## Output Data Structure

### Generation Profiles
```python
# Hourly generation profiles by technology and region
generation_profiles = {
    'solar_pv': pd.DataFrame({
        'datetime': pd.date_range('2020-01-01', periods=8760, freq='H'),
        'lower_mainland': [0.45, 0.52, ...],  # Capacity factors
        'vancouver_island': [0.38, 0.44, ...],
        'interior': [0.52, 0.61, ...]
    }),
    'wind_onshore': pd.DataFrame({
        'datetime': pd.date_range('2020-01-01', periods=8760, freq='H'),
        'coastal': [0.35, 0.42, ...],
        'interior': [0.28, 0.31, ...],
        'peace_river': [0.41, 0.48, ...]
    })
}
```

### Capacity Potentials
```python
# Regional capacity potentials by technology
capacity_potentials = {
    'solar_pv': {
        'lower_mainland': {'technical': 15000, 'economic': 8000, 'constrained': 5000},  # MW
        'vancouver_island': {'technical': 8000, 'economic': 4500, 'constrained': 3000},
        'interior': {'technical': 45000, 'economic': 25000, 'constrained': 18000}
    },
    'wind_onshore': {
        'coastal': {'technical': 12000, 'economic': 7000, 'constrained': 5500},
        'interior': {'technical': 35000, 'economic': 20000, 'constrained': 15000},
        'peace_river': {'technical': 18000, 'economic': 12000, 'constrained': 9000}
    }
}
```

### Cost Data
```python
# Technology cost parameters
cost_parameters = {
    'solar_pv': {
        'capex': {'2020': 1500, '2030': 1000, '2040': 800},  # CAD/kW
        'opex_fixed': 15,  # CAD/kW/year
        'opex_variable': 0,  # CAD/MWh
        'lifetime': 25  # years
    },
    'wind_onshore': {
        'capex': {'2020': 2000, '2030': 1700, '2040': 1500},  # CAD/kW
        'opex_fixed': 35,  # CAD/kW/year
        'opex_variable': 5,  # CAD/MWh
        'lifetime': 20  # years
    }
}
```

## Quality Assurance and Validation

### Data Validation
- **Resource Data**: Validation against measured meteorological data
- **Capacity Factors**: Comparison with existing renewable energy facilities
- **Cost Data**: Benchmarking against industry surveys and databases

### Sensitivity Analysis
- **Weather Year Sensitivity**: Analysis across multiple meteorological years
- **Technology Parameter Sensitivity**: Impact of cost and performance variations
- **Constraint Sensitivity**: Effect of different land use restriction scenarios

### Model Validation
- **Historical Comparison**: Validation against historical renewable energy deployment
- **Expert Review**: Regular review by industry and academic experts
- **Cross-Model Validation**: Consistency checks with other modeling frameworks

## Future Enhancements

### Planned Improvements
- **Offshore Wind**: Integration of offshore wind resource assessment
- **Floating Solar**: Assessment of floating photovoltaic potential
- **Agrivoltaics**: Co-location of solar and agricultural activities
- **Green Hydrogen**: Renewable hydrogen production potential

### Advanced Features
- **Machine Learning**: AI-enhanced resource assessment and forecasting
- **Real-time Data**: Integration of real-time meteorological and grid data
- **Climate Change**: Assessment of climate change impacts on renewable resources
- **Social Acceptance**: Integration of social and community factors

---

*For technical details on data linking, see [Linking Methodology](linking_methodology.md). For PyPSA integration, see [PyPSA Integration](pypsa_integration.md).*
