# zambiq1128-star/ac-energy-saving-system architecture

> Architecture diagram of the GitHub repository zambiq1128-star/ac-energy-saving-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zambiq1128-star/ac-energy-saving-system
- Repository: https://github.com/zambiq1128-star/ac-energy-saving-system

## Overview

This is a terminal-based, multi-room AC energy and cost simulator. The user workflow starts in the menu, obtains hourly outdoor temperatures (online or fallback), manages room inputs, then runs 24-hour simulations and reviews per-room costs, the highest-cost room, and Comfort-versus-Saving comparisons. The calculation layer models room heat, AC power, energy, and cost. Connections reflect the shown calls and README-described capabilities; unsampled behavior is represented only where documented.

Main entry points: [`main.py`](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/main.py) (Menu workflow), [`ruangan.py`](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/ruangan.py) (Room management), [`cuaca.py`](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/cuaca.py) (Hourly weather data), [`perhitungan.py`](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py) (Simulation dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_menu_flow["Menu workflow<br/>[main.py]"]
end

subgraph group_inputs["Inputs and weather"]
  node_input_validation["Input validation<br/>[masukan.py]"]
  node_weather_setup["Weather setup<br/>[main.py]"]
  node_weather_data["Hourly weather data<br/>[cuaca.py]"]
end

subgraph group_domain["Rooms and simulation"]
  node_room_management["Room management<br/>[ruangan.py]"]
  node_simulation_dispatch["Simulation dispatch<br/>[perhitungan.py]"]
  node_room_simulation["Room heat and AC model<br/>[perhitungan.py]"]
  node_simulation_stats["Temperature statistics<br/>[perhitungan.py]"]
  node_cost_summary["Cost and comparison<br/>[perhitungan.py]"]
end

subgraph group_views["Terminal output"]
  node_terminal_views["Menus and room views<br/>[tampilan.py]"]
  node_simulation_views["Simulation and cost reports<br/>[tampilan.py]"]
end

node_user(("User"))
node_open_meteo{{"Open-Meteo"}}

node_user -->|"selects actions"| node_menu_flow
node_menu_flow -->|"initializes weather"| node_weather_setup
node_weather_setup -->|"requests temperatures"| node_weather_data
node_weather_data -->|"queries forecast"| node_open_meteo
node_weather_setup -->|"collects fallback data"| node_input_validation
node_weather_setup -->|"uses fallback temperatures"| node_weather_data
node_menu_flow -->|"manages rooms"| node_room_management
node_room_management -->|"validates room fields"| node_input_validation
node_room_management -->|"displays room data"| node_terminal_views
node_menu_flow -->|"reads settings"| node_input_validation
node_menu_flow -->|"runs room simulations"| node_simulation_dispatch
node_simulation_dispatch -->|"simulates each room"| node_room_simulation
node_room_simulation -->|"summarizes temperatures"| node_simulation_stats
node_menu_flow -->|"finds highest cost"| node_cost_summary
node_menu_flow -->|"compares forced modes"| node_simulation_dispatch
node_menu_flow -->|"shows menus and charts"| node_terminal_views
node_menu_flow -->|"prints simulation results"| node_simulation_views

click node_menu_flow "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/main.py"
click node_room_management "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/ruangan.py"
click node_input_validation "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/masukan.py"
click node_weather_setup "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/main.py"
click node_weather_data "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/cuaca.py"
click node_simulation_dispatch "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py"
click node_room_simulation "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py"
click node_simulation_stats "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py"
click node_cost_summary "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py"
click node_terminal_views "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/tampilan.py"
click node_simulation_views "https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/tampilan.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu_flow,node_user toneBlue
class node_input_validation,node_weather_setup,node_weather_data toneAmber
class node_room_management,node_simulation_dispatch,node_room_simulation,node_simulation_stats,node_cost_summary toneMint
class node_terminal_views,node_simulation_views toneRose
class node_open_meteo toneIndigo
```

## Components

### Application flow

- [Menu workflow](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/main.py): `main.py`

### Inputs and weather

- [Input validation](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/masukan.py): `masukan.py`
- [Weather setup](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/main.py): `main.py`
- [Hourly weather data](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/cuaca.py): `cuaca.py`

### Rooms and simulation

- [Room management](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/ruangan.py): `ruangan.py`
- [Simulation dispatch](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py): `perhitungan.py`
- [Room heat and AC model](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py): `perhitungan.py`
- [Temperature statistics](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py): `perhitungan.py`
- [Cost and comparison](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/perhitungan.py): `perhitungan.py`

### Terminal output

- [Menus and room views](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/tampilan.py): `tampilan.py`
- [Simulation and cost reports](https://github.com/zambiq1128-star/ac-energy-saving-system/blob/main/tampilan.py): `tampilan.py`

### Other components

- **User**
- **Open-Meteo**

## Connections

- User → Menu workflow: selects actions (evidence: `README.md`)
- Menu workflow → Weather setup: initializes weather (evidence: `main.py`)
- Weather setup → Hourly weather data: requests temperatures (evidence: `main.py`)
- Hourly weather data → Open-Meteo: queries forecast (evidence: `cuaca.py`)
- Weather setup → Input validation: collects fallback data (evidence: `main.py`)
- Weather setup → Hourly weather data: uses fallback temperatures (evidence: `main.py`)
- Menu workflow → Room management: manages rooms (evidence: `main.py`)
- Room management → Input validation: validates room fields (evidence: `ruangan.py`)
- Room management → Menus and room views: displays room data (evidence: `ruangan.py`)
- Menu workflow → Input validation: reads settings (evidence: `main.py`)
- Menu workflow → Simulation dispatch: runs room simulations (evidence: `main.py`)
- Simulation dispatch → Room heat and AC model: simulates each room (evidence: `perhitungan.py`)
- Room heat and AC model → Temperature statistics: summarizes temperatures (evidence: `perhitungan.py`)
- Menu workflow → Cost and comparison: finds highest cost (evidence: `main.py`)
- Menu workflow → Simulation dispatch: compares forced modes (evidence: `main.py`)
- Menu workflow → Menus and room views: shows menus and charts (evidence: `main.py`)
- Menu workflow → Simulation and cost reports: prints simulation results (evidence: `main.py`)
