LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Some advice on Architecture

I would appreciate opinions on the architecture of a design I'm currently working on. Its predominately a Labview issue, but has some TestStand interactions so bear with me.....

 

***Environment...
TestStand 4.1 development
Labview 8.5.1 full development
Windows XP

 

I'm writing a Teststand test system using the parallel model with three sockets. All three sockets share several common hardware resources (DMM, DC source, barcode scanner etc).

 

My design allocates a Labview VI to each item of hardware, with the relevant TestStand socket calling these VIs when it requires the instrument resource. I start each of these VIs in the TestStand "process setup" callback in a new thread.

 

To allow TestStand to control these "instrument" VIs I have setup a Queue/Notification between each VI and TestStand. Each of these VIs are based on the queued statemachine architecture - I have a command Queue that I use to pass commands and settings from TestStand to the instrument VI (DMM measurement commands, DMM trigger settings etc). My queued state machine continually services these commands as they arrive on the queue. I also have a notification that these VIs use to send data back to the TestStand sockets (DMM measurement results, I/O statuses, commandt acknowledgements etc).

 

Hence to my question on architecture on the Labview side of things......

I have two ways of passing my command data structures, and my notication results between TestStand and the instrument VI.

 

Approach 1/ My queue is a simple enum that describes the command desired (e.g. set dMM trigger), but the actual command data (trigger settings for instance), is contained in a functional global variable. The relevant TestStand socket sets the functional global variable settings, and places a command enum onto the queue. The instrument VI actions the command and puts the result (the DMM reading for instance), into another functional global. It then sends a simple enum acknowledge back via the notification to the TestStand socket. TestStand then reads the functional global if any data is required.

 

Approach 2/ This design still uses a command queue and a notification reply from my instrument VI, but does away with the functional global variables. Instead the queue and notifications are comprised of clusters. For instance my DMM command queue has a cluster comprising a command enum and a trigger cluster. My acknowledge notification has a cluster comprising an acknowledge enum and a result cluster (voltage, underrange, ovverrange etc).

 

I'm currently preferring approach "2", as it does away with messy functional globals and is quite elegant. I've built a prototype system using approach "2" which appears to work well. However my questions are...

 

1/ What sort of processing overhead am I adding to my TestStand to server VI communication? My queue and notification clusters can get quite complex. My gut feeling is using a modern processor, the queue/nofication overhead would be trivial compared to say a DMM measurement acquisition - but am I correct?

 

2/ Is it valid to attach a labview waveform datatype to my notification? Labview lets me build such a structure without error, but I'm a bit confused as to whether a dynamic structure such as a waveform datatype can be used in a notification definition (i.e. passing a waveform data array to the "element data type" connection of a "ObtainNotification" VI). Does the notification automatically allocate/deallocate memory space as the waveform array grows - or is this in breach of a notification definition?

 

Thanks for your advice...  

 

0 Kudos
Message 1 of 9
(3,570 Views)

I'm trying to see the advantage of this over the custom step approach. I use a custom step for each instrument, modeled after the IVI step architecture. No functional globals, no queues, no notifiers (at least in LabVIEW). Data is passed directly back to TestStand as soon as the specific section (init, configure, read, etc.) of the step finishes.

0 Kudos
Message 2 of 9
(3,565 Views)

 


@Dennis Knutson wrote:

I'm trying to see the advantage of this over the custom step approach. I use a custom step for each instrument, modeled after the IVI step architecture. No functional globals, no queues, no notifiers (at least in LabVIEW). Data is passed directly back to TestStand as soon as the specific section (init, configure, read, etc.) of the step finishes.


I'm trying to see the advantage of this over the AE approach. 


 

My design allocates a Labview VI to each item of hardware...

To allow TestStand to control these "instrument" VIs I have..

 

 


 

not a single AE to access the instrument resource???

 

 

 


OK I'm not the first person to prepose a software engineering approach to LabVIEW- but, ... GD.  Encapsulate the driver functions for the application!

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 9
(3,559 Views)

TestStand accesses the instrument resource directly. Just a case statement around the driver functions. Not much different than an AE. I just place more functionality in TestStand. Can easily adapt to steps written in other languages.

 

I don't know who you were referring your remark about software engineering to. My approach is just like all of the existing steps in TestStand and they all are 'encapsulated'.

0 Kudos
Message 4 of 9
(3,555 Views)

Sorry, I've left some details of the TestStand part of my system out - a detailed TestStand discussion doesn't really belong under this group. However to clarify my situation....

 

This particular test system physically resides in Thailand. I'm working from Auckland, New Zealand. I'm regularly called to update or debug test programs across the company LAN and I use WinVNC to log onto the remote machine's desktop to do this.

 

