LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Performance of Modbus using DSC Shared Variables

Solved!
Go to solution

   I'm fairly new at using Modbus with LabVIEW.  Out of the roughly dozen tools and API's that can be used, for one project I'm working on I decided to try using Shared Variables aliased to Modbus registers in the project, which is a DSC tool.  It seemed like a clever way to go.  I've used Shared Variables in the past, though, and am aware of some of the issues surrounding them, especially when the number of them begins to increase.  I'll only have about 120 variables, so I don't think it will be too bad, but I'm beginning to be a bit concerned...

   The way I started doing this was to create a new shared variable for every data point.  What I've noticed since then is that there is a mechanism for addressing multiple registers at once using an array of values.  (Unfortunately, even if I wanted to use the array method, I probably couldn't.  The Modbus points I am interfacing to are for a custom device, and the programmer didn't bother using consecutive registers...)  But in any case, I was wondering what the performance issues might be surrounding this API.

    I'm guessing that:
1) All the caveates of shared variables apply.  These really are shared variables, it's only that DSC taught the SV Engine how to go read them.  Is that right?

   And I'm wondering:

2) Is there any performance improvement for reading an array of consecutive variables rather than reading each variable individually?

3) Are there any performance issues above what shared variables normally have, when using Modbus specifically?  (E.g. how often can you read a few hundred Modbus points from the same device?)

 

Thanks,

    DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 1 of 6
(2,673 Views)
Solution
Accepted by Dave_Thomson

Hi Dave,

 

Thanks for your good questions!

 

1) You are correct that the caveates of shared variables do apply. Generally, the major issues (race conditions etc) are not encountered because these variables are typically used as I/O. 

2) With a large number of shared variables that are on separate machines, it is best to use an array. However, with 120 variables read consecutively will not affect your overall performance, especially if you do not need to read everything simultaneously. 

3) Overall, there aren't any performance concerns outside of normal shared variable concerns. Modbus and DSC are designed to be efficient and do a good job maximizing performance for you.

 

Hope this helps.

 

Best regards,

Anna L

Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(2,644 Views)

Anna,

    Thanks so much for the reply.  That helps a lot.

    I am still wondering about one thing, though.  According to the documentation, the "A" prefix in a Modbus DSC address means that it will return an array of data, whereas something like the F prefix is for a single precision float.  When I create a channel, I pick the F300001 option, and the address that is returned is a range:  F300001 - F365534.  The range would imply that a series of values will be returned, e.g. an array.  I always just delete the range and enter a single address.  Is that the intention?  Does it return the range just so you know the range of allowed addresses?
   OK, I'm actually wondering two things.  Is there a reason why the DSC addresses start with 1, e.g. F300001, instead of 0, like F300000?  For the old Modbus API from LV7, one of the devices we have that uses that API has a register at 0.  How would that be handled in DSC?

Thanks,

    Dave

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 3 of 6
(2,627 Views)

I believe the DSC module uses the full numbering system for the is defined in the modbus spec which begins at 1 (such as 30001), but is the 0th register and zero is the actual address value that is transmitted to the modbus slave when the background DSC processes poll it.  Basically, the DSC module just maps the full address like you'd see it in the communication manual for the device, and hides the actual value used to get that address in the modbus communication protocol.  Meanwhile, the modbus library in LabVIEW doesn't hide that and makes you use the actual address value.

0 Kudos
Message 4 of 6
(2,625 Views)

Thanks.  Then, just to make sure I understand you, when moving between the two API's, you would need to add or subtract 1 from the address you use?

 

DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 5 of 6
(2,614 Views)

Yes.

0 Kudos
Message 6 of 6
(2,603 Views)