11 Replies Latest reply on Mar 17, 2015 6:59 PM by asorokina

    Data forecasting


      Looking to see if there's a good solution as part of the PI system to forecast values based on specific history range.  Looking to predict the end of the year value based on year-to-date value


      Data will be the flow rate of a value

      After 3 months, we'd like to determine if the flow rate needs to increase or decrease to have it land on target by the end of the year


      For example, say after exactly 1/4 of the year we are at an average flow rate of 10 and our target by the end of the year is 12.25

      The prediction is to increase the flow to 13 for the remaining 3/4 of the year


      This is something that we'd watch and tweak, but typically only needed when there's process upsets


      The math isn't as simple as what is shown above and I'm hoping there's something convenient built in otherwise I'll have to build some custom coding


      Thanks in advance!!

        • Re: Data farecasting



          You will be able to do this with the upcoming release of PI Server 2015, which supports future data storage and the Asset Analytics which will support writing to different times other than the triggering time (which includes future time stamps).  The target release for this is UC2015.





          (Sent from my iPad)


          "De omnibus dubitandum."

          • Re: Data farecasting

            Assuming that you did not want to use something like PI ACE to do the calculations, as an experiment, I implemented a sort of totalizer projection as a custom AF Data Reference a while back.


            This test Data Reference took an instantaneous flow rate tag, and also a totalizer tag, which was the current totalized flow of the instantaneous flow rate. Then based on those two values and the requested future time, I did a very basic calculation assuming that the flow rate would remain constant to get an estimated future totalized value. (e.g. finalValue = lastTotalizerValue + lastRateAvgValue * (Single)timeRange.Span.TotalSeconds;  )


            I did this more as a learning experience for what writing custom AF Data References look like (so the code is not optimized and I would not use it in a production setting). However, even though the PI server did not support future data, some PI clients, such as ProcessBook seemed to support requesting future data, which worked with my AF Data Reference. (I.e. I would plot something like *-30m to *+30m and would see the values projected into the future based on the last known flow and totalization).


            If your calculation is "light" enough, perhaps you could implement in an AF Data Reference as well? Then have your client request the data from an AF attribute configured with your custom data reference.


            Admittedly though, this is a more obscure solution and the calculated data is not saved - it is calculated on the fly. (And this may be an abusive use of custom data references, as I don't think they were meant to be calculation engines!)


            This is assuming that you need to make use of future timestamps. If you just needed forecasted values (say in a report), then you could potentially use any of the existing calculation methods for PI?

            • Re: Data farecasting

              Ales is correct in that we're adding some exciting features to PI Server 2015 which should allow you to do this, assuming your algorithm can be built using Asset Analytics.  Do you care to share your algorithm so we can try it out with some internal builds?



              Steve Kwan

              AF Product Manager

              • Re: Data forecasting



                I do something similar for our end-of-year projections, based on total production to date. I take the yearly production target, less the total produced to current day, then divide it by the remaining days this year. This gives us an average required production per day to make the end of year target. You can do this using performance equations (PE). If you need your total to be more accurate use a totaliser to calculate your production to date, then use that value in PE. I just use PE's as they are accurate enough, especially for projected figures. You can adjust my format to give a flow rate per hour if necessary (just divide by number of hours left in the year).


                Hope this helps,



                • Re: Data forecasting

                  Thanks for the replies!


                  I don't see the client updating at this time, so I'm fairly certain this will need to be developed as is.


                  This can be done in ACE, but so far I'm not really keen on having anything calculate in ACE that must be reliable.  I find ACE to be somewhat rudimentary and it has a lack of rigidity.  Too many places for the calculation to break and very little to no feedback that things are broken.  This application is simple enough that I don't really see the need to have ACE involved, but that could be done


                  Here's what I'm looking at doing (Similar to what Colin replied with above)


                  I have 6 emission sources that produce toxins in to the air (NOx and SO2).  We have a maximum emission limit that we must adhere to (going over a limit is VERY bad)

                  Fuel gas in is directly proportional to emissions out and the math to convert this is already being done.


                  So, sum all 6 emission values up and subtract from the allowable, then divide out by the remaining days in the year (this is essentially the same as Colin's post)


                  I do, however, need to look at each emission source individually as these are also limited to a maximum per unit (There's a limit per source and an overall facility limit)

                  Logically this would be the same


                  The end result though is I want a value per emission source on a screen for the operators showing the year end projection of each source as well as the grand total (Show limits vs projection).  I also want to show the operators some over/under values so that they can easily see what sources are needing adjustment down and which could be adjusted up to accommodate for the one that needs to be reduced.  Basically make the balancing act easier for them.


                  This doesn't need to be continuous, even once a day is fine, but I could see maybe once per hour being useful near the end of the year.  Basically a manual control loop between systems


                  Hope that clears up what I'm trying to accomplish here!  Any suggestions are more than welcome! 


                  If there's a good document to show the PI 2015 release coming up that allows future data forecasting, I'd love to read it.  If there's enough of a case for the update, I can present that to them

                  • Re: Data forecasting

                    If you don't need to historize your forecasts, there is no need to store future data in PI.


                    The simplest way to show your prediction/calculation to the user is to use good old Excel with PI-DataLink. There is a fantastic feature called AutoUpdate which recalculates your workbook permanently without any user action, say every minute.


                    Retrieve your data using DataLink to one worksheet cell, do some simple Excel date/time math, then calculate your prediction and show your result in another Excel cell. Turn AutoUpdate on and leave your worksheet open in a small window with only this number visible.


                    Of course, you can use Excel autoformatting, graphics etc. to mark some good/bad condition.

                      • Re: Data forecasting

                        As always, there are many ways to solve the same problem.  There are always advantages and disadvantages to every method.  Here are some food for thoughts.....  There are advantages with storing these values in PI Points.  First and foremost, everyone can use it and not just the person who owns the spreadsheet.  Secondly, it's much easier to manage changes and to ensure consistency - e.g. you don't have X number of Excel spreadsheets with inconsistent values because people make changes that others don't know about.  Thirdly, in most cases it's more advantages to perform real time calculations on the server side because you then don't have Y number of clients (Excel in this examples) all doing the same calculations.  There is no reason for every client to do the same calculations on the client side when you can do it once on the server side and make the results available to all the users.  Fourthly, in most cases, performance bottlenecks are related to data access and number of round trips to the server.  If your calculations are complicated and expensive to run, you want to minimize the # of clients trying to retrieve a large volume of data.




                        AF Product Manager

                      • Re: Data forecasting

                        Thanks for the feedback!


                        Excel is definitely an option, but this makes it a bit clunky having to have that open (or keep it open).  Best home for the display of this data is the PB screen IMHO

                        Since the math is really not complex, there should be no reason to have any external tool or data connection, what Colin suggests is practical.  If I set this up like so:


                        PI Tags store the flow rates (NOx rate is proportional)


                        Ratio NOx to Flow


                        For Totals:

                        We haven't implemented totalizers as that's handled in the DCS.  May pull that from the DCS, or since high accuracy is not absolutely necessary - Average the flow rate to hours run to date (omitting hours of downtime/no flow) and that's a fair representation of total.  Apply the Ratio from above


                        For forecasting:

                        (Target Max - Total from above) / hrs left in year  --> Gives me NOx Rate needed

                        NOx Rate / Ratio from above  --> Gives me Flow Rate needed


                        PI Tags hold the outputs of this simple calc


                        So this is easily handled in a performance equation, but there is some other wrenches that get tossed in to this (downtime to a particular unit, Flare gas affecting overall facility, etc),  so I may have to use ACE to do this properly.  I'll be going through this over the next few days and see where I end up here

                          • Re: Data forecasting
                            Steve Boyko

                            A few years ago I implemented a natural gas forecast system that looked at the current day's historical gas consumption, current rate of consumption, and predicted future use and forecast whether they would be over or under their target for the current gas day. There are significant penalties for consuming too much or too little. This was implemented in C# with PI-SDK as a separate task and the results were written to PI.


                            I agree it can be implemented in a performance equation (or AF's Asset Analytics) in a simplistic fashion but it sounds like you have too many other factors to consider. I would recommend a PI-SDK/AF SDK based solution so you can consider all variables. Personally I do not like using PI ACE for many of the same reasons you mentioned above.

                          • Re: Data forecasting

                            Hi Trevor,


                            I'm marking this thread as "assumed answered". Feel free to mark a specific comment as the correct answer.

                            Do not hesitate to post here again if you need further help.