# beardhealth/combined-heat-and-power-system-economic-dispatch architecture

> Architecture diagram of the GitHub repository beardhealth/combined-heat-and-power-system-economic-dispatch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beardhealth/combined-heat-and-power-system-economic-dispatch
- Repository: https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch

## Overview

This repository presents deep-reinforcement-learning approaches to combined heat-and-power economic dispatch. A run selects an algorithm, interacts with a dispatch environment to obtain states and rewards, and either trains a policy or evaluates it and records dispatch outcomes. The sampled files show TD3 with a separate environment module and asynchronous PPO with a CHP environment. The README describes the product broadly but gives little implementation detail; the test-system environment’s internals were not sampled.

Main entry points: [`DPPO_CHP.py`](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py) (PPO runner), [`DRL.py`](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py) (TD3 runner), [`CHP_MODEL.py`](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/CHP_MODEL.py) (CHP environment), [`test_system4.py`](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/test_system4.py) (Test-system environment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_td3["TD3 dispatch"]
  node_td3_run["TD3 runner<br/>[DRL.py]"]
  node_td3_agent["TD3 agent<br/>[DRL.py]"]
  node_replay[("Replay buffer<br/>[DRL.py]")]
  node_checkpoints["TD3 checkpoints<br/>[DRL.py]"]
end

subgraph group_ppo["PPO dispatch"]
  node_ppo_runner["PPO runner<br/>[DPPO_CHP.py]"]
  node_ppo_agent["PPO agent<br/>[DPPO_CHP.py]"]
  node_worker["Rollout worker<br/>[DPPO_CHP.py]"]
  node_rollout_queue["Rollout queue<br/>[DPPO_CHP.py]"]
  node_ppo_results["PPO results<br/>[DPPO_CHP.py]"]
end

subgraph group_simulation["Dispatch simulation"]
  node_test_env["Test-system environment<br/>[test_system4.py]"]
  node_chp_env["CHP environment<br/>[CHP_MODEL.py]"]
end

node_researcher(("Researcher"))
node_tensorboard[("TensorBoard logs")]

node_researcher -->|"starts run"| node_td3_run
node_td3_run -->|"selects actions"| node_td3_agent
node_td3_run -->|"steps environment"| node_test_env
node_td3_agent -->|"stores samples"| node_replay
node_td3_agent -->|"writes metrics"| node_tensorboard
node_td3_run -->|"saves or loads"| node_checkpoints
node_researcher -->|"starts run"| node_ppo_runner
node_ppo_runner -->|"updates policy"| node_ppo_agent
node_ppo_runner -->|"starts workers"| node_worker
node_worker -->|"chooses actions"| node_ppo_agent
node_worker -->|"steps environment"| node_chp_env
node_worker -->|"queues rollouts"| node_rollout_queue
node_ppo_agent -->|"consumes rollouts"| node_rollout_queue
node_ppo_runner -->|"evaluates policy"| node_chp_env
node_ppo_runner -->|"saves outputs"| node_ppo_results

click node_td3_run "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py"
click node_td3_agent "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py"
click node_replay "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py"
click node_test_env "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/test_system4.py"
click node_checkpoints "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py"
click node_ppo_runner "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py"
click node_ppo_agent "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py"
click node_worker "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py"
click node_rollout_queue "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py"
click node_chp_env "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/CHP_MODEL.py"
click node_ppo_results "https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.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_td3_run,node_td3_agent,node_replay,node_checkpoints toneBlue
class node_ppo_runner,node_ppo_agent,node_worker,node_rollout_queue,node_ppo_results,node_tensorboard toneAmber
class node_test_env,node_chp_env toneMint
class node_researcher toneIndigo
```

## Components

### TD3 dispatch

- [TD3 runner](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py): `DRL.py`
- [TD3 agent](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py): `DRL.py`
- [Replay buffer](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py): `DRL.py`
- [TD3 checkpoints](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DRL.py): `DRL.py`

### PPO dispatch

- [PPO runner](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py): `DPPO_CHP.py`
- [PPO agent](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py): `DPPO_CHP.py`
- [Rollout worker](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py): `DPPO_CHP.py`
- [Rollout queue](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py): `DPPO_CHP.py`
- [PPO results](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/DPPO_CHP.py): `DPPO_CHP.py`

### Dispatch simulation

- [Test-system environment](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/test_system4.py): `test_system4.py`
- [CHP environment](https://github.com/beardhealth/combined-heat-and-power-system-economic-dispatch/blob/master/CHP_MODEL.py): `CHP_MODEL.py`

### Other components

- **Researcher**
- **TensorBoard logs**

## Connections

- Researcher → TD3 runner: starts run (evidence: `DRL.py`)
- TD3 runner → TD3 agent: selects actions (evidence: `DRL.py`)
- TD3 runner → Test-system environment: steps environment (evidence: `DRL.py`)
- TD3 agent → Replay buffer: stores samples (evidence: `DRL.py`)
- TD3 agent → TensorBoard logs: writes metrics (evidence: `DRL.py`)
- TD3 runner → TD3 checkpoints: saves or loads (evidence: `DRL.py`)
- Researcher → PPO runner: starts run (evidence: `DPPO_CHP.py`)
- PPO runner → PPO agent: updates policy (evidence: `DPPO_CHP.py`)
- PPO runner → Rollout worker: starts workers (evidence: `DPPO_CHP.py`)
- Rollout worker → PPO agent: chooses actions (evidence: `DPPO_CHP.py`)
- Rollout worker → CHP environment: steps environment (evidence: `DPPO_CHP.py`)
- Rollout worker → Rollout queue: queues rollouts (evidence: `DPPO_CHP.py`)
- PPO agent → Rollout queue: consumes rollouts (evidence: `DPPO_CHP.py`)
- PPO runner → CHP environment: evaluates policy (evidence: `DPPO_CHP.py`)
- PPO runner → PPO results: saves outputs (evidence: `DPPO_CHP.py`)
