# bpera1111/ayme architecture

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

- Interactive diagram: https://gitdiagram.com/bpera1111/ayme
- Repository: https://github.com/bpera1111/ayme

## Overview

##### Project Type and Purpose
- This is an academic control‐system simulation and analysis project built with MATLAB and Simulink.
- It comprises two main phases (“Primera_parte” and “Segunda_Parte”), each containing Simulink models (.slx), MATLAB scripts (.m), and data files (.mat).
- It also includes report and presentation artifacts (LaTeX sources, PDFs) under “Informe” and “Presentación.”

##### High‐Level Architecture
- Components:
- Model Repository: Simulink models (.slx) organized in “Primera_parte” and “Segunda_Parte.”
- Simulation Engine: MATLAB/Simulink running models, generating raw signal outputs and data caches (slprj, varcache).
- Analysis Scripts: MATLAB .m files (e.g., graficos.m, simulacion.m) that load .mat data, compute metrics, tune controllers.
- Data Storage: .mat files under each part’s “signals” or root directory storing simulation results.
- Documentation: LaTeX sources and compiled PDFs in “Informe” and TeX/Beamer files in “Presentación.”
- Auto‐code / Acceleration: Simulink Coder / Rapid Accelerator outputs in slprj/raccel and slprj/_sfprj.

##### Relationships and Data Flows
- Models → Simulation Engine:
- Simulink loads .slx models to run time-domain tests.
- Rapid Accelerator (raccel) may be invoked to speed up simulations.
- Simulation Engine → Data Storage:
- Results exported as .mat files and stored under “signals” or root.
- Caches (slprj/sim/varcache) are generated automatically.
- Data Storage → Analysis Scripts:
- Scripts read .mat files, calculate control metrics, produce plots.
- Outputs (plots, figures) saved to disk, then imported into reports.
- Analysis Scripts → Documentation:
- Figures and numeric results get embedded into LaTeX reports and presentations.
- Final PDFs are produced in “Informe/…pdf” and “Presentación/presentacion.pdf.”

##### Architectural Patterns and Principles
- Clear separation of concerns: modeling vs. simulation vs. analysis vs. documentation.
- Reproducibility: simulation scripts and data caches ensure consistent results.
- Modular design: each Simulink subsystem (electromechanical, thermal, control) is a separate .slx.
- Pipeline flow: Model → Run → Process → Report.

##### Technologies and Frameworks
- MATLAB for scripting (.m), data handling, plotting.
- Simulink for dynamic system modeling (.slx), with Simulink Coder for acceleration.
- LaTeX/Beamer for report and slides.
- Standard file I/O (.mat, .pdf) for portability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Model Repository"
        PModels["Primera_parte Models (.slx)"]:::models
        SModels["Segunda_Parte Models (.slx)"]:::models
    end

    subgraph "Simulation Engine"
        Sim["Simulink Standard Mode"]:::sim
        Rapid["Rapid Accelerator"]:::sim
        PrimCache["Primera Build/Caches"]:::sim
        GlobCache["Global Build/Caches"]:::sim
        RaccelSeg["Segunda Raccel Outputs"]:::sim
        Sfprj["Auto-code / ModelAdvisor"]:::sim
    end

    subgraph "Data Storage"
        PData["Primera Signals (.mat)"]:::data
        SData["Segunda Signals (.mat)"]:::data
    end

    subgraph "Analysis Scripts"
        PScript["Primera Part Scripts (.m)"]:::analysis
        SScript["Segunda Part Scripts (.m)"]:::analysis
    end

    subgraph "Documentation"
        Report["Report PDFs"]:::doc
        Present["Presentation PDF"]:::doc
    end

    PModels -->|".slx → run"| Sim
    PModels -->|".slx → run"| Rapid
    SModels -->|".slx → run"| Sim
    SModels -->|".slx → run"| Rapid

    Sim -->|".mat → store"| PData
    Rapid -->|".mat → store"| PData
    Sim -->|".mat → store"| SData
    Rapid -->|".mat → store"| SData

    Sim -->|"build caches"| PrimCache
    Sim -->|"build caches"| GlobCache
    Rapid -->|"raccel outputs"| RaccelSeg
    Rapid -->|"model advisor"| Sfprj

    PData -->|"load .mat"| PScript
    SData -->|"load .mat"| SScript

    PScript -->|"plots → embed"| Report
    SScript -->|"plots → embed"| Report
    PScript -->|"plots → embed"| Present
    SScript -->|"plots → embed"| Present

    click PModels "https://github.com/bpera1111/ayme/tree/main/Primera_parte/"
    click SModels "https://github.com/bpera1111/ayme/tree/main/Segunda_Parte/"
    click PrimCache "https://github.com/bpera1111/ayme/tree/main/Primera_parte/slprj/"
    click GlobCache "https://github.com/bpera1111/ayme/tree/main/slprj/"
    click RaccelSeg "https://github.com/bpera1111/ayme/tree/main/slprj/raccel/Simulacion_parte2/"
    click Sfprj "https://github.com/bpera1111/ayme/tree/main/slprj/_sfprj/"
    click PScript "https://github.com/bpera1111/ayme/blob/main/Primera_parte/*.m"
    click SScript "https://github.com/bpera1111/ayme/blob/main/Segunda_Parte/*.m"
    click PData "https://github.com/bpera1111/ayme/tree/main/Primera_parte/"
    click SData "https://github.com/bpera1111/ayme/tree/main/Segunda_Parte/signals/"
    click Report "https://github.com/bpera1111/ayme/tree/main/Informe/"
    click Present "https://github.com/bpera1111/ayme/tree/main/Presentación/"

    classDef models fill:#ADD8E6,stroke:#000;
    classDef sim fill:#90EE90,stroke:#000;
    classDef data fill:#FFD580,stroke:#000;
    classDef analysis fill:#FFA500,stroke:#000;
    classDef doc fill:#D3D3D3,stroke:#000;
```
