Saturday, November 13, 2010

Complex data interface in LabVIEW

As I posted before I’m doing an application to manage and control data acquisition from some specific instruments. The application have some tabs with different controls and indicators and in the background have a very complex data flow that have been processing as fast as the computer can. All this data must be showed to the user but with the smallest amount of resources.

In LabVIEW it’s easy to implement a refresh routine to shown data. It’s easy as:

imageThis basic loop puts data into a control every iteration, but as you can see is not controlled in time or in valid data at the input. Of course this loop takes all the processor and resources of the system.

How about this solution?:

image

Ok, as you can see it’s a much more smart solution, didn’t it? It have a strong synchronization not only with the data flow (because of the notifier used) it have a minimum refresh interval that can be configured. An the case structure avoids the write of not valid data. This is a better implementation for data interface update, I'm not absolutely sure that is the best, because depends of the application, but is quite good.

Now I want to show my problem and my solution.

When I started to develop Lightbox I have a huge problem: A lot of different interfaces must be showed to the user only when they are needed. My first design consist on a hard and big galaxy of cases and loops. It was unreadable, and I’m sure that uses a lot of resources.

I improve the system with the next solution that I think it’s much more dynamic and light.

The interface:

image image

Let’s think that the interface has some controls in two tabs because it’s the same information but with different representations process. Also we have a very fast data flow in the background that has being processing in parallel.

Ok, the representation of a graph is much more heavy than the numeric indicators, but this two representations doesn’t need to be done at the same time because the user can’t see both together. (Think in too much tabs and more complex data right now… It can be a chaos!!)

What we can do?… Dynamic events, you can synchronize the update instructions with the next system:

image image

It’s quite complex for basic purposes, but when you have a big application it’s good:

  • The program only update the values when the user are seeing it.
  • The refresh time can be dynamically defined if you want. It can depends on the user, other vi’s that calculates the power of the PC or something like that.
  • The update is done as fast as the system look at the event structure.
  • In some complex cases you can use all the possibilities of the timed loop structures to prioritize or dynamically control the system. (Think about a terminal program to show results that gets data from a shared variable in a network. This system can also control the usage of the network or thinks like that).

Here end’s this post. I hope that you meet it useful… What do you think?

No comments:

Post a Comment