Click or drag to resize
OSIsoft, LLC

AFAnalysis Class

The AFAnalysis is used to execute an analysis on a set of data values for a Target.

Inheritance Hierarchy

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

The AFAnalysis type exposes the following members.

Constructors
  NameDescription
Public methodAFAnalysis Obsolete.
Initializes a new instance of the class with default values.
Public methodAFAnalysis(String) Obsolete.
Initializes a new instance of the class with the specified name.
Public methodAFAnalysis(AFDatabase)
Initializes a new instance of the class with default values.
Public methodAFAnalysis(String, AFAnalysisTemplate) Obsolete.
Initializes a new instance of the class with the specified name.
Public methodAFAnalysis(AFDatabase, String)
Initializes a new instance of the class with the specified name.
Public methodAFAnalysis(AFDatabase, String, AFAnalysisTemplate)
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 AFAnalysis to run the analysis.
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 propertyAutoCreated
This read-only property indicates if this analysis was automatically created by the server.
Public propertyCaseTemplate
The AFElementTemplate that is used when creating a new AFCase using one of the 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 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 analysis.
Public propertyHasNotification
This read-only property indicates if there is an AFNotification associated with this analysis.
Public propertyHasTarget
This read-only property indicates if there is a target associated with this analysis.
Public propertyHasTemplate
This read-only property indicates if this analysis is defined by an AFAnalysisTemplate.
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 propertyIsConfigured
This method returns if the analysis rule instance is properly configured.
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 propertyIsTimeRuleDefinedByTemplate
This read-only property indicates if the TimeRule is fully defined by the AFAnalysisTemplate.
Public propertyMaximumQueueSize
The maximum queue size for the analysis.
Public propertyName
This property defines the name that identifies the object.
Public propertyNotification
This property returns the AFNotification that is associated with this AFAnalysis.
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 propertyPriority
The priority of the analysis.
Public propertyPublishResults
This property indicates if the case results should automatically be published after an analysis is run.
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertyStatus
The current analysis status.
Public propertyTarget
Gets and sets the target of the analysis.
Public propertyTemplate
This property returns the AFAnalysisTemplate that was used to create this AFAnalysis.
Public propertyTimeRule
The instance of the time rule used by the AFAnalysis to determine when the next analysis should be run.
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 methodAddCase
The AddCase method creates a new AFCase for the analysis based upon the TimeRule and PreviousCase.
Public methodAddCase(AFTime)
The AddCase method creates a new AFCase for the analysis after the specified start time.
Public methodAddCase(AFTimeRuleEvent)
The AddCase method creates a new AFCase for the analysis after the specified AFTimeRuleEvent.
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 memberCheckOutAnalyses
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 methodCreateAnalysisTemplate
Create an AFAnalysisTemplate based upon the analysis.
Public methodDelete
Deletes this analysis from the AFDatabase.
Public methodStatic memberDeleteAnalyses
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 memberFindAnalyses(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFAnalysis objects with the specified list of unique identifiers.
Public methodStatic memberFindAnalyses(AFObject, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a non-paged search within the AFDatabase to retrieve a collection of AFAnalysis objects with the specified target.
Public methodStatic memberFindAnalyses(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32)
Performs a non-paged text search within the AFDatabase to retrieve a collection of AFAnalysis objects which have a field that match the specified query string.
Public methodStatic memberFindAnalyses(AFObject, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a paged search within the AFDatabase to retrieve a collection of AFAnalysis objects with the specified target.
Public methodStatic memberFindAnalyses(AFDatabase, String, AFSearchField, AFSortField, AFSortOrder, Int32, Int32, Int32)
Performs a paged search within the AFDatabase to retrieve a collection of AFAnalysis objects which have a field that match the specified query string.
Public methodStatic memberFindAnalyses(AFDatabase, String, String, NullableInt16, AFCategory, AFAnalysisTemplate, AFElement, AFStatus, AFSortField, AFSortOrder, Int32, Int32) Obsolete.
Performs a paged search within the AFDatabase to retrieve a collection of AFAnalysis objects that match the specified query strings and additional filters.
Public methodStatic memberFindAnalysesByGroupID(AFDatabase, Int16, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a non-paged search within the AFDatabase to retrieve a collection of AFAnalysis objects with the specified group identifier.
Public methodStatic memberFindAnalysesByGroupID(PISystem, Int16, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a non-paged search to retrieve a collection of all AFAnalysis objects in the specified PISystem with the specified group identifier.
Public methodStatic memberFindAnalysesByGroupID(AFDatabase, Int16, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a paged search within the AFDatabase to retrieve a collection of AFAnalysis objects with the specified group identifier.
Public methodStatic memberFindAnalysesByGroupID(PISystem, Int16, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a paged search to retrieve a collection of all AFAnalysis objects in the specified PISystem with the specified group identifier.
Public methodStatic memberFindAnalysesByTemplate(AFDatabase, AFAnalysisTemplate, AFSortField, AFSortOrder, Int32, Int32) Obsolete.
Retrieves a paged collection of AFAnalysis objects that are instantiated from the specified AFAnalysisTemplate without returning the total count.
Public methodStatic memberFindAnalysesByTemplate(AFDatabase, AFAnalysisTemplate, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Retrieves a paged collection of AFAnalysis objects that are instantiated from the specified AFAnalysisTemplate.
Public methodStatic memberFindAnalysis(PISystem, Guid)
Retrieves the AFAnalysis object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic memberFindAnalysis(PISystem, Guid, Object)
Retrieves the AFAnalysis object with the specified unique identifier at the specified query date.
Public methodStatic memberFindAnalysisGroupIDs
Retrieves the list of GroupIDs that are defined for the PISystem.
Public methodStatic memberCode exampleGetCounts(AFDatabase)
Get the number of analyses for each status.
Public methodStatic memberCode exampleGetCountsT(AFDatabase)
Get the number of analyses for each filter.
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 methodGetLastCase
Use this method to get the case with the latest start time for the analysis.
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 methodGetResults(Object, Int32, Boolean, AFAttribute, UOM)
Use this method to get all the stored results for the attribute of cases of the analysis limited to the specified count beginning at the requested start time in the specified direction.
Public methodGetResults(AFSearchMode, Object, Object, Double, AFAttribute, UOM) Obsolete.
Use this method to get all the stored results for the attribute of cases of the analysis based upon the specified search criteria.
Public methodGetResults(AFSearchMode, Object, Object, Int32, AFAttribute, UOM)
Use this method to get all the stored results for the attribute of cases of the analysis between the specified start and end times.
Public methodGetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodGetStatus
Get the analysis Status property immediately from the PI AF Server.
Public methodStatic memberGetStatus(IListAFAnalysis)
Get the status for the list of specified analyses from the PI AF Server.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsTraced
Indicates if a specified level is being traced.
Public methodStatic memberLoadAnalyses(IListAFAnalysis)
Loads the specified list AFAnalysis objects.
Public methodStatic memberLoadAnalyses(PISystem, Guid, Object)
Loads the AFAnalysis objects with the specified unique identifiers at the specified query date.
Public methodStatic memberLoadTargets
Loads the Target of the specified list of AFAnalysis objects.
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 methodRemoveCase
Removes an existing AFCase from the analysis.
Public methodResetToTemplate
This method will reset the AFAnalysis back to its template default values.
Public methodRun
Execute the analysis with default values.
Public methodRun(AFCase)
Execute the analysis for the specific AFCase.
Public methodSetStatus(AFStatus)
Set the analysis Status property immediately in the server.
Public methodStatic memberSetStatus(IListAFAnalysis, AFStatus)
Set the list of analyses to the specified status.
Public methodStatic memberSetStatus(AFDatabase, AFObject, AFStatus, AFStatus)
Sets all the analyses based upon a filter object to the specified status.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodTraceData
Output a data trace event.
Public methodTraceDetail
Output a detail trace event.
Public methodTraceError
Output an error trace event.
Public methodTraceEvent(AFTraceSwitchLevel, String)
Output a trace event with a message.
Public methodTraceEvent(AFTraceSwitchLevel, String, Int32)
Output a trace event with a message and a duration.
Public methodTraceEvent(AFTraceSwitchLevel, String, Object)
Output a trace event as a formatted message with a variable number of arguments.
Public methodTraceInformation
Output an information trace event.
Public methodTraceSummary
Output a summary trace event.
Public methodTraceWarning
Output a warning trace event.
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 AFAnalysis uses the configured TimeRule to determine when the next analysis should be executed and the configured AnalysisRule provide the logic to execute the analysis on a set of data values for a Target. See Analysis Execution for more detailed information about how analyses are executed. The AFAnalysisSearch class can be used for finding analyses.

Use the PISystem.Supports method to check if the PISystem supports the Analysis feature.

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 a model analysis and configure
// its analysis rule and time rule.

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

// Create an Element with an Attribute
AFElement myElement = myDB.Elements.Add("MyElement");
AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute");
myAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
myAttribute.DataReference.ConfigString = @"\\%Server%\sinusoid";

// Create an Analysis and set its Target to the Element
AFAnalysis myAnalysis = new AFAnalysis(myDB, "MyAnalysis");
myAnalysis.Description = "This is an analysis example";
myAnalysis.Target = myElement;

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

// Display the Name, Description, and Target
Console.WriteLine("Name = {0}", myAnalysis.Name);
Console.WriteLine("Description = {0}", myAnalysis.Description);
Console.WriteLine("Target = {0}", myAnalysis.Target);
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