My initial designs used a similar scheme to the custom teststeps you describe. However if I'm developing new products remotely, I find it very useful to have a virtual instrument front panel for all of my instrument resources. I've also put a "breakpoint" function into my virtual instrument front panels. If for example I'm experimenting with different DMM triggering settings I simply set my "breakpoint" on the relevant instrument VI and run TestStand as normal. Once the relevant instrument VI receives a command from the queue, it doesn't action it or send the notification back to TestStand. It stays in this paused state while I experiment with instrument settings via my instrument VI's front panel as required. Once I release my virtual instrument "breakpoint" my instrument VI actions the queue command and sends back the notification with whatever result was requested by TestStand. My TestStand socket then continues as normal.

 

This gives me several advantages (remember I'm always doing this remotely - hence I physically can't see or touch anything on the machine):

 

1/ I'm using SwitchExecutive. I normally embed the instrument switch routing instructions and instrument commands into one TestStand step. If I'm debugging switching connectivity issues (such as probe or backplane issues), I often repeatably query the instrument measurements while I have someone locally debugging the fixture connections. I want the switch routing left statically connected to the instrument while I do this. Without my breakpoint mode I would need to separate TestStand's switchexecutive "route", "instrument measurement", and switchexecutive "unroute" commands into three separate TestStand steps each time. I don't want this debugging overhead.

 

2/ Often when I'm debugging remotely I may change the instrument range settings temporarily, or look at the waveshape the instrument has captured (I'm using a Flex DMM). Without my instrument VI I would need to modify my TestStand instrument setup calls while I debugged, ensuring I changed them back when I finished. I don't want to edit a version controlled test sequence if I can help it. My "breakpoint" lets me rapidly experiment with the instrument range settings and view captured waveforms remotely over the LAN without editing one line of TestStand code.

 

If all this sounds rather complex, consider debugging an inline 4-socket functional tester over the LAN, while trying to communicate with a Thai technician who's first language isn't english. Excuse the rather long winded TestStand discussion in the Labview forum.....

0 Kudos
Message 5 of 9
(3,548 Views)

Okay, I understand better. I had 6 and 8 socket sequences in Malaysia. What I did was have the instrument front panels available under the TestStand tools menu that I opened after setting a breakpoint in TestStand.

0 Kudos
Message 6 of 9
(3,543 Views)

Dennis - I have a similar front panel show/hide commands on my TestStand menus. I don't normally show my instrument servers unless I'm debugging as it jumbles the screen. I'm also using the same architecture for my machine digital I/O blocks (used for fixture control, conveyor control, interlock monitoring etc), as it makes line/machine debugging (as opposed to product debugging) much easier.

 

Jeff - Regarding the AE approach. I do all this within TestStand. My instrument locking, switch-routing, aquisition-command and switch-unrouting is all done in one TestStand step. In fact with my Queue/Notification model I can combine an instrument trigger-setup, range-setup and acquisition-command into the same TestStand step just by placing three directives onto my instrument queue in the correct order. Makes very clean TestStand sequences.

 

However my Labview instrument server "queued state machine" behaves in a similar manner to the internals of an AE, i.e. it can include complex logic internally, or store instrument state information (DMM trigger settings for example). The controlled access to the resource is controlled by TestStand synchronisation objects (a lock), so I don't need this functionality.

 

Dennis - How did you handle the TestStand>Instrument and Instrument>>TestStand communication in your Malaysian system - i.e. so you could have separate front panels showing?


Appreciate the communication so far guys...

0 Kudos
Message 7 of 9
(3,506 Views)

Regarding the TestStand>LabVIEW>TestStand interface requires a bit of a long story. I started creating custom steps soon after version 2 came out (I started  with 1.0). I don't know how long you've been using TestStand, but prior to 3.something, you could not directly pass data to a VIs connector pane. What you did was pass the sequence context and read/wrote to TestStand locals or in the case of a step, the step parameters. Used the TestStand - Get Property Value and TestStand - Set Property Value functions in LabVIEW. For a variety of reasons, I got stuck at version 2 for several years so I always had to debug my code from TestStand. One advantage was that I always created a dll when I distributed the steps to the other engineers and with a single parameter, it was simpler than trying to match TestStand data types to LabVIEW ones.

 

My front panels were never shown during a normal run. When I did the remote debug, I would almost always run a single socket. A technician could also evoke this mode and they only ran a single socket when troubleshooting.

0 Kudos
Message 8 of 9
(3,488 Views)

OK, that explains your approach. I started with TestStand 3.1 so luckily didn't have those VI calling limitations.

 

I've done the equivalent of your setproperty/getproperty by passing clusters into my client-side VI.

 

Re running a single socket, same with me. I have a TS menu setting that drops all but the first socket for remote machine debugging.

0 Kudos
Message 9 of 9
(3,463 Views)