资源的利用 [英] Utilization of a Resource
问题描述
有没有办法计算特定时间范围内给定资源的利用率?我有一台可以 24 小时工作的机器,但在白天,它的利用率高于夜间.在最终统计中,使用函数machine.utilization()"我得到的结果很低,这受夜间时间的影响.如何拆分这两个统计数据?
利用率的计算方式为(工作时间)/(不包括维护的可用时间).这意味着您的问题中描述的措施可以通过两种方式实现:
- 让机器在夜间不可用",这样时间就会被排除在计算中
- ResourcePool 对象有2个属性
资源占用
和资源释放
,可以用来记录工作时间的具体实例,总结一下向上并仅除以 (8hr * (num of days)) 而不是从模型开始的总时间
有关 AnyLogic 帮助的更多详细信息和链接,请在此处查看另一个问题的答案.
更新:在ResourcePool的On seize
和On release
中,AnyLogic提供了一个名为unit的参数,即具体的资源正在处理的单位代理.因此,获取每单位的实际使用时间需要以下内容:
- 2 个映射代理的 LinkedHashMap 类型的集合 ->双倍的.一个用于存储开始时间的集合(我们称之为
col_start
,一个用于存储总使用时间,我们称之为col_worked
) On seize
应包含以下代码:col_start.put(unit, time())
发布时
应包含:
double updated = col_worked.getOrDefault(unit, 0.0) + (time() - col_start.get(unit));col_worked.put(单位,更新);
这种方式在模型执行期间的任何给定点,col_worked
将包含资源单元代理到它被利用的总时间的映射,表示为模型时间单位的双精度值.>
Is there any way to calculate the utilization of a given resource in a specific time frame? I have a machine that works h24, but during daytime hours its utilization is higher than during nighttime hours. In the final statistics, using the function "machine.utilization()" I get a low result, which is influenced by the night hours. How can I split the two statistics?
Utilization is calculated as (work time)/(available time excluding maintenance). Which means that the measure described in your question can be achieved using 2 ways:
- Make the machine 'unavailable' during the night, this way that time will be excluded in calculations
- ResourcePool object has 2 properties
on resource seize
andon resource release
which can be used to record specific instances of work time, sum it up and divide only by a period of (8hr * (num of days)) instead of total time from model start
For a little more detail and link to AnyLogic help please see the answer to another question here.
Update:
In ResourcePool's On seize
and On release
, AnyLogic provides a parameter called unit, which is the specific resource unit agent being processed. So getting actual use time per unit requires following:
- 2 collections of type LinkedHashMap that maps Agent -> Double. One collection to store start times (let's call it
col_start
and one to store total use times, let's call itcol_worked
) On seize
should contain this code:col_start.put(unit, time())
On release
should contain:
double updated = col_worked.getOrDefault(unit, 0.0) + (time() - col_start.get(unit));
col_worked.put(unit, updated);
This way at any given point during model execution, col_worked
will contain a mapping of resource unit Agent to the total sum of time it was utilised expressed as a double value in model time units.
这篇关于资源的利用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!