Read/Write and Clear from an Array Tag (integer array)

In the Tag Browser:

For reference: Tag Groups - Manual

1 Like

I have creatred New tag group (Named as New1) , select it's mode as direct , rate i s 1000 ms, and add this New1 tag group in TO_LVF_CIT_N

99

Then when I run above script (read and write OPC Tag and changed 1st value 631.67 ) in script console and refresh tag browser for checking value is changed or not...But still value is not changed I get this values
[625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])

instead of this-> [631.6699829101562, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]))

So at a minimum, that tag group will read at a pace of 1000ms. So every second it will get new values.

The thing to do, would be to write to the tag and then check it in the PLC direct and start there before moving to Ignition.

If you change the data in the tag browser directly, does the value change in the PLC to the new value?

Yes, I already use system.tag.writingBlocking for that here then after also apply sleep but after that not get updated values on tag broswer also refresh and check it

import time

opcTagPath = "[Sample_Tags]TO_LVF_CIT_N"
# Read the current values from the OPC tag
currentValues = system.tag.readBlocking([opcTagPath])[0].value
print(currentValues)

c1 = currentValues[0]
print("c1",c1)

c1 = 631.67
print("updated c1 : ",c1)

currentValues[0] = c1
print("changed value : ", currentValues)

o = system.tag.writeBlocking([opcTagPath], [currentValues])
print system.tag.writeBlocking([opcTagPath], [currentValues])

opcServer = "UAS@VLC210203"
itempath = "nsu=https://www.S/;s=TO_LVF_CIT.CIT"
system.opc.writeValue(opcServer, itempath, currentValues)

print system.opc.writeValue(opcServer, itempath, currentValues)
print("End")

system.opc.readValue(opcServer, itempath)
print system.opc.readValue(opcServer, itempath)

time.sleep(3)

print("Again read updated values")
currentValues1 = system.tag.readBlocking([opcTagPath])[0].value
print(currentValues1)

Get this output

>>> 
array(java.lang.Float, [625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])
('c1', 625.3499755859375)
('updated c1 : ', 631.67)
('changed value : ', array(java.lang.Float, [631.6699829101562, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]))
[Good]
Good
Good
End
[[Ljava.lang.Double;@101d3e93, Good, Mon Dec 11 21:34:49 IST 2023 (1702310689339)]
[[Ljava.lang.Double;@3cbb5a09, Good, Mon Dec 11 21:34:49 IST 2023 (1702310689341)]
Again read updated values
array(java.lang.Float, [625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, 625.3499755859375, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0])
>>>

Entries not updated in tag browser:

If you change the value directly in the tag browser, not via scripting, and then check the PLC is the data getting to the PLC?

1 Like

No , I get this error when I change value directly in tag browser then get array element type mismatch
image

Ok. You will need to start there and fix that first. Check the path to the tag etc... and get it working first from the Tag Browser. Then start implementing it in scripting.

1 Like

Ok sure
Here when I connect my OPC then default values that is coming from OPC in TO_LVF_CIT tag that giving Eroor_TypeConversion , So that I have created new OPC tag named as TO_LVF_CIT_N and select Float Array datatype (while creating this tag) so then I show entries of this TO_LVF_CIT_N tag showing properly 625.35, 625.35 and so on because it is no. of values in Float array.:point_down::point_down:

so is there mismatch occures while i am creating here float array ?
And in Ignition ->Config->Tags->Sample_Tags->TO_LVF_CIT_N shows entries in this way, Here all value are not separated with any delimiter
(like space).

Are you sure your OPC server is even capable of this write operation? Are you getting any logged errors in that software? You may need to be working with support to qualify that remote server's behavior (using wireshark on an unencrypted connection).

1 Like

Yes , it is capable to write , because I have checked with other tages also when I changed value of that tag via tag browser or when run perspective project and changed its value by entering new value in numeric entry field then it's work properly, See below image I checked for 2 to 3 tags for normal reading writing but its data type is only float /double not float array , I face this problem only in Float Array datatype

It doesn't seem to like the float array though.
I agree with @pturmel. Might be time for more directed support to get this working first.

ok sure will check.Thank you @bschroeder @pturmel