AVEVA Plant SCADA Forum
A support forum for AVEVA Plant SCADA (formerly Citect SCADA). Share new and exciting product information, connect, learn, and collaborate with the ecosystem of Plant SCADA Users. AVEVA Plant SCADA a reliable, flexible and high-performance Supervisory Control and Data Acquisition software solution for industrial process customers. This forum is to connect, share, learn and collaborate new and exciting product information. Feel free to join and share to your Ecosystem of Plant SCADA Users.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-09-17 07:37 AM . Last Modified: 2024-09-17 09:20 AM
Not sure if I would describe this correct, but I'll try to do my best.
I have variables which each contains a value. The value here is actually value and needs to be combined so that I can present this in mimic.
From gregstoll.com/floattohex:
So for the example, I have the 2 values: 16748 and -21408.
When converting the values to HEX, it gives gives me: 416C and AC60
When using a "floating point to hex calculator" online to convert hex to float, this gives me: 416C + AC60 = 14.7921
14.7921 is the value that I want from 16748 and -21408. This is of course just an example with values, but would like to be able convert it to a readable value in mimic
How can i make citect/cicode to do this, add 16748 and -21408 (hex 416C + AC60), to make 14.7921
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-09-19 10:14 PM
Hi @kay.oddvar,
I talked to a colleague and he showed me a cicode library which has various math functions available in it. It can be downloaded from the Plant SCADA Toolbox on GCS (Numeric Tools):
https://softwareforums.aveva.com/citect_community/f/toolbox/25150/cicode-tools
Here is the cicode function call on a page that displays the correct data:
Bin2Float(IntToBinary(Tag01)+IntToBinary(Tag02))
I've also attached the file here, in case you don't have access (rename it to *.ci before use in Plant SCADA). Also special credit goes to Eric Black who is the author of this Cicode.
Kind regards
Olivier
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-09-19 08:03 PM
Hello @kay.oddvar,
I thought this would be a simple one, but it looks like some conversion functions are missing in Citect/Cicode.
I got as far as converting the two INT values (Tag01 and Tag02 in my example) into a String Hexadecimal using the following cicode:
HexToStr(Tag01,4)+StrRight(HexToStr(Tag02,4),4)
This results in the following String in runtime: "416cac60". I could also convert it to an Integer using StrToHex, but this just resulted in the integer tag value 1097641056 in runtime.
I couldn't find a way to get the hex into the float.
I'm not sure if you have a Modbus PLC or equivalent in your system? But this could be one approach, which I have tested and works perfectly.
Basically you place the two integer tag values in adjacent modbus registers in the PLC. If using default Modnet driver, you would put Tag02 in 400001 address, and then Tag01 in 400002 address. Then define a 3rd variable, with type "REAL" that has address 400001 (it will read data from 400001 and 400002 words). The drive then does all the conversions for you. In my example, I could get it displaying 14.7921 by using the display format on the runtime page ##.####.
There might be a simpler more elegant solution to this problem, but this is what I could offer you in the limited time I have.
Kind regards
Olivier
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-09-19 10:14 PM
Hi @kay.oddvar,
I talked to a colleague and he showed me a cicode library which has various math functions available in it. It can be downloaded from the Plant SCADA Toolbox on GCS (Numeric Tools):
https://softwareforums.aveva.com/citect_community/f/toolbox/25150/cicode-tools
Here is the cicode function call on a page that displays the correct data:
Bin2Float(IntToBinary(Tag01)+IntToBinary(Tag02))
I've also attached the file here, in case you don't have access (rename it to *.ci before use in Plant SCADA). Also special credit goes to Eric Black who is the author of this Cicode.
Kind regards
Olivier
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-09-20 12:44 AM
I also thought I would be able to do this, but it got too complex for me.
For the calculation that I needed, I used the following functions:
REAL FUNCTION Bin2Float()
STRING FUNCTION IntToBinary()
INT FUNCTION Bin2Dec()
STRING FUNCTION IIF()
With these functions, I was able to get the correct value for the 2 variables.
Appreciate the help
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.