# thiagobeats/machinesimulation architecture

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

- Interactive diagram: https://gitdiagram.com/thiagobeats/machinesimulation
- Repository: https://github.com/thiagobeats/machinesimulation

## Overview

MachineSimulation is a browser-only training simulator for industrial HMIs. The principal workflow is an operator opening a machine simulation, interacting with its HMI, and seeing locally emulated machine behavior and persisted state; the README says no commands reach a PLC. It also documents a separate image-based parcours for a non-web HMI. The tree and README differ on several simulator paths, so nodes use paths present in the tree; unsampled connections are omitted or marked unverified.

Main entry points: [`b300-duo`](https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo) (Machine HMIs), [`b300-duo/sim/protocolo.js`](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/protocolo.js) (HMI protocol), [`b300-duo/framework/TcHmiFramework.js`](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/framework/TcHmiFramework.js) (TwinCAT framework), [`b300-duo/sim/sim.js`](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/sim.js) (Browser bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_machine_ui["Machine interfaces"]
  node_machine_views["Machine HMIs"]
  node_tablet_frame["Tablet frame"]
end

subgraph group_simulation["Simulation runtime"]
  node_sim_bridge["Browser bridge<br/>[sim.js]"]
  node_protocol["HMI protocol<br/>[protocolo.js]"]
  node_schemas["Symbol schemas<br/>[esquema.js]"]
  node_state[("Symbol state<br/>[estado.js]")]
  node_machine_logic["Machine logic<br/>[logica.js]"]
  node_sample_values["Scenario values<br/>[valores.js]"]
end

subgraph group_platform["HMI platform"]
  node_framework["TwinCAT framework<br/>[TcHmiFramework.js]"]
  node_controls["HMI controls"]
  node_layouts["System containers"]
  node_navigation["HMI navigation<br/>[TcHmiNavigation.js]"]
end

subgraph group_parcours["Screen parcours"]
  node_journey_map["Screen map<br/>[planta.js]"]
  node_screen_renderer["Vector renderer<br/>[vetorial.js]"]
  node_screen_content["Captured screens<br/>[programa.js]"]
end

node_operator(("Trainee"))

node_operator -->|"opens"| node_machine_views
node_machine_views -->|"shown in"| node_tablet_frame
node_machine_views -.->|"loads simulator"| node_sim_bridge
node_sim_bridge -.->|"installs protocol"| node_protocol
node_protocol -->|"reads and writes"| node_state
node_protocol -->|"uses types"| node_schemas
node_protocol -->|"runs scan"| node_machine_logic
node_machine_logic -.->|"uses scenario"| node_sample_values
node_machine_views -->|"renders with"| node_framework
node_framework -.->|"renders controls"| node_controls
node_framework -.->|"hosts views"| node_layouts
node_operator -.->|"selects screen"| node_journey_map
node_journey_map -.->|"describes drawing"| node_screen_renderer
node_screen_renderer -.->|"renders screens"| node_screen_content

click node_machine_views "https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo"
click node_tablet_frame "https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo"
click node_sim_bridge "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/sim.js"
click node_protocol "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/protocolo.js"
click node_schemas "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/esquema.js"
click node_state "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/estado.js"
click node_machine_logic "https://github.com/thiagobeats/machinesimulation/blob/main/maquinas/b300-duo/logica.js"
click node_sample_values "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/valores.js"
click node_framework "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/framework/TcHmiFramework.js"
click node_controls "https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo/Beckhoff.TwinCAT.HMI.Controls"
click node_layouts "https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo/framework/Controls/System"
click node_navigation "https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/Beckhoff.TwinCAT.HMI.BaseTemplate/TcHmiNavigation/TcHmiNavigation.js"
click node_journey_map "https://github.com/thiagobeats/machinesimulation/blob/main/maquinas/ls-b18-corteva/planta.js"
click node_screen_renderer "https://github.com/thiagobeats/machinesimulation/blob/main/web/vetorial.js"
click node_screen_content "https://github.com/thiagobeats/machinesimulation/blob/main/ls-b18-corteva/programa.js"

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_machine_views,node_tablet_frame toneBlue
class node_sim_bridge,node_protocol,node_schemas,node_state,node_machine_logic,node_sample_values toneAmber
class node_framework,node_controls,node_layouts,node_navigation toneMint
class node_journey_map,node_screen_renderer,node_screen_content toneRose
class node_operator toneIndigo
```

## Components

### Machine interfaces

- [Machine HMIs](https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo): `b300-duo`
- [Tablet frame](https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo): `b300-duo`

### Simulation runtime

- [Browser bridge](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/sim.js): `b300-duo/sim/sim.js`
- [HMI protocol](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/protocolo.js): `b300-duo/sim/protocolo.js`
- [Symbol schemas](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/esquema.js): `b300-duo/sim/esquema.js`
- [Symbol state](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/estado.js): `b300-duo/sim/estado.js`
- [Machine logic](https://github.com/thiagobeats/machinesimulation/blob/main/maquinas/b300-duo/logica.js): `maquinas/b300-duo/logica.js`
- [Scenario values](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/sim/valores.js): `b300-duo/sim/valores.js`

### HMI platform

- [TwinCAT framework](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/framework/TcHmiFramework.js): `b300-duo/framework/TcHmiFramework.js`
- [HMI controls](https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo/Beckhoff.TwinCAT.HMI.Controls): `b300-duo/Beckhoff.TwinCAT.HMI.Controls`
- [System containers](https://github.com/thiagobeats/machinesimulation/tree/main/b300-duo/framework/Controls/System): `b300-duo/framework/Controls/System`
- [HMI navigation](https://github.com/thiagobeats/machinesimulation/blob/main/b300-duo/Beckhoff.TwinCAT.HMI.BaseTemplate/TcHmiNavigation/TcHmiNavigation.js): `b300-duo/Beckhoff.TwinCAT.HMI.BaseTemplate/TcHmiNavigation/TcHmiNavigation.js`

### Screen parcours

- [Screen map](https://github.com/thiagobeats/machinesimulation/blob/main/maquinas/ls-b18-corteva/planta.js): `maquinas/ls-b18-corteva/planta.js`
- [Vector renderer](https://github.com/thiagobeats/machinesimulation/blob/main/web/vetorial.js): `web/vetorial.js`
- [Captured screens](https://github.com/thiagobeats/machinesimulation/blob/main/ls-b18-corteva/programa.js): `ls-b18-corteva/programa.js`

### Other components

- **Trainee**

## Connections

- Trainee → Machine HMIs: opens (evidence: `README.md`)
- Machine HMIs → Tablet frame: shown in (evidence: `README.md`)
- Machine HMIs → Browser bridge: loads simulator
- Browser bridge → HMI protocol: installs protocol
- HMI protocol → Symbol state: reads and writes (evidence: `README.md`)
- HMI protocol → Symbol schemas: uses types (evidence: `README.md`)
- HMI protocol → Machine logic: runs scan (evidence: `README.md`)
- Machine logic → Scenario values: uses scenario
- Machine HMIs → TwinCAT framework: renders with (evidence: `README.md`)
- TwinCAT framework → HMI controls: renders controls
- TwinCAT framework → System containers: hosts views
- Trainee → Screen map: selects screen
- Screen map → Vector renderer: describes drawing
- Vector renderer → Captured screens: renders screens
