Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lock in the real-world graph

Lock in the real-world graph

In this notebook, we set up a basic simulation where two vessels cross a lock complex in a real-world graph. We take the eastern lock chamber of the Volkerak sluices (rightern most lock chamber in the picture below).

OpenTNSim-Volkeraksluizen

0. Import

0.1 Import libraries

c:\Users\alpf\Documents\projecten\openTNSim\OpenTNSim\.venv\Lib\site-packages\requests\__init__.py:86: RequestsDependencyWarning:

Unable to find acceptable character detection dependency (chardet or charset_normalizer).

This notebook is executed with OpenTNSim version 1.3.7

0.2. Functions to be included in the utilities

1. Define object classes

2 Create graph

2.1 Import FIS graph

Next we create a network (a graph) along which the vessel can move. For this case we use the Fairway Information System graph, and make the vessels sail from one side of the lock to another side.

From the above map we select the following origin and destination pair for the vessels

2.2 Modify the FIS graph

We have to check if there are nodes within the lock chamber geometry. This is not supported by OpenTNSim, and we need to manually remove these nodes and merge the edges to a single edge. Let’s first import the lock chamber geometry, which we downloaded using OpenStreetMap (OSM) through overpass turbo (see link).

We can plot this geometry into the folium map by reconfiguring the coordinates of the lock chamber’s polygon geometry:

Loading...

There are nodes within the lock geometry, which we have to find, merge their edges and remove.

Loading...

2.3 Derive lock information

First identify at which edge the lock chamber is located:

Next, we need to derive the lock dimensions, which we can do using a bounding box polygon

Distances from the gates to the edge’s start and end node

The lock dimensions

The waiting areas and their distances to the lock doors

3. Run simulation

3.1 Set mission and simpy environment with VTS

3.2 Create lock object

3.3 Create vessels

np.float64(1080.1020142734922)
Loading...
'Vessel 1' logbook data:

Loading...
'Vessel 2' logbook data:

Loading...
Timedelta('0 days 00:04:36')