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

run(duration=86400)[source]

Run the simulation

duration: specify the duration of the simulation in seconds

class opentnsim.model.VesselGenerator(vessel_type, vessel_database, loaded=None, random_seed=3)[source]

Bases: object

A class to generate vessels from a database

arrival_process(environment, origin, destination, arrival_distribution, scenario, arrival_process)[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

generate(environment, vessel_name, scenario=None)[source]

Generate a vessel

opentnsim.core module

Main module.

class opentnsim.core.ConsumesEnergy(P_installed, L_w, C_b, nu=1e-06, rho=1000, g=9.81, x=2, eta_0=0.6, eta_r=1.0, eta_t=0.98, eta_g=0.96, c_stern=0, one_k2=2.5, *args, **kwargs)[source]

Bases: object

Mixin class: Something that consumes energy.

P_installed: installed engine power [kW] L_w: weight class of the ship (depending on carrying capacity) (classes: L1 (=1), L2 (=2), L3 (=3)) C_b: block coefficient (‘fullness’) [-] nu: kinematic viscosity [m^2/s] rho: density of the surrounding water [kg/m^3] g: gravitational accelleration [m/s^2] x: number of propellors [-] eta_0: open water efficiency of propellor [-] eta_r: relative rotative efficiency [-] eta_t: transmission efficiency [-] eta_g: gearing efficiency [-] c_stern: determines shape of the afterbody [-] one_k2: appendage resistance factor [-] c_year: construction year of the engine [y]

calculate_appendage_resistance(V_0)[source]
  1. Appendage resistance
  • 3rd resistance component defined by Holtrop and Mennen (1982)
  • Appendages (like a rudder, shafts, skeg) result in additional frictional resistance
calculate_emission_factors_total()[source]

Total emission factors:

  • The total emission factors can be computed by multiplying the general emission factor by the correction factor
calculate_engine_age()[source]

Calculating the construction year of the engine, dependend on a Weibull function with shape factor ‘k’, and scale factor ‘lmb’, which are determined by the weight class L_w

calculate_frictional_resistance(V_0, h)[source]
  1. Frictional resistance
  • 1st resistance component defined by Holtrop and Mennen (1982)
  • A modification to the original friction line is applied, based on literature of Zeng (2018), to account for shallow water effects
calculate_properties()[source]

Calculate a number of basic vessel properties

calculate_residual_resistance(V_0, h)[source]
  1. Residual resistance terms
  • Holtrop and Mennen (1982) defined three residual resistance terms:
    1. Resistance due to the bulbous bow (not incorporated since inland ships in general don’t have a bulb)
    1. Resistance due to immersed transom
    1. Resistance due to model-ship correlation
calculate_total_power_required()[source]

Total required power:

  • The total required power is the sum of the power for systems on board (P_hotel) + power required for propulsion (P_BHP)
  • The P_BHP depends on the calculated resistance
calculate_total_resistance(V_0, h)[source]

Total resistance:

The total resistance is the sum of all resistance components (Holtrop and Mennen, 1982)

calculate_viscous_resistance()[source]
  1. Viscous resistance
  • 2nd resistance component defined by Holtrop and Mennen (1982)
  • Form factor (1 + k1) has to be multiplied by the frictional resistance R_f, to account for the effect of viscosity
calculate_wave_resistance(V_0, h)[source]
  1. Wave resistance
  • 4th resistance component defined by Holtrop and Mennen (1982)
  • When the speed or the vessel size increases, the wave making resistance increases
  • In shallow water, the wave resistance shows an asymptotical behaviour by reaching the critical speed
correction_factors()[source]

Correction factors:

  • The correction factors have to be multiplied by the general emission factors, to get the total emission factors
  • The correction factor takes into account the effect of the partial engine load
  • When the partial engine load is low, the correction factors are higher (engine is less efficient)
  • Based on literature TNO (2019)
emission_factors_general()[source]

General emission factors:

This function computes general emission factors, based on construction year of the engine. - Based on literature TNO (2019)

Please note: later on a correction factor has to be applied to get the total emission factor

karpov(V_0, h)[source]

Intermediate calculation: Karpov

  • The Karpov method computes a velocity correction that accounts for limited water depth (corrected velocity V2)
  • V2 has to be implemented in the wave resistance and the residual resistance terms
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

current_speed
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

filling_degree
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

change_water_level(side)[source]

Change water level and priorities in queue

convert_chamber(environment, new_level, number_of_vessels)[source]

Convert the water level

operation_time(environment)[source]
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)

get_log_as_json()[source]
log_entry(log, t, value, geometry_log)[source]

Log

class opentnsim.core.Movable(v=4, *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

current_speed
move()[source]

determine distance between origin and destination, and yield the time it takes to travel it Assumption is that self.path is in the right order - vessel moves from route[0] to route[-1].

pass_edge(origin, destination)[source]
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_e, H_f, T_e, T_f, *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_e: vessel height unloaded H_f: vessel height loaded T_e: draught unloaded T_f: draught loaded

Add information on possible restrictions to the vessels, i.e. height, width, etc.

H

Calculate current height based on filling degree

T

Calculate current draught based on filling degree

Here we should implement the rules from Van Dorsser et al https://www.researchgate.net/publication/344340126_The_effect_of_low_water_on_loading_capacity_of_inland_ships

get_route(origin, destination, graph=None, minWidth=None, minHeight=None, minDepth=None, randomSeed=4)[source]

Calculate a path based on vessel restrictions

Module contents