2 Replies Latest reply on Oct 20, 2014 12:38 PM by veljovic

    Event Frame template

      Hi, I am trying to create an EventFrame template using AF SDK, so that it appears in PI System Explorer in the Library navigator pane under the category Event Frame Templates. Since Event Frame templates are in AF SDK represented by AFElementTemplate, my template intended for Event Frame ends up in the Element Templates category in Pi System Explorer. Any help would be appreciated. Regards, Slobodan
        • Re: Event Frame template
          Marcos Vainer Loeff

          Hello Slobodan,


          I guess you forgot to set up the InstanceType property to typeof(AFEventFrame) if you are developing in C#. Please refer to the code snippet below:



                  private void CreateEFTemplate()
                      AFElementTemplate myEFTemplate = myDB.ElementTemplates["TankEventFrameTemplate"];
                      if (myEFTemplate == null)
                          myEFTemplate = myDB.ElementTemplates.Add("TankEventFrameTemplate");
                          myEFTemplate.Description = "Tank Event Frame Template!";
                          myEFTemplate.InstanceType = typeof(AFEventFrame);
                          AFAttributeTemplate Level = myEFTemplate.AttributeTemplates.Add("Level");
                          Level.Type = typeof(double);
                          Level.DataReferencePlugIn = Level.PISystem.DataReferencePlugIns["PI Point"];
                          Level.ConfigString = @".\Elements[.]|Level";
                          Level.Description = "Level of the tank";
                          Level.DefaultUOM = myPISystem.UOMDatabase.UOMClasses["Ratio"].UOMs["percent"];
                          AFAttributeTemplate Pressure = myEFTemplate.AttributeTemplates.Add("Pressure");
                          Pressure.Type = typeof(double);
                          Pressure.DataReferencePlugIn = Level.PISystem.DataReferencePlugIns["PI Point"];
                          Pressure.ConfigString = @".\Elements[.]|Pressure;TimeRangeMethod=StartTime";
                          Pressure.Description = "Pressure of the tank";
                          Pressure.DefaultUOM = myPISystem.UOMDatabase.UOMClasses["Pressure"].UOMs["pascal"];
                          myEFTemplate.DefaultAttribute = Level;



          Hope it helps!!

          1 of 1 people found this helpful