adccommunitymod (AutomationDirect) asked a question.

DL06 Analog scaling help

Created Date: October 13,2014

Created By: dd33

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Hello, I am just getting started with analog inputs and have some questions about scaling. I am using a D0-06DR with a F0-08ADH-1 analog input card. I am trying to read a flow meter that outputs 4ma @ 0 and 20ma @166.66. If I round 166.66 up to 167 I was able to get the sample programming using BCD on page 17 of the manual to work. http://www.automationdirect.com/static/manuals/d0optionsm/ch4.pdf I can't figure out how to do this with the real number of 166.66 though. Can anyone help? Thanks!


  • adccommunitymod (AutomationDirect)

    Created Date: October 14,2014

    Created by: Bob S BN

    BCD won't give you a decimal. With that said, if you need the precision, you can "imply " a 2 place decimal by adding a couple zeroes to the end of the appropriate scaling values. If you are displaying the value on an HMI, most have the option to display with the decimal point in the right place.

  • adccommunitymod (AutomationDirect)

    Created Date: October 14,2014

    Created by: scott.lawrence

    you can do this easily, as Bob said, using decimal (BIN in AD).

    here's an example using a MATHBIN that scales the same module as 0-15.000 PSI.

    http://i.imgur.com/4pJ9VhV.png

  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: dd33

    I think I have made some progress thanks to Scott's help.

    I tested the input with a Fluke 789 meter and the results are quite accurate at 4 - 8 - 12 - 16 and 20mA.

    I am confused by the output I get when the PLC is provided with current less than 4mA though. At 0mA I get a reading that is close to 100% of my scale (16674) and at 2mA I get a reading 18752 which is greater than my scale of 16666.

    What am I missing?

    Here is a screenshot of the code

    http://i.imgur.com/SvL5g2x.png

    Thanks again!

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: bcarlton

    What happens when the raw value in V400 goes below 13107? The first subtraction yields a negative value. I think everything else is invalid after that.

  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: dd33

    At 4mA V400 = 13120 and V4000 = 4

    At 8mA V400 = 26225 and V4000 = 4169

    At 12mA V400 = 39326 and V4000 = 8334

    At 16mA V400 = 52428 and V4000 = 12500

    At 20mA V400 = 65533 and V4000 = 16665

    If I drop below 4mA I get these results:

    3mA V400 = 9846 and V4000 = 19795

    2mA V400 = 6564 and V4000 = 18752

    1mA V400 = 3284 and V4000 = 17710

    0mA V400 = 26 and V4000 = 16674

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: bcarlton

    Before the MATHBIN do a test on V400. If less than 13107 then set it equal to 13107. Then you'll get zero for the values below the minimum.

    An alternate is to do a BTOR on V400, storing the result in another pair of registers. Then use MATHR to do your calculations on the result. You'll get negative values below your minimum.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: dd33

    Ok, it seems to be working now. Not sure if this is the proper way to enter the code though.

    Here is the screenshot:

    http://i.imgur.com/w2A1YPZ.png

    Thanks again for the help.

  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: bcarlton

    That should work ok. Glad you got it. Do you understand what the problem was? The MATHBIN doesn't like it if the answer goes negative at any point in the calculation.

  • adccommunitymod (AutomationDirect)

    Created Date: October 15,2014

    Created by: dd33

    I removed the 4th rung from the program and it seems to run fine. I think I have it working now and was able to setup a few additional sample sensors. Thanks for the help.

  • adccommunitymod (AutomationDirect)

    Created Date: October 19,2014

    Created by: dd33

    Looks like I am still having problems with this.

    I added a second flow meter (v402) into the program but for some reason I can't set it to output 13107 if the input is less than 13107 on rung 6. It looks like the less than contact is true but it is not loading 13107 into v402.

    I have attached two screenshots of the programming. I am sure I am missing something obvious here. Any help would be appreciated.

    rungs 1-5 http://i.imgur.com/K3GoUoN.png

    rungs 6+ http://i.imgur.com/sww6zZS.png

    Thanks

    Expand Post
10 of 13