Wednesday, February 22, 2012

Interactive MT Connect Simulator

In the series of posts I made on MT Connect and a viewer I created for consuming some of this data, I also put up a post on a simulator for feeding data into MT Connect without having an actual machine. The simulator was based in Visio, where I could draw a "toolpath" to follow and a little shape would follow the path spitting out coordinates and breaking down intermittently, all the while pushing data to an MT Connect agent.

This simulator didn't work well for use in developing an MT Connect client I've been working on, because it was just a bit too random. I could never really demonstrate the software the way I wanted, having to wait an indeterminate amount of time for something I wanted to have happen, happen.

So I decided to mess around with building an interactive tool I could use to give a more predictable feel to the demo. I wanted to be able to, for instance, put a machine into a broken-down state and take it out of that state at will. I wanted to preempt a process if it was taking too long, or needed to get another part on the machine.

So the premise for how this simulator works is, I have a bank of machines, as well as some number of part types (3 for now). Each part type has its own processing sequence, and takes a different path through the machines. Each process also has a processing time distribution assigned to it, so they're somewhat randomly distributed (I think just normal).

To use the simulator, then, you grab a part from one of the in queues, and drop it onto a machine. The machine takes over, and runs for a time, and spits the part to the right of the machine. You then have to pick up the part and drop it in the out queue, and it travels to the next queue in its sequence.

Behind the scenes, I have javascript that uses an HTTP PUT to an MT Connect agent (has to go through a PHP script because of cross site scripting issues) whenever some event occurs (part on machine, part off, machine state change, etc...). Double clicking on the left arrow for a machine will make the machine "break down." The right arrow will restart the machine when double clicked. Double clicking the machine with a part on it will preempt the process and kick the part off the machine. It'll have to finish on the machine later. Double clicking the out queue will also preempt the process, but the part is considered "finished" and moves on to its next process.

You can play with it below, and muck around in the source code if you want. It's all made using HTML and javascript, utilizing the Raphael scalable vector graphics library to make the graphics easy. Cool thing is, this more or less works on any browser (thanks to Raphael's support of VML for older versions of IE). At some point I hope to start this as an open-source project so others can add new data items. It'd be good, too, to be able to point this thing at other agents, so anyone can use it. Right now it's hooked to the .NET agent running on our network, so you need a secret code to start submitting to it.

Any comments or suggestions would be more than welcome.




1 comment:

Unknown said...

The link does not work..
Do you have a new one?

Tim