albertogonsa Posted July 11, 2018 Report Share Posted July 11, 2018 Hello everyone, I'm Alberto from Spain, this is my first post in the community. I started in a new company and I have to modify a project with a V570. I have to read an analog value and linearize it between 0 and 1366000. I use the linear function from the analog input to a ML variable (because of the size). The problem is that the value I am reading in the output variable is negative and with no sense. I would like to use an unsigned output variable but LINEAR function doesn't allow to do this for this size of value. Do you know how to do this? Thank you very much in advanced. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted July 11, 2018 MVP 2022 Report Share Posted July 11, 2018 What is the analog input? If it's 4-20mA then you will get a negative number after linearization if the input is less than 4mA. Show us the linearization function in your program, or attach the program and someone will help you. We also need to know what I/O module is being used so we know what the analog resolution is. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted July 12, 2018 MVP 2022 Report Share Posted July 12, 2018 +1 to All of Flex's requests, but your aim involving 0 - 1366000 as the output raises another issue. Depending on the type of input and the subsequent resolution that the system can measure, at even the best resolution available the output number is going to shift by about 83 each tiny change that the system can measure. If your system has smaller input resolution, then this is going to make this number larger, so is this big shift in output number going to be ok with what you are trying to achieve? ie It isn't possible to get your range to 1366000 shifting by +/-1.......it will be much larger steps. cheers, Aus Quote Link to comment Share on other sites More sharing options...
albertogonsa Posted July 13, 2018 Author Report Share Posted July 13, 2018 On 7/11/2018 at 4:45 PM, Flex727 said: What is the analog input? If it's 4-20mA then you will get a negative number after linearization if the input is less than 4mA. Show us the linearization function in your program, or attach the program and someone will help you. We also need to know what I/O module is being used so we know what the analog resolution is. Hello all and thank you for your answer. The HW configuration is shown in the image below. The I/O module is an IO-ATC8/AI8. And this is the linear function parameters: Th analog input is 4-20 mA and the negative number was given with a value of 6 mA more or less. What I think is that the output variable is signed value so the linear function try to linearize the input between -2,147,483,648 to +2,147,483,647 that means to me 4mA = -2,147,483,648 and 20mA = +2,147,483,647 Am I wrong?? On 7/12/2018 at 3:21 AM, Ausman said: +1 to All of Flex's requests, but your aim involving 0 - 1366000 as the output raises another issue. Depending on the type of input and the subsequent resolution that the system can measure, at even the best resolution available the output number is going to shift by about 83 each tiny change that the system can measure. If your system has smaller input resolution, then this is going to make this number larger, so is this big shift in output number going to be ok with what you are trying to achieve? ie It isn't possible to get your range to 1366000 shifting by +/-1.......it will be much larger steps. cheers, Aus Hello Ausman, your are right, input changes will cause big outup changes but is ok for my application. What I want to do is open and close one plastic layer depends on the irradiance. Thank you very much. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted July 13, 2018 MVP 2022 Report Share Posted July 13, 2018 5 hours ago, albertogonsa said: What I think is that the output variable is signed value so the linear function try to linearize the input between -2,147,483,648 to +2,147,483,647 that means to me 4mA = -2,147,483,648 and 20mA = +2,147,483,647 Am I wrong?? Yes, you're wrong. That is not how the linearization function works. It sets ML 12 to 0 when MI 523 is 3277 and sets ML 12 to 1366000 when MI 523 is 16383, and linearizes between those numbers. What is the value of MI 523 when you believe you're seeing 6mA on the input? And how do you know you actually have 6mA? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted July 13, 2018 MVP 2022 Report Share Posted July 13, 2018 2 hours ago, Flex727 said: It sets ML 12 to 0 when MI 523 is 3277 and sets ML 12 to 1366000 when MI 523 is 16383, and linearizes between those numbers. Just to expand and clarify, it actually uses those inputs to create a mathematical formula (also known as slope). Then it uses that formula to convert (or linearize) from the "X" variable to the "Y" variable. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted July 13, 2018 MVP 2022 Report Share Posted July 13, 2018 Hi Alberto, have a look at my Linz calculator here: It works the same formula as the PLC, and might better explain the relationships if you play with the X & Ys. cheers, Aus Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.