# rodrigoyalibat/proyectofisicaii architecture

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

- Interactive diagram: https://gitdiagram.com/rodrigoyalibat/proyectofisicaii
- Repository: https://github.com/rodrigoyalibat/proyectofisicaii

## Overview

##### Project type and purpose
- This is a front-end web application (an educational simulator) built purely with HTML, CSS, and JavaScript.
- Its goal is to let students build resistive circuits in series or parallel, set resistor values and a voltage source, then compute and display equivalent resistance, current, voltage drops, and power.

##### File structure
- Top-level files only:
- index.html – the application’s single page (UI container)
- script.js – the logic: reading user input, modeling circuits, performing calculations, and updating the view
- README.md  – project description and user instructions
- No backend or database—this is a static, client-side tool.

##### Key insights from the README
- Interactive drag/drop or click-to-add resistors
- Core features: adding resistors, defining values, voltage source, computing circuit parameters, graphical display
- Target audience: students, educational tool

##### Main components
a. Browser Environment
- HTML Renderer (index.html)
- CSS Styling Engine (style.css)
- JavaScript Engine (script.js)
b. JavaScript Modules (logical subdivisions within script.js)
1. UI Controller
– Listens for user actions: add resistor, change value, set voltage
– Updates input forms and buttons
2. Circuit Model
– Data structures representing nodes, resistors, connections
3. Calculation Engine
– Series/parallel resistance formulas
– Ohm’s law (I = V/R), power (P = VI)
4. Visualization Renderer
c. Data flow & interactions
- User → UI Controller → Circuit Model → Calculation Engine → Visualization Renderer → Browser viewport
- UI Controller also pulls data from HTML form elements and pushes updates back into the DOM

##### Architectural patterns & design principles
- Separation of concerns:
- Static assets (HTML/CSS) vs dynamic logic (JS)
- Within JS, divide into input handling, data modeling, computing, rendering
- Single-page application (SPA) pattern – all functionality lives in one HTML page

##### Detail without over-engineering
- Every logical piece even if it lives in one file.
- The goal is clarity on how user actions propagate through the system and produce the visual circuit and numerical results.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User(("Student/User")):::user

    subgraph "Browser Environment"
        subgraph "Static Assets"
            HTML["index.html (UI Container)"]:::static
            CSS["style.css (Styles)"]:::static
            README["README.md (Project Description)"]:::static
        end
        subgraph "JavaScript Engine"
            UI["UI Controller"]:::logic
            Model["Circuit Model"]:::logic
            Calc["Calculation Engine"]:::logic
            Viz["Visualization Renderer"]:::logic
        end
    end

    %% Data Flow
    User -->|"interacts (click/add resistor)"| UI
    UI -->|"resistor config"| Model
    Model -->|"circuit data"| Calc
    Calc -->|"computed values"| Viz
    Viz -->|"render commands"| HTML
    UI -->|"read/write DOM"| HTML
    Viz -->|"update DOM"| HTML

    %% Click Events
    click HTML "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/index.html"
    click CSS "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/style.css"
    click README "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/README.md"
    click UI "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/script.js"
    click Model "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/script.js"
    click Calc "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/script.js"
    click Viz "https://github.com/rodrigoyalibat/proyectofisicaii/blob/main/script.js"

    %% Styles
    classDef static fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#000,stroke-width:1px
    classDef user fill:#f0f0f0,stroke:#000,stroke-width:1px
```
