09-19-2012 10:45 AM
Hi everyone, I need a suggestion to do the following operations:
my .vi have some array of string controls:
An array of 8 string controls named "set flux" that sends 8 set flux value commands to the instrument by a for loop and
an array of 8 ON/OFF switches that send OPEN/CLOSE command to 8 electrovalves.
My intention is to build a cicle or sub vi that follow theese operations, in order:
open an existing text file properly configured i.e. in this way (jumping the first row that is only to properly write values)
TIME_TO_WAIT_(in minutes) FLUX1 FLUX2 FLUX3 FLUX4 FLUX5 FLUX6 FLUX7 FLUX8 EVL1 EVL2 EVL3 EVL4 EVL5 EVL6 EVL7 EVL8
100 0000 0100 0200 2000 0100 0500 0500 ON ON OFF OFF OFF ON OFF OFF
200 1000 0100 0200 0500 0000 0000 0000 OFF ON ON OFF OFF OFF ON ON
100 2000 0200 0000 1000 0000 1000 1000 ON OFF OFF OFF OFF OFF OFF OFF
so, after have read the first row wait 100 minutes then set the 8 fluxes as follow and set 8 electrovalves as follow
then after 200 minutes set ...as the second row
then after 100 minutes set...as the third row
....ecetera
can anyone suggest the best and fastest way to do this?
Thankyou very much.
09-19-2012 02:48 PM
@ghrsdr wrote:
Hi everyone, I need a suggestion to do the following operations:
my .vi have some array of string controls:
An array of 8 string controls named "set flux" that sends 8 set flux value commands to the instrument by a for loop and
an array of 8 ON/OFF switches that send OPEN/CLOSE command to 8 electrovalves.
My intention is to build a cicle or sub vi that follow theese operations, in order:
open an existing text file properly configured i.e. in this way (jumping the first row that is only to properly write values)
TIME_TO_WAIT_(in minutes) FLUX1 FLUX2 FLUX3 FLUX4 FLUX5 FLUX6 FLUX7 FLUX8 EVL1 EVL2 EVL3 EVL4 EVL5 EVL6 EVL7 EVL8
100 0000 0100 0200 2000 0100 0500 0500 ON ON OFF OFF OFF ON OFF OFF
200 1000 0100 0200 0500 0000 0000 0000 OFF ON ON OFF OFF OFF ON ON
100 2000 0200 0000 1000 0000 1000 1000 ON OFF OFF OFF OFF OFF OFF OFF
so, after have read the first row wait 100 minutes then set the 8 fluxes as follow and set 8 electrovalves as follow
then after 200 minutes set ...as the second row
then after 100 minutes set...as the third row
....ecetera
can anyone suggest the best and fastest way to do this?
Thankyou very much.
I would read each line of the text file into an array where the elements of the array are a cluster.
Each cluster would be comprised of an U16, an array with 8 elements of U16, and a second array with 8 elements that are boolean.
Autoindex the array of clusters with a FOR loop. Inside the FOR loop, you would unbundle the cluster to get to the information that you would need.
09-20-2012 03:31 AM
Thankyou very much, it seems pretty simple, well for me not so much but I understand what you say.
Do you think I should read each line at a time (in this case I have to place a 2 dimension array with a not well defined number of rows) or read line by line at the end of the minutes?
09-20-2012 10:31 AM
I would make it a 1D array where each cluster is the information from one line of the text file.
09-20-2012 11:45 AM - edited 09-20-2012 11:50 AM
looks like you are reading the data vertically? from your statement...and you want time/bool with each flux#,evl# respectfully
09-20-2012 12:59 PM
09-20-2012 02:03 PM
see attached PNG file
09-21-2012 02:48 AM
Tankyou very much apok and nyc, I will take in account your suggestions and try to place them in my vi.