Coverage for test_model.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python # -*- coding: utf-8 -*-
# make the environment def env():
# make the location objects def Location(): core.Log, # Allow logging of all discrete events core.Locatable, # Add coordinates to extract distance information and visualize core.HasContainer, # Add information on the material available at the site core.HasResource), # Add information on serving equipment {}) # The dictionary is empty because the site type is generic
# make the transportprocessingresource def TransportProcessingResource(): (core.Identifiable, # Give it a name core.Log, # Allow logging of all discrete events core.ContainerDependentMovable, # A moving container, so capacity and location core.Processor, # Allow for loading and unloading core.HasResource), # Add information on serving equipment {})
# Test model with one trip - transporting an amount with "Vessel 01" from "From Site" to "To Site"
# Initialize from site with correct parameters
"name": "Location A", # The name of the "from location" "geometry": location_from_site, # The coordinates of the "from location" "capacity": amount, # The capacity of the "from location" "level": amount} # The actual volume of the "from location" "name": "Location B", # The name of the "to location" "geometry": location_to_site, # The coordinates of the "to location" "capacity": amount, # The capacity of the "to location" "level": 0} # The actual volume of the "to location"
# make the vessel "name": "Vessel 01", # Name of the vessel "geometry": location_from_site, # It is located at the "from location" "unloading_func": (lambda x: x), # Unloading production is 1 amount / s "loading_func": (lambda x: x), # Loading production is 1 amount / s "capacity": 1_000, # Capacity of the vessel "compute_v": (lambda x: 1)} # Speed is always 1 m / s
# make the activity name = "Moving amount", # We are moving soil origin = from_location, # We originate from the from_site destination = to_location, # And therefore travel to the to_site loader = vessel, # The benefit of a TSHD, all steps can be done mover = vessel, # The benefit of a TSHD, all steps can be done unloader = vessel, # The benefit of a TSHD, all steps can be done start_condition = None) # We can start right away and do not stop
# run the activity
# Duration of the activity should be equal to loading + sailing + unloading + sailing # -- Loading duration is equal to the amount # -- Unloading duration is equal to the amount # -- Sailing duration is equal to the distance travelled
# Test model with multiple trips
# Initialize from site with correct parameters
"name": "Location A", # The name of the "from location" "geometry": location_from_site, # The coordinates of the "from location" "capacity": amount, # The capacity of the "from location" "level": amount} # The actual volume of the "from location" "name": "Location B", # The name of the "to location" "geometry": location_to_site, # The coordinates of the "to location" "capacity": amount, # The capacity of the "to location" "level": 0} # The actual volume of the "to location"
# make the vessel "name": "Vessel 01", # Name of the vessel "geometry": location_from_site, # It is located at the "from location" "unloading_func": (lambda x: x), # Unloading production is 1 amount / s "loading_func": (lambda x: x), # Loading production is 1 amount / s "capacity": 1_000, # Capacity of the vessel "compute_v": (lambda x: 1)} # Speed is always 1 m / s
# make the activity name = "Moving amount", # We are moving soil origin = from_location, # We originate from the from_site destination = to_location, # And therefore travel to the to_site loader = vessel, # The benefit of a TSHD, all steps can be done mover = vessel, # The benefit of a TSHD, all steps can be done unloader = vessel, # The benefit of a TSHD, all steps can be done start_condition = None) # We can start right away and do not stop
# run the activity
# Duration of the activity should be equal to loading + sailing + unloading + sailing # -- Loading duration is equal to the amount # -- Unloading duration is equal to the amount # -- Sailing duration is equal to the distance travelled
# Test conditions |