Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified the repository name and removed link calculation procedures #12

Merged
merged 50 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d836bbf
removed: setup submodule and moved the scripts to common
nagacharan-tangirala Dec 27, 2023
cdee4da
refactoring: changes due to moving files
nagacharan-tangirala Dec 27, 2023
4830ce2
added: script to convert links file to ns3 readable format
nagacharan-tangirala Dec 27, 2023
8c09406
removed: this file to replace other file
nagacharan-tangirala Dec 28, 2023
951d24f
added: script to generate v2r transitions for both ns3 and mosaic
nagacharan-tangirala Dec 28, 2023
18af8bb
added: rsu json file creation script for the mosaic
nagacharan-tangirala Dec 28, 2023
8c0da14
added: readme file for the scripts submodule
nagacharan-tangirala Dec 28, 2023
6162c1e
added: lat lon as a part of rsu file creation
nagacharan-tangirala Dec 28, 2023
4965052
added: lat and lon position to the controller file
nagacharan-tangirala Dec 31, 2023
62ea8f2
fixed: bug in rounding up the timestamp
nagacharan-tangirala Jan 1, 2024
1c5898b
added: utility scripts to convert geo data
nagacharan-tangirala Jan 5, 2024
df47d91
added: util method to read projection, get_center respects the offsets
nagacharan-tangirala Jan 5, 2024
b99bade
added: sumo tag constants
nagacharan-tangirala Jan 5, 2024
bdaebac
modified: the input definitions in rsu generation script
nagacharan-tangirala Jan 5, 2024
385be07
modified: v2r transitions to accept command line arguments
nagacharan-tangirala Jan 5, 2024
c182b6b
fixed: bug in retranslating the sumo coordinates
nagacharan-tangirala Jan 5, 2024
832d9e2
modified: removed hardcoded projection string
nagacharan-tangirala Jan 5, 2024
45ff648
fixed: bug in link generation, +1 is not needed
nagacharan-tangirala Jan 5, 2024
848d7ff
simplified: road id reading to avoid any string to int conversion issues
nagacharan-tangirala Jan 5, 2024
a87a20f
added: progress bar for link generation step and other minor changes
nagacharan-tangirala Jan 5, 2024
ff1a3a7
added: execution time is calculated for the scenario generation
nagacharan-tangirala Jan 5, 2024
ae43338
fixed: bug in controller position calculation
nagacharan-tangirala Jan 5, 2024
711c135
modified: size limit constants
nagacharan-tangirala Jan 9, 2024
ebfe82d
modified: the generation process steps to be configurable
nagacharan-tangirala Jan 14, 2024
16b4b74
renamed: the file name to be appropriate
nagacharan-tangirala Jan 14, 2024
b919e7d
modified: variables into cmd line arguments
nagacharan-tangirala Jan 15, 2024
ca6a98f
added: few helper scripts
nagacharan-tangirala Jan 19, 2024
2780a67
added: helper comment for the script
nagacharan-tangirala Jan 25, 2024
bf937dd
build(deps): bump pre-commit/action from 3.0.0 to 3.0.1
dependabot[bot] Feb 12, 2024
b4f4ffc
fixed issue with xml reading
nagacharan-tangirala Feb 12, 2024
17d6116
build(deps): bump codecov/codecov-action from 3.1.4 to 4.0.2
dependabot[bot] Feb 26, 2024
5c31329
added: script to scale down the routes proportionally in SUMO routing…
nagacharan-tangirala Feb 29, 2024
c20acfc
Merge remote-tracking branch 'origin/dependabot/github_actions/codeco…
nagacharan-tangirala Feb 29, 2024
21a02c6
Merge remote-tracking branch 'origin/dependabot/github_actions/pre-co…
nagacharan-tangirala Feb 29, 2024
2b570bd
removed: scripts that are not intended for the simulator
nagacharan-tangirala Feb 29, 2024
aa475cb
refactored: removed links, renamed folders
nagacharan-tangirala Feb 29, 2024
61614b3
removed: configure data modification steps
nagacharan-tangirala Feb 29, 2024
f71865b
simplified: initialization of the device position calculator
nagacharan-tangirala Feb 29, 2024
4aa4367
simplified: vehicle position calculation initialization
nagacharan-tangirala Feb 29, 2024
e42370a
simplified: core method for creating devices, removed link calls
nagacharan-tangirala Feb 29, 2024
15bd105
added: other name change related stuff
nagacharan-tangirala Feb 29, 2024
84c9466
build(deps): bump codecov/codecov-action from 3.1.4 to 4.2.0
dependabot[bot] Apr 8, 2024
b2bdb7d
added: mosaic related files to retain until PADS submission
nagacharan-tangirala Apr 14, 2024
da49029
added: contents in the mosaic rsu files
nagacharan-tangirala Apr 14, 2024
f960b01
modified: node to agent to keep up with the changes in the Disolv
nagacharan-tangirala Apr 14, 2024
1723c8b
modified: filepath to reflect the new location
nagacharan-tangirala Apr 14, 2024
a224760
prettified: the print statement that indicates execution time
nagacharan-tangirala Apr 14, 2024
ba2b3b5
refactored: disolv-positions to prep-disolv
nagacharan-tangirala Apr 14, 2024
e4f30a1
fixed: project files and the readme file
nagacharan-tangirala Apr 14, 2024
d1183d6
Merge remote-tracking branch 'origin/dependabot/github_actions/codeco…
nagacharan-tangirala Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ full_name: Nagacharan Teja Tangirala
license: MIT
org: nagacharan-tangirala
project_name: prep-pavenet
project_short_description: The scenarios for PAVeNet are prepared by this project.
url: https://github.com/nagacharan-tangirala/prep-pavenet
project_short_description: The positions for disolv are prepared by this project.
url: https://github.com/nagacharan-tangirala/disolv-positions
vcs: true
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.1
with:
extra_args: --hook-stage manual --all-files
- name: Run PyLint
Expand Down Expand Up @@ -66,4 +66,4 @@ jobs:
--durations=20

