英文:
How to set distance of the path in Anylogic?
问题
我想要创建多条连接多个节点的路径,并使用 'MoveTo' 块来移动代理。
我想要通过 '距离/速度' 来定义移动,因为路径的距离不同。
我该如何设置每条路径的距离?
我在路径选项中寻找了距离选项,但没有找到。
英文:
I want to make several paths connecting several nodes and use 'MoveTo' block to move the agent.
I want to define the movement by 'distance/speed' since the distance of paths are different.
How can I set the distance of each path?
I looked for distance option in path, but i cannot find any.
答案1
得分: 1
为了做到这一点,你需要按照自己的方式创建距离,最简单的方法是使用一个LinkedHashMap,其中键将是路径,而值将是距离....然后在moveTo中,你只需使用theHashMapName.get(pathName)
来获取路径的距离。
另一个选项是在Process Modelling库中使用conveyor,而不是moveTo,因为使用它,你可以定义传送带的长度,但不确定这是否适用于你的情况,但你可以调查一下。
英文:
in order to do this, you need to create the distances your own way, the easiest way is a LinkedHashMap in which the key will be the path, and the value will be the distance.... Then in the moveTo you can just use theHashMapName.get(pathName)
to get the distance of the path
Another option is to use instead of moveTo, use conveyor from the Process Modelling library, because with it, you can define the length of the conveyor, but it's uncertain if this will work in your case, but you can investigate it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论