I want to get many items from FilterStore .
factory.stock_part.items FilterStore is list type
[{'order_id': 534066215, 'id': 0}, {'order_id': 534066215, 'id': 1}, {'order_id': 534066215, 'id': 2}, {'order_id': 534066215, 'id': 3}, {'order_id': 534066215, 'id': 4}, {'order_id': 534066215, 'id': 5}, {'order_id': 534066215, 'id': 6}, {'order_id': 534066215, 'id': 7}, {'order_id': 534066215, 'id': 8}] and I want to use: factory.stock_part.get()
to get five items
factory.stock_part.get(5) is not work.
How do I resolve this? Here's the full code:
import simpy class Factory(): def __init__(self, env): self.stock_part = simpy.FilterStore(env, capacity = 100000) def stock_out(env,factory): while True: yield env.timeout(10) #in here I hope the inventory reduce 3,but one of the following 3 lines is not work factory.stock_part.get(5) factory.stock_part.get()[0:3] factory.stock_part.get(factory.stock_part.items[0:3]) env = simpy.Environment() factory = Factory(env) #create inventory list factory.stock_part.put({'id':1}) factory.stock_part.put({'id':2}) factory.stock_part.put({'id':3}) factory.stock_part.put({'id':4}) factory.stock_part.put({'id':5}) on_process = env.process(stock_out(env, factory)) print('start') env.run(until = 300) print('end') https://stackoverflow.com/questions/66560909/i-want-go-get-many-items-from-filterstore-in-simpy-python March 10, 2021 at 04:25PM
没有评论:
发表评论