简体   繁体   English

AnyLogic人口位置

[英]AnyLogic location of population

I created a function to move agents from my population (database) into a process.我创建了一个 function 来将代理从我的人口(数据库)移动到一个进程中。

Somehow it throws an Error它以某种方式抛出错误

Exception during discrete event execution:
root.<population>[0]:
This agent isn't located in any space

The goal of my model is that transporters arrive at certain arrival times (the same date as in the model) from a dataset in my factory:我的 model 的目标是运输车从我工厂的数据集中到达特定的到达时间(与模型中的日期相同):

在此处输入图像描述

在此处输入图像描述

My steps until now:到目前为止我的步骤:

  1. Create a population with agents of the type of my agents and fill them with the values of my data用我的代理类型的代理创建一个群体,并用我的数据值填充它们

  2. create an event which checks every minute for all objects of my population if their arrival time equals the models time创建一个事件,如果它们的到达时间等于模型时间,则每分钟检查我人口中的所有对象

  3. Write a function that enters them into my process and on the road to come to my factory写一个 function 让他们进入我的流程并在来我工厂的路上

Therefor every transporter exists already before being entered into my process so that the event can check the condition.因此,每个传输器在进入我的流程之前就已经存在,以便事件可以检查条件。

My problem: When the condition is true and the object should enter my process an error occurs:我的问题:当条件为真且 object 应该进入我的进程时,出现错误:

Exception during discrete event execution:
    root.<population>[0]:
    This agent isn't located in any space

I don't understand why they dont have their initial space already.我不明白为什么他们还没有初始空间。 I tried to set the space on the enter block with agent.setSpace(getSpace()) but nothing changed.我尝试使用agent.setSpace(getSpace())在输入块上设置空间,但没有任何改变。 My population is also in the main method我的population也在main方法中在此处输入图像描述 Properties of pop:流行的属性: 在此处输入图像描述

在此处输入图像描述

properties agent:物业代理: 在此处输入图像描述 在此处输入图像描述

Agents are not data.代理不是数据。 They need a space.他们需要一个空间。 By default, it is the space of the ebmedding agent of their population (typically Main if the population is on Main ).默认情况下,它是其种群的 ebmedding 代理的空间(如果种群位于Main上,则通常为Main )。

If your Enter block is not in the same agent as the population was beforehand, you need to call agent.setSpace(getSpace()) in the "on enter" code box of the "Enter" block.如果您的Enter块与之前的人口不在同一个代理中,则需要在“Enter”块的“on enter”代码框中调用agent.setSpace(getSpace())

This should assign the agents to use the new space of the embedding agent这应该分配代理使用嵌入代理的新空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM