C# Class MATLABfromCSharp.MainControl

Mostrar archivo Open project: osisoft/PI-to-MATLAB-Utility Class Usage Examples

Public Methods

Method Description
ImportToAF ( string path, string workspaceVariableName, string AFName ) : void

Gets value from Matlab and writes it to AF.

Will not write, if the Attribute is read-only. A Matlab Variable Name must be input.

MainControl ( ) : System

Starts up the Desktop Matlab or attaches to COM-Enabled Matlab. to Com-Enable Matlab use [ enableservice('AutomationServer',true);]

checkMatlab ( bool showDialog ) : void

Checks to see if Matlab is still open and asks to Reload the logged data and reopens matlab.

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

Passes the Data Preferences from the MainForm to the AFAccess.

getAFData ( string server_database, string attName, string MatlabName, string searchPath, string start, string end, bool edit ) : void

Accesses the AFServer to get data.

getAFDatabase ( ) : AFDatabase

Returns the AFDatabase that the MainControl is using.

getAttributes ( string path ) : AFAttributes

Uses the Element Path to access the Attributes.

The AFTreeView is implemented with ToolTipText is the path to the selected Element.

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

Get the Data from PIServer using AFSDK.

getPIPoints ( PISystem sys, PIServer serv ) : List

Accesses the PIServer to get the PIPoints that are available.

importLog ( string path ) : string[]

Imports a saved file into Matlab.

saveCurrentLog ( string filePath ) : void

Calls the LogSystem.Save method.

saveMatlabLog ( string filePath ) : void

Not implemented. Future use: writes a matlab that imports the same data.

setAFDatabase ( string currentDatabase ) : void

Sets the AFDatabase that the MainControl will use.

setMainForm ( MainForm form ) : void

Give the MainControl access to the MainForm

Method Details

ImportToAF() public method

Gets value from Matlab and writes it to AF.
Will not write, if the Attribute is read-only. A Matlab Variable Name must be input.
public ImportToAF ( string path, string workspaceVariableName, string AFName ) : void
path string The path to the Element to search with.
workspaceVariableName string The variable name in Matlab being used.
AFName string The attribute name in AF being written to.
return void

MainControl() public method

Starts up the Desktop Matlab or attaches to COM-Enabled Matlab. to Com-Enable Matlab use [ enableservice('AutomationServer',true);]
public MainControl ( ) : System
return System

checkMatlab() public method

Checks to see if Matlab is still open and asks to Reload the logged data and reopens matlab.
public checkMatlab ( bool showDialog ) : void
showDialog bool Whether to show a dialog with yes or no.
return void

currentDataPrefChanges() public method

Passes the Data Preferences from the MainForm to the AFAccess.
public currentDataPrefChanges ( bool timestamp, int datapref, string format ) : void
timestamp bool true: exports the timestamp to Matlab.
datapref int Integer for Attribute.GetValues; 0(raw), negative(sampling), positive(profiled sampling)
format string String representation of the Data Preferences.
return void

getAFData() public method

Accesses the AFServer to get data.
public getAFData ( string server_database, string attName, string MatlabName, string searchPath, string start, string end, bool edit ) : void
server_database string The string of the server and database 'server'-'database'
attName string Name of the Attribute.
MatlabName string Variable name to be used in Matlab workspace.
searchPath string The path to the Element.
start string The time at which data will start being imported from.
end string The time when data will stop being imported.
edit bool true: Adds the log input into the LogSystem (generally true)
return void

getAFDatabase() public method

Returns the AFDatabase that the MainControl is using.
public getAFDatabase ( ) : AFDatabase
return AFDatabase

getAttributes() public method

Uses the Element Path to access the Attributes.
The AFTreeView is implemented with ToolTipText is the path to the selected Element.
public getAttributes ( string path ) : AFAttributes
path string The pathway to the Element
return AFAttributes

getPIData() public method

Get the Data from PIServer using AFSDK.
public getPIData ( string point, string server, string MatlabName, string start, string end, bool edit ) : void
point string The name of the PIPoint.
server string The PIServer
MatlabName string The name of the variable to be used for Matlab.
start string The time to start taking data from.
end string The time to stop taking data from.
edit bool true: Adds the log to the LogSystem (generally true)
return void

getPIPoints() public method

Accesses the PIServer to get the PIPoints that are available.
public getPIPoints ( PISystem sys, PIServer serv ) : List
sys PISystem The current PISystem
serv PIServer The current PIServer
return List

importLog() public method

Imports a saved file into Matlab.
public importLog ( string path ) : string[]
path string The path to the importe File.
return string[]

saveCurrentLog() public method

Calls the LogSystem.Save method.
public saveCurrentLog ( string filePath ) : void
filePath string The path to where the file will be written.
return void

saveMatlabLog() public method

Not implemented. Future use: writes a matlab that imports the same data.
public saveMatlabLog ( string filePath ) : void
filePath string The path to where the file will be written.
return void

setAFDatabase() public method

Sets the AFDatabase that the MainControl will use.
public setAFDatabase ( string currentDatabase ) : void
currentDatabase string The name of the AFDatabase.
return void

setMainForm() public method

Give the MainControl access to the MainForm
public setMainForm ( MainForm form ) : void
form MainForm The Main Form
return void