C# Class MATLABfromCSharp.AFAccess

Show file Open project: osisoft/PI-to-MATLAB-Utility Class Usage Examples

Public Methods

Method Description
getAFData ( string server_database, string AttributeName, string MatlabName, string path, string start, string end, bool addToListView ) : void

Using AFSDK adds both PI Tags and Constant attribute values to Matlab.

Attribute.GetValues is an Important call <= Int32 determines level of specficity of returned values.

getData ( string server_database, string AttributeName, string MatlabName, string start, string end, Object afobject, bool addToListView ) : void

Common calls of getting Data from AFServer

getEventFrameData ( string server_database, string AttributeName, string MatlabName, AFEventFrame frame, bool addToListView ) : void

Gets the data of the EventFrame attribute chosen.

getPIData ( string MatlabName, string server, string point, string start, string end, bool addToListView ) : void

Get the PIPoint data, uses AFSDK.

isAbsoluteTimeString ( string start, string end, LogInput logInput ) : bool

Determines if the inputted strings are in PI Absolute Time.

setDataPrefs ( bool timestamp, int datapref, string format ) : void

Sets the Datapreferences in AFAccess.

writeToAF ( AFElement element, AFAttribute attribute, double value ) : void

Writes to AF, and checks in the element.

Private Methods

Method Description
AFValuesToArray ( object vals ) : double[]

Move from object array into a double array. Turns enumerated values into doubles.

Called often after AFValues are given to method ConvertAFValues.GetValuesArray(..).

checkAFTimeRange ( string start, string end ) : AFTimeRange

Confirm that a valid start and end time were entered by the user.

Method Details

getAFData() public static method

Using AFSDK adds both PI Tags and Constant attribute values to Matlab.
Attribute.GetValues is an Important call <= Int32 determines level of specficity of returned values.
public static getAFData ( string server_database, string AttributeName, string MatlabName, string path, string start, string end, bool addToListView ) : void
server_database string String representing server and database
AttributeName string The name of the attribute
MatlabName string The variable name in the Matlab Workspace.
path string The path to the AFElement.
start string Start of Data Collection.
end string End of Data Collection.
addToListView bool true: adds the log input to the Log. (generally true).
return void

getData() public static method

Common calls of getting Data from AFServer
public static getData ( string server_database, string AttributeName, string MatlabName, string start, string end, Object afobject, bool addToListView ) : void
server_database string String representing the server and database
AttributeName string name of the attribute
MatlabName string variable name for the Matlab Workspace
start string Start time of data collection.
end string End time of the data collection.
afobject Object AF object - AFAttribute, AFEventFrame, or PIPoint
addToListView bool Whether to add to the Listview (generally true)
return void

getEventFrameData() public static method

Gets the data of the EventFrame attribute chosen.
public static getEventFrameData ( string server_database, string AttributeName, string MatlabName, AFEventFrame frame, bool addToListView ) : void
server_database string Unique string representing the server and database
AttributeName string The name of the AFEventFrame AFAttribute.
MatlabName string The name of the variable in the Matlab workspace.
frame AFEventFrame The AFEventFrame object.
addToListView bool true: adds input into the LogSystem. (Generally true)
return void

getPIData() public static method

Get the PIPoint data, uses AFSDK.
public static getPIData ( string MatlabName, string server, string point, string start, string end, bool addToListView ) : void
MatlabName string The variable name in Matlab workspace.
server string The name of the server.
point string The name of the Point.
start string The start time of data collection.
end string The end time of data collection.
addToListView bool true: adds to the LogSystem ListView. (generally true)
return void

isAbsoluteTimeString() public static method

Determines if the inputted strings are in PI Absolute Time.
public static isAbsoluteTimeString ( string start, string end, LogInput logInput ) : bool
start string The string of the start time.
end string The string of the end time.
logInput LogInput Adds the Absolute time to this logInput.
return bool

setDataPrefs() public static method

Sets the Datapreferences in AFAccess.
public static setDataPrefs ( bool timestamp, int datapref, string format ) : void
timestamp bool if true: exports the Timestamp with the data.
datapref int Integer for Attribute.GetValues; 0(raw), negative(Samples), positive(profiled samples)
format string String representation of the Data Preference
return void

writeToAF() public static method

Writes to AF, and checks in the element.
public static writeToAF ( AFElement element, AFAttribute attribute, double value ) : void
element AFElement AFElement being written to.
attribute AFAttribute AFAttribute being changed.
value double The new value being imported.
return void