adccommunitymod (AutomationDirect) asked a question.

Min and max inside math function

Created Date: November 07,2015

Created By: ivan_drago

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

Hi, I'm using a click PLC model C0-02DD2-D with the thermocouple expansion module C0-04THM. Is there a function available inside the math function to compare two values and return the max or min value? For example: DF2 = 10 Min(5,DF2) returns 5 And a similar function to return Max? I have a math function which returns a value between 0-100 used to open a modulating valve a certain percent open. But I also have a user setable minimum percent open and maximum percent open. I can see how to do this with conditional rungs, but it starts to add a lot of rungs of code. It would be easier for me to keep it all straight contained in one math function. Thanks.


  • adccommunitymod (AutomationDirect)

    Created Date: November 09,2015

    Created by: winterrossi

    I don't think the Click has anything like that. It's math function is just like having a scientific calculator.

  • adccommunitymod (AutomationDirect)

    Created Date: November 09,2015

    Created by: winterrossi

    Hint: put that code in a separate subroutine and just call it when the value changes.

  • adccommunitymod (AutomationDirect)

    Created Date: November 07,2015

    Created by: ivan_drago

    Hi,

    I'm using a click PLC model C0-02DD2-D with the thermocouple expansion module C0-04THM.

    Is there a function available inside the math function to compare two values and return the max or min value?

    For example:

    DF2 = 10

    Min(5,DF2) returns 5

    And a similar function to return Max?

    I have a math function which returns a value between 0-100 used to open a modulating valve a certain percent open. But I also have a user setable minimum percent open and maximum percent open.

    I can see how to do this with conditional rungs, but it starts to add a lot of rungs of code. It would be easier for me to keep it all straight contained in one math function.

    Thanks.

    Expand Post