LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

automatic timing within a while loop and saving to an excel or work file

I have created a VI that includes a PID loop and various monitoring of feedbacks through a AI module.  The VI works fine in manual mode, everything (except the local variable start values) is inside of a while loop, working at approximately 12 iterations a second.
 
I am trying to incorporate automatic mode.  This involves switching analog outputs, turning on the PID loop at a certain setpoint, and running like this for a period of time (about 4 hours).  The feedback values are then saved to an Excel or Word file and unit would then proceed to the next timed part of the test, with different analog outputs.
 
I tried adding a flat sequence structure inside the while loop but my iterations dropped to approximately 2/second - way too slow.
 
I currently have programmed a capture of the iteration count and am using this to time the automatic mode functions, but this is very labor intensive to do - there must be an easier way!
 
If you have any ideas on how I can accomplish an easy timed loop without slowing down my iterations, please let me know.
 
I also would like to have some information on how save data to an existing excel or word file (for printing a data sheet on the product).  I have seen posts regarding this, but they seem to just create a file with the numbers, not a readable data sheet.
 
Thank you.



metzler CLAD
0 Kudos
Message 1 of 7
(3,175 Views)
It would make matters easier to discuss if you could post some of your code, but it sounds like maybe you need to look into the consumer/produce design pattern a bit - it might do what you are needing.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,160 Views)
This is my vi.  The top section performs the automatic parts that I have completed.



metzler CLAD
0 Kudos
Message 3 of 7
(3,147 Views)
I am new to LabView, so that VI probably needs a lot of improving.



metzler CLAD
0 Kudos
Message 4 of 7
(3,138 Views)

Hi metzler,

Thanks for contacting National Instruments.  I have been looking into your question and looking over your code a little bit.  For one, I do agree with the earlier post that the producer/consumer method may be the best way to go.  You can get a good starting point for this by opening LabVIEW and going to New...>>VI>>Frameworks>>Design Pattern and then look at the Producer/Consumer method.  This design basically allows you to sample some data at a fast rate and then take the data out of a queue in the consumer loop when you are ready.  Also, after looking at your program, I would suggest some methods for controlling the data flow of your program.  If you go into the LabVIEW Help, you can search for "dataflow" and you will be able to read about some hints and methods that you would need to enforce.  I hope some of this helps and if you have any more questions about this same issue, please feel free to reply back.  Thanks!

Regards

Noah R
Applications Engineering
National Instruments
0 Kudos
Message 5 of 7
(3,113 Views)
Hey Noah;

I was just about to post back with the same recommendations!

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 7
(3,101 Views)
Thanks Mike!  Always good to know that I'm on the same page as someone else!
Regards

Noah R
Applications Engineering
National Instruments
0 Kudos
Message 7 of 7
(3,088 Views)