# gurgenbaghdatyan/vcp architecture

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

- Interactive diagram: https://gitdiagram.com/gurgenbaghdatyan/vcp
- Repository: https://github.com/gurgenbaghdatyan/vcp

## Overview

This is a Node.js OCPP virtual charge-point simulator. Its main workflow starts a selected OCPP-version entry point, connects to a Central System over WebSocket, and exchanges validated protocol messages; incoming actions are dispatched to version-specific handlers, while transaction events can drive simulated meter values. The README also documents a separate admin-command WebSocket proxy. The supplied excerpts support the core runtime links, but not detailed wiring for every protocol action or the UI, so those are represented as broader subsystems.

Main entry points: [`src/vcp.ts`](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/vcp.ts) (Charge point runtime), [`src/ocppMessageHandler.ts`](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessageHandler.ts) (Version handler resolver), [`src/ocppMessage.ts`](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessage.ts) (OCPP message model), [`index_16.ts`](https://github.com/gurgenbaghdatyan/vcp/blob/main/index_16.ts) (OCPP 1.6 entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Simulator runtime"]
  node_entry16["OCPP 1.6 entry<br/>[index_16.ts]"]
  node_entry201["OCPP 2.0.1 entry<br/>[index_201.ts]"]
  node_entry21["OCPP 2.1 entry<br/>[index_21.ts]"]
  node_vcp["Charge point runtime<br/>[vcp.ts]"]
  node_schema["Schema validation<br/>[schemaValidator.ts]"]
  node_transport["OCPP message model<br/>[ocppMessage.ts]"]
  node_factory["Message factory<br/>[messageFactory.ts]"]
  node_logger["Logging<br/>[logger.ts]"]
end

subgraph group_protocol["OCPP protocol"]
  node_handler["Version handler resolver"]
  node_h16["OCPP 1.6 dispatch<br/>[messageHandler.ts]"]
  node_h201["OCPP 2.0.1 dispatch<br/>[messageHandler.ts]"]
  node_h21["OCPP 2.1 dispatch<br/>[messageHandler.ts]"]
  node_m16["OCPP 1.6 actions"]
  node_m201["OCPP 2.0.1 actions"]
  node_m21["OCPP 2.1 actions"]
  node_common16["1.6 message schemas<br/>[_common.ts]"]
  node_common201["2.0.1 message schemas<br/>[_common.ts]"]
  node_common21["2.1 message schemas<br/>[_common.ts]"]
end

subgraph group_session["Transactions"]
  node_transactions["Transaction and meter simulation"]
  node_start16["Start transaction handling"]
end

subgraph group_admin["Admin interface"]
  node_adminapi["Admin command endpoint<br/>[vcp.ts]"]
  node_adminclient["Admin command client<br/>[admin.ts]"]
  node_admincommands["Admin command examples"]
  node_ui["Admin UI"]
end

node_operator(("Simulator operator"))
node_central(("Central System"))

node_operator -->|"starts"| node_entry16
node_operator -->|"starts"| node_entry201
node_operator -.->|"starts"| node_entry21
node_entry16 -->|"configures"| node_vcp
node_entry201 -.->|"configures"| node_vcp
node_entry21 -.->|"configures"| node_vcp
node_vcp -->|"connects by WebSocket"| node_central
node_vcp -->|"validates messages"| node_schema
node_vcp -->|"resolves handler"| node_handler
node_handler -->|"selects by version"| node_h16
node_handler -->|"selects by version"| node_h201
node_handler -->|"selects by version"| node_h21
node_h16 -->|"dispatches actions"| node_m16
node_h201 -->|"dispatches actions"| node_m201
node_h21 -->|"dispatches actions"| node_m21
node_m16 -.->|"uses schemas"| node_common16
node_m201 -->|"uses schemas"| node_common201
node_m21 -->|"uses schemas"| node_common21
node_transport -->|"builds calls"| node_factory
node_transport -->|"logs parse issues"| node_logger
node_start16 -->|"starts session"| node_transactions
node_transactions -->|"uses runtime callbacks"| node_vcp
node_operator -->|"runs commands"| node_admincommands
node_admincommands -->|"sends command"| node_adminclient
node_adminclient -->|"POSTs execute request"| node_adminapi
node_adminapi -->|"proxies OCPP messages"| node_central

click node_entry16 "https://github.com/gurgenbaghdatyan/vcp/blob/main/index_16.ts"
click node_entry201 "https://github.com/gurgenbaghdatyan/vcp/blob/main/index_201.ts"
click node_entry21 "https://github.com/gurgenbaghdatyan/vcp/blob/main/index_21.ts"
click node_vcp "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/vcp.ts"
click node_schema "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/schemaValidator.ts"
click node_transport "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessage.ts"
click node_factory "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/messageFactory.ts"
click node_logger "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/logger.ts"
click node_handler "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessageHandler.ts"
click node_h16 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messageHandler.ts"
click node_h201 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v201/messageHandler.ts"
click node_h21 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v21/messageHandler.ts"
click node_m16 "https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v16/messages"
click node_m201 "https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v201/messages"
click node_m21 "https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v21/messages"
click node_common16 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messages/_common.ts"
click node_common201 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v201/messages/_common.ts"
click node_common21 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v21/messages/_common.ts"
click node_transactions "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/transactionManager.ts"
click node_start16 "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messages/startTransaction.ts"
click node_adminapi "https://github.com/gurgenbaghdatyan/vcp/blob/main/src/vcp.ts"
click node_adminclient "https://github.com/gurgenbaghdatyan/vcp/blob/main/admin/admin.ts"
click node_admincommands "https://github.com/gurgenbaghdatyan/vcp/tree/main/admin"
click node_ui "https://github.com/gurgenbaghdatyan/vcp/tree/main/ui"

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_entry16,node_entry201,node_entry21,node_vcp,node_schema,node_transport,node_factory,node_logger toneBlue
class node_handler,node_h16,node_h201,node_h21,node_m16,node_m201,node_m21,node_common16,node_common201,node_common21 toneAmber
class node_transactions,node_start16 toneMint
class node_adminapi,node_adminclient,node_admincommands,node_ui toneRose
class node_operator,node_central toneIndigo
```

## Components

### Simulator runtime

- [OCPP 1.6 entry](https://github.com/gurgenbaghdatyan/vcp/blob/main/index_16.ts): `index_16.ts`
- [OCPP 2.0.1 entry](https://github.com/gurgenbaghdatyan/vcp/blob/main/index_201.ts): `index_201.ts`
- [OCPP 2.1 entry](https://github.com/gurgenbaghdatyan/vcp/blob/main/index_21.ts): `index_21.ts`
- [Charge point runtime](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/vcp.ts): `src/vcp.ts`
- [Schema validation](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/schemaValidator.ts): `src/schemaValidator.ts`
- [OCPP message model](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessage.ts): `src/ocppMessage.ts`
- [Message factory](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/messageFactory.ts): `src/messageFactory.ts`
- [Logging](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/logger.ts): `src/logger.ts`

### OCPP protocol

- [Version handler resolver](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/ocppMessageHandler.ts): `src/ocppMessageHandler.ts`
- [OCPP 1.6 dispatch](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messageHandler.ts): `src/v16/messageHandler.ts`
- [OCPP 2.0.1 dispatch](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v201/messageHandler.ts): `src/v201/messageHandler.ts`
- [OCPP 2.1 dispatch](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v21/messageHandler.ts): `src/v21/messageHandler.ts`
- [OCPP 1.6 actions](https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v16/messages): `src/v16/messages`
- [OCPP 2.0.1 actions](https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v201/messages): `src/v201/messages`
- [OCPP 2.1 actions](https://github.com/gurgenbaghdatyan/vcp/tree/main/src/v21/messages): `src/v21/messages`
- [1.6 message schemas](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messages/_common.ts): `src/v16/messages/_common.ts`
- [2.0.1 message schemas](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v201/messages/_common.ts): `src/v201/messages/_common.ts`
- [2.1 message schemas](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v21/messages/_common.ts): `src/v21/messages/_common.ts`

### Transactions

- [Transaction and meter simulation](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/transactionManager.ts): `src/transactionManager.ts`
- [Start transaction handling](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/v16/messages/startTransaction.ts): `src/v16/messages/startTransaction.ts`

### Admin interface

- [Admin command endpoint](https://github.com/gurgenbaghdatyan/vcp/blob/main/src/vcp.ts): `src/vcp.ts`
- [Admin command client](https://github.com/gurgenbaghdatyan/vcp/blob/main/admin/admin.ts): `admin/admin.ts`
- [Admin command examples](https://github.com/gurgenbaghdatyan/vcp/tree/main/admin): `admin`
- [Admin UI](https://github.com/gurgenbaghdatyan/vcp/tree/main/ui): `ui`

### Other components

- **Simulator operator**
- **Central System**

## Connections

- Simulator operator → OCPP 1.6 entry: starts (evidence: `README.md`)
- Simulator operator → OCPP 2.0.1 entry: starts (evidence: `README.md`)
- Simulator operator → OCPP 2.1 entry: starts
- OCPP 1.6 entry → Charge point runtime: configures (evidence: `index_16.ts`)
- OCPP 2.0.1 entry → Charge point runtime: configures
- OCPP 2.1 entry → Charge point runtime: configures
- Charge point runtime → Central System: connects by WebSocket (evidence: `src/vcp.ts`)
- Charge point runtime → Schema validation: validates messages (evidence: `src/vcp.ts`)
- Charge point runtime → Version handler resolver: resolves handler (evidence: `src/vcp.ts`)
- Version handler resolver → OCPP 1.6 dispatch: selects by version (evidence: `src/ocppMessageHandler.ts`)
- Version handler resolver → OCPP 2.0.1 dispatch: selects by version (evidence: `src/ocppMessageHandler.ts`)
- Version handler resolver → OCPP 2.1 dispatch: selects by version (evidence: `src/ocppMessageHandler.ts`)
- OCPP 1.6 dispatch → OCPP 1.6 actions: dispatches actions (evidence: `src/v16/messageHandler.ts`)
- OCPP 2.0.1 dispatch → OCPP 2.0.1 actions: dispatches actions (evidence: `src/v201/messageHandler.ts`)
- OCPP 2.1 dispatch → OCPP 2.1 actions: dispatches actions (evidence: `src/v21/messageHandler.ts`)
- OCPP 1.6 actions → 1.6 message schemas: uses schemas (evidence: `src/v16/messages/authorize.ts`)
- OCPP 2.0.1 actions → 2.0.1 message schemas: uses schemas (evidence: `src/v201/messages/authorize.ts`)
- OCPP 2.1 actions → 2.1 message schemas: uses schemas (evidence: `src/v21/messages/authorize.ts`)
- OCPP message model → Message factory: builds calls (evidence: `src/ocppMessage.ts`)
- OCPP message model → Logging: logs parse issues (evidence: `src/ocppMessage.ts`)
- Start transaction handling → Transaction and meter simulation: starts session (evidence: `src/v16/messages/startTransaction.ts`)
- Transaction and meter simulation → Charge point runtime: uses runtime callbacks (evidence: `src/transactionManager.ts`)
- Simulator operator → Admin command examples: runs commands (evidence: `README.md`)
- Admin command examples → Admin command client: sends command (evidence: `README.md`)
- Admin command client → Admin command endpoint: POSTs execute request (evidence: `admin/admin.ts`)
- Admin command endpoint → Central System: proxies OCPP messages (evidence: `README.md`)
