The if statement in your steak process will just loop infinitely since it never hits a yield statement. If I understand correctly you want to start the steak process when the soup_finish container reaches a level of 3?
You could yield to a get request of 3 from that container (then immediately put 3 back if desired) before entering the main process loop like so:
def steak(env, cooking):
yield cooking.soup_finish.get(3)
cooking.soup_finish.put(3)
while True:
yield cooking.steak_start.get(1)
steak_time = 2
yield env.timeout(steak_time)
yield cooking.steak_finish.put(1)
Or use a container for soup_finish that overrides the put method to check when the level first reaches 3 to trigger the steak process:
class SoupFinishContainer(simpy.Container):
def __init__(self, env, capacity, init):
super().__init__(env, capacity, init)
self.triggered = False
def put(self, amount):
if not self.triggered and self.level >= 3:
self.triggered = True
self._env.process(steak(self._env, cooking))
return super().put(amount)