dannyt Posted June 5, 2007 Report Share Posted June 5, 2007 We have written a set of local wrapper VI's around the standard VISA communication VI's. These VI's are to provide a standard way of logging in VISA read and writes plus a way of handling a device online (available) / offline (unavailable) functionality. The core of these wrappers is a VI (shown below in visa_connections.vi) that holds some shift registers which contain all information we are interested in, for all the VISA devices used in our test system - Instrument name (this is the name WE refer to the instrument by) - VISA Resource Name - Online? - Driver I see two methods of getting this information into our Visa-read and write VI's where they are needed; I would be grateful for any views about the efficiency of these two method and any general comments about these techniques Method One : We would call visa_connections with the instrument name, run the open case shown below and pass all the required info out using the Visa Data Cluster this cluster is then chained into our read & write wrappers so they have all the information they require. Methods Two: Instead of creating the Visa Data Cluster, as in the open case below, I just pass out the VISA Resource Name name and chain this into my read & write VI's. In this case I would then need to make a call in each sub-vi back to the visa_connection.vi to lookup up any extra information required. A typical situation of using this would be a visa query, with method one, I call visa_connections.vi once pass the VIsa Data Cluster forward to a write then a read, because of the cluster I am using more memory then if I just pass the reference alone. But if I use the visa reference only method I would need to two extra calls to visa_connections.vi (one in read, one in write) to get the online? and instrument name info. So is it better to pass around all the information needed in a cluster or is it better to make extra VI calls and get it when needed. My own timing test seem to show it is better to pass round all the needed information. I hope this makes some sense cheers Dannyt http://forums.lavag.org/index.php?act=attach&type=post&id=6014 Quote Link to comment
Yair Posted June 5, 2007 Report Share Posted June 5, 2007 "better" is a highly relative term. You seem to be concerned about speed, so you would probably be better off with the second method, because with the first one each call would lock the VI and prevent concurrent access, but that highly depends on specific circumstances. The code you have here is actually the basis for two options - an action engine and an ad-hoc object-oriented system. In an OOP system, you would have the basic OOP infrastructure managing the instances and the locking and your code would manage the different functions (for example, you would have an "Open" function which would return a reference, a "Write" function and a read and write function for most properties). This creates a lot of overhead in the number of VIs that you will have and is usually slower, but it has it advantages the more complex your system gets. You can search for GOOP to learn about the different flavors of OOP in LabVIEW. P.S. It's a minor point, but you can set the case structure to ignore the casing of strings. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.