Gaylord Williams Posted April 27, 2023 Report Share Posted April 27, 2023 Hi guys, In a VAR i am reading in a data exchange zone, 16 reals words of 16 bits floatting format. In Visilogic. The MFs are 32-bit format. I tried to read directly from the MFs to get a readable value, but the words overlap with the others register words. To solve this problem i used Fernando's technique i saw in his topic, I moved my readed MI to another memory zone, 1 word out of 2, in order to transfer this zone to the MFs via the "structure" function and then be able to read them. However, I have a very small loss of precision(exemple 1498 instead of 5000 , and for power 147, 2663 instead of 147,00 its not a lot but significant in my case. My question is: Is there a way to read a 16-bit word in real floatting format? whitout doing what i did Thank you for your time guys Link to comment Share on other sites More sharing options...
AlexUT Posted April 27, 2023 Report Share Posted April 27, 2023 Unitronics supporting 32-bits floatting format as mostly used. Can you provide more information about your case: - Device model you use with 16-bit memory float registers and programming documents, or link to documentation.. - Programming documents to better understand used memory float forma, or link to documentation. Link to comment Share on other sites More sharing options...
Gaylord Williams Posted April 27, 2023 Author Report Share Posted April 27, 2023 the exchange data format is not precised in my doc , but i can see it with Artics Tools,(a tool to read in the variator) the area is in 16bits format Real. it's an AD 5000 from Nidec (no public data) i thought about a correcting formula but it's not constant few example of missprecision to help you to understand : real value 1500 showed value 1498 3000 ==>2992 750==>748 1250==>1248 1000==>1000 i tried to correct with corrected value = 1498 + (1500 - 1498) * (1500 / 1498) = 1500.33 but for 2992 + (3000 - 2992) * (3000 / 2992) = 3002.34 it's still not precise Link to comment Share on other sites More sharing options...
Fernando Castro Posted April 27, 2023 Report Share Posted April 27, 2023 4 hours ago, Gaylord Williams said: the exchange data format is not precised in my doc , but i can see it with Artics Tools,(a tool to read in the variator) the area is in 16bits format Real. it's an AD 5000 from Nidec (no public data) i thought about a correcting formula but it's not constant few example of missprecision to help you to understand : real value 1500 showed value 1498 3000 ==>2992 750==>748 1250==>1248 1000==>1000 i tried to correct with corrected value = 1498 + (1500 - 1498) * (1500 / 1498) = 1500.33 but for 2992 + (3000 - 2992) * (3000 / 2992) = 3002.34 it's still not precise there is over there some different float 32-bit representations standards. I did not find the one that Unitronics is using but since I recently did some communication with a device that uses IEEE754 for floating point arithmetic and I got same readings, I am assuming it is IEEE754. In your case I'll start reading values in HEX to see if the "RAW" data being sent and received is the same to determine where that precision loss is. is it the data not being transmitted correctly or not converted correctly? Also, you mentioned REAL data which I think it's not quite the same as FLOAT data. but let's start with the hex values, you can use a Modbus master simulator in a computer (Modbus Master Simulator - free software utility for testing Modbus slave devices (dxp.pl)) to see what is in the AD 5000 from Nidec. Link to comment Share on other sites More sharing options...
Fernando Castro Posted April 27, 2023 Report Share Posted April 27, 2023 6 hours ago, Gaylord Williams said: real value 1500 showed value 1498 3000 ==>2992 750==>748 1250==>1248 1000==>1000 i tried to correct with corrected value = 1498 + (1500 - 1498) * (1500 / 1498) = 1500.33 Also, I just realized that in this examples that you gave there are no float numbers all of those are INT ... are you sure that you VFD is using float type?. In any case reading the values in hex format as I mentioned before will give you a hint on where the problem is Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now