Using Formulas With Scripts

Forum Home Forums Understanding the Software Using Formulas Using Formulas With Scripts

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #13497
    DHague
    Participant

    I have a channel with a formula that needs to be activated at a regular interval this seems to be provided with the “EverySec” function in the “Timers” script. For example, I want to be able to have the following formula:

    EverySec(SetVal(101, Val()+1:Val()))

    However, this causes an error. Some clarification on how this functionality is achieved would be helpful.

    Thanks.

    #13501
    Mikhail
    Moderator

    If you use this formula inside the channel 101, try
    EverySec(() => { return Val() + 1; }) or
    EverySec(() => Val() + 1)
    The channel should be of the Calculated type.

    • This reply was modified 1 year, 10 months ago by Mikhail.
    • This reply was modified 1 year, 10 months ago by Mikhail.
    #13504
    DHague
    Participant

    Is there a way to edit the script to make it update every half second instead of every second?

    #13505
    DHague
    Participant

    Thanks

    • This reply was modified 1 year, 10 months ago by DHague.
    #13511
    Mikhail
    Moderator

    Is there a way to edit the script to make it update every half second instead of every second?

    Open the Scripts table and check the EveryPeriod method. You can use it instead of EverySec.

    #13519
    DHague
    Participant

    Thanks for the info,
    I have been trying to figure out how to get the channel to stop counting at a maximum value, using limits to do this has proven to be non-functional even when tied to the channel. Currently I have the E. Low and the Low set to 0, the High and E. High set to 165, and the dead band set to 1. Is there a way to have my channel stop counting once it reaches 165 using limits or is that under a different function?

    #13521
    Mikhail
    Moderator

    You should create a more complex function and use it inside EverySec, e.g.,
    EverySec(() => MyFunc)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.