I’ve been wrestling with a scaling issue with an OPC tag (-10 to +10) volt analog output, and would appreciate some help.
I have a tag coming out of an Opto-22 device and I am running ignition version 8.0.16. Showing that I can get one extreme or the other to display correctly, but any value in the middle is wrong, is telling me that this is not a linear scale, and was looking for help with either python code examples or perhaps something I am missing directly with the OPC tag definition, I would appreciate a nudge on the proper direction.
Using Ignitions OPC Quick client I can collect counts/values of -1606 for -10 and 16672 for +10 volts.
I then use these values to define the OPC tag as follows;
In my code I can then have a numeric field display both extremes as follows, but anything in-between is not correct.
…and + 10 volts
But, 5.5 volts displays as 9.93 volts (etc, etc)
All tag values are defined as floating, and changing from Linear to Square Root does not help… as mentioned I would appreciate some help!
Can you post datasheet links for the devices in question?
You posted the raw values for -10V and 10V, but what raw value is being read when it shows 9.93V. Just want to make sure that just because you’re feeding it 5.5V doesn’t mean that equivalent raw value is coming through.
Thank you all for your responses,
I have attached a Datasheet for the Opto-22 DA7 (-10 to 10 volt) Analog output
DA7_0441_Std_Voltage_Output_data_sheet.pdf (601.9 KB)
I’ve monitored the values/counts as I’ve changed voltage as well as placed a volt meter on the output to ensure that the volts that I request are actually being output…
Besides the -10 and 10 volt raw counts, I’ve documented the raw counts for the following voltages, with the first column being volts.
-1 = -16512
-2 = -16384
-3 = -16320
-4 = 16256
-5 = 16224
1 = 16225
2 = 16384
3 = 16447
4 = 16511
5 = 16543
6 = 16576
7 = 16607
8 = 16639
9 = 16655
10 = 16672
And the OPC Quick Client for 5.5 volts is below;
Which shows 5 volts being 16543 raw counts and 5.5 being 16559 for a difference of 16 counts, yet still below 6 volts (16576).
Again thank you for your help…
My mistake for the -4 and -5 volts the counts should be NEGATIVE or -4 volts = -16256 and -5 volts should be -16224
I apologize for the confusion
It looks something like a Modbus byte-order problem to me. Can you reverse the byte-order? I’ve tried it in a spreadsheet but can’t see a pattern.
The datasheet says the modules are 12-bit ADC so max positive would be 2047(0x07FF) and max negative would be -2048 (0xF800).
I think @Transistor is on the right path.
I question whether you should even have this addressed as floating point or if you should just be reading a 16-bit register and then applying scaling.
What does your Modbus address mapping look like?
edit: oops, based on your screenshot you probably don’t have it configured as a float in the address mapping, but it would still be useful to see.
Oooh, that could do it. I missed that!
Haha, I’m not sure now, need to see the mapping.
Good Points, ModBus is very confusing to me…
Below is the Ignition addressing, followed by a shot of ModScan64 (addressing) and value.
Modscan with the value of 5.5 volts being output
Both Ignition and ModScan is addressed to the IP address of the Opto-22 board containing the DA7 module.
I don’t understand what I’m seeing in the Modscan screenshot. Is it saying the value is
Are you in some kind of view that is showing you 32-bit values by combining adjacent registers?
Okay, that value is
0x40AFE6FE, which if you interpret is a 32-bit IEEE float is
So maybe you don’t need any scaling at all, and you just need to change the Modbus Type in your mapping to be 32-bit float.
Changing views in Modscan to Floating Point ( most significant register first ) and I now see the value that is being output 5.4969 or my (approx) 5.5 volts
Holy cow guys, without you and your ideas I would still be working on this (night/day!!! I might add) and for this I sincerely want to thank you!
I changed the addressing on the Ignition side to floating point, and turned off scaling, and I’m displaying out to the screen/HMI the actual values, example follows;
Many many thanks!