Delay during Calc Block

What is the simplest way to have a delay in the code of a CALC block? I need to execute a command and wat xx seconds before the next line is executed.

6 Replies

  • A calc block cannot wait in the middle of its code.. 
    The code will have to finish, but set a counter variable that increments with each scan. Put in an if counter greater or equal to x line that executes the new code. Make sure to initialize and reset the counter appropriately.. if the module or controller is over taxed, a scan rate count may not equal a consistent time value however. I can send an example if you need clarification.
    
    jwooten84 <bounce-jwooten84@community.emerson.com> wrote:
    
    

    What is the simplest way to have a delay in the code of a CALC block? I need to execute a command and wat xx seconds before the next line is executed.

  • In reply to Youssef.El-Bahtimy:

    I knew I could do with an additional timers and such, but just wanted to verify that I wasnt missing something in the syntax to delay.  I even tried with a WHILE loop and no success.  Thanks for the assistance though.  Calc is using a timer built into the module for the delay.

  • Have you considered using an SFC to sequence your commands?

    Also, you could use several action blocksseting their input as needed to execute in sequence.

    Combinations of condition blocks and action blocks could be used and this also helps in trouble shooting as you can see or force blocks as needed.

    One large CALC block may not be the best architecture for your requirement.
    Andre Dicaire
    Sent on my BlackBerry

     
    From: Youssef.El-Bahtimy [mailto:bounce-YoussefEl-Bahtimy@community.emerson.com]
    Sent: Friday, November 02, 2012 01:11 PM
    To: DeltaV@community.emerson.com <DeltaV@community.emerson.com>
    Subject: Re: [EE365 DeltaV Track] Delay during Calc Block
     
    A calc block cannot wait in the middle of its code.. The code will have to finish, but set a counter variable that increments with each scan. Put in an if counter greater or equal to x line that executes the new code. Make sure to initialize and reset the counter appropriately.. if the module or controller is over taxed, a scan rate count may not equal a consistent time value however. I can send an example if you need clarification.  jwooten84 <bounce-jwooten84@community.emerson.com> wrote:  

    What is the simplest way to have a delay in the code of a CALC block? I need to execute a command and wat xx seconds before the next line is executed.

    Andre Dicaire

  • In reply to Andre Dicaire:

    One problem with counting scans is that sooner later, someone is going to change the scan time of the module and the code will not work the same way but they might not see why because the CALC block might be buried somewhere down in the module.  A CND block has a timer built in and, depending on what you are trying to do, several CND blocks might be able to handle the logic.  Alternatively, you can tie a CND block and a CALC block to do pretty much anything that requires a single timer.

  • There are also time parameters accessible in controller.   You can access, read secs past midnight and then simply wait on next command until time delay has passed.

    Sent from my Verizon Wireless 4G LTE DROID


    carllemp <bounce-carllemp@community.emerson.com> wrote:

    One problem with counting scans is that sooner later, someone is going to change the scan time of the module and the code will not work the same way but they might not see why because the CALC block might be buried somewhere down in the module.  A CND block has a timer built in and, depending on what you are trying to do, several CND blocks might be able to handle the logic.  Alternatively, you can tie a CND block and a CALC block to do pretty much anything that requires a single timer.

  • I’ve used a rudimentary sequence/pointer system within a CALC block before to control execution, break the calculation down into steps then increment the pointer at the end of the step to move the Calc on to subsequent step you wish to execute. In your case don’t increment the pointer until your timer/counter/FOR loop has completed.
     
    Quite easy to do in a calc block and not as cumbersome as an SFC, although it is harder to try to troubleshoot the inside of a calc block compare to SFC.
     
    From: jwooten84 [mailto:bounce-jwooten84@community.emerson.com]
    Sent: Friday, November 02, 2012 10:36 PM
    To: DeltaV@community.emerson.com
    Subject: RE: [EE365 DeltaV Track] Delay during Calc Block
     

    I knew I could do with an additional timers and such, but just wanted to verify that I wasnt missing something in the syntax to delay.  I even tried with a WHILE loop and no success.  Thanks for the assistance though.  Calc is using a timer built into the module for the delay.