From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-29-2009 05:13 PM
We have a generic test setup that reads channels from a configuration file and sets up the cards appropriately. This is all fine and good. Next we want to specify the test conditions in the configuration file. The test conditions can be arbitrary, like "ch1 > 3.14 for more than 50 ms and any 2 of ch2, ch3, ch4 are > 123.45 for more than 25 ms." I REALLY don't want to invent yet another expression language. I thought about using MathScript but then I thought, why not use a VI? Can I reference a VI that captures all the test-specific conditions and call it programmatically on the RT PXI target? Is this even a good idea? Has anyone run into a similar problem?
Thanks.
01-30-2009 01:18 PM
Hello,
You can definitely create such a VI. Using Open VI Reference, you can remotely reference a VI and pass to it the channels and voltages that you wish. Please reply if you have questions.
01-30-2009 01:21 PM
01-30-2009 03:09 PM
Why not just store the test parameters in a .CSV file then read the file with the Read Spreadsheet File.VI?
Anyone can create a .CSV with any text editor just seperate the values with commas.
value1,value2,value3
Just make sure you set the Read Spreadsheet File.VI delimiter input to a comma (,)
01-30-2009 03:57 PM
OK, how do I represent an arbitrary expression tree with a CSV file?
01-30-2009 04:09 PM - edited 01-30-2009 04:13 PM
It depends on how much string parsing you want to do and how flexable it needs to be.
Right off teh top of my head I would say you could do something like this:
for say "ch1 > 3.14 for more than 50 ms and any 2 of ch2, ch3, ch4 are > 123.45 for more than 25 ms." in the csv file you could have
ch1,>,3.14,50ms,ch2,>,123.45,25ms,ch2,>,123.45,25,ms,ch3,>,123.45,25ms,ch4,>,123.45,25ms
Then use Read Spreadsheet File.VI set to read a string.
That will output a string array with each element containing each value that is seperated by the commas.
Then you index the array elements and convert them to numbers as needed for input to your vi's
Use the fields elements containg the < or > to select cases fo comparing as needed
01-30-2009 04:14 PM
Oh sure. I don't need a CSV for that -- I can store the test condition as a string in my config file. But as you point out, it involves writing a grammar parser in VI. I'd really rather not if I don't have to. I'm looking into using MathScript ...
02-01-2009 10:57 PM
OK, it seemed like the Eval Multivariable Scalar was going to be the solution I wanted. I thought I could feed it a string like "(a > 2.3) || (b < 3.14)" but it apparently doesn't like boolean expressions. I keep getting "wrong variable name." I get this error for something as simple as "a && b". How can I get the eval to use a boolean expression?
02-02-2009 01:05 PM
Hello,
You could build an executable out of your VI to give to your client, then you can just provide them with a LabVIEW runtime Installer so that they can run it without having LabVIEW and there is no need for a license.
This can be done in your project explorer window if you right click Build Specifications and select new Installer and new Exe.
02-02-2009 01:19 PM
As much as I'd like to charge the customer every time they want to change their test conditions, I don't think that will be an acceptable solution to them. The idea is to empower them to go off an do tests by themselves. Besides, I tried out the VI approach and uncovered an issue. The VIs must all have the same input/output connectors (of course), which means I need to pass in an array of all the channel values. The problem is that from one test to the next, the number of channels may change while the test condition might not. So either there needs to be a new test condition VI with the indices changed (error prone) or the VI needs to look up the channel index by name every time it's called (at 100 Hz).