我想在NuSMv中表达这个问题:
用户可以处于以下三种状态之一:U-需要,U-使用,U-悲伤(代表需要服务的用户,开始使用,他/她对此质量感到满意服务或开始使用,而他/她分别由于服务质量低劣而感到难过。
服务可以处于以下三种状态之一:S-offer,S-good,S-bad; ;(代表未使用的服务,指提供优质服务的服务 或质量分别较差的服务。)
一组事件:外观,使用,停止,监视,检测-p,补救-p,表示寻找服务,开始使用服务,停止使用服务,监视质量,检测问题维修并分别解决问题。
这是我的SMV代码:
MODULE main
VAR
Service: {S-offer,S-good,S-bad};
User:{U-need,U-using,U-sad};
Event:{look,use,stop,monitor,detect-p,remedy-p};
ASSIGN
init(Event) := look;
init(User) := U-need;
init(Service) := {S-offer,S-good};
next(Event) := case
(Event = look) & (Service=S-offer) : look;
(Event = look) & (Service=S-good) : use;
(Event = use) & (Service=S-good) : monitor;
(Event = monitor) & (Service=S-good) : {monitor,stop,detect-p};
(Event = detect-p) : remedy-p;
(Event = remedy-p) : monitor;
TRUE:Event;
esac;
next(User) := case
(Event = look) & next(Event)=look : U-need;
(Event = look) & next(Event)=use : U-using;
(Event = use) & next(Event)=monitor : U-using;
(Event = monitor) & next(Event)=monitor : U-using;
(Event = monitor) & next(Event)=stop : U-need;
(Event = monitor) & next(Event)=detect-p : U-sad;
(Event = detect-p ) & next(Event)=remedy-p : U-using;
TRUE:User;
esac;
next(Service) := case
(Event = look) & next(Event)=look : S-offer;
(Event = look) & next(Event)=use : S-good;
(Event = use) & next(Event)=monitor : S-good;
(Event = monitor) & next(Event)=monitor : S-good;
(Event = monitor) & next(Event)=stop : S-offer;
(Event = monitor) & next(Event)=detect-p : S-bad;
(Event = detect-p ) & next(Event)=remedy-p : S-good;
TRUE:Service;
esac;
-我想确认此代码代表我上面描述的问题 -我将事件和服务以及用户的状态都表示为变量,对吗?