Classes

This are overwritten salabim classes and self created classes mainly used to run the simulation and set correct parameters for the simulation.

The classes Vessel, InstallationVessel and SupplyVessel have the goal of providing a structured way to store and enter parameters for the vessels. The most important class is the Experiment class as it provides the main simulation run and contains methods to transform and clean the results of the runs before storing it to the database. The main method used is the logsim.classes.Experiment.run_experiment() method. This method will go over each of the weather samples and create a seperate salabim environment for each sample. It will generate the vessel components and run the appropriate supply chain configuration. It will then save the sample in the experiment class with the logsim.classes.Experiment.save_sample_result() method. After each sample is run it will call the logsim.classes.Experiment.calculate_kpis() method to clean the results, calculate the overall KPI’s and store it in the database by calling the logsim.db.Database.insert() method. Each entry in the database will be one run with the corresponding configuration and parameters, it contains the durations of each sample and the overall KPI’s. It is also possible to write the results to a JSON file instead of a database by setting the save_json parameter to True in the logsim.classes.Experiment.run_experiment() method.

class logsim.classes.Vessel(foundation_capacity: int, sailing_speed: Distribution, day_rate: tuple, mobilization_rate: tuple, sailing_cost: tuple, load_time: Distribution, mooring_time: Distribution, unmooring_time: Distribution, within_port_speed: Distribution)

Class for defining vessel characteristics. Contains most important vessel characteristics for simulation. Some parameters are obligatory, others are optional. The optional parameters are only required for specific vessels.

Parameters:
  • foundation_capacity – Number of foundations that can be transported

  • sailing_speed – Sailing speed of vessel as distribution

  • day_rate – Day rate of vessel

  • mobilization_rate – The cost of mobilizing the vessel for a project

  • sailing_cost – Sailing cost of vessel

  • load_time – Load time of vessel as distribution

  • mooring_time – Mooring time of vessel as distribution

  • unmooring_time – Unmooring time of vessel as distribution

  • within_port_speed – Speed of vessel within port as distribution

as_dict() dict

Helper function to convert class to dictionary which is required for saving to database. Calls correct functions for Distribution and Pint types to get string representation.

Returns:

Dictionary with class attributes

class logsim.classes.InstallationVessel(foundation_capacity: int, sailing_speed: Distribution, day_rate: tuple, mobilization_rate: tuple, sailing_cost: tuple, dp_fuel_cost: tuple, installation_limit_period: float, installation_limit_wave: float, installation_time: Distribution, sailing_limit_period: float, sailing_limit_wave: float, alongside_limit_period: float, alongside_limit_wave: float, load_time: Distribution, mooring_time: Distribution, unmooring_time: Distribution, alongside_mooring_time: Distribution, alongside_unmooring_time: Distribution, alongside_transfer_time: Distribution, within_port_speed: Distribution)

Class representing the installation vessel. Inherits from Vessel.

Parameters:
  • foundation_capacity – The foundation capacity of the vessel

  • sailing_speed – The sailing speed of the vessel

  • day_rate – The day rate of the vessel

  • mobilization_rate – The cost of mobilizing the vessel for a project

  • sailing_cost – The sailing cost of the vessel

  • dp_fuel_cost – The DP fuel cost of the vessel

  • installation_limit_period – The installation limit period of the vessel

  • installation_limit_wave – The installation limit wave of the vessel

  • installation_time – The installation time of the vessel

  • sailing_limit_period – The sailing limit period of the vessel

  • sailing_limit_wave – The sailing limit wave of the vessel

  • alongside_limit_period – The alongside limit period of the vessel

  • alongside_limit_wave – The alongside limit wave of the vessel

  • load_time – The load time of the vessel

  • mooring_time – The mooring time of the vessel

  • unmooring_time – The unmooring time of the vessel

  • alongside_mooring_time – The alongside mooring time of the vessel

  • alongside_unmooring_time – The alongside unmooring time of the vessel

  • alongside_transfer_time – The alongside transfer time of the vessel

  • within_port_speed – Sailing speed within ports

as_dict() dict

Helper function to convert class to dictionary which is required for saving to database. :return: dictionary with class attributes

class logsim.classes.SupplyVessel(foundation_capacity: int, sailing_speed: Distribution, day_rate: tuple, mobilization_rate: tuple, sailing_cost: tuple, sailing_limit_period: float, sailing_limit_wave: float, load_time: Distribution, mooring_time: Distribution, unmooring_time: Distribution, within_port_speed: Distribution)

Class representing a supply vessel. Inherits from Vessel.

Parameters:
  • foundation_capacity – The foundation capacity of the vessel

  • sailing_speed – The sailing speed of the vessel

  • day_rate – The day rate of the vessel

  • mobilization_rate – The cost of mobilizing the vessel for a project

  • sailing_cost – The sailing cost of the vessel

  • sailing_limit_period – The sailing limit period of the vessel

  • sailing_limit_wave – The sailing limit wave of the vessel

  • load_time – The load time of the vessel

  • mooring_time – The mooring time of the vessel

  • unmooring_time – The unmooring time of the vessel

  • within_port_speed – Sailing speed within ports

