# daniel207eae1/proyecto_ecovilla architecture

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

- Interactive diagram: https://gitdiagram.com/daniel207eae1/proyecto_ecovilla
- Repository: https://github.com/daniel207eae1/proyecto_ecovilla

## Overview

##### Project Type and Purpose
- The project appears to be focused on energy-related data collection and visualization—likely for smart meters, inverters, and weather stations in an eco-village (“Proyecto_ecovilla”).
- The presence of “Dispositivos Reales” (which means “Real Devices”) and “Simuladores” (simulators) directories suggests that the system interfaces with both real devices (like smart meters via a DLMS client) and simulator modules (for inverters and smart meters).
- Grafana dashboards and Docker files indicate that the project also involves containerized services and visualization components, forming part of an infrastructure that gathers, processes, and displays data about energy and weather conditions.

##### File Structure
- Top-level Items:
- Configuration files (.gitattributes, .gitignore, AWN.env) hint at environment setup and project maintenance.
- Dockerfile and docker-compose.yml indicate containerized deployment.
- Dispositivos Reales:
- Contains a subdirectory “Gurux.DLMS.Client.Example.python” where you see Python scripts (GXDLMSReader.py, GXSettings.py, main.py, etc.) which likely implement the DLMS client functionality for reading data from smart meters.
- WeatherStation.py is also at this level, suggesting integration with weather sensor data.
- Grafana:
- Holds several JSON files for Grafana dashboards which are used to display different types of meter data or weather station information.
- Simuladores:
- Contains simulation modules, like SmartMeter.py and Inverter.py, to mimic device behavior for testing or demonstration purposes.
- Propuestas:
- There's a proposal script (Propuesta_Inversor.py), likely aimed at demonstrating or testing proposed configurations or control logic for an inverter.

a. Main Components
- Device Interface Layer:
- Real Devices: DLMS client module (Gurux.DLMS.Client.Example.python) and WeatherStation.py.
- Simulated Devices: Simuladores/Inverter.py and Simuladores/SmartMeter.py.
- Data Processing Layer:
- This layer includes the Python scripts that handle reading, processing, and logging (e.g., main.py, GXDLMSReader.py, logFile.txt) from the physical/simulated devices.
- Visualization and Dashboard Layer:
- Grafana dashboards (as seen in the Grafana directory) are used to present processed smart meter and weather data.
- Proposal/Decision Module:
- In Propuestas, the Propuesta_Inversor.py that might suggest actions or strategies based on energy data.
- Containerization/Deployment:
- Dockerfile and docker-compose.yml show how the various components are containerized and orchestrated, implying integration via Docker containers.

b. Relationships and Interactions
- Data flows from real devices and simulators into the data processing services (DLMS client and weather station components).
- Processed data (and logs) is then made available to Grafana for visualization through API calls or data pushes.
- The Proposal module might consume the processed data to offer control logic or recommendations, possibly sending commands back to devices or updating dashboards.
- Docker orchestration connects these subsystems into a cohesive deployment where inter-container communication is clearly defined.

c. Architectural Patterns and Design Principles
- Modular Design: The separation into directories clearly shows a division between real device handling, simulation, and proposal logic.
- Containerization: Use of Docker indicates a microservices or container-centric approach to deployment.
- Integration via standardized interfaces: The reliance on DLMS (a standard protocol for smart meters) and usage of Grafana for visualization reinforces industry-standard communication and monitoring.

d. Relevant Technologies, Frameworks, or Libraries
- Python is the primary programming language as seen by the numerous “.py” files.
- Gurux.DLMS library is used for interacting with DLMS-compliant smart meters.
- Grafana provides the visualization layer through pre-built JSON dashboards.
- Docker and docker-compose enable containerized deployments.
- (Implicitly) Environment management via AWN.env and configuration files hints at practices for managing deployments.

##### Elements
- “Real Devices” block containing Gurux.DLMS Client components and WeatherStation.py
- “Simulators” block containing SmartMeter.py and Inverter.py
- “Processing Engine” block representing main.py, GXDLMSReader.py, logging, etc.
- “Visualization” block for Grafana dashboards
- “Proposal Module” for Propuesta_Inversor.py
- “Containerization” block representing Docker and docker-compose orchestration

##### Putting It All Together
- That the entire system is containerized by including a surrounding boundary labeled “Docker Environment” managed through docker-compose.

##### Final Advice
- Accurately capturing data flow and external interface points (e.g., where the DLMS-based communication occurs, how environmental variables are managed, and how dashboards are fed data).
- Don’t hesitate to break down complex submodules into further detail if needed—simplicity with clarity is key.

## Diagram (Mermaid)

```mermaid
graph TD

  %% Device Interface Layer
  subgraph "Device Interface Layer"
    DLMSClient["DLMS Client (Gurux)"]:::device
    WeatherStation["Weather Station"]:::device
  end

  subgraph "Simulated Devices"
    SmartMeterSim["Smart Meter Simulator"]:::device
    InverterSim["Inverter Simulator"]:::device
  end

  %% Data Processing Layer
  subgraph "Data Processing Layer"
    ProcessingEngine["Processing Engine (main.py, GXDLMSReader.py)"]:::processing
  end

  %% Visualization & Proposal Layer
  subgraph "Visualization & Proposal Layer"
    GrafanaDash["Grafana Dashboards"]:::visual
    ProposalModule["Proposal Module (Propuesta_Inversor.py)"]:::proposal
  end

  %% Containerization/Deployment Layer
  subgraph "Containerization/Deployment"
    Container["Containerization"]:::container
    Dockerfile["Dockerfile"]:::container
    DockerCompose["docker-compose.yml"]:::container
  end

  %% Connections from Device Interfaces to Processing Engine
  DLMSClient -->|"data"| ProcessingEngine
  WeatherStation -->|"data"| ProcessingEngine
  SmartMeterSim -->|"simulated data"| ProcessingEngine
  InverterSim -->|"simulated data"| ProcessingEngine

  %% Connections from Processing Engine to Visualization & Proposal
  ProcessingEngine -->|"processed data"| GrafanaDash
  ProcessingEngine -->|"processed data"| ProposalModule

  %% Containerization integration
  Container -->|"orchestrates"| ProcessingEngine
  Dockerfile --- Container
  DockerCompose --- Container

  %% Click Events
  click DLMSClient "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/Dispositivos Reales/Gurux.DLMS.Client.Example.python"
  click WeatherStation "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/Dispositivos Reales/WeatherStation.py"
  click SmartMeterSim "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/Simuladores/SmartMeter.py"
  click InverterSim "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/Simuladores/Inverter.py"
  click GrafanaDash "https://github.com/daniel207eae1/proyecto_ecovilla/tree/main/Grafana/"
  click ProposalModule "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/Propuestas/Propuesta_Inversor.py"
  click Dockerfile "https://github.com/daniel207eae1/proyecto_ecovilla/tree/main/Dockerfile"
  click DockerCompose "https://github.com/daniel207eae1/proyecto_ecovilla/blob/main/docker-compose.yml"

  %% Styles
  classDef device fill:#ADD8E6,stroke:#000,stroke-width:2px;
  classDef processing fill:#FFFF99,stroke:#000,stroke-width:2px;
  classDef visual fill:#90EE90,stroke:#000,stroke-width:2px;
  classDef proposal fill:#FFDAB9,stroke:#000,stroke-width:2px;
  classDef container fill:#DDA0DD,stroke:#000,stroke-width:2px;
```
