你会如何​​设计一个应用程序运行的机器? [英] How would you design an application to run a machine?

查看:153
本文介绍了你会如何​​设计一个应用程序运行的机器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你问什么类型的机器?测量楔和透镜圆机器。

What type of machine you ask? A machine that measures wedge and roundness of lenses.

我已经写软件的机器,它是在生产,但它是脆,容易时,他们不这样做的事情以正确的顺序来锁定窗口。我试图想出最好的办法建筑师它,这样它的稳定​​和维护。

I've already written software for the machine and it is in production, but it is brittle and prone to lock ups when they dont do things in the right order. I'm trying to come up with the best way to architect it so that its stable and maintainable.

下面是快速第二十二跑下来。有两种模式,设置和运行。在设置模式下,操作员可以手动移动任何使用控制面板上的6个不同的瞬时切换开关之一的6种不同的电机。他们得到的一切驻留在,那么他们将其运行模式,加载伦泽和preSS去。机器会自动带来三大指标,找到伦泽的边缘,然后旋转主轴并测量周围的楔形的所有道路。

Here's the quick twenty second run down. There are two modes, setup and run. In setup mode the operator can manually move any of the 6 different motors using one of the 6 different momentary toggle switches on the control panel. They get everything homed in, then they turn it to run mode, load a lense, and press go. The machine will automatically bring in the three indicators, find the edge of the lense, and then rotate the spindle and measure all the way around the wedge.

我具有提出,说,当开关状态发生了改变,哪个开关是,其新的状态是什么样的事件类的一个非常贫困的非设计结束。然后,我做了很多IFS之类的东西,以确定哪些机器可以做。你可以想像,这是非常非常糟糕。

I ended with a very poor non-design of having a class that raised an event that says when a switch has changed state, which switch it was, and what its new state is. Then I do a lot of ifs and stuff to determine what the machine can do. As you can imagine, this is very very bad.

有没有人对如何构建这个什么好的建议?我有一些我自己的,但我想听到一些来自那些可能会多一点经验与这种类型的应用程序的开发。

Does anyone have any good ideas on how to structure this? I have some of my own, but I want to hear some from those that may be a little more experienced with this type of application development.

推荐答案

您需要的是建立一个有限状态机,这是模型就像你有一个问题的最好办法:

What you need is build a finite-state machine, that's the best way to model a problem like the one you have:

http://en.wikipedia.org/wiki/Finite_state_machine

这篇关于你会如何​​设计一个应用程序运行的机器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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