![](/img/trans.png)
[英]The method areEqualByThreeDecimalPlace(double, double) is undefined for the type DecimalComparator
[英]The method getDistanceByRoute(double, double, double, double) is undefined for the type Car Anylogic
我是 Anylogic 的新手,我正在研究 model,其中一些汽車使用我在 GIS map 中創建的 GIS 路線從 A 點行駛到 B 點。
我需要使用 function getDistanceByRoute 來使用緯度和經度進行一些計算,但它不起作用並且給出了此錯誤:
說明:方法 getDistanceByRoute(double, double, double, double) 未針對 Car 類型定義。 位置:dinamic3/Car/moving_to_CS - State
我不知道如何解決這個問題,我嘗試了 function getDistanceGIS 並且它有效,但我需要使用 getDistanceByRoute,它對距離測量更精確。
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state at_Milano = statechart_state.at_Milano;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state moving_to_Cortina = statechart_state.moving_to_Cortina;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state moving_to_CS = statechart_state.moving_to_CS;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state at_CS = statechart_state.at_CS;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state state5 = statechart_state.state5;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state at_Cortina = statechart_state.at_Cortina;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state state4 = statechart_state.state4;
@AnyLogicCustomProposalPriority(type = AnyLogicCustomProposalPriority.Type.STATIC_ELEMENT)
public static final statechart_state finalState = statechart_state.finalState;
@AnyLogicInternalCodegenAPI
private void enterState( statechart_state self, boolean _destination ) {
switch( self ) {
case at_Milano:
logToDBEnterState(statechart, self);
// (Simple state (not composite))
statechart.setActiveState_xjal( at_Milano );
transition2.start();
return;
case moving_to_Cortina:
logToDBEnterState(statechart, self);
// (Composite state)
{
moveTo(main.cortina);
consumption_switch=1;
charging_switch=0;
time=time();
;}
transition3.start();
transition5.start();
if ( _destination ) {
enterState( state4, true );
}
return;
case moving_to_CS:
logToDBEnterState(statechart, self);
// (Composite state)
{
double a;
double b;
double c;
double d;
a=main.charging_stations.get(k+1).lat_cs;
b=main.charging_stations.get(k+1).lon_cs;
c=main.charging_stations.get(k).lat_cs;
d=main.charging_stations.get(k).lon_cs;
x=(getDistanceByRoute(lat_1,lon_1,a,b)*0.001);
要使這個 function 起作用,您需要引用您希望它應用到的 map:
map.getDistanceByRoute(double, double, double, double);
所以一定要加上“地圖”。 到你的代碼,如果這是你的名字 map object。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.