# enrymarch10/pps-gridsim architecture

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

- Interactive diagram: https://gitdiagram.com/enrymarch10/pps-gridsim
- Repository: https://github.com/enrymarch10/pps-gridsim

## Overview

GridSim is a desktop micro-grid simulator. A user selects or configures a scenario, runs a tick-based simulation, and inspects grid flows and statistics. The runtime advances environment time, evolves entities, and solves cable loads; the GUI and DSL provide scenario entry points, while statistics and observability support results. The README contains no capability details, and several modules were not sampled, so those branches are represented without asserting unsupported call relationships.

Main entry points: [`app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala) (Simulation Engine), [`app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala) (Runtime Factory), [`app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala`](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala) (Entity Dispatcher), [`app/src/main/scala/org/gridsim/core/simulation/SimulationState.scala`](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationState.scala) (Simulation Snapshot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenario["Scenario Setup"]
  node_catalog["Scenario Catalog"]
  node_dsl["Grid Builders"]
end

subgraph group_runtime["Simulation Runtime"]
  node_dispatcher["Entity Dispatcher"]
  node_engine["Simulation Engine"]
  node_controller["Simulation Controller"]
  node_factory["Runtime Factory"]
  node_snapshot["Simulation Snapshot"]
end

subgraph group_domain["Grid Domain"]
  node_topology["Grid Topology<br/>[Topology.scala]"]
  node_entities["Grid Entities<br/>[GridEntity.scala]"]
  node_environment["Environment<br/>[Environment.scala]"]
  node_house["House Evolution"]
  node_producer["Solar Evolution"]
  node_storage["Storage Exchange"]
end

subgraph group_analysis["Results and Analysis"]
  node_solver["Power Flow Solver"]
  node_statistics["Statistics Engine"]
  node_observability["Data Dispatch"]
end

subgraph group_interface["Desktop Interface"]
  node_gui["Desktop GUI<br/>[GuiApp.scala]"]
  node_scenarioui["Scenario Selection"]
  node_preset["Preset Repository"]
  node_views["Simulation Views"]
end

node_user(("User"))

node_user -.->|"uses"| node_gui
node_gui -.->|"selects scenarios"| node_scenarioui
node_scenarioui -.->|"loads presets"| node_preset
node_preset -->|"reads catalog"| node_catalog
node_catalog -->|"builds scenarios"| node_dsl
node_dsl -.->|"configures grid"| node_topology
node_topology -.->|"contains entities"| node_entities
node_factory -->|"creates"| node_controller
node_factory -->|"configures"| node_engine
node_factory -->|"configures"| node_dispatcher
node_factory -->|"configures"| node_solver
node_controller -->|"steps simulation"| node_engine
node_controller -->|"tracks state"| node_snapshot
node_engine -->|"advances time"| node_environment
node_engine -->|"evolves entities"| node_dispatcher
node_engine -->|"solves cable loads"| node_solver
node_dispatcher -.->|"dispatches to"| node_house
node_dispatcher -.->|"dispatches to"| node_producer
node_engine -->|"updates snapshot"| node_snapshot
node_storage -->|"updates storage"| node_entities
node_views -.->|"presents results"| node_statistics
node_views -.->|"presents state"| node_snapshot
node_observability -.->|"dispatches data"| node_snapshot

click node_catalog "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/dsl/scenarios/GridScenarioCatalog.scala"
click node_dsl "https://github.com/enrymarch10/pps-gridsim/tree/main/app/src/main/scala/org/gridsim/dsl"
click node_topology "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/network/Topology.scala"
click node_entities "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/GridEntity.scala"
click node_environment "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/Environment.scala"
click node_house "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/house/HouseEvolution.scala"
click node_producer "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/producer/SolarPanelEvolution.scala"
click node_storage "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/storage/StorageEnergyExchanger.scala"
click node_dispatcher "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala"
click node_engine "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala"
click node_controller "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationController.scala"
click node_factory "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala"
click node_snapshot "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationState.scala"
click node_solver "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/solver/PowerFlowSolver.scala"
click node_statistics "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/statistics/StatisticsEngine.scala"
click node_observability "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/observability/Fs2DataDispatcher.scala"
click node_gui "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/app/GuiApp.scala"
click node_scenarioui "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/viewmodel/ScenarioSelectionViewModel.scala"
click node_preset "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/ports/DslScenarioPresetRepository.scala"
click node_views "https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/view/SimulationView.scala"

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_catalog,node_dsl,node_user toneBlue
class node_dispatcher,node_engine,node_controller,node_factory,node_snapshot toneAmber
class node_topology,node_entities,node_environment,node_house,node_producer,node_storage toneMint
class node_solver,node_statistics,node_observability toneRose
class node_gui,node_scenarioui,node_preset,node_views toneIndigo
```

## Components

### Scenario Setup

- [Scenario Catalog](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/dsl/scenarios/GridScenarioCatalog.scala): `app/src/main/scala/org/gridsim/dsl/scenarios/GridScenarioCatalog.scala`
- [Grid Builders](https://github.com/enrymarch10/pps-gridsim/tree/main/app/src/main/scala/org/gridsim/dsl): `app/src/main/scala/org/gridsim/dsl`

### Simulation Runtime

- [Entity Dispatcher](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala): `app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala`
- [Simulation Engine](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala): `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`
- [Simulation Controller](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationController.scala): `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationController.scala`
- [Runtime Factory](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala): `app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`
- [Simulation Snapshot](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/simulation/SimulationState.scala): `app/src/main/scala/org/gridsim/core/simulation/SimulationState.scala`

### Grid Domain

- [Grid Topology](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/network/Topology.scala): `app/src/main/scala/org/gridsim/core/model/network/Topology.scala`
- [Grid Entities](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/GridEntity.scala): `app/src/main/scala/org/gridsim/core/model/GridEntity.scala`
- [Environment](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/model/Environment.scala): `app/src/main/scala/org/gridsim/core/model/Environment.scala`
- [House Evolution](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/house/HouseEvolution.scala): `app/src/main/scala/org/gridsim/core/behaviour/house/HouseEvolution.scala`
- [Solar Evolution](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/producer/SolarPanelEvolution.scala): `app/src/main/scala/org/gridsim/core/behaviour/producer/SolarPanelEvolution.scala`
- [Storage Exchange](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/behaviour/storage/StorageEnergyExchanger.scala): `app/src/main/scala/org/gridsim/core/behaviour/storage/StorageEnergyExchanger.scala`

### Results and Analysis

- [Power Flow Solver](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/solver/PowerFlowSolver.scala): `app/src/main/scala/org/gridsim/core/solver/PowerFlowSolver.scala`
- [Statistics Engine](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/statistics/StatisticsEngine.scala): `app/src/main/scala/org/gridsim/statistics/StatisticsEngine.scala`
- [Data Dispatch](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/core/observability/Fs2DataDispatcher.scala): `app/src/main/scala/org/gridsim/core/observability/Fs2DataDispatcher.scala`

### Desktop Interface

- [Desktop GUI](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/app/GuiApp.scala): `app/src/main/scala/org/gridsim/gui/app/GuiApp.scala`
- [Scenario Selection](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/viewmodel/ScenarioSelectionViewModel.scala): `app/src/main/scala/org/gridsim/gui/viewmodel/ScenarioSelectionViewModel.scala`
- [Preset Repository](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/ports/DslScenarioPresetRepository.scala): `app/src/main/scala/org/gridsim/gui/ports/DslScenarioPresetRepository.scala`
- [Simulation Views](https://github.com/enrymarch10/pps-gridsim/blob/main/app/src/main/scala/org/gridsim/gui/view/SimulationView.scala): `app/src/main/scala/org/gridsim/gui/view/SimulationView.scala`

### Other components

- **User**

## Connections

- User → Desktop GUI: uses
- Desktop GUI → Scenario Selection: selects scenarios
- Scenario Selection → Preset Repository: loads presets
- Preset Repository → Scenario Catalog: reads catalog (evidence: `app/src/main/scala/org/gridsim/gui/ports/DslScenarioPresetRepository.scala`)
- Scenario Catalog → Grid Builders: builds scenarios (evidence: `app/src/main/scala/org/gridsim/dsl/scenarios/GridScenarioCatalog.scala`)
- Grid Builders → Grid Topology: configures grid
- Grid Topology → Grid Entities: contains entities
- Runtime Factory → Simulation Controller: creates (evidence: `app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`)
- Runtime Factory → Simulation Engine: configures (evidence: `app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`)
- Runtime Factory → Entity Dispatcher: configures (evidence: `app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`)
- Runtime Factory → Power Flow Solver: configures (evidence: `app/src/main/scala/org/gridsim/core/simulation/SimulationControllerFactory.scala`)
- Simulation Controller → Simulation Engine: steps simulation (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationController.scala`)
- Simulation Controller → Simulation Snapshot: tracks state (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationController.scala`)
- Simulation Engine → Environment: advances time (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`)
- Simulation Engine → Entity Dispatcher: evolves entities (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`)
- Simulation Engine → Power Flow Solver: solves cable loads (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`)
- Entity Dispatcher → House Evolution: dispatches to (evidence: `app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala`)
- Entity Dispatcher → Solar Evolution: dispatches to (evidence: `app/src/main/scala/org/gridsim/core/behaviour/EntityEvolutionDispatcher.scala`)
- Simulation Engine → Simulation Snapshot: updates snapshot (evidence: `app/src/main/scala/org/gridsim/core/simulation/DefaultSimulationEngine.scala`)
- Storage Exchange → Grid Entities: updates storage (evidence: `app/src/main/scala/org/gridsim/core/behaviour/storage/StorageEnergyExchanger.scala`)
- Simulation Views → Statistics Engine: presents results
- Simulation Views → Simulation Snapshot: presents state
- Data Dispatch → Simulation Snapshot: dispatches data (evidence: `app/src/main/scala/org/gridsim/core/observability/Fs2DataDispatcher.scala`)
