用条件建模FSM? [英] Modeling FSM with conditions?

查看:101
本文介绍了用条件建模FSM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该对FSM进行建模,但是不确定如何对条件进行建模.让我们以简单的ATM示例为例:

I am supposed to model a FSM but I am unsure how to model conditions. Let's take the simple ATM example:

  • 如果用户按确认"并且PIN码正确,请转到状态2.

  • If user presses "Confirm" AND PIN is correct, go to State 2.

如果用户按确认"并且PIN码不正确,请转到状态3.

If user presses "Confirm" AND PIN is not correct, go to State 3.

还是我可以简单地使用称为错误的引脚"和正确的引脚"的输入?我需要它是正式的,以便我可以使用FSM测试程序,例如封面集生成等.但是我不知道是否可以用这种方式对FSM进行建模(也许添加表示其他条件的状态?)

Or could I simply use input called "wrong pin" and "correct pin"? I would need it to be formal so that I can employ FSM testing procedures, like cover set generation etc. But I do not know if FSM can be modeled this way (maybe with adding states representing additional conditions?)

推荐答案

是否对要使用的建模技术或语言有要求?

Is there a requirement about the modeling technique or language to be used?

如果不同意,我同意Svenja Wendler的回答,并建议使用 UML状态机器图用于此目的,它使您可以使用选择,还可以对状态转换中的保护条件和动作进行建模.

If not, I agree with Svenja Wendler's answer and would recommend using UML state machine diagrams for this purpose, allowing you to use choices and also to model guard conditions and actions on your state transitions.

这篇关于用条件建模FSM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