1 Reply Latest reply on Sep 21, 2017 2:44 PM by pmartin

    ACE monitor


      Hello, I have one status in ACEClaseeLabraries, how could I get the value by using the PI SDK or PI AF SDK and show on the AF attribute?? Thanks a lot!!


        • Re: ACE monitor

          Hi YuLin,


          In order to do this continuously, you'll want to set up a service.  The code for that service is relatively simple.  You grab the value from the MDB Property using PI SDK and then you can write it to an attribute using the AF SDK.  I recommend having this attribute be a PI Point Data Reference so that you can keep the ACE Status history.  Here is the code:


          //PISDK to Get Data from MDB
          Server piServer = new PISDK.PISDK().Servers.DefaultServer;
          PIModuleDB mdb = piServer.PIModuleDB;
          PIModule mod = mdb.PIModules["%OSI"].PIModules["ACEClassLibraries"].PIModules["FindValuesEQ"];
          PIProperty prop = mod.PIProperties["Status"];
          //AF SDK to write Status to attribute
          PISystem afserver = new PISystems().DefaultPISystem;
          AFDatabase db = afserver.Databases.DefaultDatabase;
          db.Elements["Element2"].Attributes["ACE Status"].Data.UpdateValue( new AFValue( prop.Value, DateTime.Now ), OSIsoft.AF.Data.AFUpdateOption.Replace );
          1 of 1 people found this helpful