adccommunitymod (AutomationDirect) asked a question.

When are Math results available on a Click?

Created Date: October 30,2012

Created By: cgarai

**** 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.****

Are the results of math expressions available to subsequent math instructions in either the same rung or subsequent rungs? I'm trying to do a digital filter; will either of these work? On the same rung: ----- FilterNew = alpha * FilterNew + (1-alpha)*FilterOld : :----- FilterOld = FilterNew : :-----NewVar = F(FilterNew) Or, on separate rungs: ----- FilterNew = alpha * FilterNew + (1-alpha)*FilterOld ----- FilterOld = FilterNew ------NewVar = F(FilterNew) It seems to me that they have to be in order to make more complicated math possible, but it also seems to violate the notion of updating outputs at the end of the scan. Thanks, Chris


  • adccommunitymod (AutomationDirect)

    Created Date: October 30,2012

    Created by: Do-more PE

    They should be available as in example 1.

    Each parallel output instruction should evaluate from top to bottom fully before moving to the next.

  • adccommunitymod (AutomationDirect)

    Created Date: October 30,2012

    Created by: bcarlton

    but it also seems to violate the notion of updating outputs at the end of the scan

    Math results are not 'outputs '

    Actually the 'Y ' bits at the end of a rung are not 'outputs ' either, they are just bits (named 'Yxxx ') in a table. The state of these bits are transferred to the actual physical outputs at the end of the scan.

    The 'Y ' bit which has been set at the end of a rung can be tested in a following rung and turn on other logic even if the same 'Y ' bit is reset in a third rung. The output associated with that 'Y ' bit will not turn on. but the 'turned on ' logic in the middle rung will be true. (This is a reason that the 'state ' colored boxes can be misleading. They only show the truth state at the end of a scan.)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: October 31,2012

    Created by: cgarai

    That is key info! I'm not sure how I missed out on that concept, but it makes a huge difference in how I think about the programming.

    Wondering where it is outlined in the Click documentation??

    Thank you!

  • adccommunitymod (AutomationDirect)

    Created Date: October 31,2012

    Created by: Do-more PE

    It probably isn't. It's the way that the majority of PLC's on the market operate however. There are exceptions to this rule, but not with the AD line of PLC's.

  • adccommunitymod (AutomationDirect)

    Created Date: November 01,2012

    Created by: milldrone

    It's the way that the majority of PLC's on the market operate

    If you would like to see a Youtube video of how a PLC "works " under the hood go to http://www.ronbeaufort.com/ and check out the sample lessons.

  • adccommunitymod (AutomationDirect)

    Created Date: November 01,2012

    Created by: AlbertL

    That is key info! I'm not sure how I missed out on that concept, but it makes a huge difference in how I think about the programming.

    Wondering where it is outlined in the Click documentation??

    Thank you!

    I think what you 're looking for is in the "CPU Operation " section of Chapter 2 of the Click user manual (page 2-15).

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: October 30,2012

    Created by: cgarai

    Are the results of math expressions available to subsequent math instructions in either the same rung or subsequent rungs?

    I'm trying to do a digital filter; will either of these work?

    On the same rung:

    ----- FilterNew = alpha * FilterNew + (1-alpha)*FilterOld

    :

    :----- FilterOld = FilterNew

    :

    :-----NewVar = F(FilterNew)

    Or, on separate rungs:

    ----- FilterNew = alpha * FilterNew + (1-alpha)*FilterOld

    ----- FilterOld = FilterNew

    ------NewVar = F(FilterNew)

    It seems to me that they have to be in order to make more complicated math possible, but it also seems to violate the notion of updating outputs at the end of the scan.

    Thanks,

    Chris

    Expand Post