as_dict() dict

Helper function to convert class to dictionary which is required for saving to database. :return: dictionary with class attributes

class logsim.classes.Experiment(installation_vessel: ~logsim.classes.InstallationVessel, logistic_configuration: ~logsim.enumerations.LogisticType, distances: ~logsim.classes.Distances, to_install: int, use_weather: bool = True, decision_rules: bool = True, intermediate_location_capacity: int | None = None, intermediate_location_quays: int | None = None, intermediate_location_stock_minimum: int | None = None, intermediate_location_cost: tuple | None = None, results: list | None = None, weather_data: ~logsim.weather.WeatherData | None = None, supply_vessel: ~logsim.classes.SupplyVessel | None = None, supply_vessel_2: ~logsim.classes.SupplyVessel | None = None, _raw_results: dict | None = None, _sim: ~logsim.classes_salabim.SimulationEnvironment = <logsim.classes_salabim.SimulationEnvironment object>)

Class for defining experiment characteristics. Contains most important experiment characteristics for simulation. Need to pass required vessels of type Vessel. Optional parameters are only required for specific experiments.

Parameters:
  • installation_vessel – Installation vessel

  • logistic_configuration – Logistic configuration

  • distances – Distances between locations

  • to_install – Number of foundations to install

  • use_weather – Boolean to indicate if weather should be used

  • decision_rules – If decision rules should be used or vessels should only look 1 operation ahead.

  • _sim – Simulation environment

  • _raw_results – dict

  • results – list

  • weather_data – Weather data

  • intermediate_location_capacity – Capacity of intermediate location

  • intermediate_location_quays – Number of quays at intermediate location

  • intermediate_location_stock_minimum – Stock at the intermediate location before starting installation vessel

  • intermediate_location_cost – Cost of rental of intermediate location in euro’s/month

  • supply_vessel – Offshore barge

  • supply_vessel_2 – Second offshore barge

calculate_kpis(iv=None, barge=None, barge_2=None, save_db=False, save_json=False, experiment_id=None, experiment_error=None, batch_datetime='Undefined') None

After simulation, calculate KPIs for each sample and save to database if requested.

Parameters:
  • iv – Installation vessel component run in simulation

  • barge – Barge component run in simulation

  • barge – Barge component run in simulation

  • barge_2 – Second barge component run in simulation

  • save_db – Save results to database

  • experiment_id – Experiment id to use when saving results in database

  • experiment_error – Boolean indicating if experiment resulted in an error (if one of the samples resulted in an error)

  • batch_datetime – Datetime that can be passed to group multiple experiments together with a common datetime reflecting the batch it was run in (for example multiprocessing)

  • save_db – Boolean indicating if results should be saved to database

  • save_json – Boolean indicating if results should be saved to json

  • experiment_id – Experiment id to use when saving results in database

  • experiment_error – Boolean indicating if experiment resulted in an error (if one of the samples resulted in an error)

  • batch_datetime – Datetime that can be passed to group multiple experiments together with a common datetime reflecting the batch it was run in (for example multiprocessing)

run_experiment(animate=False, trace=False, plot=False, save_db=False, save_json=False, experiment_id=None, batch_datetime='Undefined') None

Run the experiment. Main method to be called. First sets the experiment to the simulation environment ( SimulationEnvironment). Then will go over each sample of the weather_data (either synthetic or not) and run the experiment for each sample by creating a new salabim environment, setting the vessel parameters, weather sample, creating the components and running the simulation. The results are then saved at each simulation run in the _raw_results dictionary. After all samples are run, the results are calculated and saved to the results dictionary by calling the appropriate functions.

Parameters:
  • animate – Animate the simulation

  • trace – Trace the simulation

  • plot – Plot the results of the last simulation run

  • save_db – Save the results to the DB (set in database.py)

  • experiment_id – Experiment ID that can be used to group multiple runs together with a common id in the DB

  • batch_datetime – Datetime that can be passed to group multiple experiments together with a common datetime reflecting the batch it was run in (for example multiprocessing)

save_sample_result(iv: InstallationVesselComponent, supply_vessel: SupplyVesselComponent, supply_vessel_2: SupplyVesselComponent, sample_no: int, run_time: float, sample_error: bool)

Save sample result for experiment. Sample result contains data of installation vessel and supply vessels.

Parameters:
  • iv ("InstallationVesselComponent") – Installation vessel component run in simulation

  • supply_vessel (SupplyVesselComponent) – Barge component run in simulation

  • supply_vessel_2 (SupplyVesselComponent) – Second barge component run in simulation

  • sample_no (int) – Sample number, used for identification

  • run_time (float) – Run time of simulation

  • sample_error (bool) – Boolean indicating if sample resulted in an error