{"id":279,"date":"2022-05-25T11:05:15","date_gmt":"2022-05-25T09:05:15","guid":{"rendered":"https:\/\/disorder.dk\/wonderware\/?p=279"},"modified":"2022-05-25T11:05:15","modified_gmt":"2022-05-25T09:05:15","slug":"aveva-system-platform-does-not-support-unsigned-integers","status":"publish","type":"post","link":"https:\/\/disorder.dk\/wonderware\/2022\/05\/25\/aveva-system-platform-does-not-support-unsigned-integers\/","title":{"rendered":"AVEVA System Platform Does Not Support Unsigned Integers"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The DDESuiteLink protocol in AVEVA System Platform 2020 R2 SP1 that connects to the OI Gateway R3, does not support unsigned 32 bit integers. All Integer datatype attributes on objects, are read as signed integers, despite being read correctly from the OPC UA server in the PLC.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The solution is to never use bit 31 in a bit mapping, as this is the data for signed or unsigned. You can only use 31 bits in a status word. Read the full explanation and data flow below.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Data from the Codesys PLC<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The background for this problem, is the implementation of a status function block in a PLC. The status block collects 32 bits of information and packs them in a DWORD datatype in the Codesys Runtime PLC. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1009\" height=\"385\" src=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger1_codesys.jpg\" alt=\"Codesys Runtime with 32 bits packed in a DWORD\" class=\"wp-image-281\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger1_codesys.jpg 1009w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger1_codesys-300x114.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger1_codesys-768x293.jpg 768w\" sizes=\"auto, (max-width: 1009px) 100vw, 1009px\" \/><figcaption>Codesys Runtime with 32 bits packed in a DWORD<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here the signal PHA001_V1 shows a DWORD with a binary value and its decimal representation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">System Platform Object for 32 bits of Boolean values<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In System Platform, the receiving object has a DWORD attribute configured and 32 bits of Booleans for reading out each single bit value. The only possible datatype is an Integer. There is no choice of signed or unsigned, this is where our troubles start.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"270\" src=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger2_dword_object.jpg\" alt=\"System Platform Integer Datatype is not chosen to be signed or unsigned.\" class=\"wp-image-282\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger2_dword_object.jpg 925w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger2_dword_object-300x88.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger2_dword_object-768x224.jpg 768w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><figcaption>System Platform Integer Datatype is not chosen to be signed or unsigned.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Each bit is being read out with a reference to the DWORD attribute and is being called with .00 for bit 0 up to .31 for bit 31. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"522\" src=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger3_bit00_object.jpg\" alt=\"System Platform how to read a single bit value\" class=\"wp-image-283\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger3_bit00_object.jpg 925w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger3_bit00_object-300x169.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger3_bit00_object-768x433.jpg 768w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><figcaption>System Platform how to read a single bit value<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">System Platform OI Gateway OPC UA Client<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The OI Gateway OPC UA Client reads the DWORD just fine, as a unsigned Integer. So far so good. The unsigned integer from the Codesys PLC comes correctly through the OPC UA server to the client.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"362\" src=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger4_smc-1024x362.jpg\" alt=\"System Platform OI Gateway OPC UA Client reading a unsigned integer\" class=\"wp-image-284\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger4_smc-1024x362.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger4_smc-300x106.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger4_smc-768x271.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger4_smc.jpg 1296w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>System Platform OI Gateway OPC UA Client reading a unsigned integer<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">System Platform DDESuiteLink Unsigned Integer<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When viewing the DWORD and BIT00 object attributes in the Object Viewer, it is clear that the Integer is being parsed as a signed integer and its overrun into the maximum positive value of a signed integer.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"159\" src=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer-1024x159.jpg\" alt=\"System Platform Object Viewer Unsigned integer\" class=\"wp-image-285\" srcset=\"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer-1024x159.jpg 1024w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer-300x47.jpg 300w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer-768x119.jpg 768w, https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer.jpg 1101w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>System Platform Object Viewer Unsigned integer<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The solution is to only use bit 00 to bit 30 in a status word, as System Platform treats all integer datatypes as signed integers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The DDESuiteLink protocol in AVEVA System Platform 2020 R2 SP1 that connects to the OI Gateway R3, does not support unsigned 32 bit integers. All Integer datatype attributes on objects, are read as signed integers, despite being read correctly from the OPC UA server in the PLC. The solution is to never use bit 31<\/p>\n<p class=\"excert-link-wrapper\"><a href=\"https:\/\/disorder.dk\/wonderware\/2022\/05\/25\/aveva-system-platform-does-not-support-unsigned-integers\/\" class=\"excerpt-more-link\" >Continue Reading<span class=\"screen-reader-text\"> &#8220;AVEVA System Platform Does Not Support Unsigned Integers&#8221;<\/span><span class=\"meta-nav\"> &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":285,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[2,6,37,23],"tags":[57,56,34,32,58,19],"class_list":["post-279","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-archestra-ide","category-wonderware","category-codesys","category-system-platform-2020","tag-2020-r2-sp1","tag-aveva","tag-codesys","tag-plc","tag-system-platform","tag-wonderware"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"https:\/\/disorder.dk\/wonderware\/wp-content\/uploads\/2022\/05\/unsignedinteger5_objectviewer.jpg","_links":{"self":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/comments?post=279"}],"version-history":[{"count":1,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/279\/revisions"}],"predecessor-version":[{"id":286,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/posts\/279\/revisions\/286"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/media\/285"}],"wp:attachment":[{"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/media?parent=279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/categories?post=279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/disorder.dk\/wonderware\/wp-json\/wp\/v2\/tags?post=279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}