displaying a timer accumulator

Upload: lettolima

Post on 07-Jul-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/18/2019 Displaying a Timer Accumulator

    1/2

    Rockwell Automation Support Center

    7771 - Displaying a Timer Accumulator value in Hour:Minute:Second formatAccess Level: TechConnectDate Created: 02/22/2000 04:03 PMLast Updated: 11/15/2013 05:02 PM

    Background:In certain applications it may be desirable to display the Accumulated Value of a PLC or SLC timer in a numeric display that shows the accumulated seconds inHour:Minute:Second Format.

    Solution:

    You can add a calculation in several numeric displays that converts the accumulated seconds into hours, minutes and seconds. By dividing the accumulated time by 3600,hours are displayed. Taking the remainder and dividing by 60 results in minutes. Finally, the remainder of the accumulated timer divided by 60 will produce seconds. Themodulus operator (%) is the key to this operation. "Timer%60", for example, returns the remainder of Timer divided by 60. Using this operator, hours, minutes and seconds canbe extracted from the accumulated time.

    Example

    The accumulated time is contained in a tag called "Timer". The following setup is for 1 timer accumulator. For each Timer Accumulator, you will have 3 numeric displays .HH:MM:SS

    First numeric display is for HH, the expression will be:

    Timer / 3600

    Field Length = 2

    Decimal Place = 0

    Second numeric display is for MM, the expression will be:

    (Timer % 3600)/60

    Field Length = 2

    Decimal Place = 0

    Third numeric display is for SS , the expression will be:

    Timer % 60

    Field Length = 2

    Decimal Place = 0

    Note: 100 timer displays have been tested on a screen with no problem.

    The graphic may look something like the following example:

    HoursMinutesSeconds

    2 29 16

    Actual Timer Value

    8956

    RSView Enterprise Exception (SE and ME)

    RSView Machine Edition and Supervisory Edition will experience the following error message when trying to implement the expressions above. This is due to the expression

    creating a floating point number. From the RSView Help "You cannot perform modulus or bitwise operations on floating point numbers". The Example below demonstrates anexpression that obtains the desired result without error.

    Error message

    Unable to activate connection (Timer) % 60

    Invalid expression: '(Timer) % 60: 'Error at line 1, column 14: Invalid Floating point operation'

    Example

    Perform the modulus done before division:

    For minutes: ( ({[ControlLogix]Timer.acc}%3600000)/ 1000)/60

    For seconds: ({[ControlLogix]Timer.acc}%60000)/ 1000

  • 8/18/2019 Displaying a Timer Accumulator

    2/2

    Comments (0)

    This answer has no comments

    Post a Comment

    Product Tree for This Answer (expand/collapse)

    DISCLAIMERThis knowledge base web site is intended to provide general technical information on a particular subject or subjects and is not an exhaustive treatment of such subjects.Accordingly, the information in this web site is not intended to constitute application, design, software or other professional engineering advice or services. Before making anydecision or taking any action, which might affect your equipment, you should consult a qualified professional advisor.

    ROCKWELL AUTOMATION DOES NOT WARRANT THE COMPLETENESS, TIMELINESS OR ACCURACY OF ANY OF THE DATA CONTAINED IN THIS WEB SITE ANDMAY MAKE CHANGES THERETO AT ANY TIME IN ITS SOLE DISCRETION WITHOUT NOTICE. FURTHER, ALL INFORMATION CONVEYED HEREBY IS PROVIDED TOUSERS "AS IS." IN NO EVENT SHALL ROCKWELL BE LIABLE FOR ANY DAMAGES OF ANY KIND INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL,LOSS PROFIT OR DAMAGE, EVEN IF ROCKWELL AUTOMATION HAVE BEEN ADVISED ON THE POSSIBILITY OF SUCH DAMAGES.

    ROCKWELL AUTOMATION DISCLAIMS ALL WARRANTIES WHETHER EXPRESSED OR IMPLIED IN RESPECT OF THE INFORMATION (INCLUDING SOFTWARE)PROVIDED HEREBY, INCLUDING THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, AND NON-INFRINGEMENT. Note thatcertain jurisdictions do not countenance the exclusion of implied warranties; thus, this disclaimer may not apply to you.

    This page is best viewed in Internet Explorer 7, Firefox 3.5, Chrome 4, Safari 4 or newer.