# ASF Sensor Hub - System Design Documentation

**Version:** 2.0  
**Date:** 2025-01-19  
**Status:** Final for Implementation Phase

## Directory Structure

```
system_design/
├── features/                          # Feature specifications
│   ├── Features.md                    # Main feature catalog
│   ├── [DAQ] Sensor Data Acquisition Features.md
│   ├── [DQC] Data Quality & Calibration Features.md
│   ├── [COM] Communication Features.md
│   ├── [DIAG] Diagnostics & Health Monitoring Features.md
│   ├── [DATA] Persistence & Data Management Features.md
│   ├── [OTA] Firmware Update (OTA) Features.md
│   ├── [SEC] Security & Safety Features.md
│   ├── [SYS] System Management Features.md
│   ├── [PWR] Power & Fault Handling Features.md
│   ├── [HW] Hardware Abstraction Features.md
│   ├── Cross-Feature Constraints.md
│   ├── System Assumptions & Limitations.md
│   └── System_Requirements_Traceability.csv  # Feature → SR mapping
│
├── specifications/                    # System specifications
│   ├── System_State_Machine_Specification.md
│   ├── Failure_Handling_Model.md
│   └── System Review Checklist.md
│
├── SRS/                              # Software Requirements Specification
│   ├── SRS.md                        # Main SRS document
│   ├── Annex_A_Traceability.md
│   ├── Annex_B_Interfaces.md
│   ├── Annex_C_Budgets.md
│   ├── VV_Matrix.md                  # Verification & Validation matrix
│   └── Traceability_SWRS.csv         # SWR traceability
│
├── analysis/                         # Analysis and review documents
│   ├── Gap_Analysis_and_Solutions.md
│   └── Engineering_Review_Report.md
│
├── system_requirementsand_and_traceability.csv  # Original system requirements
└── README.md                         # This file
```

## Document Overview

### Features (`features/`)

Contains all feature specifications with system requirements:
- **10 feature groups** (DAQ, DQC, COM, DIAG, DATA, OTA, SEC, SYS, PWR, HW)
- **39 features** total
- **139 system requirements** (SR-*)
- **System_Requirements_Traceability.csv** - Complete feature-to-requirement mapping

### Specifications (`specifications/`)

Core system specifications:
- **System State Machine** - 11 states with transition rules
- **Failure Handling Model** - Fault taxonomy and recovery behaviors
- **System Review Checklist** - Gate criteria for implementation

### SRS (`SRS/`)

Software Requirements Specification (ISO/IEC/IEEE 29148 compliant):
- **Main SRS** - Over 200 Software Requirements (SWR-*)
- **Annexes** - Traceability, Interfaces, Budgets
- **V&V Matrix** - Verification methods for all requirements

### Analysis (`analysis/`)

Analysis and review documents:
- **Gap Analysis and Solutions** - Consolidated gap analysis with solutions
- **Engineering Review Report** - Architecture review findings

## Quick Reference

### Feature Groups

| Group | Features | System Requirements |
|-------|----------|---------------------|
| DAQ | 4 | 13 |
| DQC | 5 | 18 |
| COM | 4 | 17 |
| DIAG | 4 | 14 |
| DATA | 4 | 13 |
| OTA | 5 | 16 |
| SEC | 4 | 15 |
| SYS | 5 | 17 |
| PWR | 2 | 8 |
| HW | 2 | 8 |
| **TOTAL** | **39** | **139** |

### System States

1. INIT - Hardware and software initialization
2. BOOT_FAILURE - Secure boot verification failed
3. RUNNING - Normal sensor acquisition and communication
4. WARNING - Non-fatal fault detected, degraded operation
5. FAULT - Fatal error, core functionality disabled
6. OTA_PREP - OTA preparation phase
7. OTA_UPDATE - Firmware update in progress
8. MC_UPDATE - Machine constants update in progress
9. TEARDOWN - Controlled shutdown sequence
10. SERVICE - Engineering or diagnostic interaction
11. SD_DEGRADED - SD card failure detected, fallback mode

### Technology Stack

- **Hardware:** ESP32-S3
- **Framework:** ESP-IDF v5.4
- **Communication:** Wi-Fi 802.11n, MQTT over TLS 1.2, ESP-NOW
- **Security:** Secure Boot V2, Flash Encryption (AES-256), mTLS
- **Storage:** FAT32 (SD Card), NVS (Encrypted)
- **OTA:** A/B Partitioning, SHA-256

## Document Status

**Status:** Final for Implementation Phase  
**Next Phase:** Component Design → Implementation

---

**For questions or updates, refer to the individual feature specifications or system specifications.**
