# vishnuprakash-jaganmohan/automotive-embedded-projects architecture

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

- Interactive diagram: https://gitdiagram.com/vishnuprakash-jaganmohan/automotive-embedded-projects
- Repository: https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects

## Overview

This is a small C ECU-control simulator: a user changes simulated inputs through a terminal, runs one or more control cycles, and sees the resulting ECU state, engine speed, and diagnostic status. The implementation validates sensor ranges, handles overtemperature faults and ignition-off behavior, and calculates an educational RPM value while running. The broader repository README describes communication, monitoring, and fault-injection projects as planned; they are not implemented in this project’s shown source. Relationships below are limited to the supplied source excerpts.

Main entry points: [`Automotive ECU Simulator/src/main.c`](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c) (Command interface), [`Automotive ECU Simulator/src/ecu.c`](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c) (Control cycle), [`Automotive ECU Simulator/include/ecu.h`](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/include/ecu.h) (ECU outputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Terminal interaction"]
  node_cli["Command interface<br/>[main.c]"]
  node_inputs["Simulated inputs<br/>[main.c]"]
end

subgraph group_control["ECU control"]
  node_control_cycle["Control cycle<br/>[ecu.c]"]
  node_validation["Input validation<br/>[ecu.c]"]
  node_state_logic["State and RPM logic<br/>[ecu.c]"]
  node_diagnostics["Fault and DTC logic<br/>[ecu.c]"]
  node_outputs["ECU outputs<br/>[ecu.h]"]
end

subgraph group_reporting["Status reporting"]
  node_status["Status display<br/>[main.c]"]
end

node_user(("Simulator user"))

node_user -->|"enters commands"| node_cli
node_cli -->|"sets values"| node_inputs
node_cli -->|"calls update"| node_control_cycle
node_control_cycle -->|"validates inputs"| node_validation
node_control_cycle -->|"sets state and RPM"| node_state_logic
node_control_cycle -->|"sets fault codes"| node_diagnostics
node_state_logic -->|"updates fields"| node_outputs
node_diagnostics -->|"updates fields"| node_outputs
node_cli -->|"initializes outputs"| node_outputs
node_cli -->|"prints status"| node_status
node_status -->|"reads ECU fields"| node_outputs
node_status -->|"displays results"| node_user

click node_cli "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c"
click node_inputs "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c"
click node_control_cycle "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c"
click node_validation "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c"
click node_state_logic "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c"
click node_diagnostics "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c"
click node_outputs "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/include/ecu.h"
click node_status "https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.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_cli,node_inputs,node_user toneBlue
class node_control_cycle,node_validation,node_state_logic,node_diagnostics,node_outputs toneAmber
class node_status toneMint
```

## Components

### Terminal interaction

- [Command interface](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c): `Automotive ECU Simulator/src/main.c`
- [Simulated inputs](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c): `Automotive ECU Simulator/src/main.c`

### ECU control

- [Control cycle](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c): `Automotive ECU Simulator/src/ecu.c`
- [Input validation](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c): `Automotive ECU Simulator/src/ecu.c`
- [State and RPM logic](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c): `Automotive ECU Simulator/src/ecu.c`
- [Fault and DTC logic](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/ecu.c): `Automotive ECU Simulator/src/ecu.c`
- [ECU outputs](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/include/ecu.h): `Automotive ECU Simulator/include/ecu.h`

### Status reporting

- [Status display](https://github.com/vishnuprakash-jaganmohan/automotive-embedded-projects/blob/main/Automotive%20ECU%20Simulator/src/main.c): `Automotive ECU Simulator/src/main.c`

### Other components

- **Simulator user**

## Connections

- Simulator user → Command interface: enters commands (evidence: `Automotive ECU Simulator/src/main.c`)
- Command interface → Simulated inputs: sets values (evidence: `Automotive ECU Simulator/src/main.c`)
- Command interface → Control cycle: calls update (evidence: `Automotive ECU Simulator/src/main.c`)
- Control cycle → Input validation: validates inputs (evidence: `Automotive ECU Simulator/src/ecu.c`)
- Control cycle → State and RPM logic: sets state and RPM (evidence: `Automotive ECU Simulator/src/ecu.c`)
- Control cycle → Fault and DTC logic: sets fault codes (evidence: `Automotive ECU Simulator/src/ecu.c`)
- State and RPM logic → ECU outputs: updates fields (evidence: `Automotive ECU Simulator/src/ecu.c`)
- Fault and DTC logic → ECU outputs: updates fields (evidence: `Automotive ECU Simulator/src/ecu.c`)
- Command interface → ECU outputs: initializes outputs (evidence: `Automotive ECU Simulator/src/main.c`)
- Command interface → Status display: prints status (evidence: `Automotive ECU Simulator/src/main.c`)
- Status display → ECU outputs: reads ECU fields (evidence: `Automotive ECU Simulator/src/main.c`)
- Status display → Simulator user: displays results (evidence: `Automotive ECU Simulator/src/main.c`)
