Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 612 Location: Cheshire, United Kingdom.
|
Once you have managed to Connect to PI-AF Database you can connect to a model belonging to that AFDatabase.
Example routine to achieve this is below, this assumes you have a class level variable "AFMod" defined as "AFModel".
Code: Private Function ConnectToModel(ByVal WhichModel As String) As Boolean
Dim ret As Boolean = False
Try ' Check this AF Database contains any models! If AFDB.Models.Count > 0 Then ' Models available, check AFModel object state, create if required If (AFMod Is Nothing) Then AFMod = AFDB.Models(WhichModel) ' If model already existed, check it is pointing to correct model If Not AFMod.Name.ToLower.Equals(WhichModel) Then AFMod = AFDB.Models(WhichModel) Else ret = False End If ret = Not (AFMod Is Nothing) Catch ex As Exception ret = False End Try
Return ret
End Function
To use in conjunction with the connect to PI-AF Database:
Code: If ConnectToAF("af_server_name", "af_database_name") Then If ConnectToModel("af_model_name") Then 'Now manipulate model, elements connections, analysis, case etc End If End If Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|