9 Replies Latest reply on Apr 3, 2018 2:01 PM by jasongogal

    Question regarding AF event creation

    ChrisGag

      Good day

       

      I have a question regarding event creation in AF.

       

      I have a table (in AF) where I store the shift info for the site Ex.:

       

      Line               Shift name               Start time                              End time

      Line 1             Shift 1                      2-28-2018 6:30 AM               2-28-2018 2:30 PM

      Line 2             Shift 2                      2-28-2018 2:30 PM               2-28-2018 10:30 PM

      ..

      ..

      ..

       

      I am trying to create an event that will start and end at those time.

       

      I am able to start the event at the proper start time but with everything I used I cannot end the event at the exact end time (but the next one start at the proper time)

       

      I always need to end the event 1 minute early so for example 2:29PM

       

      I have tried using build in time to create event using a start time and an offset and that is working but not if I use external data.

       

      Thank you in advance for the help

       

      Regards

       

      christian

        • Re: Question regarding AF event creation
          sraposo

          Hi Christian,

           

          Are the shifts always 8 hour shifts and always starting at 6:30am, 2:30pm and 10:30pm ?

           

          How is your Event Frame analysis currently configured and how are your attributes with a data reference of table lookup configured?

           

          Thanks,

          Seb

            • Re: Question regarding AF event creation
              ChrisGag

              Hi Sebastien

               

              Most of the time. What happen is that they can have 2 shift of 8 hours sometime, sometime when the production is full it will be 3 shift.

               

              Some time they will be off and so on and it will be different for different machine.

               

              Normally everywhere I went, they have a schedule per machine for weeks, months and event 1 year in advance somewhere (excel, scheduler, etc). They can even go to 12 hours shift from time to time.

               

              I have tried to use '*'=starttime and it is also working. did not had time to change that one. normally in the documentation it say that if the end trigger is the same as the start trigger, you don't need an end trigger but it does not seem to work when you do a look up

               

              shift.png

              • Re: Question regarding AF event creation
                ChrisGag

                Sorry

                 

                this is how the table look's like

                 

                shift_table.png

              • Re: Question regarding AF event creation
                SymasolFrancois

                Hi there, I am also trying to work around this for shift changes.

                 

                 

                1. I made an analysis that extract data from the lookup table and outputs them to an attribute linked to a PI tag; let's call it "shift_trigger"

                2 The analysis creating the event frame is triggered by event by "shift_trigger"

                 

                I tried two things

                a) Populate trigger with the start of the shift only

                basically i got something like:

                Timestamp                       Value

                02-mar-2018 00:00:00     1

                02-mar-2018 08:00:00     1

                02-mar-2018 16:00:00     1

                etc.

                The analysis creating the shift event frame does not fire

                 

                 

                b) Populate my trigger tag with the same as above and but adding 0's when time is not equal to shift start.  Getting something like this (when periodic interval is 1 hour)

                Timestamp                       Value

                02-mar-2018 00:00:00     1

                02-mar-2018 01:00:00     0

                02-mar-2018 02:00:00     0

                02-mar-2018 03:00:00     0

                02-mar-2018 04:00:00     0

                02-mar-2018 05:00:00     0

                02-mar-2018 06:00:00     0

                02-mar-2018 07:00:00     0

                02-mar-2018 08:00:00     1

                02-mar-2018 09:00:00     0

                etc.

                This one fires at the right time but closes the event as soon as the condition seen below it not me.  I the case above this means  starting the event at 02-mar-2018 00:00:00  and closing it at 02-mar-2018 01:00:00. 

                 

                 

                c) The closest i found is to to populate my "shift_trigger" like this

                 

                05-Mar-18 00:00:00

                1

                05-Mar-18 07:59:59

                0

                05-Mar-18 08:00:00

                1

                05-Mar-18 15:59:59

                0

                05-Mar-18 16:00:00

                1

                05-Mar-18 23:59:59

                0

                06-Mar-18 00:00:00

                1

                06-Mar-18 07:59:59

                0

                06-Mar-18 08:00:00

                1

                06-Mar-18 15:59:59

                0

                06-Mar-18 16:00:00

                1

                 

                And I end up with event frames missing 1 second

                 

                Like Christian, i would really like to be able to chain my events meaning (setting the "end time" of the previous event equal to the "start time" of the following event)

                 

                If someone has an idea on how to work around this or help me out doing things the proper way, I am a taker

                Thanks in advance

                François

                • Re: Question regarding AF event creation
                  SymasolFrancois

                  Hi,

                  Got help from tech support on that one to make it work (Thanks David!)

                   

                  The trick is to have the same condition for the start trigger and the end trigger but set a "true for" on the start trigger to a couple of seconds (in my case 5 seconds).

                   

                  When the trigger time is hit, the current event is closed.  5 seconds later, it evaluates the start trigger and starts/creates the new event at the exact same time as the end time of the previous event.

                   

                  Francois

                  3 of 3 people found this helpful
                    • Re: Question regarding AF event creation
                      sraposo

                      Thanks for sharing François! Sorry I couldn't get back to this thread earlier.

                       

                      I'd like to mention, creating these back-to-back event frames with analysis should be much easier in a future version. We are currently working on enhancing the analysis service to support this in a more user friendly way:

                       

                      Easily create periodic event frames – Customer Feedback for OSIsoft & the PI System

                       

                      Thanks,

                      Seb

                      • Re: Question regarding AF event creation
                        jasongogal

                        Any chance you could post a screenshot of the logic?

                          • Re: Question regarding AF event creation
                            SymasolFrancois

                            Hi Jason,

                            Setting the analysis "true for" 5 seconds did not work all the time and while i was searching on square for a solution i ended up on one of Roger Palmen's post (sorry I was not able to locate it).

                            I ended up using the toggle tag trick that works all the time.

                            Basically you need three items:

                            1. An attribute that toggles from 0 to 1 like this ( in my case I created shift event frames from an external SQL table)

                            Hi Jason,

                            Setting the analysis "true for" 5 seconds did not work all the time and while i was searching on square for a solution i ended up on one of Roger Palmen's post (sorry I was not able to locate it).

                            I ended up using the toggle tag trick that works all the time.

                            Basically you need three items:

                            1. An attribute that toggles from 0 to 1 like this ( in my case I created shift event frames from an external SQL table)

                            Picture1.png

                             

                             

                            2. You then need two event frame analysis

                            One that creates the EF when the toggle tag value is 1 and closes the event frame when the toggle tag value is 0

                             

                            And a second one which performs the opposite

                             

                            It works fine but requires to have your event frames chained all the time and in my case it meant that I would need a "non productive time"  EF for periods where line is down due, for example, to lack of order.

                             

                             

                            Hope it helps a bit, do not hesitate if you need some more details

                            Best regards

                            François

                        • Re: Question regarding AF event creation
                          jasongogal

                          Merci Francois.

                           

                          That makes sense; I have done flip flopping event frames the same way. I seem to also find that trying to schedule analyses and EFs based on table selections is sometimes inconsistent. I still really haven't rooted this out completely problem-free.