LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i make this VI run faster?

What part of this massive code is giving you the problem? This really doesn't look like you took any of our advice to heart. This is still one massive block diagram with all of the code running in a single while loop.

 

Here is a picture of a fairly typical, well architected piece of code. While it doesn't quite fit on a single screen any single section of teh code can be. This is one of the larger block diagrams we have. Most will easily fit on a single screen.

 

Clean Block diagram.PNG

 

Notice that this code is east to read and follow. It ises multiple while loops. This is a typical producer/consumer design pattern. It is also one part of a much larger application.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 14
(858 Views)

I don't want to sound like I'm justifying my self, you guy are the experts and that's why I'm asking your help by advices. Just wanted to give you an update (I know that I'm still wrong) but the database task works pretty well, even in the large code, I've noticed than the delay happens when the code tries to write to the OPC Server.

I'm no longer beside the PLC but, analyzing the code I thought than in the small code LabView has to resolve many OPC URL's on almost every cycle. Is it possible that, if I put the OPC URL's out of the main loop the problem will be solved or, at least, mynimized?

It's just a temporary solution before rewriting the all stuff

0 Kudos
Message 12 of 14
(849 Views)

@Coy, i haven't used datasockets, but could one issue be that you're doing 4 connections at once? Wire the error in/outs to have them execute sequentially (or better place them in a loop).

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 13 of 14
(838 Views)

Guys, I'm glad to say that I've found the delay. After all, iIt has nothing to do with the code (after having isolated the piece of code that I show you) The main problem was in the OPC Configurator. Please let me try to explain in order that someone else may benefit from my experience and mistakes:

The MX OPC Server groups th tags in "Groups", every tag is "A piece of DLL" as can be read in the manual, but this grouping happens behind the scenes, I could not see it and it was making "groups" of one only tag, having the capacity of making groups of until 64 tags. So the OPC Server was consuming a lot o unnecesary "DLL Resources". Th only problem is that the tags must be taken in a given order; you cannot group, fro example, the x64 with the x240 tags, so I had to reestructure my PLC program to send the tags in a more confortable way to the OPC, using X0, X1, X2... and so on in order to be able to group them.

I appreciate everyone comments and advices, I've learned a  lot from this experience and I hope someone else may benefit from the mistakes I've made in this project. You guys may be sure that I'm going to be the first one on taking advantages from this series of mistakes. 

I'm writing this on December th 25th. 2012, so Merry Christmas everyone

0 Kudos
Message 14 of 14
(784 Views)