Click or drag to resize
OSIsoft, LLC

AFCase Class

The AFCase is used by an AFAnalysis to store the data results of an analysis.

Inheritance Hierarchy

Namespace:  OSIsoft.AF.Analysis
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
[SerializableAttribute]
public sealed class AFCase : AFEventFrame, 
	IComparable<AFCase>, IAFTrace

The AFCase type exposes the following members.

Constructors
  NameDescription
Public methodAFCase(AFAnalysis)
Initializes a new instance of an AFCase with default values.
Public methodAFCase(AFAnalysis, AFElementTemplate)
Initializes a new instance of an AFCase with the specified AFElementTemplate.
Public methodAFCase(AFAnalysis, AFTime)
Initializes a new instance of an AFCase with the specified start time.
Public methodAFCase(AFAnalysis, AFTimeRuleEvent)
Initializes a new instance of an AFCase with its start and end times defined by an AFTimeRuleEvent.
Public methodAFCase(AFAnalysis, AFTime, AFElementTemplate)
Initializes a new instance of an AFCase with specified start time and AFElementTemplate.
Public methodAFCase(AFAnalysis, AFTime, AFTime)
Initializes a new instance of an AFCase with the specified start and end times.
Public methodAFCase(AFAnalysis, AFTimeRuleEvent, Boolean)
Initializes a new temporary instance of an AFCase with its start and end times defined by an AFTimeRuleEvent.
Public methodAFCase(AFAnalysis, AFTime, AFTime, AFElementTemplate)
Initializes a new instance of an AFCase with specified start and end times and AFElementTemplate.
Public methodAFCase(AFAnalysis, AFTime, AFTime, AFElementTemplate, Boolean)
Initializes a new temporary instance of an AFCase with specified start and end times and AFElementTemplate.
Top
Properties
  NameDescription
