2 Replies Latest reply on Feb 4, 2016 4:29 PM by gregor

    Module database version, getting the right tag from the alias


      I have a pi ace calculation and an MDB that links alias to tags where the tags change rarely.  But I need to keep the definition of the old tags so that I can recalculate old data.

      All my mdb structure is set up with a date of 1/1/1970.

      Yesterday I added my first tag change version for 1/1/2016.

      I use the following code.



      public static PIACEPoint GetPIACEPoint(PIACEPoint point, string alias)
       PIACEPoint pt = new PIACEPoint();
       pt = point;
       moduleOlderVersion = (PIModule)module.Version.Value(point.ExeTime, RetrievalTypeConstants.rtAuto); 
                      // unfortunately the alias contains part of the path, need to strip the path off
       alias = alias.Substring(alias.IndexOf(@"\") + 1);
       pt.SetTag(Path, moduleOlderVersion.PIAliases[alias].DataSource.Name, TagAliasUsedType.TagAliasAsInput);
       return pt;


      Before I call this code, I can look at the piacepoint and see a structure called taginfo which contains the correct alias.

      After I call this code, the taginfo structure is still there but the alias is replaced with the tagname.

      I need the alias to stay in tact.

      Is there a better way of finding the tag for the right module?

        • Re: Module database version, getting the right tag from the alias

          Hello Peter,


          What I understand is the following:


          - You are using PI ACE calculations based on Module context where Aliases are referring PI Points. For simplicity, let's assume you do have an Alias "Input" and another "Output".

          - What PI Points Aliases are pointing to is relatively fix but may change.

          - You decided for Module versioning to keep track of changes over time.

          - You like to be able to reproduce what PI Point was referenced for a certain period.

          - You may also schedule your ACE calculation for recalculation and like the correct PI Point being used based on the Module version that was active at that time.


          If there something wrong with the above, please correct me.

          Can you please explain where you do run into an issue? With the code snippet you provided, is my assumption right that Alias names "Input" and "Output" have not changed?


          I am also uncertain if we would recommend using PI ACE with Module Database Versioning these days. Have you thought about alternatives e.g. using Asset Based Analytics?

            • Re: Module database version, getting the right tag from the alias

              Hello Peter,


              I've done some testing and found what you are trying to do will likely not work or not work very well.

              I've created an ACE module and set the context to "Input" and "Output" alias of an existing Module in MDB. The output was pointing to a PI point of type string and I was logging the name of the Point configured with "Input" to it.

              I than created a new version of the Module in MDB and pointed "Input" to a different PI Point.

              PI ACE was recognizing the change when debugging but the "running" PI ACE Module was still reporting the "old" PI Point reference until I restarted the module. I assume the information is either cached within the PIACEClassLibraryHost.exe session or even with the PI SDK connection used by PIACEClassLibraryHost.exe


              This said, if I properly understand what you are trying to do here, I feel this will not be working properly.