每次尝试运行代码时,我都会使用自旋模型检查器进行模型检查验证:
旋转:traffic_controller:12,错误:未声明的变量:to_green锯 '')'= 41'
子进程异常退出 我也已经宣布了。我正在使用旋转版本6.4.9
proctype traffic_controller(int id; int red; int green; int yellow)
{
bool event_flag = false;
int neighbor_id , send_node_id , interval ;
byte circular_ch[4];
mtype msg_signal ;
end_1 :
do
::circular_ch[ id ]?msg_signal (send_node_id);
if
:: ( msg_signal == to_green ) ;
green_state:
if
:: interval = GREEN_INTERVAL0 ;
:: interval = GREEN_INTERVAL1 ;
:: interval = GREEN_INTERVAL2 ;
fi;
set (clock [id] , interval) ;
red_activated_region_end :
red_signal [id] = false ;
green_activated_region_start ;
green_signal [id] = true ;
if
:: ( expire ( clock [id] ) ) -> clock [id] = ZERO;
green_activated_region_end :
green_signal [id] = false ;
goto yellow_state ;
fi;
yellow_state :
set ( clock [id] , YELLOW_INTERVAL ) ;
yellow_activated_region_start ;
yellow_signal [id] = false ;
if
:: ( expire ( clock [id] ) ) -> clock [id] = ZERO ;
yellow_activated_region_end :
yellow_signal [id] = false ;
if
:: (id != NUM_NODES-1) -> neighbor_id = id+1 ;
::else -> neighbor_id =ZERO;
fi;
red_signal [id] = true;
red_activated_region_start :
circular_ch [ neighbor_id ] ! to_green (id) ;
fi;
fi;
od;
}
init
{
run traffic_controller();
mtype : msg_signal = { to_green, pear, banana }
}
答案 0 :(得分:0)
与此有关的两个问题:
msg_signal
,而不在main
中声明。GREEN_INTERVAL0
,YELLOW_INTERVAL
,set
,clock
)