I need to change some attributes of some elements in AF model programmatically. I need to do it periodically, once in each hour. Can I do it with Data Reference add-in or I need another tool for do it?
If I understand your need correctly, you could just program a .NET application referencing the AF-SDK. This is some sample code like to change the value of an attribute of an element of an AF model:
Dim MyPISystems As New PISystems
Dim MyPISystem As PISystem = MyPISystems.DefaultPISystem
Dim MyDB As AFDatabase
Dim MyModel As AFModel
Dim MyElement As AFElement
Dim MyAttribute As AFAttribute
Dim MyValue As New AFValue
MyDB = MyPISystem.Databases("Database1")
MyModel = AFModel.FindModels(MyDB, Nothing, "MyModel", 1, True, 0, 0, 1).Item(0)
MyElement = MyModel.Elements().Item("DestElement")
MyAttribute = MyElement.Attributes().Item("Attribute3")
MyValue.Timestamp = New AFTime(DateTime.UtcNow)
MyValue.Value = 33
The value is hard coded in the sample, but of course you would set it to whatever value you need.
If you code this as a Windows service, you could add some code to have the above code run every hour. If you have PI ACE, this could be implemented as an ACE calculation and run by the PI ACE Scheduler.
Please let me know if I understood your need correctly.
And if you need to modify a data reference here's a small example that shows how to do that using the DataReferencePlugIn Property. It is a rough example with a hard coded server name and it's for a PI point reference only but you get the idea.
Public Sub LinkPIPoint(ByVal pstrTagName As String, ByVal pstrEngUnits As String, ByRef myPISystem As PISystem, _ ByRef myDB As AFDatabase, ByRef AFAttrib As AFAttribute, pblnRemoveLink As Boolean) Try 'Create or remove the link between the AF attribute and the PI Point. If pblnRemoveLink Then AFAttrib.DataReferencePlugIn = Nothing AFAttrib.SetValue(0, AFAttrib.DefaultUOM) 'set a default value. Else AFAttrib.DataReferencePlugIn = myPISystem.DataReferencePlugIns("PI Point") AFAttrib.ConfigString = "\\100SRV21\" & pstrTagName AFAttrib.DataReference.UOM = myPISystem.UOMDatabase.UOMs(pstrEngUnits) End If
Catch ex As Exception MsgBox(ex.Message, , "clsAF.LinkPIPoint") End Try End Sub
I have PI ACE 2010. How I can register new calculation without Visual Studio if I have dll with it? Is it necessary to have MDB for PI ACE 2010 if I already have PI AF 2010?
Nikolay FilatovI have PI ACE 2010. How I can register new calculation without Visual Studio if I have dll with it?
I have PI ACE 2010. How I can register new calculation without Visual Studio if I have dll with it?
Well, I don't think this is actually a supported procedure. PI ACE is designed so that all ACE calculations are coded, debugged, tested and registered using the ACE Wizard in Visual Studio.
Nikolay FilatovIs it necessary to have MDB for PI ACE 2010 if I already have PI AF 2010?
Is it necessary to have MDB for PI ACE 2010 if I already have PI AF 2010?
Yes, you'll need to have the MDB writable and synchronized with PI AF through the PI AF Link Subsystem, as PI ACE stores all its metadata (calculation contexts, location of class library files, etc) in the MDB.
You can read more about the relation and interaction between the MDB and AF in the PI Server 2010 in the document "PI Server 2010 MDB to AF Transition Guide", available from the TechSupport website (either the English version or Russian version).
Thanks a lot for your answers.
But now I have a problem with starting ACE module:
[DEAD LINK] vcampus.osisoft.com/.../11308.aspx
You are welcome, Nikolay. Please take a look at my answer in other thread and see if it applies to your case.
Is PI ACE going to be used as the scheduler for Configured Analytics Abacus? It seems periodically changing attribute values would be a good fit for such functionality (a common request I'm sure).
Retrieving data ...