Propina,Ispin:带有旋转的模型检查器Promela建模

时间:2019-02-10 12:19:22

标签: model promela spin

每次尝试运行代码时,我都会使用自旋模型检查器进行模型检查验证:

  

旋转: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 }
}

1 个答案:

答案 0 :(得分:0)

与此有关的两个问题:

  1. 全局声明msg_signal,而不在main中声明。
  2. 您还有很多未定义的内容(例如GREEN_INTERVAL0YELLOW_INTERVALsetclock