# ramp-project/ramp-mobility architecture

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

- Interactive diagram: https://gitdiagram.com/ramp-project/ramp-mobility
- Repository: https://github.com/ramp-project/ramp-mobility

## Overview

1. **Project purpose and scope**
   - RAMP-mobility is a Python 3.7 model for generating **bottom-up stochastic electric-vehicle mobility and charging load profiles** at **1-minute resolution**.
   - It is not an app or service; it is a **simulation pipeline** driven by country-specific input files and CSV datasets.

2. **High-level architecture**
   - The repository is organized around a **single simulation flow**:
     - load country and empirical inputs,
     - initialize vehicle/mobility state,
     - simulate mobility trajectories,
     - simulate charging behavior,
     - post-process results into outputs.
   - The model is split into **two conceptual modules**: mobility generation and charging simulation.

3. **Execution entrypoint and orchestration**
   - `ramp_mobility/ramp_run.py` is the main orchestration layer.
   - It likely coordinates model setup, parameter selection, running scenarios, and exporting results.
   - `ramp_mobility/__init__.py` makes the package importable as a reusable library.

4. **Core simulation engine**
   - `ramp_mobility/core_model/` contains the main computational engine:
     - `core.py` — central model logic and simulation coordination,
     - `initialise.py` — prepares the initial state, likely populating vehicle populations and time-series structures,
     - `stochastic_process_mobility.py` — generates randomized trip/parking behavior,
     - `charging_process.py` — converts mobility states into charging demand.
   - This is the main boundary between **input data** and **time-series outputs**.

5. **Mobility model subsystem**
   - The mobility subsystem produces vehicle availability, trips, and parking patterns from stochastic rules.
   - It consumes precomputed empirical distributions and country-specific assumptions from `database/` and the country input files.
   - The output of this subsystem is the per-vehicle temporal activity pattern that downstream charging logic uses.

6. **Charging model subsystem**
   - The charging subsystem runs after mobility is known and simulates battery charging at the vehicle level.
   - README shows four strategies implemented:
     - **Uncontrolled**
     - **Perfect Foresight**
     - **Night Charge**
     - **RES Integration**
   - This subsystem depends on parking availability, charging-point availability, and in the RES case, residual-load information.

7. **Country-specific configuration layer**
   - `ramp_mobility/country_input_files/Europe/` contains one Python file per supported country: 28 European countries in total.
   - These files act as a **parameterization boundary** for national assumptions, meaning the same core model is reused across countries with different inputs.
   - This is the main place where regional behavior is specialized without changing the core engine.

8. **Data layer**
   - `database/` contains the empirical and derived CSV inputs used by the model:
     - trip timing distributions (`trips_by_time_*.csv`),
     - vehicle share,
     - temperature/population datasets,
     - demand and load-related distributions,
     - residual load curves per country under `database/residual_load/`.
   - These files are static model resources, not runtime code, and they feed the stochastic generation and smart-charging logic.

9. **Post-processing boundary**
   - `ramp_mobility/post_process/post_process.py` handles result aggregation and formatting after the simulation.
   - This suggests the model produces raw per-vehicle or per-step outputs first, then transforms them into analysis-ready profiles or summaries.

10. **Utility/support code**
   - `ramp_mobility/utils.py` likely holds shared helper functions used across initialization, model execution, and output handling.
   - This is a cross-cutting support layer rather than a primary subsystem.

11. **Model inputs and outputs**
   - Inputs are mostly **CSV datasets** plus **country-specific Python parameter modules**.
   - Outputs are not shown in the tree, but from the README the intended result is **high-resolution EV mobility and charging load profiles** for scenario analysis.

12. **Repository-level documentation and reproducibility**
   - `docs/getting_started.md` provides the user-facing run instructions.
   - `environment.yml` defines the execution environment, indicating the project is intended to be run in a managed Python environment with pinned dependencies.
   - `VERSION.txt` and `CHANGELOG.md` support release tracking.

13. **Key architectural constraint**
   - The model is designed around **national heterogeneity**: the core simulation is shared, but behavior is controlled by per-country inputs and country-specific datasets.
   - For an architecture diagram, the main boundary to show is: **shared stochastic engine** in the center, with **country/data inputs** on one side and **charging/load outputs** on the other.

