英文:
How to limit the number of loop of one agent in a block in anylogic?
问题
我正在研究一个模型,在这个模型中,顾客首先占用接待区(在接待处点餐),然后释放接待区并移动到占用餐桌(坐在餐桌上)。现在我已经使用了选择输出(参见图像),这使得顾客可以在不占用额外餐桌的情况下再点一杯酒,因为他们已经占用了一个餐桌。
现在我想将这个循环限制在8次之内。也就是说,一个顾客最多可以点8杯酒(一个代理可以在系统中进行8次服务/延迟)。
英文:
I am working on a model, where customer seize reception (order at reception for food) and then releases the reception and moves to seize dining table (sit at table). Now I have used select output (see image) which allows the customer to have another drink without seizing additional dining table because they already have seized one dining table.
Now I want to limit this loop to the number 8. That is one customer can have a maximum of 8 drinks (one agent can be in the system for 8 services/delay).
答案1
得分: 0
将一个名为counter
的int
变量放入您的客户代理中,并在客户每次循环时将其增加1。
您需要设置流程图块以“知道”它是客户在流动。
然后,在其中一个块的代码部分,您可以编写agent.counter ++;
。
英文:
Put a int
variable (name it counter
) into your customer agent and add 1 to it every time the customer makes a loop.
You need to setup the flow chart blocks to "know" that it is customers flowing through.
Then, in one of the block's code sections, you can write agent.counter ++;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论