# nkapila6/quadcopter-simulation architecture

> Architecture diagram of the GitHub repository nkapila6/quadcopter-simulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nkapila6/quadcopter-simulation
- Repository: https://github.com/nkapila6/quadcopter-simulation

## Overview

##### Main Components

a) Input Layer:
- Electronic voltage inputs (4 channels, one for each rotor)
- Initial conditions and parameters
- User interface/control inputs

b) Core Simulation Components:
- Motor dynamics module
- Rotor system (both dual and quad configurations)
- Physics engine/mathematical model
- Motion equations processor

c) Output Layer:
- Motion visualization
- State variables output
- Performance metrics

**[DualRotor.slx] -----> [dual_to_quad.slx] -----> [quadrotor.slx]**

##### Key Relationships to Highlight

- Voltage to motor speed conversion
- Motor speed to rotor force calculation
- Force to motion translation
- System state feedback loops
- Transition between dual and quad rotor configurations

##### Specific Implementation Details

a) Dual Rotor System:
- Simplified 2-rotor dynamics
- Stability calculations
- Control mechanisms

b) Quad Rotor System:
- Full 4-rotor configuration
- Inter-rotor interactions
- Thrust vectoring

c) Conversion Module:
- Transformation logic
- Adaptation mechanisms
- Parameter scaling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        style Legend fill:#f5f5f5,stroke:#333
        I1[Input Component]:::input
        P1[Processing Component]:::processing
        O1[Output Component]:::output
        S1[Storage Component]:::storage
        I1 --> |Data Flow| P1
        P1 -.-> |Parameter Influence| O1
        P1 === |Physical Interaction| S1
    end

    subgraph "Input Layer"
        VI[Voltage Inputs]:::input
        IC[Initial Conditions]:::input
        UI[User Interface Controls]:::input
    end

    subgraph "Dual Rotor System"
        DR[DualRotor Model]:::processing
        DM[Motor Dynamics]:::processing
        DR2[Rotor Dynamics]:::processing
        DS[Stability Calc]:::processing
        DC[Control Mechanisms]:::processing
    end

    subgraph "Conversion Module"
        CM[Transformation Logic]:::processing
        AS[Adaptation System]:::processing
        PS[Parameter Scaling]:::processing
    end

    subgraph "Quad Rotor System"
        QR[Quadrotor Model]:::processing
        QM[Motor Dynamics]:::processing
        QR2[Rotor Dynamics]:::processing
        QI[Inter-rotor Interactions]:::processing
        TV[Thrust Vectoring]:::processing
    end

    subgraph "Motion Equations"
        DOF[6-DOF Calculations]:::processing
        AV[Angular Velocity Comp]:::processing
        PO[Position Orientation]:::processing
    end

    subgraph "Output Layer"
        MV[Motion Visualization]:::output
        SV[State Variables]:::output
        PM[Performance Metrics]:::output
    end

    %% Input connections
    VI --> DR
    IC --> DR
    UI --> DR

    %% Dual Rotor System internal
    DR --> DM
    DM --> DR2
    DR2 --> DS
    DS --> DC

    %% Conversion flow
    DC --> CM
    CM --> AS
    AS --> PS

    %% Quad Rotor System internal
    PS --> QR
    QR --> QM
    QM --> QR2
    QR2 --> QI
    QI --> TV

    %% Motion equations
    TV --> DOF
    DOF --> AV
    AV --> PO

    %% Output connections
    PO --> MV
    PO --> SV
    PO --> PM

    %% Styles
    classDef input fill:#a2d2ff,stroke:#333
    classDef processing fill:#90be6d,stroke:#333
    classDef output fill:#f9c74f,stroke:#333
    classDef storage fill:#d3d3d3,stroke:#333

    %% Click events
    click DR "https://github.com/nkapila6/Quadcopter-Simulation/blob/master/DualRotor.slx"
    click QR "https://github.com/nkapila6/Quadcopter-Simulation/blob/master/quadrotor.slx"
    click CM "https://github.com/nkapila6/Quadcopter-Simulation/blob/master/dual_to_quad.slx"
```
