OpenTNSim¶
This page lists all functions and classes available in the OpenTNSim.model and OpenTNSim.core modules. For examples on how to use these submodules please check out the Examples page, information on installing OpenCLSim can be found on the Installation page.
Submodules¶
The main components are the Model module and the Core module. All of their components are listed below.
opentnsim.model module¶
Vessel generator.
- class opentnsim.model.Simulation(simulation_start, graph, scenario=None)[source]¶
Bases:
opentnsim.core.Identifiable
A class to generate vessels from a database
- add_vessels(origin, destination, vessel=None, vessel_generator=None, arrival_distribution=1, arrival_process='Markovian')[source]¶
Make arrival process
environment: simpy environment arrival_distribution: specify the distribution from which vessels are generated, int or list arrival_process: process of arrivals
- class opentnsim.model.VesselGenerator(vessel_type, vessel_database, loaded=None, random_seed=3)[source]¶
Bases:
object
A class to generate vessels from a database
opentnsim.core module¶
Main module.
- class opentnsim.core.ContainerDependentMovable(compute_v, *args, **kwargs)[source]¶
Bases:
opentnsim.core.Movable
,opentnsim.core.HasContainer
ContainerDependentMovable class Used for objects that move with a speed dependent on the container level compute_v: a function, given the fraction the container is filled (in [0,1]), returns the current speed
- property current_speed¶
- class opentnsim.core.ExtraMetadata(*args, **kwargs)[source]¶
Bases:
object
store all leftover keyword arguments as metadata property (use as last mixin)
- class opentnsim.core.HasContainer(capacity, level=0, total_requested=0, *args, **kwargs)[source]¶
Bases:
opentnsim.core.SimpyObject
Mixin class: Something with a storage capacity capacity: amount the container can hold level: amount the container holds initially container: a simpy object that can hold stuff total_requested: a counter that helps to prevent over requesting
- property filling_degree¶
- property is_loaded¶
- class opentnsim.core.HasLength(length, remaining_length=0, total_requested=0, *args, **kwargs)[source]¶
Bases:
opentnsim.core.SimpyObject
Mixin class: Something with a storage capacity
capacity: amount the container can hold level: amount the container holds initially total_requested: a counter that helps to prevent over requesting
- class opentnsim.core.HasLockDoors(node_1, node_3, *args, **kwargs)[source]¶
Bases:
opentnsim.core.SimpyObject
- class opentnsim.core.HasResource(nr_resources=1, priority=False, *args, **kwargs)[source]¶
Bases:
opentnsim.core.SimpyObject
Something that has a resource limitation, a resource request must be granted before the object can be used.
nr_resources: nr of requests that can be handled simultaneously
- class opentnsim.core.Identifiable(name, id=None, *args, **kwargs)[source]¶
Bases:
object
Mixin class: Something that has a name and id
name: a name
id: a unique id generated with uuid
- class opentnsim.core.IsLock(node_1, node_2, node_3, lock_length, lock_width, lock_depth, doors_open, doors_close, wlev_dif, disch_coeff, grav_acc, opening_area, opening_depth, simulation_start, operating_time, *args, **kwargs)[source]¶
Bases:
opentnsim.core.HasResource
,opentnsim.core.HasLength
,opentnsim.core.HasLockDoors
,opentnsim.core.Identifiable
,opentnsim.core.Log
Mixin class: Something has lock object properties - properties in meters - operation in seconds
- class opentnsim.core.IsLockLineUpArea(node, lineup_length, *args, **kwargs)[source]¶
Bases:
opentnsim.core.HasResource
,opentnsim.core.HasLength
,opentnsim.core.Identifiable
,opentnsim.core.Log
Mixin class: Something has lock object properties - properties in meters - operation in seconds
- class opentnsim.core.IsLockWaitingArea(node, *args, **kwargs)[source]¶
Bases:
opentnsim.core.HasResource
,opentnsim.core.Identifiable
,opentnsim.core.Log
Mixin class: Something has lock object properties
properties in meters
operation in seconds
- class opentnsim.core.Locatable(geometry, *args, **kwargs)[source]¶
Bases:
object
Mixin class: Something with a geometry (geojson format)
geometry: can be a point as well as a polygon
- class opentnsim.core.Log(*args, **kwargs)[source]¶
Bases:
opentnsim.core.SimpyObject
Mixin class: Something that has logging capability
log: log message [format: ‘start activity’ or ‘stop activity’] t: timestamp value: a value can be logged as well geometry: value from locatable (lat, lon)
- class opentnsim.core.Movable(v, *args, **kwargs)[source]¶
Bases:
opentnsim.core.Locatable
,opentnsim.core.Routeable
,opentnsim.core.Log
Mixin class: Something can move
Used for object that can move with a fixed speed
geometry: point used to track its current location
v: speed
- property current_speed¶
- class opentnsim.core.Neighbours[source]¶
Bases:
object
Can be added to a locatable object (list)
travel_to: list of locatables to which can be travelled
- class opentnsim.core.Routeable(route, complete_path=None, *args, **kwargs)[source]¶
Bases:
object
Mixin class: Something with a route (networkx format)
route: a networkx path
- class opentnsim.core.SimpyObject(env, *args, **kwargs)[source]¶
Bases:
object
General object which can be extended by any class requiring a simpy environment
env: a simpy Environment
- class opentnsim.core.VesselProperties(type, B, L, h_min=None, T=None, C_B=None, H_e=None, H_f=None, T_e=None, T_f=None, safety_margin=None, h_squat=None, payload=None, vessel_type=None, *args, **kwargs)[source]¶
Bases:
object
Mixin class: Something that has vessel properties This mixin is updated to better accommodate the ConsumesEnergy mixin
type: can contain info on vessel type (avv class, cemt_class or other)
B: vessel width
L: vessel length
h_min: vessel minimum water depth, can also be extracted from the network edges if they have the property [‘Info’][‘GeneralDepth’]
T: actual draught
C_B: block coefficient (‘fullness’) [-]
safety_margin : the water area above the waterway bed reserved to prevent ship grounding due to ship squatting during sailing, the value of safety margin depends on waterway bed material and ship types. For tanker vessel with rocky bed the safety margin is recommended as 0.3 m based on Van Dorsser et al. The value setting for safety margin depends on the risk attitude of the ship captain and shipping companies.
h_squat: the water depth considering ship squatting while the ship moving (if set to False, h_squat is disabled)
payload: cargo load [ton], the actual draught can be determined by knowing payload based on van Dorsser et al’s method.(https://www.researchgate.net/publication/344340126_The_effect_of_low_water_on_loading_capacity_of_inland_ships)
vessel_type: vessel type can be selected from “Container”,”Dry_SH”,”Dry_DH”,”Barge”,”Tanker”. (“Dry_SH” means dry bulk single hull, “Dry_DH” means dry bulk double hull), based on van Dorsser et al’s paper.(https://www.researchgate.net/publication/344340126_The_effect_of_low_water_on_loading_capacity_of_inland_ships)
Alternatively you can specify draught based on filling degree - H_e: vessel height unloaded - H_f: vessel height loaded - T_e: draught unloaded - T_f: draught loaded
- property H¶
Calculate current height based on filling degree
- property T¶
Compute the actual draught
There are 3 ways to get actual draught - by directly providing actual draught values in the notebook - Or by providing ship draughts in fully loaded state and empty state, the actual draught will be computed based on filling degree
- calculate_max_sinkage(v, h_0)[source]¶
Calculate the maximum sinkage of a moving ship
the calculation equation is described in Barrass, B. & Derrett, R.’s book (2006), Ship Stability for Masters and Mates, chapter 42. https://doi.org/10.1016/B978-0-08-097093-6.00042-6
some explanation for the variables in the equation: - h_0: water depth - v: ship velocity relative to the water - 150: Here we use the standard width 150 m as the waterway width
- get_route(origin, destination, graph=None, minWidth=None, minHeight=None, minDepth=None, randomSeed=4)[source]¶
Calculate a path based on vessel restrictions
- property h_min¶