Negative Raw Values

My system is reading values from a PLC using the Kepware Modbus driver.
I have a Scaled OPC tag in Ignition, which is of type Float4.
The Lo & Hi Raw are 6400 and 32000
The Lo & Hi Scaled are 0 and 40.
Clamping Mode “Both” is enabled.

When the value in the PLC goes to less than zero, say -5, then Ignition displays the full scale value, 40.

I looked into this further by disabling the scaling, and in this case Ignition displays 65531, which is the number you get if you ignore the sign bit on -5.

Is there any way to tell Ignition that the raw value is signed?

Also, perhaps of note, is that Kepware’s “Quick Client” displays the value as -5 in unscaled mode and as 0 in scaled mode, so it is being retrieved correctly from the PLC, it is just a matter of interpretation of the raw data by Ignition.

Hi,

Is it possible that you added the tag to Ignition while it was defined as a Word in Kepware, and then later went in and changed the data type there to something else, like Short? I was only able to reproduce this problem by first subscribing to the tag in Ignition and then changing the type- Ignition continues to receive data for the type subscribed under, but the quick client- which subscribes each time you open it- gets the new data type.

If this sounds plausible, you just need to get Ignition to re-subscribe. You could disable/reenable the sqltag, but probably the easiest thing to do is go to Runtime>Reinitialize in Kepware. This will disconnect Ignition from the server, and Igntion will reconnect and resubscribe after a few seconds.

Let me know if all of this is way off, and we’ll see if there’s another explanation.

Regards,

Thanks for the reply, but I don’t think this is the issue as it persists across system restarts (this is a system in development at the moment)
Also, I haven’t defined the tag in Kepware at all per se, I am just using the modbus address (eg Kepware.Modbus.PLC.402049) in Ignition so Kepware doesn’t need to have tags defined in this case. I have created a few tags in Kepware for testing with Quick Client, but they are not being read by Ignition.
However, this does cause me to think that maybe Kepware defaults to unsigned in this case. I’ll have a look at the driver help and get back.

Update *******

I think I can solve this by adding the datatype (eg @short) to the end of my address. The default is “word” which is unsigned, but “short” is signed. See extract from Kepware help below.

I’ll look at it on Monday, but I think this should do it.

[code]
The OPC server is connected to a temperature-control instrument. The display on the instrument reads negative, but the number in the Quick Client or some other client reads backwards from 65535. For instance, -2 reads 65534.

Solution:
Change the tag from an unsigned integer (Byte, Word, Dword) to a signed integer of the same size (Char, Short, or Long, respectively).

If you are using a dynamic tag in your client application, you can specify a data type different than our driver’s default for that memory type by appending an @ sign, then our server’s name for the datatype, to the item ID in your client. (Example for a standard Modbus device in our Modbus driver: Channel1.Device1.400001@Short) Information about dynamic tags, including about setting the data type, is in our server help file (Help | Contents), in the topic Basic Server Components | What is a Tag? | Tag Properties | Dynamic Tags.[/code]

1 Like

We also had to append the data type to the register location on a project where we were using Kepware’s Dynamic Tags feature. Bear in mind that you’ll have to change your scaling so that the input range (-32768 …32767 or a subset) maps to your scaled range (-40°C …40°C or whatever).

If you’re using Modbus, have you looked at Ignition’s free Modbus driver? It works natively with Modbus TCP/IP, but even if you’re using Modbus ASCII or RTU, you can buy something like a Moxa MB3180 to translate between the Ethernet and serial protocols for half the price of the Kepware driver. We’ve used them before with no problems.

Thanks for the tip. This project was specified and the equipment ordered before the built-in TCP driver was released to production. We will definitely be going down that road in future.
We have previously used the B&B Electronics MES1A which costs €280 for Modbus RS-232 to TCP/IP conversion. What sort of price is the Moxa Unit?

http://amplicon.com have it for £159 (about €186), along with bigger models with more serial ports. I’ve used Moxa kit for years with good results.

I’ve found B&B to be good but expensive.