如何在AB模型中使用Vehicle inState命令

时间:2019-02-12 22:16:42

标签: anylogic

在具有GIS模型的供应链中,我试图使用以下事件使用工厂和零售商之间的主要事件来计算行进距离。我收到此错误消息:

The method Instate( Vehicles. statechart_state) is undefined by the state T

这是什么意思?

还有另一种方法来计算设施之间的总距离吗?

我尝试了DistanceByRoute(agent),但没有得到任何输出。

Vehicles vehicles = getRandom(filter(vehicles, v -> v.inState(Vehicles.AtRetailers) ) );if (vehicles != null) {send("go", vehicles);}

1 个答案:

答案 0 :(得分:0)

该错误消息提示您的代码正在检查代理状态。尝试以下方法:

Vehicles vehicles = getRandom(filter(vehicles, v -> v.mySDtatechart.isStateActive(Vehicles.AtRetailers) ) );

其中“ myStateChart”是您的Vehicle代理类中的状态图,“ AtRetailers”是您正在myStateChart中检查的状态。