Main entry points: [`ramp_mobility/core_model/core.py`](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/core.py) (Core model), [`ramp_mobility/core_model/charging_process.py`](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/charging_process.py) (Charging sim), [`ramp_mobility/core_model/stochastic_process_mobility.py`](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/stochastic_process_mobility.py) (Mobility sim), [`ramp_mobility/ramp_run.py`](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/ramp_run.py) (Run model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_docs["Docs & release"]
  node_readme["README<br/>docs<br/>[README.md]"]
  node_getting_started["Quick start<br/>docs<br/>[getting_started.md]"]
  node_env["Env spec<br/>build<br/>[environment.yml]"]
  node_version["Versioning<br/>release<br/>[VERSION.txt]"]
end

subgraph group_entry["Entry & orchestration"]
  node_ramp_run["Run model<br/>orchestrator<br/>[ramp_run.py]"]
  node_pkg_init["Package init<br/>[__init__.py]"]
end

subgraph group_core["Core simulation"]
  node_core_main["Core model<br/>engine<br/>[core.py]"]
  node_init_state["Initialise<br/>state setup<br/>[initialise.py]"]
  node_mobility["Mobility sim<br/>stochastic model"]
  node_charging["Charging sim<br/>charging model"]
  node_utils["Utils<br/>support<br/>[utils.py]"]
end

subgraph group_inputs["Country & data inputs"]
  node_eu_params["Europe params<br/>country config<br/>[__init__.py]"]
  node_at_params["Country file<br/>country config<br/>[AT.py]"]
  node_trips["Trip curves<br/>csv data"]
  node_loads["Residual load<br/>csv data"]
  node_fleet_data["Fleet data<br/>csv data<br/>[vehicle_share.csv]"]
  node_demand_data["Demand data<br/>csv data"]
end

subgraph group_output["Post-processing"]
  node_post["Post-process<br/>formatter<br/>[post_process.py]"]
end

node_readme -->|"documents"| node_ramp_run
node_getting_started -->|"runs"| node_ramp_run
node_env -->|"pins"| node_ramp_run
node_ramp_run -->|"orchestrates"| node_core_main
node_pkg_init -->|"exposes"| node_ramp_run
node_core_main -->|"initializes"| node_init_state
node_core_main -->|"simulates"| node_mobility
node_core_main -->|"simulates"| node_charging
node_init_state -->|"uses"| node_eu_params
node_init_state -->|"uses"| node_fleet_data
node_mobility -->|"uses"| node_trips
node_mobility -->|"uses"| node_eu_params
node_mobility -.->|"uses"| node_at_params
node_charging -->|"uses"| node_loads
node_charging -->|"uses"| node_eu_params
node_charging -->|"depends on"| node_mobility
node_charging -->|"uses"| node_demand_data
node_core_main -.->|"shares"| node_utils
node_core_main -->|"hands off"| node_post
node_post -->|"packages"| node_version

click node_readme "https://github.com/ramp-project/ramp-mobility/blob/master/README.md"
click node_getting_started "https://github.com/ramp-project/ramp-mobility/blob/master/docs/getting_started.md"
click node_env "https://github.com/ramp-project/ramp-mobility/blob/master/environment.yml"
click node_version "https://github.com/ramp-project/ramp-mobility/blob/master/VERSION.txt"
click node_ramp_run "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/ramp_run.py"
click node_pkg_init "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/__init__.py"
click node_core_main "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/core.py"
click node_init_state "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/initialise.py"
click node_mobility "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/stochastic_process_mobility.py"
click node_charging "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/charging_process.py"
click node_utils "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/utils.py"
click node_eu_params "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/country_input_files/Europe/__init__.py"
click node_at_params "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/country_input_files/Europe/AT.py"
click node_trips "https://github.com/ramp-project/ramp-mobility/blob/master/database/trips_by_time_weekday.csv"
click node_loads "https://github.com/ramp-project/ramp-mobility/blob/master/database/residual_load/residual_load_DE.csv"
click node_fleet_data "https://github.com/ramp-project/ramp-mobility/blob/master/database/vehicle_share.csv"
click node_demand_data "https://github.com/ramp-project/ramp-mobility/blob/master/database/temp_ninja_pop_1980-2019.csv"
click node_post "https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/post_process/post_process.py"

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_readme,node_getting_started,node_env,node_version toneBlue
class node_ramp_run,node_pkg_init toneAmber
class node_core_main,node_init_state,node_mobility,node_charging,node_utils toneMint
class node_eu_params,node_at_params,node_trips,node_loads,node_fleet_data,node_demand_data toneRose
class node_post toneIndigo
```

## Components

### Docs & release

User guidance and release metadata.

- [README](https://github.com/ramp-project/ramp-mobility/blob/master/README.md): docs · Project overview and model description. · `README.md`
- [Quick start](https://github.com/ramp-project/ramp-mobility/blob/master/docs/getting_started.md): docs · Run instructions and setup guidance. · `docs/getting_started.md`
- [Env spec](https://github.com/ramp-project/ramp-mobility/blob/master/environment.yml): build · Pinned Python environment and dependencies. · `environment.yml`
- [Versioning](https://github.com/ramp-project/ramp-mobility/blob/master/VERSION.txt): release · Release tracking metadata. · `VERSION.txt`

### Entry & orchestration

Top-level run coordination.

- [Run model](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/ramp_run.py): orchestrator · Main simulation entrypoint and scenario runner. · `ramp_mobility/ramp_run.py`
- [Package init](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/__init__.py): package · Makes the model importable as a library. · `ramp_mobility/__init__.py`

### Core simulation

Shared stochastic mobility and charging engine.

- [Core model](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/core.py): engine · Central simulation coordination. · `ramp_mobility/core_model/core.py`
- [Initialise](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/initialise.py): state setup · Builds vehicle populations and simulation state. · `ramp_mobility/core_model/initialise.py`
- [Mobility sim](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/stochastic_process_mobility.py): stochastic model · Generates trips, parking, and availability trajectories. · `ramp_mobility/core_model/stochastic_process_mobility.py`
- [Charging sim](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/core_model/charging_process.py): charging model · Converts mobility states into charging demand. · `ramp_mobility/core_model/charging_process.py`
- [Utils](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/utils.py): support · Shared helpers used across the pipeline. · `ramp_mobility/utils.py`

### Country & data inputs

Reusable national parameters and empirical CSV resources.

- [Europe params](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/country_input_files/Europe/__init__.py): country config · Country-specific parameter modules for 28 European countries. · `ramp_mobility/country_input_files/Europe/__init__.py`
- [Country file](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/country_input_files/Europe/AT.py): country config · Representative national input module. · `ramp_mobility/country_input_files/Europe/AT.py`
- [Trip curves](https://github.com/ramp-project/ramp-mobility/blob/master/database/trips_by_time_weekday.csv): csv data · Empirical trip timing distributions by day type. · `database/trips_by_time_weekday.csv`
- [Residual load](https://github.com/ramp-project/ramp-mobility/blob/master/database/residual_load/residual_load_DE.csv): csv data · Country residual-load curves for smart charging. · `database/residual_load/residual_load_DE.csv`
- [Fleet data](https://github.com/ramp-project/ramp-mobility/blob/master/database/vehicle_share.csv): csv data · Vehicle share and demand-related empirical inputs. · `database/vehicle_share.csv`
- [Demand data](https://github.com/ramp-project/ramp-mobility/blob/master/database/temp_ninja_pop_1980-2019.csv): csv data · Additional empirical distributions and population/temperature inputs. · `database/temp_ninja_pop_1980-2019.csv`

### Post-processing

Result aggregation and formatting.

- [Post-process](https://github.com/ramp-project/ramp-mobility/blob/master/ramp_mobility/post_process/post_process.py): formatter · Aggregates raw outputs into analysis-ready profiles. · `ramp_mobility/post_process/post_process.py`

## Connections

- README → Run model: documents · Explains how the simulation is executed.
- Quick start → Run model: runs · Provides usage instructions for the entrypoint.
- Env spec → Run model: pins · Defines the execution environment.
- Run model → Core model: orchestrates · Coordinates the end-to-end simulation flow.
- Package init → Run model: exposes · Makes the package importable for running and reuse.
- Core model → Initialise: initializes · Prepares the simulation state.
- Core model → Mobility sim: simulates · Runs the stochastic mobility generation stage.
- Core model → Charging sim: simulates · Runs the charging-demand stage.
- Initialise → Europe params: uses · Loads country-specific model parameters.
- Initialise → Fleet data: uses · Consumes fleet and population input data.
- Mobility sim → Trip curves: uses · Samples from empirical trip timing distributions.
- Mobility sim → Europe params: uses · Applies national mobility assumptions.
- Mobility sim → Country file: uses · Represents per-country specialization.
- Charging sim → Residual load: uses · Uses residual-load information for RES integration.
- Charging sim → Europe params: uses · Reads country-specific charging assumptions.
- Charging sim → Mobility sim: depends on · Consumes mobility and parking availability.
- Charging sim → Demand data: uses · Consumes supporting empirical inputs.
- Core model → Utils: shares · Uses common helper routines.
- Core model → Post-process: hands off · Sends raw outputs to post-processing.
- Post-process → Versioning: packages · Produces finalized outputs for release and analysis.
