11 Replies Latest reply on May 24, 2010 11:58 AM by Asle Frantzen

    "CALC FAILED" after midnight due to timestamps

    dbloyd

       

       

      I have created a few tags to track up/down time on equipment per shift. Out of the five tags created only two work all the time. The other three stop working after midnight. I know why they are failing,  start time(t+7h) end time(+12h)   works fine, however start time(t+19h) end time(+12h) does not, I am assuming this is because at midnight its a new day and my start time is now after my end time before the 12h elapsed. I'm sure there is a way to enter the start time and end time in a way that this will not happen but I am having a time figuring out what that way is.

       

       

       

      ex. (TimeEq('22shtbrk','t+19h','+12h',"OFF")/60)

       

      Any help is appreciated.

       

      Thanks,

       

      Derek Loyd

        • Re: "CALC FAILED" after midnight due to timestamps
          Asle Frantzen

          Derek Loyd

          I have created a few tags to track up/down time on equipment per shift. Out of the five tags created only two work all the time. The other three stop working after midnight. I know why they are failing,  start time(t+7h) end time(+12h)   works fine, however start time(t+19h) end time(+12h) does not, I am assuming this is because at midnight its a new day and my start time is now after my end time before the 12h elapsed. I'm sure there is a way to enter the start time and end time in a way that this will not happen but I am having a time figuring out what that way is.

          ex. (TimeEq('22shtbrk','t+19h','+12h',"OFF")/60)

           

          Any help is appreciated.

           

          Thanks,

           

          Derek Loyd

           

          Hi Derek

           

          I've had similar challenges before, and the one I had in ProcessBook hasn't been fixed yet.

           

          The problem happens when you cross midnight, as you say. 't+19h' would then be 19 hours into the new day, and it'll fail.

           

          In my thread about this issue (http://vcampus.osisoft.com/forums/t/877.aspx) there is a tip about creating a ProcessBook add-in, and create your own custom time variables (myShift1Start, myShift1End, etc). Maybe that'll fix your problem. The reason I couldn't use this, is that my customer didn't want to have to install an add-in for all the potential ProcessBook users in their organization.

          • Re: "CALC FAILED" after midnight due to timestamps
            dbloyd

            Asle Frantzen @ Amitec

            The reason I couldn't use this, is that my customer didn't want to have to install an add-in for all the potential ProcessBook users in their organization.

             

            Yes this would cause a problem for me as well.

             

            So it appears that at the moment there is no work around. I'll keep a look out for a fix.

             

            Thanks again for your help.

            • Re: "CALC FAILED" after midnight due to timestamps

              Unless I have missed something obvious...you are using performance equations so you want this as a real time calc and your shifts run from 7am->7pm, 7pm->7am, then the following might be of use:

               

              if hour('*') <19 then (if hour('*') >= 7 then timeeq('22shtbrk','t+7h','*',"OFF")/60 else timeeq('22shtbrk','t-5h','*',"OFF")/60) else (if hour('*') >= 0 then timeeq('22shtbrk','t-5h','*',"OFF")/60 else timeeq('22shtbrk','t+19h','*',"OFF")/60)

              • Re: "CALC FAILED" after midnight due to timestamps
                dbloyd

                Thank you all for your input, it is greatly appreciated!

                 

                I called TechSupport this morning and talked with a very helpful fellow, Fabio. We worked via email and phone and he helped me get here.....

                 

                 

                 

                if (('*' >= "00:00:00") and ('*' < "07:00:00")) then TimeEq('22shtbrk','t','*',"Break")/60 Else if (('*' >= "07:00:00") and ('*' < "19:00:00")) then Nooutput() else TimeEq('22shtbrk','t+7h','*',"Break")/60

                 

                 

                 

                It looks and acts as if it will work, will only truly know tomorrow morning after nightshift and comparing the time to the manually entered data. I will need to set this value to zero at 7:00pm everyday so that each shift starts a new count. Would it be better to do this in the same PE or create another PE using this tag to do this, or does it really make a difference?

                 

                The Nooutput() is really really useful, as before I was going t use 0, which would have elimenated my last 6 hours of data. These values will be displayed all of dayshift on the dashboard and will only reset at the moment the new tag starts creating data(still have to add this).

                 

                From this I will be able to build tags for our 8 hour shift days(thursday and Friday) as well and using another PE which designates if the shift is a 12hr shift day or 8 hour shift day I should get alot of use out of these tags.

                 

                 

                 

                All the help is appreciated.  I will post the results as to if this worked as intended tomorrow.

                 

                Derek

                 

                 

                  • Re: "CALC FAILED" after midnight due to timestamps
                    Asle Frantzen

                    Derek Loyd

                     

                     

                    It looks and acts as if it will work, will only truly know tomorrow morning after nightshift and comparing the time to the manually entered data. I will need to set this value to zero at 7:00pm everyday so that each shift starts a new count. Would it be better to do this in the same PE or create another PE using this tag to do this, or does it really make a difference?

                     

                     

                    Afaik, PE's can only write values to themselves, so my guess is you'd have to do it in the same calc.

                  • Re: "CALC FAILED" after midnight due to timestamps
                    dbloyd

                    Just wanted to touch base and let others know this was accomplished, had to tweak a bit here and there to work out some of the craziness.

                     

                    The tag will read data during the selected time, it will then hold that value over the next shift and reset back to zero as the new shift begins.

                     

                    I want to thank Fabio in Tech Support for all his time!

                     

                    I created tags for two machines with 2 - 12hr shifts and 3 8hr shifts.

                     

                    Ex.

                     

                    19:00:00  to  07:00:00

                     

                    if (('*' >= "00:00:00") and ('*' < "07:00:00")) then TimeEq('22shtbrk','y+19h','*',"Break")/60 Else if (('*' >= "19:00:00") and ('*' < "00:00:00")) then TimeEq('22shtbrk','t+19h','*',"Break")/60 else if (Hour('*') = 18 and minute('*') = 59) then 0 else nooutput()

                     

                    Ex.

                     

                    07:00:00 to 19:00:00

                     

                    If (('*' >="07:00:00") and ('*' < "19:00:00")) then TimeEq('22shtbrk','t+7h','*',"Break")/60 Else if (hour('*')=6 and minute('*')=59) then 0 else Nooutput()

                     

                     

                     

                    Just change the times to suit your needs, the top one deals with the midnight problem, and the bottom one deals with the shifts not having to cross midnight.

                     

                     

                     

                    I banged my head for quite some time on this one, wanted to help others trying to do something similar from having the same problems.