Hi all,
The Problem:
I want to run the same software on machines with different hardware without any changes to the VI's. Rather, I'd like to use a config file to map universal commands to the appropriate relays at run time.
(Unfortunately I am not able to pull screenshots or anything off of my platforms, and my development computer doesn't have any PXI cards it's tough to get a screenshot but I'll explain this as best as I can.)
PXI1 cfg: (16 channel relay in slot 2)
======================================
Relay1 : 2-1
...
Relay 16: 2-16
PXI2 cfg: (8 channel relay in slots 2 and 3)
======================================
Relay1: 2-1
....
Relay8: 2-8
Relay9: 3-1
....
Relay16: 3-16
So when a script says "Close Relay 9" the user doesn't care the physical location of that relay. In PXI1 the 9th relay in Slot 2 will close and in PXI2 the 1st relay in Slot 3 will close. At that point it's just simple mapping.
Where I hit a snag when my system has 2 power supplies controlled by GPIB, 2 power supplies that are controlled over RS232, 3 PXI relay cards, 16 relays controlled by Digital Outputs, 16 channels of analog inputs, and god knows what else.
If anyone knows an elegant solution that'll allow tasks to be created and mapped at run time, that'd be wonderful.
Things I've Tried:
-Using MAX to name each relay, input, output, PSU, etc.
If there was a way to programmatically do this, I'd maybe go for it but given the sheer amount of tasks I'd need to create it'd be a nightmare.
-Opening DAQmx/TCP/Serial Task, performing action, Closing task every time action occurs.
While my program doesn't require Real-Time, the amount of overhead is not ideal. Especially for tasks like AI or RFSA that takes a significant time to create/start/stop/close.
-After Opening each of the tasks, converting each of the instrument handles"to Variant", clustering them with a string denoting the data type I'd like to convert it back into upon use, and building an array of these clusters.
I'd rather not have to pass this massive array into every subVI I call. Ideally, since race conditions are a non-issue (since I will only be reading from that array) I could use a Global Variable.... but I try to avoid those if I can.
If anyone has any ideas I may be completely overlooking I'd greatly appreciate it. Would using Classes help? I'm familiar with C# and other object oriented languages that use classes but I haven't used Classes in LabVIEW. As usual I'm trying to minimize wiring and clutter where possible. ANY help would be amazing. Thanks.
~Andrew Wojtkowski