Skip to content

Commit e4e0b1d

Browse files
authored
Merge 24f75c0 into release
2 parents ea763e2 + 24f75c0 commit e4e0b1d

71 files changed

Lines changed: 2062 additions & 1801 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
55

66
## [Unreleased]
77

8+
## [0.8.2] - 2025-10-03
9+
* [bug] fixed bug that all target ships had id = 10.
10+
* [bug] fixed duplicate -v parameter warning.
11+
* If own ship ID is not given in own_ship.json file, then ID is set to 1. Target ship IDs will follow from own ship ID.
12+
* Better documentation of output files, added links to maritime schema, and improved navigation between related sections.
13+
* Updated documentaion of target ships in input_files.rst
14+
815
## [0.8.1] - 2025-05-12
9-
* Changed first assert in test_basic_cli() from 0 to 2.
16+
* Changed first assert in test_basic_cli() from 0 to 2.
1017

1118
## [0.8.0] - 2025-05-09
1219

CITATION.cff

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ authors:
2020
email: Minos.Hemrich@dnv.com
2121
affiliation: DNV
2222
testers:
23-
- given-names: Grunde
24-
family-names: Løvoll
23+
- given-names: Melih
24+
family-names: Akdag
2525
affiliation: DNV
2626
- given-names: Stephanie
2727
family-names: Kemna
@@ -36,4 +36,4 @@ keywords:
3636
- Systematic assessment
3737
license: MIT
3838
url: 'https://github.com/dnv-opensource/ship-traffic-generator'
39-
version: 0.7.2
39+
version: 0.8.2

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Traffic Generator
2+
23
The tool generates a structured set of encounters for verifying automatic collision and grounding avoidance systems.
34
Based on input parameters such as desired situation, relative speed, relative bearing etc,
45
the tool will generate a set of traffic situations. The traffic situations may be written to files and/or inspected using plots.
@@ -10,12 +11,15 @@ For package documentation, see [https://dnv-opensource.github.io/ship-traffic-ge
1011
## Installation
1112

1213
To install Ship Traffic Generator, run this command in your terminal:
14+
1315
```sh
1416
pip install trafficgen
1517
```
18+
1619
This is the preferred method to install Traffic Generator, as it will always install the most recent stable release.
1720

1821
You can check your installation by running:
22+
1923
```sh
2024
uv run trafficgen --help
2125
```
@@ -35,52 +39,68 @@ For further explanations, see the [documentation pages](https://dnv-opensource.g
3539
This project uses `uv` as package manager.
3640
If you haven't already, install [uv](https://docs.astral.sh/uv), preferably using it's ["Standalone installer"](https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_2) method: <br>
3741
..on Windows:
42+
3843
```sh
3944
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
4045
```
46+
4147
..on MacOS and Linux:
48+
4249
```sh
4350
curl -LsSf https://astral.sh/uv/install.sh | sh
4451
```
52+
4553
(see [docs.astral.sh/uv](https://docs.astral.sh/uv/getting-started/installation/) for all / alternative installation methods.)
4654

4755
Once installed, you can update `uv` to its latest version, anytime, by running:
56+
4857
```sh
4958
uv self update
5059
```
5160

5261
### Install Python
62+
5363
The traffic generator requires Python 3.11 or later. <br>
5464

5565
If you don't already have a compatible version installed on your machine, you way install Python through `uv`:
66+
5667
```sh
5768
uv python install
5869
```
70+
5971
This will install the latest stable version of Python into the uv Python directory, i.e. as a uv-managed version of Python.
6072
> **Note**: you can also do this after you clone the repo, see below.
6173
6274
Alternatively, and if you want a standalone version of Python on your machine, you can install Python either via `winget`:
75+
6376
```sh
6477
winget install --id Python.Python
6578
```
79+
6680
or you can download and install Python from the [python.org](https://www.python.org/downloads/) website.
6781

6882
### Clone the repository
83+
6984
Clone the traffig generator repository into your local development directory:
85+
7086
```sh
7187
git clone https://github.com/dnv-opensource/ship-traffic-generator path/to/your/dir/ship-traffic-generator
7288
```
89+
7390
Change into the project directory after cloning:
91+
7492
```sh
7593
cd ship-traffic-generator
7694
```
7795

7896
### Install dependencies
7997

8098
Run `uv sync -U` to create a virtual environment and install all project dependencies into it:
99+
81100
```sh
82101
uv sync -U
83102
```
103+
84104
> **Note**: Using `--no-dev` will omit installing development dependencies.
85105
86106
> **Note**: You can also define the python environment at the same time, by running for example ```uv sync -U -p 3.12``` to install Python 3.12.
@@ -90,8 +110,10 @@ uv sync -U
90110
> `uv sync`.
91111
92112
### (Optional) Activate the virtual environment
113+
93114
When using `uv`, there is in almost all cases no longer a need to manually activate the virtual environment. <br>
94115
`uv` will find the `.venv` virtual environment in the working directory or any parent directory, and activate it on the fly whenever you run a command via `uv` inside your project folder structure:
116+
95117
```sh
96118
uv run <command>
97119
```
@@ -100,11 +122,15 @@ However, you still _can_ manually activate the virtual environment if needed.
100122
When developing in an IDE, for instance, this can in some cases be necessary depending on your IDE settings.
101123
To manually activate the virtual environment, run one of the "known" legacy commands: <br>
102124
..on Windows:
125+
103126
```sh
104127
.venv\Scripts\activate.bat
105128
```
129+
106130
> **Note**: If you use the cmd terminal in VS Code, it will show this activated venv as (trafficgen) at the start of every line command.
131+
107132
..on Linux:
133+
108134
```sh
109135
source .venv/bin/activate
110136
```
@@ -126,7 +152,31 @@ pytest .
126152
For pre-generated package documentation, see [https://dnv-opensource.github.io/ship-traffic-generator/](https://dnv-opensource.github.io/ship-traffic-generator/)
127153

128154
To generate documentation from the source code, use:
155+
129156
```sh
130157
uv run docs/make.bat html
131158
```
159+
132160
The html documentation will then be available in `docs/build/html/index.html`
161+
162+
### Testing PRs
163+
164+
1. Check out the PR branch
165+
166+
1. Update dependencies, re-install latest package, and run tests (ensure all pass):
167+
168+
```sh
169+
.venv\Scripts\activate.bat
170+
uv self update
171+
uv sync -U
172+
uv pip install -e .
173+
pytest .
174+
```
175+
176+
1. Run any additional tests you want / care about / related to PR topic, e.g.:
177+
178+
```sh
179+
trafficgen gen-situation -o test_output
180+
```
181+
182+
and make edits to config or change this command to test new functionalities.

data/baseline_situations_generated/traffic_situation_01.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.0",
2+
"version": "0.8.2",
33
"title": "HO",
44
"description": "A head on situation with one target ship.",
55
"ownShip": {
@@ -28,7 +28,7 @@
2828
}
2929
],
3030
"static": {
31-
"id": 0,
31+
"id": 1,
3232
"mmsi": 257847600,
3333
"name": "BASTO VI",
3434
"dimensions": {
@@ -70,16 +70,16 @@
7070
}
7171
],
7272
"static": {
73-
"id": 10,
73+
"id": 2,
7474
"name": "target_ship_1",
7575
"dimensions": {
76-
"length": 122.0,
77-
"width": 20.0,
78-
"height": 8.0,
79-
"a": 61.0,
80-
"b": 61.0,
81-
"c": 10.0,
82-
"d": 10.0
76+
"length": 178.0,
77+
"width": 30.0,
78+
"height": 30.0,
79+
"a": 89.0,
80+
"b": 89.0,
81+
"c": 15.0,
82+
"d": 15.0
8383
},
8484
"shipType": "Passenger"
8585
}

data/baseline_situations_generated/traffic_situation_02.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.0",
2+
"version": "0.8.2",
33
"title": "CR-GW",
44
"description": "A crossing situation with one target ship. Own ship is give-way.",
55
"ownShip": {
@@ -28,7 +28,7 @@
2828
}
2929
],
3030
"static": {
31-
"id": 0,
31+
"id": 1,
3232
"mmsi": 257847600,
3333
"name": "BASTO VI",
3434
"dimensions": {
@@ -70,7 +70,7 @@
7070
}
7171
],
7272
"static": {
73-
"id": 10,
73+
"id": 2,
7474
"name": "target_ship_1",
7575
"dimensions": {
7676
"length": 122.0,

data/baseline_situations_generated/traffic_situation_03.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.0",
2+
"version": "0.8.2",
33
"title": "CR-SO",
44
"description": "A crossing situation with one target ship. Own ship is stand-on.",
55
"ownShip": {
@@ -28,7 +28,7 @@
2828
}
2929
],
3030
"static": {
31-
"id": 0,
31+
"id": 1,
3232
"mmsi": 257847600,
3333
"name": "BASTO VI",
3434
"dimensions": {
@@ -70,7 +70,7 @@
7070
}
7171
],
7272
"static": {
73-
"id": 10,
73+
"id": 2,
7474
"name": "target_ship_1",
7575
"dimensions": {
7676
"length": 50.0,

data/baseline_situations_generated/traffic_situation_04.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.0",
2+
"version": "0.8.2",
33
"title": "OT-GW",
44
"description": "A overting situation with one target ship. Own ship is give-way.",
55
"ownShip": {
@@ -28,7 +28,7 @@
2828
}
2929
],
3030
"static": {
31-
"id": 0,
31+
"id": 1,
3232
"mmsi": 257847600,
3333
"name": "BASTO VI",
3434
"dimensions": {
@@ -70,16 +70,16 @@
7070
}
7171
],
7272
"static": {
73-
"id": 10,
73+
"id": 2,
7474
"name": "target_ship_1",
7575
"dimensions": {
76-
"length": 178.0,
77-
"width": 30.0,
78-
"height": 30.0,
79-
"a": 89.0,
80-
"b": 89.0,
81-
"c": 15.0,
82-
"d": 15.0
76+
"length": 122.0,
77+
"width": 20.0,
78+
"height": 8.0,
79+
"a": 61.0,
80+
"b": 61.0,
81+
"c": 10.0,
82+
"d": 10.0
8383
},
8484
"shipType": "Passenger"
8585
}

data/baseline_situations_generated/traffic_situation_05.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.0",
2+
"version": "0.8.2",
33
"title": "OT-SO",
44
"description": "A overtaking situation with one target ship. Own ship is stand-on.",
55
"ownShip": {
@@ -28,7 +28,7 @@
2828
}
2929
],
3030
"static": {
31-
"id": 0,
31+
"id": 1,
3232
"mmsi": 257847600,
3333
"name": "BASTO VI",
3434
"dimensions": {
@@ -47,41 +47,41 @@
4747
{
4848
"initial": {
4949
"position": {
50-
"lon": 10.47731353,
51-
"lat": 58.73759413
50+
"lon": 10.47473875,
51+
"lat": 58.73258475
5252
},
53-
"sog": 15.0,
54-
"cog": 5.04,
55-
"heading": 5.04,
53+
"sog": 15.9,
54+
"cog": 5.67,
55+
"heading": 5.67,
5656
"navStatus": "Under way using engine"
5757
},
5858
"waypoints": [
5959
{
6060
"position": {
61-
"lon": 10.47731353,
62-
"lat": 58.73759413
61+
"lon": 10.47473875,
62+
"lat": 58.73258475
6363
}
6464
},
6565
{
6666
"position": {
67-
"lon": 10.4983629,
68-
"lat": 58.86153921
67+
"lon": 10.49994834,
68+
"lat": 58.86444213
6969
}
7070
}
7171
],
7272
"static": {
73-
"id": 10,
73+
"id": 2,
7474
"name": "target_ship_1",
7575
"dimensions": {
76-
"length": 50.0,
77-
"width": 10.0,
76+
"length": 122.0,
77+
"width": 20.0,
7878
"height": 8.0,
79-
"a": 25.0,
80-
"b": 25.0,
81-
"c": 5.0,
82-
"d": 5.0
79+
"a": 61.0,
80+
"b": 61.0,
81+
"c": 10.0,
82+
"d": 10.0
8383
},
84-
"shipType": "Cargo"
84+
"shipType": "Passenger"
8585
}
8686
}
8787
]

0 commit comments

Comments
 (0)