def test_interp(): env = Environment(state=weather) assert "windspeed_20m" not in env.state.dtype.names constraints = {"waveheight": le(2), "windspeed_20m": le(10)} valid = env._find_valid_constraints(**constraints) assert "windspeed_20m" in env.state.dtype.names assert (env.state["windspeed_10m"] < env.state["windspeed_20m"]).all() assert (env.state["windspeed_20m"] < env.state["windspeed_100m"]).all()
def transit_limits(self): """ Returns dictionary of `marmot.Constraints` for 'windspeed' and 'waveheight', representing the transit limits of the vessel. """ _dict = { "windspeed": le(self._transport_specs["max_windspeed"]), "waveheight": le(self._transport_specs["max_waveheight"]), } return _dict
def test_simple_constraint_application(): env = Environment(state=simple_weather) constraints = {"windspeed": le(10)} valid = env._find_valid_constraints(**constraints) assert valid == constraints with_height = {"windspeed_100m": le(10)} valid = env._find_valid_constraints(**with_height) assert "windspeed" in list(valid.keys()) with_mult_heights = {"windspeed_100m": le(10), "windspeed_10m": le(8)} with pytest.raises(ValueError): valid = env._find_valid_constraints(**with_mult_heights)
def test_extrap(): env = Environment(state=weather) assert "windspeed_120m" not in env.state.dtype.names constraints = {"waveheight": le(2), "windspeed_120m": le(10)} valid = env._find_valid_constraints(**constraints) assert "windspeed_120m" in env.state.dtype.names assert (env.state["windspeed_120m"] > env.state["windspeed_100m"]).all() env2 = Environment(state=weather, ws_alpha=0.12) assert "windspeed_120m" not in env2.state.dtype.names constraints = {"waveheight": le(2), "windspeed_120m": le(10)} valid = env2._find_valid_constraints(**constraints) assert (env.state["windspeed_100m"] == env2.state["windspeed_100m"]).all() assert (env.state["windspeed_120m"] < env2.state["windspeed_120m"]).all()
def mechanical_completion(self): """ Task representing time associated with performing mechanical compltion work at quayside. """ yield self.task("Mechanical Completion", 24, constraints={"windspeed": le(18)})
def lift_and_attach_blade(self): """ Task representing time associated with lifting and attaching a turbine blade at quayside. """ yield self.task("Lift and Attach Blade", 3.5, constraints={"windspeed": le(12)})
def lift_and_attach_nacelle(self): """ Task representing time associated with lifting and attaching a nacelle at quayside. """ yield self.task("Lift and Attach Nacelle", 7, constraints={"windspeed": le(15)})
def operational_limits(self): """ Returns dictionary of `marmot.Constraints` for 'windspeed' and 'waveheight', representing the operational limits of the vessel. """ try: _ = getattr(self, "crane") max_windspeed = self._crane_specs["max_windspeed"] except MissingComponent: max_windspeed = self._transport_specs["max_windspeed"] _dict = { "windspeed": le(max_windspeed), "waveheight": le(self._transport_specs["max_waveheight"]), } return _dict
def lift_and_attach_tower_section(self): """ Task representing time associated with lifting and attaching a tower section at quayside. """ yield self.task( "Lift and Attach Tower Section", 12, constraints={"windspeed": le(15)}, )
def test_constraint_application(): env = Environment(state=weather) constraints = {"waveheight": le(2), "windspeed": le(10)} valid = env._find_valid_constraints(**constraints) assert "windspeed_10m" in list(valid.keys()) constraints = {"waveheight": le(2), "windspeed_10m": le(10)} valid = env._find_valid_constraints(**constraints) assert "waveheight" in list(valid.keys()) assert "windspeed_10m" in list(valid.keys()) assert "windspeed_20m" not in env.state.dtype.names constraints = {"waveheight": le(2), "windspeed_20m": le(10)} valid = env._find_valid_constraints(**constraints) assert "windspeed_20m" in list(valid.keys()) assert "windspeed_20m" in env.state.dtype.names assert "windspeed_120m" not in env.state.dtype.names constraints = {"waveheight": le(2), "windspeed_120m": le(10)} valid = env._find_valid_constraints(**constraints) assert "windspeed_120m" in list(valid.keys()) assert "windspeed_120m" in env.state.dtype.names
def install_moored_substructures(vessel, queue, distance, substructures, station_keeping_vessels, **kwargs): """ Logic that a Multi-Purpose Support Vessel uses at site to complete the installation of moored substructures. Parameters ---------- vessel : Vessel queue : distance : int | float Distance between port and site (km). substructures : int Number of substructures to install before transiting back to port. station_keeping_vessels : int Number of vessels to use for substructure station keeping during final installation at site. """ n = 0 while n < substructures: if queue.vessel: start = vessel.env.now if n == 0: vessel.mobilize() yield vessel.transit(distance) yield vessel.task_wrapper( "Position Substructure", 2, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) yield vessel.task_wrapper( "Ballast to Operational Draft", 6, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) yield vessel.task_wrapper( "Connect Mooring Lines", 22, suspendable=True, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) yield vessel.task_wrapper( "Check Mooring Lines", 12, suspendable=True, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) group_time = vessel.env.now - start queue.vessel.submit_action_log( "Positioning Support", group_time, location="site", num_vessels=station_keeping_vessels, ) yield queue.vessel.release.succeed() n += 1 else: start = vessel.env.now yield queue.activate delay_time = vessel.env.now - start if n != 0: vessel.submit_action_log("Delay", delay_time, location="Site") yield vessel.transit(distance)
def transfer_moored_substructures_from_storage(group, feed, distance, queue, towing_vessels, towing_speed, **kwargs): """ Process logic for the towing vessel group. Parameters ---------- group : Vessel Towing group. feed : simpy.Store Completed assembly storage. distance : int | float Distance from port to site. towing_vessels : int Number of vessels to use for towing to site. towing_speed : int | float Configured towing speed (km/h) """ towing_time = distance / towing_speed transit_time = distance / group.transit_speed while True: start = group.env.now assembly = yield feed.get() delay = group.env.now - start if delay > 0: group.submit_action_log("Delay: No Completed Assemblies Available", delay) yield group.group_task( "Ballast to Towing Draft", 6, num_vessels=towing_vessels, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) yield group.group_task( "Tow Substructure", towing_time, num_vessels=towing_vessels, constraints={ "windspeed": le(15), "waveheight": le(2.5) }, ) # At Site with queue.request() as req: queue_start = group.env.now yield req queue_time = group.env.now - queue_start if queue_time > 0: group.submit_action_log("Queue", queue_time, location="Site") queue.vessel = group active_start = group.env.now queue.activate.succeed() # Released by WTIV when objects are depleted group.release = group.env.event() yield group.release active_time = group.env.now - active_start queue.vessel = None queue.activate = group.env.event() yield group.group_task("Transit", transit_time, num_vessels=towing_vessels)
def install_gravity_base_foundations(vessel, queue, distance, substructures, station_keeping_vessels, **kwargs): """ Logic that a Multi-Purpose Support Vessel uses at site to complete the installation of gravity based foundations. Parameters ---------- vessel : Vessel queue : distance : int | float Distance between port and site (km). substructures : int Number of substructures to install before transiting back to port. station_keeping_vessels : int Number of vessels to use for substructure station keeping during final installation at site. """ n = 0 while n < substructures: if queue.vessel: start = vessel.env.now if n == 0: vessel.mobilize() yield vessel.transit(distance) yield vessel.task( "Position Substructure", 5, constraints={ "windspeed": le(15), "waveheight": le(2) }, ) yield vessel.task( "ROV Survey", 1, constraints={ "windspeed": le(25), "waveheight": le(3) }, ) # TODO: Model for ballast pump time yield vessel.task( "Pump Ballast", 12, # suspendable=True, constraints={ "windspeed": le(15), "waveheight": le(2) }, ) # TODO: Model for GBF grout time yield vessel.task( "Grout GBF", 6, suspendable=True, constraints={ "windspeed": le(15), "waveheight": le(2) }, ) group_time = vessel.env.now - start queue.vessel.submit_action_log( "Positioning Support", group_time, location="site", num_vessels=station_keeping_vessels, ) yield queue.vessel.release.succeed() n += 1 else: start = vessel.env.now yield queue.activate delay_time = vessel.env.now - start if n != 0: vessel.submit_action_log("Delay", delay_time, location="Site") yield vessel.transit(distance)