08-20-2007 02:45 PM
08-20-2007 07:24 PM
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.
@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.
08-21-2007 08:01 AM
08-22-2007 07:02 AM
Well here is what the loop does :
@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
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,
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.
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]
08-22-2007 07:19 AM
08-22-2007 10:19 AM
@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?
08-22-2007 06:38 PM
By using a shift register to count 10 iterations and resetting the counter at the 10th iteration.
@johnsold wrote:
How do you run 500 ms switching of solenoids inside a 50 ms loop?
........
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.
Can you post the code you described? It is much easier to locate a problem with the actual code.
08-22-2007 07:14 PM
@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.