We want to develop a program on matlab that would get the PI AF data.
Firstly we created an instance of the AF SDK and import the relevant namespaces:
afSDK = NET.addAssembly('OSIsoft.AFSDK'); import OSIsoft.AF.* import OSIsoft.AF.Asset.*
After that, we connected to our AF server and database:
piSystems = OSIsoft.AF.PISystems; PIsystem = piSystems.Item('SERVEUR-PI'); AFdatabase = PIsystem.Databases.Item('TechnoCentre');
But now we are connected, we would like to get the status of our sensors (for exemple, on excel our tag/data item is \\SERVEUR-PI\TechnoCentre\SNEEC\MMV2\WMET\H103M\WS(8)|Status)
We tryed to get values:
powerTransmitters = AFElement.FindElements(AFdatabase, , 'WS(8)', AFSearchField.Name, true, AFSortField.Name, AFSortOrder.Ascending,intmax('int32')); attrib = powerTransmitters.Item(0).Attributes; PV = attrib.Item('Status'); myTime = OSIsoft.AF.Time.AFTime.Now; myValues = PV.Data.RecordedValue(myTime, Data.AFRetrievalMode.AtOrBefore, PV.DefaultUOM); myValues.Value
But matlab returns :
ans = Table 'MMV2' was not available for attribute 'SNEEC\MMV2\WMET\H103M\WS(8)|Status'.
On excel if I make a current value or a Archive Value it works, excel return "GOOD", but if I make a TIME DATA, excel send the message: Table 'MMV2' was not available for attribute 'SNEEC\MMV2\WMET\H103M\WS(8)|Status'.
So I think my problem is that in matlab I try to get my values with a TIME DATA instead of make it with a Archive Value but I don't know how to do it?
Thanks in advance.