# vaibhavreddy0226/smarthvac_nnpid architecture

> Architecture diagram of the GitHub repository vaibhavreddy0226/smarthvac_nnpid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vaibhavreddy0226/smarthvac_nnpid
- Repository: https://github.com/vaibhavreddy0226/smarthvac_nnpid

## Overview

SmartHVAC NNPID is a MATLAB/Simulink HVAC temperature-control project whose PID gains are controlled by a neural network. The documented workflow is to start the workspace, optionally tune and manually update fixed baseline gains, then run the main workflow; the system is evaluated under four conditions. The README documents generated training data, neural-network artifacts, and a Simulink model. Source excerpts were unavailable, so runtime calls among modules and detailed evaluation flow are not inferred.

Main entry points: [`training/s02_train_nn.m`](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s02_train_nn.m) (Neural Network Training), [`training/s00_tune_baseline.m`](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s00_tune_baseline.m) (Baseline Tuning), [`training/s01_generate_training_data.m`](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s01_generate_training_data.m) (Training Data Generation), [`simulink/s03_build_model.m`](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/simulink/s03_build_model.m) (Simulink Model Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration &amp; Control"]
  node_startup["Workspace Startup<br/>[startup.m]"]
  node_parameters["HVAC Parameters<br/>[hvac_params.m]"]
  node_root["HVAC Root<br/>[hvac_root.m]"]
  node_workspace["Workspace Init<br/>[init_workspace.m]"]
  node_scheduler["Gain Scheduler<br/>[gain_scheduler.m]"]
  node_capacity["HVAC Capacity<br/>[hvac_capacity.m]"]
  node_pid["PID Step<br/>[pid_step.m]"]
end

subgraph group_learning["Gain Learning"]
  node_baseline["Baseline Tuning"]
  node_gain_cost["Gain Cost<br/>[gain_cost.m]"]
  node_data_generation["Training Data Generation"]
  node_training_data["Training Data<br/>[training_data.mat]"]
  node_nn_training["Neural Network Training<br/>[s02_train_nn.m]"]
  node_gain_net["Gain Network<br/>[gain_net.mat]"]
  node_nn_function["NN Gain Function<br/>[nn_gain_fcn.m]"]
end

subgraph group_simulation["Scenarios &amp; Simulation"]
  node_scenario["Scenario Builder<br/>[make_scenario.m]"]
  node_profile["Real Profile Loader"]
  node_plant["Room Simulation<br/>[simulate_room.m]"]
  node_model_builder["Simulink Model Builder<br/>[s03_build_model.m]"]
  node_model["HVAC Simulink Model<br/>[hvac_nnpid.slx]"]
end

subgraph group_evaluation["Evaluation"]
  node_main["Main Run Workflow<br/>[main_run_all.m]"]
  node_verification["Link Verification<br/>[s04_verify_link.m]"]
  node_case_runner["Simulink Case Runner"]
  node_comparison["Scenario Comparison"]
  node_metrics["Metric Computation<br/>[compute_metrics.m]"]
  node_results["Metrics Table<br/>[metrics_table.csv]"]
end

node_user(("MATLAB User"))

node_user -->|"runs first"| node_startup
node_user -.->|"optionally runs"| node_baseline
node_baseline -->|"manual gain update"| node_parameters
node_user -->|"runs afterward"| node_main
node_data_generation -->|"generates"| node_training_data
node_nn_training -->|"generates"| node_gain_net
node_nn_training -->|"generates"| node_nn_function
node_model_builder -->|"generates"| node_model

click node_startup "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/startup.m"
click node_parameters "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/hvac_params.m"
click node_root "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/hvac_root.m"
click node_workspace "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/init_workspace.m"
click node_scheduler "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/gain_scheduler.m"
click node_capacity "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/hvac_capacity.m"
click node_pid "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/pid_step.m"
click node_baseline "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s00_tune_baseline.m"
click node_gain_cost "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/gain_cost.m"
click node_data_generation "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s01_generate_training_data.m"
click node_training_data "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/data/training_data.mat"
click node_nn_training "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s02_train_nn.m"
click node_gain_net "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/nn/gain_net.mat"
click node_nn_function "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/nn/nn_gain_fcn.m"
click node_scenario "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/scenarios/make_scenario.m"
click node_profile "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/scenarios/load_real_profile.m"
click node_plant "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/plant_sim/simulate_room.m"
click node_model_builder "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/simulink/s03_build_model.m"
click node_model "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/simulink/hvac_nnpid.slx"
click node_main "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/main_run_all.m"
click node_verification "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/s04_verify_link.m"
click node_case_runner "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/run_simulink_case.m"
click node_comparison "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/s05_run_comparison.m"
click node_metrics "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/compute_metrics.m"
click node_results "https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/results/metrics_table.csv"

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_startup,node_parameters,node_root,node_workspace,node_scheduler,node_capacity,node_pid,node_user toneBlue
class node_baseline,node_gain_cost,node_data_generation,node_training_data,node_nn_training,node_gain_net,node_nn_function toneAmber
class node_scenario,node_profile,node_plant,node_model_builder,node_model toneMint
class node_main,node_verification,node_case_runner,node_comparison,node_metrics,node_results toneRose
```

## Components

### Configuration & Control

- [Workspace Startup](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/startup.m): `startup.m`
- [HVAC Parameters](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/hvac_params.m): `config/hvac_params.m`
- [HVAC Root](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/hvac_root.m): `config/hvac_root.m`
- [Workspace Init](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/config/init_workspace.m): `config/init_workspace.m`
- [Gain Scheduler](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/gain_scheduler.m): `functions/gain_scheduler.m`
- [HVAC Capacity](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/hvac_capacity.m): `functions/hvac_capacity.m`
- [PID Step](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/functions/pid_step.m): `functions/pid_step.m`

### Gain Learning

- [Baseline Tuning](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s00_tune_baseline.m): `training/s00_tune_baseline.m`
- [Gain Cost](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/gain_cost.m): `training/gain_cost.m`
- [Training Data Generation](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s01_generate_training_data.m): `training/s01_generate_training_data.m`
- [Training Data](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/data/training_data.mat): `data/training_data.mat`
- [Neural Network Training](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/training/s02_train_nn.m): `training/s02_train_nn.m`
- [Gain Network](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/nn/gain_net.mat): `nn/gain_net.mat`
- [NN Gain Function](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/nn/nn_gain_fcn.m): `nn/nn_gain_fcn.m`

### Scenarios & Simulation

- [Scenario Builder](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/scenarios/make_scenario.m): `scenarios/make_scenario.m`
- [Real Profile Loader](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/scenarios/load_real_profile.m): `scenarios/load_real_profile.m`
- [Room Simulation](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/plant_sim/simulate_room.m): `plant_sim/simulate_room.m`
- [Simulink Model Builder](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/simulink/s03_build_model.m): `simulink/s03_build_model.m`
- [HVAC Simulink Model](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/simulink/hvac_nnpid.slx): `simulink/hvac_nnpid.slx`

### Evaluation

- [Main Run Workflow](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/main_run_all.m): `main_run_all.m`
- [Link Verification](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/s04_verify_link.m): `evaluation/s04_verify_link.m`
- [Simulink Case Runner](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/run_simulink_case.m): `evaluation/run_simulink_case.m`
- [Scenario Comparison](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/s05_run_comparison.m): `evaluation/s05_run_comparison.m`
- [Metric Computation](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/evaluation/compute_metrics.m): `evaluation/compute_metrics.m`
- [Metrics Table](https://github.com/vaibhavreddy0226/smarthvac_nnpid/blob/main/results/metrics_table.csv): `results/metrics_table.csv`

### Other components

- **MATLAB User**

## Connections

- MATLAB User → Workspace Startup: runs first (evidence: `README.md`)
- MATLAB User → Baseline Tuning: optionally runs (evidence: `README.md`)
- Baseline Tuning → HVAC Parameters: manual gain update (evidence: `README.md`)
- MATLAB User → Main Run Workflow: runs afterward (evidence: `README.md`)
- Training Data Generation → Training Data: generates (evidence: `README.md`)
- Neural Network Training → Gain Network: generates (evidence: `README.md`)
- Neural Network Training → NN Gain Function: generates (evidence: `README.md`)
- Simulink Model Builder → HVAC Simulink Model: generates (evidence: `README.md`)
