LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

automated and timed operations from text file

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.

 

 

0 Kudos
Message 1 of 8
(3,230 Views)

@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.

 

 

 

 

 

0 Kudos
Message 2 of 8
(3,214 Views)

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?

0 Kudos
Message 3 of 8
(3,198 Views)

I would make it a 1D array where each cluster is the information from one line of the text file.

 

 

0 Kudos
Message 4 of 8
(3,183 Views)

looks like you are reading the data vertically? from your statement...and you want time/bool with each flux#,evl# respectfully

0 Kudos
Message 5 of 8
(3,176 Views)

auto and time.png

0 Kudos
Message 6 of 8
(3,169 Views)

see attached PNG file

0 Kudos
Message 7 of 8
(3,155 Views)

Tankyou very much apok and nyc, I will take in account your suggestions and try to place them in my vi.

 

0 Kudos
Message 8 of 8
(3,131 Views)