Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you read all the devices at once from a FieldPoint TC-120 module?

I would like to read the 'All' item (in the MAX explorer app) for a Fieldpoint TC-120 module using the measurement studio .NET datasocket class.  MAX currently only displays the value of the first tc which is what the datasocket class returns as well.  Is there a way to configure it so that all the tc values are returned in one call.  If that is not possible, is it possible to read the individual items referencing them by there channel index and not the name they are currently given in MAX? 
 
Thanks Kevin
0 Kudos
Message 1 of 8
(3,865 Views)
Howdy Kevin -

If you have the "All" item from your FeildPoint module already being published to the datasocket server, then reading back that item should be fairly simple.  Although MAX only displays the first value, the "All" item is actually an array of doubles. Fortunately, the DataSocketData Class supports an array of doubles (you can search the Measurement Studio documentation for "DataSocketData" for more information on supported datatypes).  Thus, it should be very straightforward to bring in the channel data.

Using the datasocket reader/writer example (found in <Measurement Studio Directory>\DotNET\Examples\DataSocket\ReaderWriter\cs or vb), I was able to read the "All" item which was being published to a datasocket server.  The channels are in order in the array, meaning channel 0 was item 0 in the array, channel 1 was item 1, etc...

See if you are able to run the example reader program to bring in the array data. 

Let me know if you have any more questions.  I'd be glad to help out.

Have a great day!

Regards,
Andrew W || Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,836 Views)

Forgive my ignorance but what publishes the 'All' item from the fieldpoint module?  Is this an embedded vi that needs to run on the FP, or some app that runs on the pc to publish the data, or can it be setup with some sort of configuration?  I've been trying to access it with this particular URL - ' dstp://localhost/National Instruments.OPCFieldPoint/reactor_1\thermocouples\All'. 

Thanks Kevin

0 Kudos
Message 3 of 8
(3,833 Views)
Kevin,

The FieldPoint server running on the PC actually publishes the OPC data. It does this automatically whenever you set up channels in your .iak file. It also handles communication with the FieldPoint controller, whether it be an embedded or network controller. Does this answer your question? Are you having problems accessing the data at that particular address?

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 4 of 8
(3,821 Views)

Yes, I'm still having problems.  First the address mentioned only works if I have a datasocket server running (which I expected).  But the URL is not published when the FP is connected to the datasocket.  My application then becomes the one that publishes the address.  In other words the address is created when I connect, not when the FP is connected.  You mentioned the FP server publishes the OPC data, should I be connecting to the OPC protocol with something like this - 'opc://localhost/National Instruments.OPCFieldPoint/reactor_1\thermocouples\All'?  If so this does not work it just returns the same value that MAX displays - a single float value that corresponds to the first TC value, not an array of floats for each of the TC values.

Communication is working fine between the PC and FP, MAX is able to read and write values, my app can read various OPC variables and and RT app that I have running down on the FP that publishes its own variables is reading and writing those variables. 

I could be using the wrong URL.  I have attached my iak file.  Given that information, what is the URL I should be using to access the 'All' item for the TC120 module? 
 
Is there any kind of configuration on either the FP or the PC side that needs to happen so the FP will publish the data?
 
0 Kudos
Message 5 of 8
(3,819 Views)
Kevin,
 
What happens when you cast the "value" property to an array of doubles (as in (double[])e.Data.Value)? Is only the first value of the array valid? You are using the correct URL, and based on your ability to read the same value displayd in MAX I think everything else is working fine, as well.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 6 of 8
(3,796 Views)

I get a 'Specified cast is not valid' exception.  I've modified the reader sample applications DataSocketUpdated event handler to be:

double[] vals;
try
{
   System.Diagnostics.Debug.WriteLine("e.Data.Value type is " + e.Data.Value.GetType().Name);
   vals = (double[])e.Data.Value;
   System.Diagnostics.Debug.WriteLine("Size of array is " + vals.Length.ToString());
}
catch (Exception ex)
{
   System.Diagnostics.Debug.WriteLine(ex.Message);
}

I was hoping to get the following output:

    e.Data.Value type is double[]
    Size of array is 8

But instead I get

    e.Data.Value type is Single
    Specified cast is not valid.

I'm using this URL - opc://localhost/National Instruments.OPCFieldPoint/reactor_1\thermocouples\All

Is there someone I can contact directly to figure this out?

kevin

0 Kudos
Message 7 of 8
(3,796 Views)
Kevin,

Looks like the OPC server only publishes this as a single value (the first channel). I set it up over here, and the Server Explorer shows it as only a "4-Byte Real." You'll probably have to read each of the channels individually. My apologies for the misinformation - With the Fieldpoint VIs in LabVIEW, you need only cast the "All" variant to an array of doubles. Please let me know if you have any more questions.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 8 of 8
(3,768 Views)