Public propertyAcknowledgedBy
This property indicates by whom the AFEventFrame was acknowledged.
(Inherited from AFEventFrame.)
Public propertyAcknowledgedDate
This property indicates when the AFEventFrame was acknowledged.
(Inherited from AFEventFrame.)
Public propertyAdditionalInfo
Additional information created by the time rule.
Public propertyAnalysis
The AFAnalysis which created this object.
(Inherited from AFEventFrame.)
Public propertyAnalysisRule
The AFAnalysisRule from the AFAnalysis which created this object.
Public propertyAreValuesCaptured
This property indicates whether the AFEventFrame has captured its AFAttribute values.
(Inherited from AFEventFrame.)
Public propertyAttributes
This is a collection of attributes that are owned by this element.
(Inherited from AFBaseElement.)
Public propertyCanBeAcknowledged
This property indicates whether the AFEventFrame can be acknowledged.
(Inherited from AFEventFrame.)
Public propertyCategories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
(Inherited from AFBaseElement.)
Public propertyCategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFBaseElement.)
Public propertyCheckOutInfo
This read-only property returns the checked out status information for the object.
Public propertyCollectElementsTime
This read-only property returns the time that elements were last collected for the case analysis.
Public propertyCollectInputsTime
This read-only property returns the time that input values were last read for the case analysis.
Public propertyCollectTransfersTime
This read-only property returns the time that transfers were last collected for the case analysis.
Public propertyConnections
This is a collection of connections between elements that are active for this case.
Public propertyDatabase
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFBaseElement.)
Public propertyDefaultAttribute
The default AFAttribute for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultInputPort
The default input AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultOutputPort
The default output AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultUndirectedPort
The default undirected AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDescription
Read/write property that provides a more detailed description of the object.
(Inherited from AFBaseElement.)
Public propertyDuration
This is a read-only property which returns the period's StartTime and EndTime values as a time range.
(Inherited from AFEventFrame.)
Public propertyElements
Gets the collection of elements (including transfers) that are active for this case.
Public propertyEndTime
This read-only property represents the end time of the period.
(Inherited from AFEventFrame.)
Public propertyEventFrames
This is a collection of child event frames that have been added to this event frame.
(Inherited from AFEventFrame.)
Public propertyExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFBaseElement.)
Public propertyHasChildElements
This read-only property returns if the event frame has child elements.
(Inherited from AFEventFrame.)
Public propertyHasChildEventFrames
This read-only property returns if the event frame has child event frames.
(Inherited from AFEventFrame.)
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 propertyIsAcknowledged
This property indicates whether the AFEventFrame has been acknowledged.
(Inherited from AFEventFrame.)
Public propertyIsAnnotated
This property indicates whether this element has any annotations.
(Inherited from AFBaseElement.)
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 propertyIsLocked
This property indicates whether the AFEventFrame has been locked.
(Inherited from AFEventFrame.)
Public propertyIsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public propertyIsPublished
This property indicates whether the results for the case, which was run, have been published to the locations specified by the attribute's data reference.
Public propertyIsRoot
This property indicates if the AFEventFrame is a root object owned by the AFDatabase.
(Inherited from AFEventFrame.)
Public propertyIsTemporary
This property indicates whether the AFEventFrame is temporary. A temporary AFEventFrame cannot be saved to the server.
(Inherited from AFEventFrame.)
Public propertyLayers
This is a collection of AFLayers that keep track of the active layers within the model when a case analysis is run.
Public propertyModel
This read-only property returns the AFModel that is the target of the AFAnalysis.
Public propertyName
Read/write property that identifies the name of the object.
(Inherited from AFBaseElement.)
Public propertyParent
This read-only property is returns the parent AFEventFrame that owns the event frame if it is referenced by another event frame.
(Inherited from AFEventFrame.)
Public propertyParents
This is a collection of all AFEventFrame objects that reference this event frame.
(Inherited from AFEventFrame.)
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyPorts
This is a collection of AFPort objects representing the possible connection ports for this element. Ports are used in a AFModel to define an AFConnection between AFBaseElement object.
(Inherited from AFBaseElement.)
Public propertyPreviousCase
This property returns the previous case to the current case used during the analysis.
Public propertyPrimaryReferencedElement
The primary referenced AFElement associated with the event frame.
(Inherited from AFEventFrame.)
Public propertyPublishTime
This read-only property returns the time that the case analysis was last published.
Public propertyReferencedElements
This is a collection of elements that are referenced by this event frame.
(Inherited from AFEventFrame.)
Public propertyResults
This is a collection of AFResults that keep the result values for a case run.
Public propertyRunTime
This read-only property returns the time that the case analysis was last executed.
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertySeverity
This is the severity level associated with the event.
(Inherited from AFEventFrame.)
Public propertyStartTime
This read-only property represents the start time of the period.
(Inherited from AFEventFrame.)
Public propertyTarget
Gets and sets the target of this case that is used by the configured analysis rule.
Public propertyTemplate
The AFElementTemplate that was used to define this object.
(Inherited from AFBaseElement.)
Public propertyTimeRange
This is a read-only property which returns the period's StartTime and EndTime values as a time range.
(Inherited from AFEventFrame.)
Public propertyType
This read-only property specifies the base type of the element.
(Inherited from AFBaseElement.)
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodAcknowledge(String, NullableAFTime)
Acknowledges a single AFEventFrame.
(Inherited from AFEventFrame.)
Public methodAddInput(AFAttribute)
Adds an attribute and its value at the time of the case to the result set.
Public methodAddInput(AFAttribute, AFValue)
Adds an attribute and a specified AFValue to the result set.
Public methodAddInput(AFAttribute, AFValue, UOM) Obsolete.
Adds an attribute and a specified value to the result set.
Public methodAddInput(AFAttribute, Object, UOM)
Adds an attribute and a specified value to the result set.
Public methodCode exampleApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodCaptureValues
Capture and cache the AFAttribute values with a AFDataReference using the default non-cached data provider.
(Inherited from AFEventFrame.)
Public methodCaptureValues(IAFDataProvider)
Capture and cache the AFAttribute values with a AFDataReference using the specified IAFDataProvider.
(Inherited from AFEventFrame.)
Public methodChangeReferenceType
Change the existing AFReferenceType between a child event frame.
(Inherited from AFEventFrame.)
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 memberCheckOutCases
Check out the objects with the specified unique identifiers at the specified query date.
Public methodCollectElements
This method collects the elements that are active for this case.
Public methodCollectInputs
This method uses the AFAnalysisRule to obtain the input values necessary to start an analysis.
Public methodCollectInputs(AFCaseLog) Obsolete.
This method uses the AFAnalysisRule to obtain the input values necessary to start an analysis.
Public methodCollectTransfers
This method collects the transfers that are active for this case.
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFEventFrame.)
Public methodCompareTo(AFEventFrame)
Compares this instance with a specified AFEventFrame.
(Inherited from AFEventFrame.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodCreateElementTemplate
Create an AFElementTemplate based upon the element.
(Inherited from AFBaseElement.)
Public methodCreateTemporary
This method creates a temporary case from the current case.
Public methodDelete
Deletes this event frame from the AFDatabase.
(Inherited from AFEventFrame.)
Public methodStatic memberDeleteCases
Delete the objects with the specified unique identifiers.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFEventFrame.)
Public methodEquals(AFEventFrame)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFEventFrame.)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic memberFindCase(PISystem, Guid)
Retrieves the AFCase object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic memberFindCase(PISystem, Guid, Object)
Retrieves the AFCase object with the specified unique identifier at the specified query date.
Public methodStatic memberFindCases(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFCase objects with the specified list of unique identifiers.
Public methodStatic memberFindCases(AFAnalysis, String, AFSearchField, AFSortField, AFSortOrder, Int32)
Performs a text search within the AFDatabase to retrieve a collection of AFCase objects that match the specified query string.
Public methodStatic memberFindCases(AFAnalysis, Object, Int32, AFEventFrameSearchMode, String, AFCategory, AFElementTemplate)
Retrieves a list of AFCase objects limited to the specified count beginning at the requested time in the specified direction.
Public methodStatic memberFindCases(AFAnalysis, Object, Int32, Boolean, String, AFCategory, AFElementTemplate) Obsolete.
Retrieves a list of AFCase objects limited to the specified count beginning at the requested start time in the specified direction.
Public methodStatic memberFindCases(AFAnalysis, AFSearchMode, Object, Object, String, AFCategory, AFElementTemplate, AFSortField, AFSortOrder, Int32) Obsolete.
Retrieves a list of AFCase objects that match the specified filtering conditions.
Public methodGetAdjustments
This method returns a collection of AFAdjustment objects for all the Results within the AFCase.
Public methodGetAnnotations
Retrieves a collection of existing AFAnnotation objects belonging to this AFBaseElement.
(Inherited from AFBaseElement.)
Public methodGetAttributeByTrait
Retrieves the child AFAttribute with the specified AFAttributeTrait.
(Inherited from AFBaseElement.)
Public methodGetAttributesByTrait
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
(Inherited from AFBaseElement.)
Public methodGetConnectedElements(AFBaseElement)
This method returns a collection of AFBaseElement objects which are connected to the specified element (or child element) within the case.
Public methodGetConnectedElements(AFBaseElement, AFPortType)
This method returns a collection of AFBaseElement objects which are connected to the specified element (or child element) through a port of the specified type within the case.
Public methodGetConnectedElements(AFBaseElement, String)
This method returns a collection of AFBaseElement objects which are connected to the specified element and port within the case.
Public methodGetConnections(AFBaseElement)
This method returns a collection of AFConnection objects representing a connection between the specified element (or child element) and another element within the case.
Public methodGetConnections(AFBaseElement, AFPortType)
This method returns a collection of AFConnection objects with the specified port type representing a connection between the specified element (or child element) and another element within the case.
Public methodGetConnections(AFBaseElement, String)
This method returns a collection of AFConnection objects with the specified port name representing a connection between the specified element and another element within the case.
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 AFEventFrame.)
Public methodGetLayers
This method returns a collection of AFLayer objects for the specified element representing all the active layers of the case which contain the element.
Public methodGetParents(AFCategory)
Retrieves a collection of AFEventFrame objects that reference this event frame using the specified AFCategory.
(Inherited from AFEventFrame.)
Public methodGetParents(AFReferenceType)
Retrieves a collection of AFEventFrame objects that reference this event frame using the specified AFReferenceType.
(Inherited from AFEventFrame.)
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 methodGetPaths
Get all the relative paths to this AFEventFrame.
(Inherited from AFEventFrame.)
Public methodGetReferenceTypes
Retrieves a collection of all AFReferenceType objects that represent types of references from this event frame to its child event frames.
(Inherited from AFEventFrame.)
Public methodGetReferenceTypes(AFEventFrame)
Retrieves a collection of AFReferenceType objects that represent types of references between this event frame and the specified related event frame.
(Inherited from AFEventFrame.)
Public methodGetResult
This method gets the result for the specified attribute.
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 methodIsActiveElement
Determines if the specified AFElement is active within the case.
Public methodIsActiveTransfer
Determines if the specified AFTransfer is active within the case.
Public methodIsTraced
Indicates if a specified level is being traced.
Public methodIsTypeOf
Checks if the current AFBaseElement is derived from the specified AFElementTemplate.
(Inherited from AFBaseElement.)
Public methodStatic memberLoadCases(IListAFCase)
Loads the specified list AFCase objects.
Public methodStatic memberLoadCases(PISystem, Guid, Object)
Loads the AFCase objects with the specified unique identifiers. at the specified query date.
Public methodLock
Locks this event frame so that no further changes can be made.
(Inherited from AFEventFrame.)
Public methodPersist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public methodPublish
The output AFAttribute values of the analysis case run are published to the locations specified by the attribute's data reference configuration.
Public methodPublishValue(AFAttribute, AFValue)
Write the specified value of the AFAttribute directly to the data reference source using the specified AFValue object.
Public methodPublishValue(AFAttribute, Object, UOM)
Write the specified value of the AFAttribute directly to the data reference source with the specified unit-of-measure at the case's EndTime.
Public methodRefresh
Refreshes the client with any changes that have been made to the object since loaded.
Public methodReset(AFAttribute)
This method resets an attribute in an analysis case.
Public methodReset(AFResult)
This method resets an attribute for the specified AFResult in an analysis case.
Public methodReset(Boolean, Boolean)
This method resets the input and/or output results generated in an analysis case.
Public methodReset(Boolean, Boolean, AFAttribute) Obsolete.
This method resets the results generated in an analysis case.
Public methodRun
This method uses the AFAnalysisRule to execute the analysis and generate analysis results.
Public methodRun(AFCaseLog) Obsolete.
This method uses the AFAnalysisRule to execute the analysis and generate analysis results.
Public methodSetEndTime
Set the time that represents the time that the period ended.
(Inherited from AFEventFrame.)
Public methodSetStartTime
Set the time that represents the time that the period started.
(Overrides AFEventFrameSetStartTime(Object).)
Public methodToString
Returns a String that represents the current object.
(Overrides AFObjectToString.)
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.
Public methodUnlock
Unlocks a locked event frame so that further changes can be made.
(Inherited from AFEventFrame.)
Top
Events
  NameDescription
