LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data vanishing from LV2 global...

You should probably stay with the globals if they currently work. Substituting a plain lv2 global won't give you any additional advantages unless you add more intelligence to the subVI.
0 Kudos
Message 11 of 18
(1,164 Views)


@altenbach wrote:
You should probably stay with the globals if they currently work. Substituting a plain lv2 global won't give you any additional advantages unless you add more intelligence to the subVI.


No I don't think they ( globals) are working right now. I am ( was ) using them to pass data between a Main VI and other VIs which were running inside a sub-panel of the Main. And both the Main and the loaded sub_VIs had timed loops running at 50ms. Though I took care to properly prioritze the loops, none of them were finishing on time. Hence started the analysis as to why they always finish late. One of the suspects was the globals.

Anyway the  modified code will be tried out  shortly. Will post back on improvements.

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 12 of 18
(1,147 Views)
Globals are pretty fast. Compared to the 50 ms loop timing, it is more likely that something in your processing is the problem. What are the loops doing?

Lynn
0 Kudos
Message 13 of 18
(1,131 Views)


@johnsold wrote:
Globals are pretty fast. Compared to the 50 ms loop timing, it is more likely that something in your processing is the problem. What are the loops doing?

Lynn

Well here is what the loop does :

Every 50 ms second:

  • Indexing Raw & Averaged ( 8 )Analog Inputs And building into an Array again.

  • Belt Tension Maintaining loop.

  • Check if fluid  Temperature in range.

  • Case selector switch deciding which case to run among 5 different options (Interlock failure / Cycle Run / Manual mode etc.).

  • Once Cycle Starts,

  • Corresponding state machine case will run. Just two cases each lasting for 500ms to seitch on / off a solenoid.

  • Timeout Structure will run.

  • Send the user selected parameters to a front screen real time plot in a chart.
  • Once every 3000 cylces, code to capture data in binary file & text file happens. [ Write to Disk in a preformatted file name ]

  • Every 500ms all the 8 analog input values are scaled to engineering parameters and saved.[ Write to disk by appending to a file]

Frankly I do not see any major load in the above for a PC running at 2.5Ghz and with 512 MB ram. Nothing else runs in the background except for native WIN_XP thread as part of OS.

Could it be that I am writing too ofetn to the disk ( once every 500ms) ???

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 14 of 18
(1,108 Views)
How do you run 500 ms switching of solenoids inside a 50 ms loop?

I suspect the problem is in the way you have structured the program. Reading through your description does not point to any one thing but it leaves me with a vague sense that something is preventing it from running as fast as you need.

Can you post the code you described? It is much easier to locate a problem with the actual code.

I doubt that the file saves themselves are the root of the problem, but that process can probably be optimized. For one thing I would probably put the file access outside the loop to avoid OS latency issues.

Lynn
0 Kudos
Message 15 of 18
(1,103 Views)


@Raghunathan wrote:

Could it be that I am writing too ofetn to the disk ( once every 500ms) ???

How are you doing this? Best would be to open the file once before the loop, the append using low-level function while keeping the file open. If you use highlevel file IO, your file will be openend and closed constantly.

What is a "Belt Tension Maintaining loop"? Are you running a loop within the loop?

"Indexing Raw & Averaged ( 8 )Analog Inputs And building into an Array again." How many arrays are you building and how big can they get?

 

0 Kudos
Message 16 of 18
(1,091 Views)

@johnsold wrote:
How do you run 500 ms switching of solenoids inside a 50 ms loop?
........

By using a shift register to count 10 iterations and resetting the counter at the 10th iteration.


  Can you post the code you described? It is much easier to locate a problem with the actual code.

I have enclosed the zip file of the part of the code. Unzip and open the VIs with password "km" without the quotes. The VIs that need to be studied are Main & Variable Load durability Test VIs. Other VIs are just support ones so that you can open the block diagram without breaking the arrow.

First and foremost I would like to know if I am doing too mcuh inside of a single timed loop ?

Thanks

Raghunathan

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 17 of 18
(1,077 Views)


@altenbach wrote:


@Raghunathan wrote:

Could it be that I am writing too ofetn to the disk ( once every 500ms) ???

1. How are you doing this? Best would be to open the file once before the loop, the append using low-level function while keeping the file open. If you use highlevel file IO, your file will be openend and closed constantly.

2. What is a "Belt Tension Maintaining loop"? Are you running a loop within the loop?

3. "Indexing Raw & Averaged ( 8 )Analog Inputs And building into an Array again." How many arrays are you building and how big can they get?


Answers :
1. I have posted the code that does this. It is inside the Variable Load Durability Test .VI and is called "History Data Capture " What it does is this :
               - Creates two files BackUpData.txt and Current.txt. to start with.
               -  Appends the captured data of Analog input channels (8) once every 500ms and writes in append mode to Current.txt file
              - At the end of 3600 such writes, it clears the BackUpData.txt first, then copies all data from Current.tx to BackUpData.txt and deletes the Current.txt file. The creates a fresh Current.txt file ans starts over. Please let me know if this can be optimized..

2. It is a simple loop that checks the value of a load cell (as belt tension) and compares with a user defined limit. Based on that, it switches on /off a electric motor  to correct the  situation. Happens very rarely as mostly the belt tension once set remains so.

3. Two arrays with 8 samples each built from the data from "DAQMx -1D-DBL-NChan-1Samp " function. These arrays are overwritten once every 50ms and do not  grow. And right now even the Averaged function is not made use of.       

Thanks for your time.


Raghunathan

PS: I have posted the relevant code as a zip file in reply to Johnsold's message.


Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 18 of 18
(1,072 Views)