LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write data read from a PLC to an EXCEL file continously

Hello all,
here is what i've been trying to accomplish...there is streaming data that is read from a PLC using DataSockets, this data needs to be written to a EXCEL sheet. in my trial i can write data generated by random into the excel sheet but i'm not successful in reading from the data sockets and writing that data into the Excel Sheet. i've attached my VI.
any suggestions, direction to a forum or resource etc is welcome.
cheers,
-U
0 Kudos
Message 1 of 3
(4,781 Views)
I shall begin and end with the same request. Here it is. Please, please, please, hire an Alliance Member who is a Certified LabVIEW Developer (like me) to help you even if just for a single day. Have the CLD write a few VIs for you, and then refer to those VIs for style guidelines and techniques. Having said that, my compliments to you for using 7.0.

Now, we're in the middle so I'll address your problems.

1. You say you want continuous storage of data, yet your dataflow does not allow it. You have all the datasocket reading contained in a while loop. The output of the while loop is an array on which the Excel writing loop depends. The Excel writing cannot happen until after your datasocket reading completes due to that data dependency. A central theme of LabVIEW is the concept of data dependency. You must learn it, use it, and love it.

2. You have branched the ActiveX reference to Excel several times and distributed it to asynchronous parallel while loops. There is no guarantee that those loops will all execute at the same rate. Also, it makes you code very hard to interpret. You can achieve a more desirable result by using in-line VIs. I�ll be extra-nice and show you what I mean in the attached example.

3. The branching of the ActiveX reference is bad, but the multiple closing of Excel is worse. You only have to close the references, workbooks, and worksheets that you open, not each branch of those references. You�ve got lots of redundant code there that will generate errors. You would see those errors if you wired up the other instances. Tisk, tisk.

4. You have VI-itis: Inflamation of the VI. We must all strive to keep diagrams compact and readable. The guideline is that if you cannot manage to fit the diagram on one screen, extend in one direction only. It makes debug / feature addition orders of magnitude faster and easier.

So, check out the example I whipped up based on your VI. Now, some disclaimers; I only spent about 10 minutes on the example. It should work, but there may be something I missed. Either way, it should give you a guide. Also, if I seem harsh, it�s only because I care. I use LabVIEW every day, and I like others to realize its full potential. When wireworkers turn out poor code, it hurts us all. You have great potential and have come a long way. Keep an open mind and keep tinkering. That goes for all of you!

Again, try to work with an Alliance Member. We do this stuff every day, and most of us are good at it.

Sincerely,

Daniel L. Press
Certified LabVIEW Developer
Director of Engineering
PrimeTest Corporation
www.primetest.com
0 Kudos
Message 2 of 3
(4,781 Views)
Thanks a million for helping out, as you realized i'm relatively new to the Field and have picked up many erreneous practices along the way. I liked your style, shall change for the better thanks.
cheers,
-U
0 Kudos
Message 3 of 3
(4,781 Views)