LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programing pxi for long activcation with high reliablity

Hi,

I am writing a labVIEW procedure which suppose to run 24/7 for couple of mounts and it is very important to me that procedure will be stable and won't crash at all.

the procedure include activation of PXI with the following i/o interface:

1. configuring NI 2527 (multiplexer) as 2 wire 32X1 multiplexer topology.

2. activating analog outputs in NI 6361 (DAQmx)

3. measuring signals with NI 6361 analog inputs (DAQmx).

4. measuring signals with NI scope (NI 5114).

 

those 4 sub procedures are suppose to run for thousandth of time (inside a state machine which being run in loops).

 

 

I tried to run my original code , and it turns out that once in a while (usually after couple of days of running in loops) I receive unexpected error from  part of the procedure that activate the PXI (which cause to crash of the procedure).

 

I changed all of my pxi procedure to act as state machine of "try and finally" topology with the following general structure:

*) "try state": try do the required procedure, if no error go "finally succeed", if error and number of trying<5 go to "reboot", else go to "finally failed"

*) "reboot state": clean handle (or task), clear error, reset device, and go to "try".

*) "finally failed state": clean handle (or task) reset device, turn on a flag of "PXI error" (global Boolean veritable which initialize to be false) and exit the state machine.

*) "finally succeed state":clean handle or task (only if needed) and exit the state machine.

 

in addition I added a "error handler procedure" that in case of "error in" and "PXI error" the it clear the error, reset all PXI instruments and try to reactivate the procedure.

 

since I modified the above changes the program did not crashed, but even thou I want to be sure that I am not doing something wrong.

I attached some of my VI, and I would appreciate if someone will give me suggestion and  ideas for making the procedure more reliable.

 

thanks Harel

 

 

0 Kudos
Message 1 of 3
(2,809 Views)

The code looks great. One small recommendation, it is best coding practice to place some kind of wait function inside a while loop to free up more of the processor. Other than that, no noticeable flaws

0 Kudos
Message 2 of 3
(2,741 Views)

Hi,

 

Neat metholodgy of using FGV's for this, additionally to the comment on timing your loops, you could also log the errors when they do occur so we know the error code and the VI which did error.

 

This is suggested as common practice in Core 2 and 3, a very similar method to what is mentioned in Core 2 is provided below which was created by an Alliance Partner:

 

https://forums.ni.com/t5/Example-Program-Drafts/Error-Logging-VIs/ta-p/3535523

 

That is you can use expressions with the string functions to extract the error code, string and then also log the date time as well.

 

Best regards,

 

Ed

0 Kudos
Message 3 of 3
(2,728 Views)