Click or drag to resize
OSIsoft, LLC

AFAnalysisTemplate Class

The AFAnalysisTemplate represents a template of information used to create an AFAnalysis.

Inheritance Hierarchy
SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AnalysisAFAnalysisTemplate

Namespace:  OSIsoft.AF.Analysis
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
[SerializableAttribute]
public sealed class AFAnalysisTemplate : AFObject, 
	IAFTransactable, IAFChangedEvent, IAFSecurable, IComparable<AFAnalysisTemplate>

The AFAnalysisTemplate type exposes the following members.

Constructors
  NameDescription
Public methodAFAnalysisTemplate
Initializes a new instance of the class with default values.
Public methodAFAnalysisTemplate(String)
Initializes a new instance of the class with the specified name.
Top
Properties
  NameDescription
Public propertyAnalysisRule
The instance of the analysis rule used by the AFAnalysisTemplate to configure an analysis rule in an AFAnalysis created from this template.
Public propertyAnalysisRulePlugIn
The analysis rule plugin property is used to specify which analysis rule will be used by the AFAnalysis to run the analysis.
Public propertyCaseTemplate
The AFElementTemplate that is used when creating a new AFCase using one of the AFAnalysis.AddCase Overload methods.
Public propertyCategories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
Public propertyCategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
Public propertyCheckOutInfo
This read-only property returns the checked out status information for the object.
Public propertyCreateEnabled
This property indicates whether any AFAnalysis created from this template will have the initial Status property set to Enabled or Disabled.
Public propertyDatabase
This read-only property returns the AFDatabase where this object is defined.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
Public propertyGroupID
Indicates the group identifier for the AFAnalysis created from this template.
Public propertyHasNotificationTemplate
This read-only property indicates if there is an AFNotificationTemplate associated with this analysis template.
Public propertyHasTarget
This read-only property indicates if there is a target associated with this analysis template.
Public propertyID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyIsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public propertyIsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public propertyName
Read/write property that identifies the name of the object.
Public propertyStatic memberNone
An AFAnalysisTemplate that represents no analysis template.
Public propertyNotificationTemplate
This property returns the AFNotificationTemplate that is associated with this AFAnalysisTemplate.
Public propertyOutputTime
The analysis output time offset.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertyTarget
The target of the analysis template.
Public propertyTimeRule
The instance of the time rule used by the AFAnalysisTemplate to configure a time rule in an AFAnalysis created from this template.
Public propertyTimeRulePlugIn
The time rule plugin property is used to specify which time rule will be used by the AFAnalysis to determine when the analysis runs.
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodCode exampleApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodCode exampleCheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public methodCheckOut
This method locks the object so that its configuration can be modified.
Public methodStatic memberCheckOutAnalysisTemplates
Check out the objects with the specified unique identifiers at the specified query date.
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodStatic memberDeleteAnalysisTemplates
Delete the objects with the specified unique identifiers.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic memberFindAnalysisTemplate(PISystem, Guid)
Retrieves the AFAnalysisTemplate object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic memberFindAnalysisTemplate(PISystem, Guid, Object)
Retrieves the AFAnalysisTemplate object with the specified unique identifier at the specified query date.
Public methodStatic memberFindAnalysisTemplates(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFAnalysisTemplate objects with the specified list of unique identifiers.
Public methodStatic memberFindAnalysisTemplates(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32)
Performs a text search within the AFDatabase to retrieve a collection of AFAnalysisTemplate objects that match the specified query string.
Public methodGetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public methodGetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberLoadAnalysisTemplates(IListAFAnalysisTemplate)
Loads the specified list AFAnalysisTemplate objects.
Public methodStatic memberLoadAnalysisTemplates(PISystem, Guid, Object)
Loads the AFAnalysisTemplate objects with the specified unique identifiers at the specified query date.
Public methodPersist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public methodRefresh
Refreshes the client with any changes that have been made to the object since loaded.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodUndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Top
Remarks

The template specifies the initial value of several of the properties for the analyses created from the template.

The collection of available analysis templates is maintained by the AFDatabase. Create a new AFAnalysisTemplate object by calling the AFAnalysisTemplates.Add method. The list of AFAnalysis objects created from an AFAnalysisTemplate can be found by calling one of the AFAnalysis.FindAnalysesByTemplate Overload methods. The AFAnalysisSearch class can be used for finding analysis templates.

Important note Important
When removing an AFAnalysisTemplate, any AFAnalysis created from the template will be deleted unless it is tied to an AFNotification.

Examples
// This example demonstrates how to create an analysis template, configure its
// analysis rule and time rule, and create an analysis from the template.

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Create an Element Template with Attributes
AFElementTemplate myElementTemplate = myDB.ElementTemplates.Add("MyElementTemplate");
AFAttributeTemplate myAttributeTemplate = myElementTemplate.AttributeTemplates.Add("MyAttribute");
myAttributeTemplate.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
myAttributeTemplate.DataReference.ConfigString = @"\\%Server%\sinusoid";

// Create an Analysis Template and set its Target to the Element Template
AFAnalysisTemplate myAnalysisTemplate = myDB.AnalysisTemplates.Add("MyAnalysisTemplate");
myAnalysisTemplate.Description = "This is an analysis example";
myAnalysisTemplate.Target = myElementTemplate;

// Set the Analysis Rule and Time Rule
myAnalysisTemplate.AnalysisRulePlugIn = myPISystem.AnalysisRulePlugIns["Imbalance"];
myAnalysisTemplate.TimeRulePlugIn = myPISystem.TimeRulePlugIns["Periodic"];
myAnalysisTemplate.AnalysisRule.ConfigString = "Balance=Volume;Imbalance=Volume Imbalance;UOM=US gal";
myAnalysisTemplate.TimeRule.ConfigString = "Frequency=3600";

// Instantiate an Element from the Element Template
AFElement myElement = myDB.Elements.Add("MyElement", myElementTemplate);

// Display the Template's Name, Description, and Target
Console.WriteLine("Name = {0}", myAnalysisTemplate.Name);
Console.WriteLine("Description = {0}", myAnalysisTemplate.Description);
Console.WriteLine("Target = {0}", myAnalysisTemplate.Target.Name);

// Get the instantiated analysis from the instantiated element
AFAnalysis myAnalysis = myElement.Analyses["MyAnalysisTemplate"];

// Display the Analysis's Name, Description, Target, and Template
Console.WriteLine("Name = {0}", myAnalysis.Name);
Console.WriteLine("Description = {0}", myAnalysis.Description);
Console.WriteLine("Target = {0}", myAnalysis.Target);
Console.WriteLine("Template = {0}", myAnalysis.Template.Name);
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
See Also
Enabling Operational Intelligence