- name: Upload coverage report
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4.2.0
32 changes: 10 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
# prep-pavenet
# Prep-Disolv

[![Actions Status][actions-badge]][actions-link]
[![Documentation Status][rtd-badge]][rtd-link]
This repository does the pre-processing of the mobility traces to be readable by [Disolv](https://github.com/nagacharan-tangirala/disolv).

[![PyPI version][pypi-version]][pypi-link]
[![Conda-Forge][conda-badge]][conda-link]
[![PyPI platforms][pypi-platforms]][pypi-link]
### Features

[![GitHub Discussion][github-discussions-badge]][github-discussions-link]
- Reads SUMO Floating Car Data (FCD) traces and converts them to Disolv readable format.
- Generates Activation timing files for all the devices.
- Positions Road-side Units (RSUs) at junctions.

<!-- SPHINX-START -->
### Note

<!-- prettier-ignore-start -->
[actions-badge]: https://github.com/nagacharan-tangirala/prep-pavenet/workflows/CI/badge.svg
[actions-link]: https://github.com/nagacharan-tangirala/prep-pavenet/actions
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/prep-pavenet
[conda-link]: https://github.com/conda-forge/prep-pavenet-feedstock
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
[github-discussions-link]: https://github.com/nagacharan-tangirala/prep-pavenet/discussions
[pypi-link]: https://pypi.org/project/prep-pavenet/
[pypi-platforms]: https://img.shields.io/pypi/pyversions/prep-pavenet
[pypi-version]: https://img.shields.io/pypi/v/prep-pavenet
[rtd-badge]: https://readthedocs.org/projects/prep-pavenet/badge/?version=latest
[rtd-link]: https://prep-pavenet.readthedocs.io/en/latest/?badge=latest

<!-- prettier-ignore-end -->
- Requirement and tool specific extensions are possible. New source of mobility traces can be added using the SUMO case as an example.
- The RSU placement can be extended to other types of placement strategies or even to other types of infrastructure.
- One-time scripts are added to the directory `scripts` for later reference.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
project = "prep-pavenet"
copyright = "2023, Nagacharan Teja Tangirala"
author = "Nagacharan Teja Tangirala"
version = release = importlib.metadata.version("prep_pavenet")
version = release = importlib.metadata.version("disolv_positions")

extensions = [
"myst_parser",
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def pylint(session: nox.Session) -> None:
# This needs to be installed into the package environment, and is slower
# than a pre-commit check
session.install(".", "pylint")
session.run("pylint", "prep_pavenet", *session.posargs)
session.run("pylint", "disolv_positions", *session.posargs)


@nox.session
Expand Down Expand Up @@ -99,7 +99,7 @@ def build_api_docs(session: nox.Session) -> None:
"--module-first",
"--no-toc",
"--force",
"../src/prep_pavenet",
"../src/disolv_positions",
)


Expand Down
27 changes: 14 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ build-backend = "hatchling.build"


[project]
name = "prep-pavenet"
name = "prep-disolv"
authors = [
{ name = "Nagacharan Teja Tangirala", email = "nagacharan.tangirala@tum.de" },
]
description = "The scenarios for PAVeNet are prepared by this project."
description = "The position files for disolv are prepared by this project."
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.12"
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Science/Research",
Expand Down Expand Up @@ -55,15 +55,16 @@ docs = [
]

[project.urls]
Homepage = "https://github.com/nagacharan-tangirala/prep-pavenet"
"Bug Tracker" = "https://github.com/nagacharan-tangirala/prep-pavenet/issues"
Discussions = "https://github.com/nagacharan-tangirala/prep-pavenet/discussions"
Changelog = "https://github.com/nagacharan-tangirala/prep-pavenet/releases"
Homepage = "https://github.com/nagacharan-tangirala/disolv-positions"
"Bug Tracker" = "https://github.com/nagacharan-tangirala/disolv-positions/issues"
Discussions = "https://github.com/nagacharan-tangirala/disolv-positions/discussions"
Changelog = "https://github.com/nagacharan-tangirala/disolv-positions/releases"


[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/prep_pavenet/_version.py"
build.hooks.vcs.version-file = "src/disolv_positions/_version.py"
envs.default.python = "3.12"
envs.default.dependencies = [
"pytest",
"pytest-cov",
Expand All @@ -84,7 +85,7 @@ testpaths = [


[tool.coverage]
run.source = ["prep_pavenet"]
run.source = ["disolv_positions"]
port.exclude_lines = [
'pragma: no cover',
'\.\.\.',
Expand All @@ -93,7 +94,7 @@ port.exclude_lines = [

[tool.mypy]
files = ["src", "tests"]
python_version = "3.8"
python_version = "3.12"
warn_unused_configs = true
strict = true
show_error_codes = true
Expand All @@ -103,7 +104,7 @@ disallow_untyped_defs = false
disallow_incomplete_defs = false

[[tool.mypy.overrides]]
module = "prep_pavenet.*"
module = "disolv_positions.*"
disallow_untyped_defs = true
disallow_incomplete_defs = true

Expand Down Expand Up @@ -140,15 +141,15 @@ ignore = [
]
isort.required-imports = ["from __future__ import annotations"]
# Uncomment if using a _compat.typing backport
# typing-modules = ["prep_pavenet._compat.typing"]
# typing-modules = ["disolv_positions._compat.typing"]

[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20"]
"noxfile.py" = ["T20"]


[tool.pylint]
py-version = "3.8"
py-version = "3.12"
ignore-paths = [".*/_version.py"]
reports.output-format = "colorized"
similarities.ignore-imports = "yes"
Expand Down
7 changes: 6 additions & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

import argparse
import sys
import time

from prep_pavenet.core.core import Core
from prep_disolv.core.core import Core


def main():
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", help="Config file path", required=True)
args = parser.parse_args()
core = Core(args.config)
# calculate execution time
exec_start = time.time()
core.prepare_scenario()
exec_end = time.time()
print(f"Execution time: {exec_end - exec_start:.3f} seconds")


if __name__ == "__main__":
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions src/prep_disolv/common/columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from __future__ import annotations

AGENT_ID = "agent_id"
NS3_ID = "ns3_id"
COORD_X = "x"
COORD_Y = "y"
TIME_STEP = "time_step"
ON_TIMES = "on_times"
OFF_TIMES = "off_times"
LAT = "lat"
LON = "lon"

ACTIVATION_COLUMNS = [AGENT_ID, NS3_ID, ON_TIMES, OFF_TIMES]
RSU_COLUMNS = [TIME_STEP, AGENT_ID, NS3_ID, COORD_X, COORD_Y, LAT, LON]
CONTROLLER_COLUMNS = [TIME_STEP, AGENT_ID, NS3_ID, COORD_X, COORD_Y, LAT, LON]

# Folders
POSITIONS_FOLDER = "positions"
ACTIVATIONS_FOLDER = "activations"
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

import toml

from prep_pavenet.common.columns import (
from prep_disolv.common.columns import (
ACTIVATIONS_FOLDER,
LINKS_FOLDER,
POSITIONS_FOLDER,
)

# Config keys.
LOG_SETTINGS = "logging"
TRAFFIC_SETTINGS = "traffic"
DATA_STEP_SETTINGS = "data_steps"
VEHICLE_SETTINGS = "vehicles"
RSU_SETTINGS = "rsu"
OUTPUT_SETTINGS = "output"
CONTROLLER_SETTINGS = "controller"
SIMULATION_SETTINGS = "simulation"
LINK_SETTINGS = "links"

# Common keys.
ID_INIT = "id_init"
Expand All @@ -36,7 +35,6 @@
# RSU keys.
PLACEMENT = "placement"
START_TIME = "start_time"
END_TIME = "end_time"

# Logging keys.
LOG_LEVEL = "log_level"
Expand All @@ -45,7 +43,6 @@
# Simulation keys.
DURATION = "duration"
STEP_SIZE = "step_size"
STREAMING_TIME = "streaming_time"


def read_config_toml(config_toml: str) -> dict:
Expand Down Expand Up @@ -83,7 +80,6 @@ def _create_output_folders(self) -> None:

output_path.mkdir(parents=True, exist_ok=True)
Path.mkdir(output_path / ACTIVATIONS_FOLDER, exist_ok=True)
Path.mkdir(output_path / LINKS_FOLDER, exist_ok=True)
Path.mkdir(output_path / POSITIONS_FOLDER, exist_ok=True)

def get(self, key: str) -> dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
LOG_LEVEL = "log_level"
LOG_OVERWRITE = "log_overwrite"

DEFAULT_LOG_FILE = "prep_pavenet.log"
DEFAULT_LOG_FILE = "disolv_positions.log"
DEFAULT_LOG_LEVEL = "INFO"
DEFAULT_LOG_OVERWRITE = False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,55 @@
from pathlib import Path

BOUNDARY = "convBoundary"
OFFSETS = "netOffset"
LOCATION = "location"
PROJECTION = "projParameter"


def get_offsets(sumo_net_file: Path) -> (float, float):
"""Get the offsets from the sumo net file."""
sumo_iter = Et.iterparse(str(sumo_net_file), events=("start", "end"))
for event, elem in sumo_iter:
if event == "end" and elem.tag == LOCATION:
boundary = elem.attrib[BOUNDARY]
offset_x = float(boundary.split(",")[0])
offset_y = float(boundary.split(",")[1])
offsets = elem.attrib[OFFSETS]
offset_x = float(offsets.split(",")[0])
offset_y = float(offsets.split(",")[1])
return offset_x, offset_y
msg = "Could not find offsets in sumo net file."
logging.error(msg)
raise ValueError(msg)


def get_projection(sumo_net_file: Path) -> (float, float):
"""Get the offsets from the sumo net file."""
sumo_iter = Et.iterparse(str(sumo_net_file), events=("start", "end"))
for event, elem in sumo_iter:
if event == "end" and elem.tag == LOCATION:
return elem.attrib[PROJECTION]
msg = "Could not find projection parameter in sumo net file."
logging.error(msg)
raise ValueError(msg)


def get_center(sumo_net_file: Path) -> (float, float):
"""Get the center of the sumo net file."""
offsets = get_offsets(sumo_net_file)
sumo_iter = Et.iterparse(str(sumo_net_file), events=("start", "end"))

for event, elem in sumo_iter:
if event == "end" and elem.tag == LOCATION:
boundary = elem.attrib[BOUNDARY]

low_x = float(boundary.split(",")[0])
low_y = float(boundary.split(",")[1])
high_x = float(boundary.split(",")[2])
high_y = float(boundary.split(",")[3])
return (low_x + high_x) / 2, (low_y + high_y) / 2
return None

center_x = (low_x + high_x) / 2
center_y = (low_y + high_y) / 2

return center_x - offsets[0], center_y - offsets[1]

msg = "Could not find network center in sumo net file."
logging.error(msg)
raise ValueError(msg)
Loading
Loading