# 🏗️ HADEX Architecture

## System Overview

HADEX is built on a modular, physics-informed architecture that integrates eight core parameters into a unified computational framework.

## High-Level Architecture

```

┌─────────────────────────────────────────────────────────────┐
│                      HADEX Core Engine                       │
│  ┌──────────┬──────────┬──────────┬──────────┬──────────┐  │
│  │   Tait   │ Mackenzie│ Pressure │  Swarm   │   Bio    │  │
│  │ Equation │ Equation │ Viscosity│   Nav    │Integrated│  │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘  │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
▼                     ▼                     ▼
┌───────────────┐    ┌───────────────┐    ┌───────────────┐
│     Core      │    │  Navigation   │    │    Sensing    │
│   ┌───────┐   │    │   ┌───────┐   │    │   ┌───────┐   │
│   │ EOS   │   │    │   │Swarm  │   │    │   │Oxygen │   │
│   ├───────┤   │    │   ├───────┤   │    │   ├───────┤   │
│   │Acoustic│   │    │   │Pos    │   │    │   │Turb   │   │
│   ├───────┤   │    │   ├───────┤   │    │   ├───────┤   │
│   │Visc   │   │    │   │Adapt  │   │    │   │Bio    │   │
│   └───────┘   │    │   └───────┘   │    │   └───────┘   │
└───────────────┘    └───────────────┘    └───────────────┘
│                     │                     │
└─────────────────────┼─────────────────────┘
▼
┌─────────────────┐
│  Energy & Power │
│  ┌─────┬─────┐  │
│  │Piezo│Storage│  │
│  └─────┴─────┘  │
└─────────────────┘

```

## Module Descriptions

### Core Module
- **Equation of State**: Tait equation for seawater density under extreme pressure
- **Acoustic Model**: Mackenzie equation for sound velocity to 11,000m
- **Pressure Viscosity**: Pressure-dependent dynamic viscosity calculations
- **Fluid Properties**: Comprehensive fluid dynamics utilities

### Navigation Module
- **Swarm Algorithm**: Cooperative acoustic localization without GPS
- **Position Estimator**: Multi-lateration with outlier rejection
- **Adaptive Ranging**: Real-time sound velocity correction
- **Bio Navigation**: Bioluminescence-assisted positioning

### Sensing Module
- **Oxygen Flux**: Benthic oxygen diffusion measurements
- **Turbidity Currents**: Sediment transport modeling
- **Bioluminescence**: Light emission detection and spectral analysis
- **Pressure Sensing**: Ambient pressure monitoring

### Energy Module
- **Piezo Harvester**: Power generation from pressure fluctuations
- **Energy Storage**: Battery and capacitor management
- **Power Budget**: Mission energy planning

### Robotics Module
- **AUV Controller**: Autonomous vehicle control
- **Thruster Model**: Viscosity-compensated propulsion
- **Buoyancy Control**: Depth-dependent buoyancy
- **Communication**: Acoustic modem integration

## Data Flow

1. **Input Layer**: Environmental data (CTD, bathymetry, currents)
2. **Physics Layer**: Core calculations (density, acoustics, viscosity)
3. **Navigation Layer**: Swarm positioning and path planning
4. **Sensing Layer**: Real-time measurements and analysis
5. **Energy Layer**: Power management and harvesting
6. **Output Layer**: Mission data and visualizations

## Performance Specifications

| Component | Performance | Validation |
|-----------|-------------|------------|
| Density Calculation | ±0.3% | Challenger Deep |
| Sound Velocity | ±12 ms/5km | Mackenzie equation |
| Swarm Positioning | 0.78m RMS | 72-hour mission |
| Energy Harvest | 2.8mW | 87% of predicted |