Public eventCode exampleAfter
Occurs after an AFCase method specified in the AFCaseAction enumeration has been called.
Public eventCode exampleBefore
Occurs before an AFCase method specified in the AFCaseAction enumeration has been called.
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Public eventCode exampleExecuting
Occurs during the execution of an AFCase method specified in the AFCaseAction enumeration.
Top
Remarks

The default time rule used to generate the case and the analysis rule used to execute the analysis is obtained from the AFAnalysis that owns the case. Besides the ID for the case, the StartTime, EndTime, and RunTime values uniquely define an instance of an AFCase object. The AFCaseSearch class can be used for finding cases.

See Model Analysis Execution for more detailed information about how analyses are executed.

Examples
// This example demonstrates how to create and run a case.
// Note: This example assumes that there is a database called "Chocolate Milk Tutorial"
// containing a Model named "ChocolateMilkModel", with a Model Analysis
// named "Volume Balance"

// Get the Database
PISystems myPISystems = new PISystems();
AFDatabase myDB = myPISystems.DefaultPISystem.Databases["Chocolate Milk Tutorial"];

// Get the Model Analysis
AFAnalysis myAnalysis = AFAnalysis.FindAnalyses(myDB, "ChocolateMilkModel::Volume Balance",
    AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 1)[0];

// Create the Case
AFCase myCase = myAnalysis.AddCase();
myCase.SetStartTime(System.DateTime.UtcNow.AddHours(-1));
myCase.SetEndTime(System.DateTime.UtcNow);

// Run the Case and Capture Messages Using Custom TraceListener
// See AFTrace example for MyTraceListener
int msgCount = 0;
using (MyTraceListener listener = new MyTraceListener())
{
    myAnalysis.Run(myCase);

    foreach (string message in listener.GetMessages())
    {
        Console.WriteLine(message);
        msgCount++;
    }
    Console.WriteLine("Finished Running Case\n");
}

// Display Case Information
Console.WriteLine("Analysis Name = {0}", myCase.Analysis.Name);
Console.WriteLine("Case Start Time = {0}", myCase.StartTime.LocalTime);
Console.WriteLine("Case End Time = {0}", myCase.EndTime.LocalTime);
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