Help Getting Started with Instrument Interface

Hi There,

I have a variety of sensors connected to the gateway OPC UA server through the TCP driver. I’m trying to figure out how to parse the values written into the tags with the Instrument Interface, ultimately.

Could I have a hand getting started?

Mike

The instrument interface is really for parsing data from serial devices or files. If you are using the TCP driver you already have the values as tags. You can create expression tags to perform string manipulations on the values for some simple parsing.

If you have an example of the string you can post it and we can help you out.

Sure, here’s one:

3200000020E25A41 DS1923 temperature: 25.593747 deg.C.

3200000020E25A41 is the id of the device
DS1923 is the type of device
25.593747 deg.C is the value

Thanks a lot!

Mike

Ok, you can make expression tags that have an expression like this:try(split({[~]RawTag}, " ")[0,0], "Unknown")That will get out the id of the device. Replace the {[~]RawTag} with the path to your string tag. To get the type of the device:try(split({[~]RawTag}, " ")[1,0], "Unknown")Lastly, to get the value:try(split({[~]RawTag}, " ")[3,0], 0.0)

Awesome. Thanks. One more question. Let’s say I have a thermometer component. I want to update it on a Tag Change event. How do I reference the thermometer (let’s say it’s in the main window) within the event script?

Thanks a lot. I’ve been reading the forum all morning and it really is full of helpful info.

Mike

You don’t need to do anything with scripts. Just simply bind the thermometer property to the tag. There is a bind button to the right of each property. You can also drag the tag you created to the appropriate property of the thermometer and it wil do the same thing.

But then how do I set the thermometer to the parsed value from the tag? Do I create a second tag from the parsed values from the tag created by the TCP Driver and use that new tag for the thermometer?

Sorry if I sound like an idiot. I’m somewhat of a noob. :scratch:

Mike

Yes, you create a second tag that is an expression tag with one of the expressions I mentioned earlier. You can bind the component to the new expression tag. Expression tags are used just like OPC tags except the values come from a calculation which in this case is the parsed value.

Oops, sorry about that. I got it now. Thank you.

Mike

Okay, now I feel really dumb. How do I get the path to my string tag? I tried

try(split({[iButtonTCP]51151/Field0}, " ")[3,0], 0.0)

which gives me an “unable to find referenced tag path” error

I also tried

try(split({Tags/iButtonTemperature}, " ")[3,0], 0.0)

which gives me the same.

I feel like I’m close…

Mike

Try inserting the tag paths with the built in “insert tag” button on the right side of the expression window, those should give you the correct path references for your tags.

That’s it!

Thanks,
Mike