11 Replies Latest reply on May 15, 2015 11:38 PM by bshang

    Customized playback function in Processbook

    lqml

      Hi all,

       

      I am just starting to use PI Server and also Processbook to manage and display our lab data and I got a need for a customized playback function. So basically I would like the traces in plots redraw and populate again when doing the playback, instead of just moving the timerange and showing different part of the trace. The .gif below may explain better of what I have in mind:

      multicomet_animation2.gif

      I have posted this question before in PI Square: Question about PI Processbook playback function You may take a look of this thread.

      Since I did not get this issue solved so I am re-posting it here, hoping this would be a more relevant place for it.

       

      Regards,

       

      Qinmiao Li

        • Re: Customized playback function in Processbook
          bshang

          Hi Qinmiao,

           

          I wanted to answer some questions you had in the prior thread. The For loop in the code posted in the prior thread iterates through all the datasets that were added. ds is the reference to the dataset. Also, you are correct in that the Exp logic controls how many points are displayed. The display is updated by

           

          ds.Expression = Exp

          MyDatasets.SetDataset ds

           

          as you mentioned.

           

          On a broader note, Processbook Dataset shouldn't really be used for this playback feature. The original source code posted was more proof of concept, but for new projects, we'd really want to try alternatives besides Datasets. Taking a step back, can you describe the use case for this scenario? What feature would the fixed-range playback offer?

            • Re: Customized playback function in Processbook
              lqml

              Hi Barry,

               

              Thank you for your comments for previous codes. But since you mentioned that PB Dataset should not be used for the playback feature, I would like to know more about your ideas on it.

               

              Here in my case, for the customized playback function, I would like it to have features like:

              • Playback time range can be defined by users
              • Playback rate can also be defined by users

              Another feature would be the dynamic of the plot. Taking the gif image above for example, the default playback function is having static traces in the plot and moving the timerange below to show different parts of traces. But for the new one, I want the timerange to be fixed and the traces re-draw again just as that gif image.

               

              Please let me know if you need more information from me.

               

              Thank you!

               

              Qinmiao

                • Re: Customized playback function in Processbook
                  bshang

                  There isn't a native control on PB that would allow this. The PB Dataset may work but what I really wanted to say was that even with Datasets, the functionality would be limited.  The current example posted should satisfy the features above, but the display still would not update as smoothly as in the GIF.

                   

                  What issue did you run into with the sample that was posted? Can you explain in more detail or post a screenshot? If you can provide your current VBA code, that would be helpful as well.

                    • Re: Customized playback function in Processbook
                      lqml

                      Hi Barry,

                       

                      I used that example. Basically I did no change that previous example. So the problem was that I can add traces to the plot and also the timerange was correctly set as what I defined. But after I hit start button, the trace was still static and nothing else happened.

                       

                      Are you able to have this example work like my expectation? If so could you talk a bit about how you used it, in case I missed anything?

                       

                      Thanks!

                       

                      Qinmiao

                        • Re: Customized playback function in Processbook
                          bshang

                          Some things to check first:

                          1. Make sure we are in Run mode (Arrow button at top left is checked).

                          2. What is the start/end time that you chose?

                          3. What was the playback speed?

                          4. Can you post all the archived events for the tag here in this thread as a csv? (timestamp,value). You can do so via SMT>ArchiveEditor. Query for the same time range as in PB and click the ExportCSV button at the top right. This will enable me to try to reproduce the behavior.

                            • Re: Customized playback function in Processbook
                              lqml

                              Thank you Barry.

                               

                              1. Yes I ran it in Run Mode.

                              2. I tried with the timerange from 11-May-2015 08:00:00 to 11-May-2015 10:00:00.

                              3. Playback speed was x50.

                              4. Sorry I did not figure out how to add attachment here. So I used Dropbox and here is the link: Dropbox - ArchiveEditorListing_DECADE_A1800_PV_I_a.csv

                               

                              And here is a snapshot of what I got in PB:

                              1.PNG

                              I set all the parameters like mentioned above. And after I hit the button Start, the trace appears in the plot with the same timerange as I set. But there is no dynamic.

                               

                              Qinmiao

                                • Re: Customized playback function in Processbook
                                  bshang

                                  I wasn't able to reproduce the issue. Do you find that nothing shows up after you click Start? Or does the entire trace show up instead?

                                   

                                  To be sure, are you able to trend the tag in real-time using a "normal" trend symbol?

                                   

                                  I've attached a modified code below. It does two major things.

                                  1) Sets the calculation interval of the dataset to 5s rather than 5m. You'll notice a block of code commented out which set the interval based on playback.

                                  2) Uses a "timer" rather than Display_DataUpdate event handler to update the trend. I used and modified the example here

                                  How to use a timer in VBA ProcessBook? (i.e. Animation or recurring update ... )

                                   

                                  During the For Loop, can you write out the values of Counter and Multiplier?

                                  dt = Format(DateAdd(Unit, 5 * Counter * Multiplier, Start), "dd-MMM-yy hh:mm:ss")

                                   

                                  I am wondering if they are not getting set properly.

                                   

                                  If there are still issues after the trying the above and the new display is not working, we can open a TechSupport case and do a remote session to look into this more closely.

                                    • Re: Customized playback function in Processbook
                                      lqml

                                      Hi Barry,

                                       

                                      I have the entire trace show up after clicking Start. (Just as the snapshot I posted)

                                       

                                      Yes. I can see the tag tracing properly in normal trend.

                                       

                                      For the pdi you posted, I changed this line:

                                          Trend1.AddTrace TagName.Value & ".Value"

                                      to

                                          Trend1.AddTrace TagName.Value

                                      Cause otherwise, I cannot add tag into the plot. There will be A1800_PV_I_a.Value showing as the tag name in the plot. So I deleted & ".Value". Then I was able to add tag.

                                       

                                      Also for the value of Counter and Multiplier, I am not sure whether I did it right. But what I did is that I open the VBA editor and locate Public Sub ExecuteAnimation1() and press F8 to execute each line of Public Sub ExecuteAnimation1().

                                       

                                      The Counter was 30 and Multiplier was 50 at first and 0.8333333...at last.

                                       

                                      Thanks, I appreciate your concern on this issue and a remote session would be good if you can arrange one.

                                       

                                      Qinmiao

                                        • Re: Customized playback function in Processbook
                                          bshang

                                          Hi Qinmiao,

                                           

                                          Can you change the line back to

                                          Trend1.AddTrace TagName.Value & ".Value"

                                           

                                          The reason is that we'd like to add a "PI Calculation Dataset", but removing the ".Value" actually adds the entire trace (as a PI Tag). It is the PI Calculation Dataset which accepts a PE expression that allows us to selectively filter points by time.

                                           

                                          Note that when you click Add Tag, no trace should show in the trend as we initially set the end time of the dataset values to equal to the start time. Once the Start button is clicked, then the end time is gradually increased according to the playback rate, so more values should begin to show.

                                           

                                          Can you also attach the PDI or VBA code here? To do so, please select Advanced Editor in the top right in the Reply window, then click the Attach button in the bottom right.

                                            • Re: Customized playback function in Processbook
                                              lqml

                                              Hi Barry,

                                               

                                              Sorry for the inappropriate change that I have made.

                                               

                                              I changed it back and tried again. Unfortunately it still does not work. After I clicked add trace, I got this:

                                              1.PNG

                                              Like you said, there is no trace yet. But then I hit Start and got this :

                                              2222.PNG

                                              I did wait until the button returned to Start. But there has been nothing showing up in the plot.

                                               

                                               

                                              I have been using your PDI so I did not attach my PDI.

                                               

                                              Thanks,

                                               

                                              Qinmiao