FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variables between cFPs

Hi,

I have two cFP controllers in my application (and no PC). Typically I use TCP/IP to share data between the two controllers. However, I was wondering if the network-published shared variables are any better. The following KB article has some excellent information, but it doesn't specifically address my situation:

http://zone.ni.com/devzone/conceptd.nsf/webmain/5B4C3CC1B2AD10BA862570F2007569EF?OpenDocument

I would like to know the CPU usage (which has been an issue for us on the cFPs) when using the shared variables, and the shared variable engine (SVE). Since there's no PC in my system, one of the cFPs would have to have the SVE. Would this bog down the CPU?

I am looking for experiences from people who have tried something like this. And any general tips on this topic would be much appreciated.

Thank you in advance!

-Khalid
0 Kudos
Message 1 of 4
(3,942 Views)

Hello Khalid,

Unfortunately, we do not have any benchmarking for CPU usage when using Shared Variable.  However, the one thing I would be more concerned over is memory usage.  As you probably noticed in the KB you attached, shared variables offer ease of use and fast settings, but they do take up more memory as many things have to happen under the surface for them to work properly.  The SVE will also take more RAM than TCP/IP.  So, depending on your application, you would have to choose between these options knowing that there are tradeoffs for each method...

If you provide more details about your application, I may be able to further assist you.

Regards,

AG, National Instruments

0 Kudos
Message 2 of 4
(3,929 Views)
Dear NI
 
Following up on this thread I seem to have a smiliar question. I have recently taken over a LV project including two cFP's 2120 each with a networked cFP1808 bank. Both controllers have a SVE running serving I/O data to a PC, also on of the controllers has a larger number of "memory" tags (SV) in its SVE. It totals 512 tags on the larger of the two SVE, the other one has 128 tags.
 
The cFP runs a number of PID controllers (aprox 40) using the PID toolset (reentrant feature disabled on the PID, and integrated errors etc. carried in a shift register - to save memory). The PID app communicates with the local SVE via a VI (labview 2 global) were refs to all SV are opened before the application starts.
 
To my big horror, I am not getting much speed on the PID controller (due to slow slow slow read/write with the SV) and my question is : How do I optimize this ? Is there an upper limit to how many SV a SVE on a cFP target can support ?, it is best to group similar tags into sub libs inside the main SVE lib ? Any other suggestions as how to increase performance. My cFP has pleanty of memory, but the real time performance is not there, from the PC it can take 1-10 sec. to write to a tag on the SVE of the cFP target, leading the code in the direction of race conditions.
 
Also, one big problem with SVE on cFP and PID controllers is that one would prefer to run the PID in Engineering units, however with the scaling feature of the SVE on cFP not working - not even after investing in the DSC module, it makes for poor code compared to the dreaded PLC.
 
Any help is greatly appriciated.
 
Søren hallberg jensen
0 Kudos
Message 3 of 4
(3,786 Views)
Hi Soren,
    My first suggestion would be to host all shared variables on the PC, unless you cannot do that for some reason.  With that many shared variables all transmitting their data over the network at the same time, it will cause some slowdown in data transmission.  May I ask why you have that many shared variables?  Could we perhaps restructure your code to use a FIFO, or maybe combine some shared variables into arrays or other data structures that could be transmitted all at once?  Also, here are a few links that may help you out with structuring your Real-Time code for speed:

LabVIEW Real-Time Architecture and Good Programming Practices:
http://zone.ni.com/devzone/cda/tut/p/id/2833

LabVIEW Performance and Memory Management:
http://zone.ni.com/devzone/cda/tut/p/id/3576

How Can I Optimize the Memory Use in My LabVIEW VI?
http://digital.ni.com/public.nsf/websearch/771AC793114A5CB986256CAB00079F57?OpenDocument
Brian B
Account Manager
National Instruments
0 Kudos
Message 4 of 4
(3,753 Views)