# cbevins/behaveplus-radical architecture

> Architecture diagram of the GitHub repository cbevins/behaveplus-radical, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cbevins/behaveplus-radical
- Repository: https://github.com/cbevins/behaveplus-radical

## Overview

##### Main Components

a. Core Engine Layer:
- DAG (Directed Acyclic Graph) system from the /bundle/pando/dag directory
- Variant system from /bundle/pando/variants
- Units of Measure (UOM) system from /bundle/pando/uom

b. Model Implementation Layer:
- Equations from /bundle/behaveplus/equations
- Major calculation modules:
- Surface Fire Models
- Crown Fire Models
- Spotting Models
- Fire Ellipse Models
- Tree Mortality Models
- Ignition Models

c. Configuration Layer:
- Genome system (/bundle/behaveplus/genome)
- Configuration management components
- Model DNA and variant definitions

d. Integration Layer:
- API endpoints
- Input/output processors
- Compilation system (/src/compiler)

##### Component Relationships

- Data flow between components
- Dependencies between modules
- Configuration relationships
- Calculation pathways

##### Technical Details to Highlight

- ES6 JavaScript architecture
- Node.js and browser compatibility
- DAG-based optimization system
- Units of measure conversion system
- Model configuration system

##### Additional Notes

- Dynamic nature of the DAG system
- How the genome system configures models
- Points of extension for future features
- Areas where BehavePlus6 features are pending implementation

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Engine Layer
    subgraph CoreEngine["Core Engine Layer"]
        DAG["DAG System"]
        Variants["Variant System"]
        UOM["Units of Measure"]
    end

    %% Model Implementation Layer
    subgraph Models["Model Implementation Layer"]
        SurfaceFire["Surface Fire Models"]:::model
        CrownFire["Crown Fire Models"]:::model
        Spotting["Spotting Models"]:::model
        FireEllipse["Fire Ellipse Models"]:::model
        TreeMort["Tree Mortality Models"]:::model
        Ignition["Ignition Models"]:::model
    end

    %% Configuration Layer
    subgraph Config["Configuration Layer"]
        Genome["Genome System"]
        ConfigMgmt["Configuration Management"]
        DNA["DNA Configuration"]
    end

    %% Fuel Models Layer
    subgraph FuelModels["Fuel Models"]
        BehaveFuel["Standard BEHAVE Models"]:::fuel
        Chaparral["Chaparral Fuels"]:::fuel
        PalmettoGallberry["Palmetto-Gallberry"]:::fuel
        WesternAspen["Western Aspen"]:::fuel
    end

    %% Integration Layer
    subgraph Integration["Integration Layer"]
        Compiler["Compiler System"]
        API["Main API Interface"]
        Utilities["Utility Components"]
    end

    %% Utility Components
    subgraph Utils["Utility Components"]
        CoreCalc["Core Calculations"]
        WindCalc["Wind Calculations"]
        CompassCalc["Compass Calculations"]
    end

    %% Relationships
    DAG --> Models
    Variants --> Models
    UOM --> Models
    Genome --> ConfigMgmt
    ConfigMgmt --> DNA
    DNA --> Compiler
    FuelModels --> Models
    Models --> API
    Compiler --> API
    Utils --> Models

    %% Click Events
    click DAG "https://github.com/cbevins/behaveplus-radical/tree/master/src/bundle/pando/dag/"
    click Variants "https://github.com/cbevins/behaveplus-radical/tree/master/src/bundle/pando/variants/"
    click UOM "https://github.com/cbevins/behaveplus-radical/tree/master/src/bundle/pando/uom/"
    click SurfaceFire "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/SurfaceFire.js"
    click CrownFire "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/CrownFire.js"
    click Spotting "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/Spotting.js"
    click FireEllipse "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/FireEllipse.js"
    click TreeMort "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/TreeMortality.js"
    click Ignition "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/IgnitionProbability.js"
    click Genome "https://github.com/cbevins/behaveplus-radical/tree/master/src/bundle/behaveplus/genome/"
    click ConfigMgmt "https://github.com/cbevins/behaveplus-radical/tree/master/src/bundle/behaveplus/variants/"
    click BehaveFuel "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/BehaveFuel.js"
    click Chaparral "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/ChaparralFuel.js"
    click PalmettoGallberry "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/PalmettoGallberryFuel.js"
    click WesternAspen "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/WesternAspenFuel.js"
    click Compiler "https://github.com/cbevins/behaveplus-radical/blob/master/src/compiler/BpxDnaCompiler.js"
    click API "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/Bpx.js"
    click DNA "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/BpxDna.js"
    click CoreCalc "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/Calc.js"
    click WindCalc "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/Wind.js"
    click CompassCalc "https://github.com/cbevins/behaveplus-radical/blob/master/src/bundle/behaveplus/equations/Compass.js"

    %% Styling
    classDef model fill:#90EE90
    classDef fuel fill:#FFB6C1
    classDef config fill:#FFE4B5
    classDef integration fill:#B0C4DE

    %% Legend
    subgraph Legend
        ModelNode["Model Component"]:::model
        FuelNode["Fuel Component"]:::fuel
        ConfigNode["Config Component"]:::config
        IntegrationNode["Integration Component"]:::integration
    end
```
