• Not Answered

Counter block display seconds (convert Integer to float)?

Hi all ........

I have been asked by our client if it is possible to display the seconds on a counter (count down) when it is active (maybe convert the 32-bit signed integer to a float), is this possible, I have seen some examples of code to calculate this would this be the way to do it in a calc block for example?

9 Replies

  • as you know, time remaining is not an available parameter on these timer blocks. Time remaining is calculated by subtracting Elapsed_Time from Time_Duration.

    For display purposes, you can do this calculation in a picture variable in Operate, or with a Graphics expression in Live. Yes you can do this in the controller in a CALC block expression. But I would build a GEM or Dynamo that can be used to display Time Remaining. Simply point this display object to the module/TimerBlock and there is no need to modify the existing modules. The Time_duration parameter does not change so it places virtually no load on communications.

    Andre Dicaire

  • Use a unit timer?

    Sent from my iPhone

    On 9 Aug 2021, at 19:10, Andre Dicaire <bounce-ADicaire@emersonexchange365.com> wrote:

    
    <EE365_5F00_RGB_5F00_Standard_5F00_69x42-png_2D00_90x55-png>
    Update from Emerson Exchange 365
    <4U2G7EF4S3IZ-jpg_2D00_70x70x2-jpg>
    Andre Dicaire

    as you know, time remaining is not an available parameter on these timer blocks. Time remaining is calculated by subtracting Elapsed_Time from Time_Duration.

    For display purposes, you can do this calculation in a picture variable in Operate, or with a Graphics expression in Live. Yes you can do this in the controller in a CALC block expression. But I would build a GEM or Dynamo that can be used to display Time Remaining. Simply point this display object to the module/TimerBlock and there is no need to modify the existing modules. The Time_duration parameter does not change so it places virtually no load on communications.

    View online

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.

  • Use a unit timer?

    Sent from my iPhone

    On 9 Aug 2021, at 19:10, Andre Dicaire <bounce-ADicaire@emersonexchange365.com> wrote:

    
    <EE365_5F00_RGB_5F00_Standard_5F00_69x42-png_2D00_90x55-png>
    Update from Emerson Exchange 365
    <4U2G7EF4S3IZ-jpg_2D00_70x70x2-jpg>
    Andre Dicaire

    as you know, time remaining is not an available parameter on these timer blocks. Time remaining is calculated by subtracting Elapsed_Time from Time_Duration.

    For display purposes, you can do this calculation in a picture variable in Operate, or with a Graphics expression in Live. Yes you can do this in the controller in a CALC block expression. But I would build a GEM or Dynamo that can be used to display Time Remaining. Simply point this display object to the module/TimerBlock and there is no need to modify the existing modules. The Time_duration parameter does not change so it places virtually no load on communications.

    View online

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.

  • I can also use a unit timer

    Sent from my iPhone

    On 9 Aug 2021, at 19:10, Andre Dicaire <bounce-ADicaire@emersonexchange365.com> wrote:

    
    <EE365_5F00_RGB_5F00_Standard_5F00_69x42-png_2D00_90x55-png>
    Update from Emerson Exchange 365
    <4U2G7EF4S3IZ-jpg_2D00_70x70x2-jpg>
    Andre Dicaire

    as you know, time remaining is not an available parameter on these timer blocks. Time remaining is calculated by subtracting Elapsed_Time from Time_Duration.

    For display purposes, you can do this calculation in a picture variable in Operate, or with a Graphics expression in Live. Yes you can do this in the controller in a CALC block expression. But I would build a GEM or Dynamo that can be used to display Time Remaining. Simply point this display object to the module/TimerBlock and there is no need to modify the existing modules. The Time_duration parameter does not change so it places virtually no load on communications.

    View online

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.

  • Gents apologies not sure if I am grasping this yet I have a small phase logic module that runs a little sequence to start/stop a pump and a few other things.

    In Function block view I have a little count down timer that runs the pump for 15 minutes, as the counter function block counts down as an integer value only, could I pass this through a calculation block to convert it from a 32 bit signed integer to a floating point using the following:-

    #######################
    VAR EXPONENT END_VAR;
    VAR SGN END_VAR;
    VAR MANTISSA END_VAR;

    (* IEEE754_IN is a 32 Bit Unsigned Integer parameter *)
    (* FLOAT is a floating point parameter *)

    (* Extract the Exponent from the bits 24 to 31 of the 32 bit word *)
    (* AND Mask to extract bits 24 to 31 then shift 23 bits to the right *)
    EXPONENT := SHR(('^/IEEE754_IN.CV' & 2139095040),23);

    (* Extract the Sign from the bit 32 of the 32 bit word *)
    (* AND Mask to extract bit 32 then shift 31 bits to the right *)
    SGN := SHR(('^/IEEE754_IN.CV' & 2147483648),31);

    (* Extract the Mantissa from the bits 1 to 23 of the 32 bit word *)
    (* AND Mask to extract bits 1 to 23 *)
    MANTISSA := ('^/IEEE754_IN.CV' & 8388607);


    (* The maths used to create the FLOAT from SIGN, EXPONENT and MANTISSA *)

    OUT1 := EXPONENT - 127;
    OUT2 := SGN;
    OUT3 := MANTISSA;

    '^/FLOAT.CV' := (1+ (MANTISSA * (2 ** -23))) * (2 ** OUT1);
    ##########################

    I found this in another post....
  • In reply to GaryL:

    what does the integer represent? If the counter represents seconds as an integer, and you want Seconds as a Float (i.e. a value of 10 in the integer becomes 10.0 as a Float), then you do not want to convert the bitwise 32 bit value to a Float with the above. Write or wire the integer to a Float Parameter and DeltaV will coerce the integer into float format.

    The expression above is to convert a 32 bit register that represents a Float, but had to be passed as an integer. You indicate the integer is from a DeltaV Counter Function Block, so the integer is the count value.

    Andre Dicaire

  • In reply to Andre Dicaire:

    Thanks Andre, I don't think what the client is asking for is achievable, they have asked to display the seconds on the graphic but the counter will always show the count down as 15, 14, 13, etc and not 14.43, 14.25, 13.15, etc
  • In reply to GaryL:

    Your right. If converted to FLOAT, it would always show 15.00, 14.00, 13.00 etc. The integer has no fraction to it.

    A counter is not a time. The module execution rate will influence the counter. A Retentive Timer uses a Float value for Elapsed time and you can derive time remaining from that. But generally, since this time is relative to module execution as to when it starts and when it updates, the value would be very close to whole numbers in a 1 second execution rate module.

    Andre Dicaire

  • In reply to Andre Dicaire:

    Using a Retentive Timer I can easily generate a count down with a floating point parameter (COUNT_DWN for example just in case you want to see more than integer) and then have in an ACT or CALC expression using the below which will format the number to the appropriate number of decimal places wanted:

    DECIMAL1 := 1;
    POWER1 := EXPT(10, DECIMAL1);
    '^/COUNT_DWN.CV' := ROUND(('^/RET1/TIME_DURATION.CV' - '^/RET1/ELAPSED_TIMER.CV') * POWER1) / POWER1;

    If you want to test on the fly you can add a DECIMALS parameter and then use that parameter to set the internal DECIMAL1 variable to see the effects. I can't attach a picture for some reason but it does work.

    The same can be used for a Counter but the decimal places won't be required because the values would always be integers but this same logic would work.