gazza29 Posted September 29, 2021 Report Share Posted September 29, 2021 hi what is the best way to use a math's functions. I need to convert an output put off my linearize function to a percent so i can show the tank contents in litres at the moment its 13 but need to convert this to a percentage my tank level is 21000 x 13% will give my tank contents so i need to convert that 13 also what am i going wrong with the timer below it wont energize thanks, Gary Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted September 29, 2021 MVP 2023 Report Share Posted September 29, 2021 59 minutes ago, gazza29 said: my tank level is 21000 x 13% will give my tank contents so i need to convert that 13 You need to convert a 13% tank level to gallons? One way is to multiply 21000 times 13, then divide by 100. That's the normal way percentages work. Another way would be to have a second linearization function that outputs gallons instead of percentage. 1 hour ago, gazza29 said: also what am i going wrong with the timer below it wont energize Is your timer in a subroutine that is being called by the Main Routine? Edit: I see that it is in the Main Routine. It's not possible to see if you have the tag names correct (i.e. is the timer output bit the same tag that's energizing the coil). If that is all correct, do one or both of these: 1) Place an INC function just after the Timer function and see that it actually increments. If not, 2) Place a test bit in parallel with the Negative Transition contact in front of the Timer function and activate it manually while online. This should help point you to the problem. Link to comment Share on other sites More sharing options...
gazza29 Posted September 29, 2021 Author Report Share Posted September 29, 2021 Thanks for that how do I set another linearization function up to read gallons from my 4-20ma in put new to all this thanks gary Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted September 29, 2021 MVP 2023 Report Share Posted September 29, 2021 I would re-do your first linearization function. I don't know what your comfort level with algebra is, but it is common for people to have problems visualizing what this block is doing. It is literally a PLC version of the y=mx+b line equation. Where did you get the values you have in the input parameters of the block? They should be these- a: - channel on I/O module b: A/D counts at 4 mA 😄 Minimum scaled value at 4 mA d: A/D counts at 20 mA e: Maximum scaled value at 20 mA If you don't know the A/D count minimum and maximums you can get them off the datasheet or post your part numbers. Sometimes it's helpful for me to draw a little graph to pluck those numbers off. Joe T. 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