LabVIEW and C# Application

4 posts / 0 new
Last post
Offline
Last seen: 1 year 8 months ago
Joined: 03/27/2013
Posts: 28
LabVIEW and C# Application

Hello

I'm testing the connection between a C# and a LabVIEW application. I have defined a sequence of integers in my idl file, as the topic (in my C# application) and an array of integers in my LabVIEW app. They have the same Topic Name and Type Name, but they still cannot communicate. 
What could be the reason?

Thanks a lot for your assistance

Offline
Last seen: 6 months 3 weeks ago
Joined: 04/23/2014
Posts: 45

Hi Randy,

With arrays, several things may be wrong. If you could provide more information about this issue (IDL, LabVIEW cluster, errors... ), I could be more accurate in my answer. Anyway, the commonest issues with arrays are:

  • Using sequences instead of arrays (or vice-versa). By default, we use sequences for LabVIEW arrays. You can modify this behavior by modifying the flag 'forceArrayMapping?:' in the 'Advanced Writer/Reader Configuration' cluster for the 'Advanced Creater Writer/Reader' subVI. I think this is not your case because you are suing sequences in C#.
  • Check with Admin Console that the array element type is the same that we have in the C# IDL.
  • Array size: to create an array/sequence in an IDL you provide its maximum size. We also have to do so in LabVIEW. For doing this, we need to set a value in the maximum element of the array we are going to use. For instance, the following cluster will create a 2-element sequence of double:

    • You can also use a 0 instead of a 1. I just used the '1' for avoiding using the default value, but we only need to enable the array element which match with the maximum size.
    • Then you have to save it as default values (right click in the LabVIEW control/ Data Operations/Make current value default). 

Then, you can create your example files for this type using the ComplexType Generator (version 2.0.0.104), or connecting the type directly to the CLF template for previous versions. Note: a guide of the ComplexType Generator can be found in the section "6.2 RTI DDS ComplexType Generator" "4.2 Lesson 2—Using ComplexType Generator to Publish and Subscribe to Complex Data (Clusters)" and 

I attach here this LabVIEW array as well as the IDL which it generates.

I hope the above is useful for you. Let me know whether this fixed your issue.

Angel.

File Attachments: 
Offline
Last seen: 1 year 8 months ago
Joined: 03/27/2013
Posts: 28

Hi Angel,

Thanks a lot for the great explanation.
I couldn't run the Admin Console tool on my PC when I posted this topic. The problem with the Admin Console has been solved in technical questions forum with the help of your team, so I could debug the problem. 
The topics mismatched not because of the array itself. I had 2 other booleans in my idl file and the order of them in the corresponding LabVIEW control was different. It was solved by reordering them, as simple as that.

Thanks again 

Offline
Last seen: 6 months 3 weeks ago
Joined: 04/23/2014
Posts: 45

Nice to hear that the application is working as well as Admin Console :)

Angel.