【问题标题】:AnyLogic define speed for agents in MainAnyLogic 为 Main 中的代理定义速度
【发布时间】:2014-09-17 07:14:25
【问题描述】:

我想在 main 中的参数 walkSpeed 中为我的所有代理定义速度,也就是速度。 如何从代理内部的“初始速度”设置中访问它?

documentation 推荐使用的“Main().walkingSpeed”不起作用:(

SetUp:
Main----------------------Patient
(has walkingSpeed)      |-Nurse
                        |-Internist
                        |-Surgeon



2014-08-01 更新:使用 get_Main 也不起作用

【问题讨论】:

  • " 不工作“太好了,我知道现在问题出在哪里了...
  • 感谢 James,详细的错误消息“未为 Internist 类型定义 Main() 方法。位置:Zana/Internist - Agent Type”

标签: java simulation anylogic


【解决方案1】:

假设您的 Main 中有 Agent Patient 实例。要访问为 Main 定义的参数 speed,您必须调用:get_Main().speed

如果你想从 Patien 中访问 Main 中 Agents 的其他参数,你调用:get_Main().otherAgent.get(i).otherParameter

如果你想从Patient内部访问Patient内部Agents的参数,你可以简单地调用:otherAgent.get(i).otherParameter,不过这里还是建议走Main。

【讨论】:

  • 很遗憾没有工作。我用结果的屏幕截图更新了我的问题。任何想法我做错了什么?我也试过变量!
  • 您确定您的 Main 中有您的 Patient Agent 实例吗?否则将无法正常工作。
  • 它们是由 Main 中的源元素创建的。这够了吗?
  • 否,那么您必须通过当前创建的实体之一访问参数。我推荐公司创始人的 Anylogic 书籍,作为第一次阅读模拟。有些章节很有帮助,在 API 中查看可用方法也很有帮助。
  • 这更像是一个一般性的建议 :D 我可以马上把你和相应的页面联系起来,因为我拍了一张照片,因为它对我非常有用^^ p。第422章
猜你喜欢
  • 2020-04-26
  • 2021-05-08
  • 2021-10-11
  • 2021-10-19
  • 2019-11-18
  • 1970-01-01
  • 2018-07-22
  • 2017-01-03
  • 2018-10-19
相关资源
最近更新 更多