def test_additional_logging(self): simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} reporting_activity = model.BasicActivity( env=my_env, name="Reporting activity", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5k", registry=registry, duration=0, ) basic_activity = model.BasicActivity( env=my_env, name="Basic activity", registry=registry, ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", duration=14, additional_logs=[reporting_activity], ) model.register_processes([basic_activity]) my_env.run() assert my_env.now == 14 assert_log(reporting_activity) assert_log(basic_activity)
def test_repeat_activity(): """Test the repeat activity.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} activity = model.BasicActivity( env=my_env, name="Basic activity", registry=registry, duration=14, ) repeat_activity = model.RepeatActivity( env=my_env, name="repeat", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5g", registry=registry, sub_processes=[activity], repetitions=3, ) model.register_processes([repeat_activity]) my_env.run() assert my_env.now == 42 assert_log(repeat_activity)
def test_repeat_until_timeout(self): simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} basic = model.BasicActivity( env=my_env, name="Basic activity", registry=registry, duration=10, ) act = model.WhileActivity( env=my_env, name="While activity of basic activities", registry=registry, sub_processes=[basic], condition_event={ "type": "time", "start_time": 50, }, ) model.register_processes([act]) my_env.run() assert my_env.now == 50 assert_log(act) assert_log(basic)
def test_parallel(): """Test the parallel activity.""" simulation_start = 0 env = simpy.Environment(initial_time=simulation_start) registry = {} reporting_activity = model.BasicActivity( env=env, name="Reporting activity", registry=registry, duration=0, ) sub_processes = [ model.BasicActivity( env=env, name="Basic activity1", registry=registry, duration=14, additional_logs=[reporting_activity], ), model.BasicActivity( env=env, name="Basic activity2", registry=registry, duration=5, additional_logs=[reporting_activity], ), model.BasicActivity( env=env, name="Basic activity3", registry=registry, duration=220, additional_logs=[reporting_activity], ), ] activity = model.ParallelActivity( env=env, name="Parallel process", registry=registry, sub_processes=sub_processes, ) model.register_processes([activity]) env.run() assert env.now == 220 assert_log(activity) assert_log(reporting_activity)
def test_sequence(): """Test the sequence activity.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} reporting_activity = model.BasicActivity( env=my_env, name="Reporting activity", registry=registry, duration=0, ) sub_processes = [ model.BasicActivity( env=my_env, name="Basic activity1", registry=registry, duration=14, additional_logs=[reporting_activity], ), model.BasicActivity( env=my_env, name="Basic activity2", registry=registry, duration=5, additional_logs=[reporting_activity], ), model.BasicActivity( env=my_env, name="Basic activity3", registry=registry, duration=220, additional_logs=[reporting_activity], ), ] activity = model.SequentialActivity( env=my_env, name="Sequential process", registry=registry, sub_processes=sub_processes, ) model.register_processes([activity]) my_env.run() assert my_env.now == 239 assert_log(activity)
def test_basic_activity(self): simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} act = model.BasicActivity( env=my_env, name="Basic activity", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, duration=14, ) model.register_processes([act]) my_env.run() assert my_env.now == 14
def test_start_at_timeout(self): simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} act = model.BasicActivity( env=my_env, name="Basic activity", registry=registry, duration=14, start_event={ "type": "time", "start_time": 10, }, ) model.register_processes([act]) my_env.run() assert my_env.now == 24 assert_log(act)
def test_process_synchronization(): """Test process synchronization.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} reporting_activity = model.BasicActivity( env=my_env, name="Reporting activity", registry=registry, duration=0, ) act1 = model.BasicActivity( env=my_env, name="Activity1", registry=registry, additional_logs=[reporting_activity], duration=14, ) act2 = model.BasicActivity( env=my_env, name="Activity2", registry=registry, additional_logs=[reporting_activity], start_event=[{ "type": "activity", "name": "Activity1", "state": "done" }], duration=30, ) model.register_processes([reporting_activity, act1, act2]) my_env.run() assert my_env.now == 44 assert_log(act1) assert_log(act2) assert_log(reporting_activity)
"name": "Hopper 01", "geometry": location_from_site, "capacity": 1000, "compute_v": lambda x: 10 + 2 * x, "loading_rate": 1, "unloading_rate": 5, } hopper = TransportProcessingResource(**data_hopper) (single_run, while_activity) = model.single_run_process( name="single_run", registry={}, env=my_env, origin=from_site, destination=to_site, mover=hopper, loader=hopper, unloader=hopper, ) model.register_processes([while_activity]) my_env.run() assert my_env.now == 13699.734162066252 assert_log(hopper) assert_log(from_site) assert_log(to_site) assert_log(while_activity)
def test_mulitcontainer(): """Test the multicontainer.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasMultiContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.MultiContainerDependentMovable, core.Processor, core.HasResource, core.LoadingFunction, core.UnloadingFunction, ), {}, ) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) from_site = Site( env=my_env, name="Winlocatie", ID="6dbbbdf4-4589-11e9-a501-b469212bff5d", geometry=location_from_site, store_capacity=4, initials=[ {"id": "MP", "level": 2, "capacity": 10}, {"id": "TP", "level": 0, "capacity": 2}, ], ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", ID="6dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=1, unloading_rate=1, store_capacity=4, compute_v=lambda x: 10, initials=[ {"id": "MP", "level": 0, "capacity": 2}, {"id": "TP", "level": 0, "capacity": 2}, ], ) activity = model.ShiftAmountActivity( env=my_env, name="Transfer MP", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff52", registry=registry, processor=hopper, origin=from_site, destination=hopper, amount=1, id_="MP", duration=20, ) model.register_processes([activity]) my_env.run() assert my_env.now == 20 assert hopper.container.get_level(id_="MP") == 1 assert hopper.container.get_level(id_="TP") == 0 assert from_site.container.get_level(id_="TP") == 0 assert from_site.container.get_level(id_="MP") == 1 assert_log(hopper) assert_log(activity) assert_log(from_site)
def test_shift_amount(): """Test the shift amount activity.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.Processor, core.HasResource, core.LoadingFunction, core.UnloadingFunction, ), {}, ) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) from_site = Site( env=my_env, name="Winlocatie", geometry=location_from_site, capacity=10, level=2, ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", geometry=location_from_site, loading_rate=1, unloading_rate=1, capacity=5, compute_v=lambda x: 10, ) activity = model.ShiftAmountActivity( env=my_env, name="Transfer MP", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, processor=hopper, origin=from_site, destination=hopper, amount=100, duration=10, ) model.register_processes([activity]) my_env.run() assert my_env.now == 10 assert_log(from_site) assert_log(hopper) assert_log(activity)
def test_nested_cycles(): """Test nested cycles.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.Processor, core.HasResource, core.LoadingFunction, core.UnloadingFunction, ), {}, ) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) location_to_site = shapely.geometry.Point(4.25222222, 52.11428333) from_site = Site( env=my_env, name="Winlocatie", ID="6dbbbdf4-4589-11e9-a501-b469212bff5d", geometry=location_from_site, capacity=100, level=50, ) to_site = Site( env=my_env, name="Dumplocatie", ID="6dbbbdf5-4589-11e9-82b2-b469212bff5c", geometry=location_to_site, capacity=50, level=0, ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", ID="6dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=0.00001, unloading_rate=0.00001, capacity=5, compute_v=lambda x: 10, ) loading_subcycle_processes = [ model.BasicActivity( env=my_env, name="loading activity 1", registry=registry, duration=100, additional_logs=[hopper], ), model.ShiftAmountActivity( env=my_env, name="Transfer MP", registry=registry, processor=hopper, origin=from_site, destination=hopper, amount=1, duration=1000, ), model.BasicActivity( env=my_env, name="loading activity 2", registry=registry, duration=100, additional_logs=[hopper], ), ] loading_subcycle_process = model.RepeatActivity( env=my_env, name="while_loading_subcycle", registry=registry, sub_processes=[ model.SequentialActivity( env=my_env, name="Loading subcycle", registry=registry, sub_processes=loading_subcycle_processes, ) ], repetitions=5, ) unloading_subcycle_processes = [ model.BasicActivity( env=my_env, name="unloading activity 1", registry=registry, duration=100, additional_logs=[hopper], ), model.ShiftAmountActivity( env=my_env, name="Transfer TP", registry=registry, processor=hopper, origin=hopper, destination=to_site, amount=1, duration=1000, ), model.BasicActivity( env=my_env, name="unloading activity 2", registry=registry, duration=100, additional_logs=[hopper], ), ] unloading_subcycle_process = model.RepeatActivity( env=my_env, name="while_unloading_subcycle", registry=registry, sub_processes=[ model.SequentialActivity( env=my_env, name="unloading subcycle", registry=registry, sub_processes=unloading_subcycle_processes, ) ], repetitions=5, ) single_run = [ model.BasicActivity( env=my_env, name="Basic activity 3", registry=registry, duration=100, additional_logs=[hopper], ), model.MoveActivity( env=my_env, name="sailing empty", registry=registry, mover=hopper, destination=from_site, duration=500, ), loading_subcycle_process, model.MoveActivity( env=my_env, name="sailing filled", registry=registry, mover=hopper, duration=500, destination=to_site, ), unloading_subcycle_process, model.BasicActivity( env=my_env, name="Basic activity", registry=registry, duration=100, additional_logs=[hopper], ), ] activity = model.SequentialActivity( env=my_env, name="Single run process", registry=registry, sub_processes=single_run, ) while_activity = model.WhileActivity( env=my_env, name="while", registry=registry, sub_processes=[activity], condition_event=[{ "type": "container", "concept": to_site, "state": "full" }], ) model.register_processes([while_activity]) my_env.run() assert my_env.now == 132000 assert_log(while_activity)
def test_test_resource_synchronization(): """Test resource Synchronization.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.Processor, core.HasResource, core.LoadingFunction, core.UnloadingFunction, ), {}, ) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) from_site = Site( env=my_env, name="Winlocatie", ID="6dbbbdf4-4589-11e9-a501-b469212bff5d", geometry=location_from_site, capacity=10, level=8, ) hopper1 = TransportProcessingResource( env=my_env, name="Hopper 01", ID="6dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=1, unloading_rate=1, capacity=4, compute_v=lambda x: 10, ) hopper2 = TransportProcessingResource( env=my_env, name="Hopper 02", ID="5dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=1, unloading_rate=1, capacity=4, compute_v=lambda x: 10, ) requested_resources1 = {} activity1 = model.ShiftAmountActivity( env=my_env, name="Transfer1", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff52", registry=registry, processor=hopper1, origin=from_site, destination=hopper1, amount=1, duration=20, requested_resources=requested_resources1, ) seq_activity1 = model.SequentialActivity( env=my_env, name="Sequential process1", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=[activity1], requested_resources=requested_resources1, ) while1 = model.WhileActivity( env=my_env, name="while1", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5g", registry=registry, sub_processes=[seq_activity1], requested_resources=requested_resources1, condition_event=[{ "or": [ { "type": "container", "concept": hopper1, "state": "full" }, { "type": "container", "concept": from_site, "state": "empty" }, ] }], ) activity2 = model.ShiftAmountActivity( env=my_env, name="Transfer2", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff52", registry=registry, processor=hopper2, origin=from_site, destination=hopper2, amount=1, duration=20, ) seq_activity2 = model.SequentialActivity( env=my_env, name="Sequential process2", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=[activity2], ) while2 = model.WhileActivity( env=my_env, name="while2", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff5g", registry=registry, sub_processes=[seq_activity2], condition_event=[{ "or": [ { "type": "container", "concept": hopper2, "state": "full" }, { "type": "container", "concept": from_site, "state": "empty" }, ] }], ) model.register_processes([while1, while2]) my_env.run() assert my_env.now == 160 assert_log(from_site) assert_log(while1) assert_log(while2)
def test_weather(): """Test function for weather plugin.""" simulation_start = datetime.datetime(2009, 1, 1) my_env = simpy.Environment(initial_time=simulation_start.timestamp()) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.Processor, core.HasResource, ), {}, ) TestMoveActivity = type( "TestMoveActivity", ( plugin.HasWeatherPluginActivity, model.MoveActivity, # the order is critical! ), {}, ) TestShiftActivity = type( "TestShiftActivity", ( plugin.HasWeatherPluginActivity, model.ShiftAmountActivity, # the order is critical! ), {}, ) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) # lon, lat location_to_site = shapely.geometry.Point(4.25222222, 52.11428333) # lon, lat from_site = Site( env=my_env, name="Winlocatie", geometry=location_from_site, capacity=120, level=120, ) to_site = Site( env=my_env, name="Dumplocatie", geometry=location_to_site, capacity=120, level=0, ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", geometry=location_from_site, capacity=4, compute_v=lambda x: 10, ) parent = Path(__file__).resolve().parent metocean_df = pd.read_csv(parent / "data" / "unit_test_weather.csv") metocean_df = metocean_df.set_index( pd.to_datetime(metocean_df["Time"], dayfirst=True)) metocean_df = metocean_df.sort_index() metocean_df["Hs [m]"] = ( 4 + 1.5 * np.sin(metocean_df[" Hour"] / 24 * 8 * np.pi) + 1.5 * np.sin(metocean_df[" Hour"] / 24 * 6 * np.pi)) metocean_df = metocean_df.set_index( pd.to_datetime(metocean_df["Time"], dayfirst=True)) metocean_df = metocean_df.sort_index() metocean_df["ts"] = metocean_df.index.values.astype(float) / 1_000_000_000 sailing_crit = plugin.WeatherCriterion( name="sailing_crit", condition="Hs [m]", maximum=6, window_length=3600, ) loading_crit = plugin.WeatherCriterion( name="loading_crit", condition="Hs [m]", maximum=4.5, window_length=3600, ) single_run = [ TestMoveActivity( env=my_env, name="sailing empty", registry=registry, mover=hopper, destination=from_site, metocean_criteria=sailing_crit, metocean_df=metocean_df, ), TestShiftActivity( env=my_env, name="Loading", registry=registry, processor=hopper, origin=from_site, destination=hopper, amount=4, duration=3600, metocean_criteria=loading_crit, metocean_df=metocean_df, ), TestMoveActivity( env=my_env, name="sailing full", registry=registry, mover=hopper, destination=to_site, metocean_criteria=sailing_crit, metocean_df=metocean_df, ), TestShiftActivity( env=my_env, name="unloading", registry=registry, processor=hopper, origin=hopper, destination=to_site, amount=4, duration=3600, metocean_criteria=loading_crit, metocean_df=metocean_df, ), ] activity = model.SequentialActivity( env=my_env, name="Single run process", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=single_run, ) while_activity = model.WhileActivity( env=my_env, name="while", registry=registry, sub_processes=[activity], condition_event=[{ "type": "container", "concept": to_site, "state": "full" }], ) model.register_processes([while_activity]) my_env.run() assert my_env.now == 1262737885.6491823 assert_log(hopper) assert_log(while_activity)
def test_move_activity(): """Test the move acitity.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) location_to_site = shapely.geometry.Point(4.25222222, 52.11428333) Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.HasResource, core.Processor, core.LoadingFunction, core.UnloadingFunction, ), {}, ) to_site = Site( env=my_env, name="Dumplocatie", ID="6dbbbdf5-4589-11e9-82b2-b469212bff5b", geometry=location_to_site, capacity=10, level=0, ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", ID="6dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=1, unloading_rate=1, capacity=5, compute_v=lambda x: 10, ) activity = model.MoveActivity( env=my_env, name="Soil movement", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, mover=hopper, destination=to_site, ) model.register_processes([activity]) my_env.run() assert my_env.now == 942.8245912734186 assert_log(activity) assert_log(hopper) assert_log(to_site)
def test_delay_plugin(): """Test the delay plugin.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} Site = type( "Site", ( core.Identifiable, core.Log, core.Locatable, core.HasContainer, core.HasResource, ), {}, ) TransportProcessingResource = type( "TransportProcessingResource", ( core.Identifiable, core.Log, core.ContainerDependentMovable, core.Processor, core.HasResource, core.LoadingFunction, core.UnloadingFunction, ), {}, ) DelaySequenceActivity = type( "TestShiftActivity", (plugins.HasDelayPlugin, model.SequentialActivity), {}) DelayWhileActivity = type("TestShiftActivity", (plugins.HasDelayPlugin, model.WhileActivity), {}) DelayMoveActivity = type("TestMoveActivity", (plugins.HasDelayPlugin, model.MoveActivity), {}) DelayShiftActivity = type( "TestShiftActivity", (plugins.HasDelayPlugin, model.ShiftAmountActivity), {}) DelayBasicActivity = type("TestShiftActivity", (plugins.HasDelayPlugin, model.BasicActivity), {}) location_from_site = shapely.geometry.Point(4.18055556, 52.18664444) location_to_site = shapely.geometry.Point(4.25222222, 52.11428333) from_site = Site( env=my_env, name="Winlocatie", ID="6dbbbdf4-4589-11e9-a501-b469212bff5d", geometry=location_from_site, capacity=12, level=12, ) to_site = Site( env=my_env, name="Dumplocatie", ID="6dbbbdf5-4589-11e9-82b2-b469212bff5c", geometry=location_to_site, capacity=12, level=0, ) hopper = TransportProcessingResource( env=my_env, name="Hopper 01", ID="6dbbbdf6-4589-11e9-95a2-b469212bff5b", geometry=location_from_site, loading_rate=1, unloading_rate=1, capacity=4, compute_v=lambda x: 10, ) single_run = [ DelayMoveActivity( env=my_env, name="sailing empty", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5d", registry=registry, mover=hopper, destination=from_site, delay_percentage=10, ), DelayShiftActivity( env=my_env, name="Transfer MP", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff52", registry=registry, processor=hopper, origin=from_site, destination=hopper, amount=4, duration=10, delay_percentage=10, ), DelayMoveActivity( env=my_env, name="sailing filler", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, mover=hopper, destination=to_site, delay_percentage=10, ), DelayShiftActivity( env=my_env, name="Transfer TP", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff54", registry=registry, processor=hopper, origin=hopper, destination=to_site, amount=4, duration=10, delay_percentage=10, ), DelayBasicActivity( env=my_env, name="Basic activity", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5h", registry=registry, duration=0, additional_logs=[hopper], delay_percentage=10, ), ] activity = DelaySequenceActivity( env=my_env, name="Single run process", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=single_run, delay_percentage=10, ) while_activity = DelayWhileActivity( env=my_env, name="while", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5g", registry=registry, sub_processes=[activity], condition_event=[{ "type": "container", "concept": to_site, "state": "full" }], delay_percentage=10, ) model.register_processes([while_activity]) my_env.run() assert my_env.now == 6354.357654924601 assert_log(while_activity) assert_log(hopper) assert_log(from_site) assert_log(to_site)
def test_complex_synchronization(): """Test complex synchronization.""" simulation_start = 0 my_env = simpy.Environment(initial_time=simulation_start) registry = {} keep_resources = {} reporting_activity = model.BasicActivity( env=my_env, name="Reporting activity", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5k", registry=registry, duration=0, keep_resources=keep_resources, ) sub_processes = [ model.BasicActivity( env=my_env, name="A Basic activity1", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, duration=14, additional_logs=[reporting_activity], keep_resources=keep_resources, ), model.BasicActivity( env=my_env, name="A Basic activity2", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5c", registry=registry, duration=10, additional_logs=[reporting_activity], keep_resources=keep_resources, ), model.BasicActivity( env=my_env, name="A Basic activity3", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff5d", registry=registry, duration=220, additional_logs=[reporting_activity], keep_resources=keep_resources, start_event=[{ "type": "activity", "name": "B Basic activity2", "state": "done" }], ), ] sub_processes2 = [ model.BasicActivity( env=my_env, name="B Basic activity1", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff5b", registry=registry, duration=1, additional_logs=[reporting_activity], keep_resources=keep_resources, ), model.BasicActivity( env=my_env, name="B Basic activity2", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff5c", registry=registry, duration=500, additional_logs=[reporting_activity], keep_resources=keep_resources, ), model.BasicActivity( env=my_env, name="B Basic activity3", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff5d", registry=registry, duration=120, additional_logs=[reporting_activity], keep_resources=keep_resources, ), ] B = model.SequentialActivity( env=my_env, name="B Sequential process", ID="5dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=sub_processes2, keep_resources=keep_resources, ) A = model.SequentialActivity( env=my_env, name="A Sequential process", ID="6dbbbdf7-4589-11e9-bf3b-b469212bff60", registry=registry, sub_processes=sub_processes, keep_resources=keep_resources, ) model.register_processes([A, B, reporting_activity]) my_env.run() assert my_env.now == 721 assert_log(reporting_activity) assert_log(A) assert_log(B)