# two-four-team/two_four architecture

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

- Interactive diagram: https://gitdiagram.com/two-four-team/two_four
- Repository: https://github.com/two-four-team/two_four

## Overview

This is a C-based virtual vehicle body-convenience simulator: users provide timestamped vehicle-state CSV rows, and the program evaluates lighting, wipers, door locking, and cluster warnings at each simulated cycle before writing a text log. The graph preserves the input/time handling, sensor and vehicle-state validity, each distinct control domain, and warning prioritization. The main loop excerpt supports its orchestration and output; feature relationships are shown where the sampled implementation or README documents them. Other README-described capabilities are included without inferring unsampled internal calls.

Main entry points: [`Common/main.c`](https://github.com/two-four-team/two_four/blob/main/Common/main.c) (Simulation loop), [`Common/vehicle_control.h`](https://github.com/two-four-team/two_four/blob/main/Common/vehicle_control.h) (Control data contract), [`input/input.csv`](https://github.com/two-four-team/two_four/blob/main/input/input.csv) (Vehicle-state CSV), [`sensor/sensor.c`](https://github.com/two-four-team/two_four/blob/main/sensor/sensor.c) (Sensor fault checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation runtime"]
  node_runner["Simulation loop<br/>[main.c]"]
  node_contract["Control data contract<br/>[vehicle_control.h]"]
end

subgraph group_sensing["State and sensing"]
  node_validity["Receive validity<br/>[main.c]"]
  node_sensorchecks["Sensor fault checks<br/>[sensor.c]"]
end

subgraph group_controls["Body controls"]
  node_headlight["Headlight control<br/>[headLight.c]"]
  node_wiper["Wiper control<br/>[Wiper.c]"]
  node_doorlock["Door lock control<br/>[Door.c]"]
end

subgraph group_warnings["Warnings"]
  node_doorwarning["Open-door detection<br/>[Door.c]"]
  node_cluster["Warning selection<br/>[ClusterWarning.c]"]
end

node_user(("Scenario author"))
node_csv["Vehicle-state CSV<br/>[input.csv]"]
node_log["Simulation text log"]

node_user -->|"authors scenario"| node_csv
node_csv -->|"provides rows"| node_runner
node_runner -->|"computes timeouts"| node_validity
node_runner -->|"checks sensor values"| node_sensorchecks
node_runner -->|"calls control"| node_headlight
node_runner -->|"calls control"| node_wiper
node_runner -->|"calls control"| node_doorlock
node_runner -->|"checks open doors"| node_doorwarning
node_runner -->|"selects warning"| node_cluster
node_runner -->|"writes results"| node_log
node_contract -->|"defines interface"| node_headlight
node_contract -->|"defines interface"| node_wiper
node_contract -->|"defines interface"| node_doorlock
node_contract -->|"defines interface"| node_doorwarning
node_contract -->|"defines interface"| node_sensorchecks
node_contract -->|"defines interface"| node_cluster

click node_csv "https://github.com/two-four-team/two_four/blob/main/input/input.csv"
click node_runner "https://github.com/two-four-team/two_four/blob/main/Common/main.c"
click node_contract "https://github.com/two-four-team/two_four/blob/main/Common/vehicle_control.h"
click node_log "https://github.com/two-four-team/two_four/tree/main/output"
click node_validity "https://github.com/two-four-team/two_four/blob/main/Common/main.c"
click node_sensorchecks "https://github.com/two-four-team/two_four/blob/main/sensor/sensor.c"
click node_headlight "https://github.com/two-four-team/two_four/blob/main/HeadLight/headLight.c"
click node_wiper "https://github.com/two-four-team/two_four/blob/main/Wiper/Wiper.c"
click node_doorlock "https://github.com/two-four-team/two_four/blob/main/Door/Door.c"
click node_doorwarning "https://github.com/two-four-team/two_four/blob/main/Door/Door.c"
click node_cluster "https://github.com/two-four-team/two_four/blob/main/Dashboard%20Warning/ClusterWarning.c"

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_runner,node_contract toneBlue
class node_validity,node_sensorchecks toneAmber
class node_headlight,node_wiper,node_doorlock toneMint
class node_doorwarning,node_cluster toneRose
class node_user toneIndigo
class node_csv,node_log toneTeal
```

## Components

### Simulation runtime

- [Simulation loop](https://github.com/two-four-team/two_four/blob/main/Common/main.c): `Common/main.c`
- [Control data contract](https://github.com/two-four-team/two_four/blob/main/Common/vehicle_control.h): `Common/vehicle_control.h`

### State and sensing

- [Receive validity](https://github.com/two-four-team/two_four/blob/main/Common/main.c): `Common/main.c`
- [Sensor fault checks](https://github.com/two-four-team/two_four/blob/main/sensor/sensor.c): `sensor/sensor.c`

### Body controls

- [Headlight control](https://github.com/two-four-team/two_four/blob/main/HeadLight/headLight.c): `HeadLight/headLight.c`
- [Wiper control](https://github.com/two-four-team/two_four/blob/main/Wiper/Wiper.c): `Wiper/Wiper.c`
- [Door lock control](https://github.com/two-four-team/two_four/blob/main/Door/Door.c): `Door/Door.c`

### Warnings

- [Open-door detection](https://github.com/two-four-team/two_four/blob/main/Door/Door.c): `Door/Door.c`
- [Warning selection](https://github.com/two-four-team/two_four/blob/main/Dashboard%20Warning/ClusterWarning.c): `Dashboard Warning/ClusterWarning.c`

### Other components

- **Scenario author**
- [Vehicle-state CSV](https://github.com/two-four-team/two_four/blob/main/input/input.csv): `input/input.csv`
- [Simulation text log](https://github.com/two-four-team/two_four/tree/main/output): `output`

## Connections

- Scenario author → Vehicle-state CSV: authors scenario (evidence: `README.md`)
- Vehicle-state CSV → Simulation loop: provides rows (evidence: `README.md`)
- Simulation loop → Receive validity: computes timeouts (evidence: `Common/main.c`)
- Simulation loop → Sensor fault checks: checks sensor values (evidence: `sensor/sensor.c`)
- Simulation loop → Headlight control: calls control (evidence: `HeadLight/headLight.c`)
- Simulation loop → Wiper control: calls control (evidence: `Wiper/Wiper.c`)
- Simulation loop → Door lock control: calls control (evidence: `Door/Door.c`)
- Simulation loop → Open-door detection: checks open doors (evidence: `Door/Door.c`)
- Simulation loop → Warning selection: selects warning (evidence: `Dashboard Warning/ClusterWarning.c`)
- Simulation loop → Simulation text log: writes results (evidence: `README.md`)
- Control data contract → Headlight control: defines interface (evidence: `Common/vehicle_control.h`)
- Control data contract → Wiper control: defines interface (evidence: `Common/vehicle_control.h`)
- Control data contract → Door lock control: defines interface (evidence: `Common/vehicle_control.h`)
- Control data contract → Open-door detection: defines interface (evidence: `Common/vehicle_control.h`)
- Control data contract → Sensor fault checks: defines interface (evidence: `Common/vehicle_control.h`)
- Control data contract → Warning selection: defines interface (evidence: `Common/vehicle_control.h`)
