4 Replies Latest reply on Dec 6, 2011 5:12 PM by jariwalaj

    How to best create a 'IsHoliday' point


      Hello all! I am not sure that this is correct forum for this, but I did not see any general PI question forum.


      I am in the process of defining some performance equations for summing and totalizing process tags. Some calculations will be done based on whether the current date/time is Peak or Off-Peak load. Creating a PE point for Peak vs Off-Peak is straight-forward based on certain day/hour rules. However, if the day is a recognized holiday, the entire 24 hours are considered Off-Peak.


      Is there a suggested method for using "standard" PI with PE to denote whether "today" is a holiday? I know that I can create a PE point (something like 'IsHoliday') with a list of hard-coded dates, but this of course seems wrong. Suggestions are welcome.


      The PI Server version is 3.4.380. Thanks for the help!



        • Re: How to best create a 'IsHoliday' point

          Hi Jayesh,


          It seems like you would need a referencing place, where you would store Holidays and other information.


          Depending on the target functionality of your application, you could either use AF or ACE+MDB for that. In a way that you would enter a whole year holiday calendar and then have a formula/ACE calculation working on top of that.


          In AF you could store your holiday calendar in a form of a table, and then perform the necessary calculations in the attribute.


          in MDB you could store you calendar in a property and run the necessary calculations in ACE and get a resulted tag.


          Given the current functionality of AF Formulas, the second option with a simple ACE calculation and MDB Modules/properties seems to me the easiest out of the box way to achieve that.

            • Re: How to best create a 'IsHoliday' point

              Agree with Alex here, especially considering what you can do with minimal effort.


              One additional comment is to consider Event Frames in this type of scenario.  Shift schedules, holidays, maintenance, batches, etc are all types of events you want to map in AF as they have potential to affect calculations.  Although this is like "using a sledge hammer to crack a nut" for your immediate problem, it is something to consider as you move forward.

            • Re: How to best create a 'IsHoliday' point

              Jayesh Jariwala

              I am not sure that this is correct forum for this, but I did not see any general PI question forum.
              That's because this is a programming and systems integration community . At this time there is no "generic technical support" community for PI System administrators, end-users, etc.


              That said, I consider your question to be really close to "systems integration" because PI itself does not have any knowledge of national holidays - and, as a consequence, you need to bring that information from outside. My first thought was web services, because holidays are something dynamic and you wouldn't want to store a static version of these in a table (they'd be valid for a year only). So I went to Bing, typed "holiday web service", and found a bunch of these. I followed the first search result and I found: http://www.holidaywebservice.com/ServicesAvailable_HolidayService2.aspx. This seems like a really good use case for an eventual Web Service Data Reference ;)  But we'll have to do without for now since no such data reference is available for now.


              If I had to develop this solution today, I would craft a very simple PI ACE calculation that connects to that web service and invokes one of the methods (e.g. GetHolidaysForDateRange) to find out whether today is a holiday, and then store true/false in a PI Point (which you can use everywhere else). You might want to look into the PI Web Services webinars and other materials here on vCampus, to get a better idea how to connect to a web service and invoke web methods (of course you will have to adjust a bit because you are connecting to a different web service, but you get the idea...).


              Great use case!



              • Re: How to best create a 'IsHoliday' point

                Thanks everyone for the suggestions! Storing the dates in a lookup table for AF or using a web service and AF makes sense. For this customer, they currently do not have AF employed. However, this use is one of many reasons I can use to suggest upgrading their system to PI2010 and migrating to AF.


                Kind Regards,