4 Replies Latest reply on Apr 22, 2013 7:10 AM by VarbanVarbanov

    Starting/stopping ACE module programatically

    VarbanVarbanov

      Hi, I'm trying to stop ACEModule exe, module or context using :  PIACEMDBFunctions.ChangePIACEEMCStatus(mdbObjectPath, (int)StatusCode.scOutOfService). It works!!!

      But i could not tell the same for  starting:

       PIACEMDBFunctions.ChangePIACEEMCStatus(path, (int)StatusCode.scOn)  - sets the status at On, all shines green but no calculations are perfomed (I wait for an hour - nothing changes)

      or

       PIACEMDBFunctions.ChangePIACEEMCStatus(path, (int)StatusCode.scStarting) - set the status for "Starting" and it seems to stay forever

      What is the proper way to do this?
      Can somebody explain how exactly this works I guess after setting the status ACE Schesuler checks it and starts/stops calculation?
      Maybe it works with conjunction with something else like Modified or StatusSince properties which i need to set?

      Thank you for your help!! 

        • Re: Starting/stopping ACE module programatically

          Hello Varban,

           

          Have you seen the thread titled Managing ACE Context by program. Please pay attention to what Steve Pilon has posted.

            • Re: Starting/stopping ACE module programatically
              VarbanVarbanov

              Hi, Gregor, Thank you very much!!!

               

              So in summary - for anyone who is having the same difficullties - for Starting context, module, executable you should set its Status code to ... Off

               

              Here is my code:

               

              private void StartACEMdbObject(string mdbObjectPath)

               

                     {

               

                         PIACEMDBFunctions.SetRefreshPIModuleToTrue();

               

                         PIACEMDBFunctions.ChangePIACEEMCStatus(mdbObjectPath, (int)StatusCode.scOff);

               

                     }

                • Re: Starting/stopping ACE module programatically

                  Hello Varban,

                   

                  From my point of view there is an important aspect missing with your summary.

                   

                  Steve Pilon

                  Before I get any further, please note that what I am about to write is not a documented feature and therefore is not supported through our regular channels such as Tech Support. Also, since this meant as an internal call rather than a publicly available one, please note there is no guarantee that this will continue to work in future versions of PI ACE - make sure you test this thoroughly before to upgrade PI ACE in the future.

                   

                  With that said (and if you are fine with my previous paragraph ), you can use the ChangePIACEEMCStatus method that's part of the PIACECommon namespace (which means your ACE program will need reference the OSIsoft.PIACECommon assembly as well). The ACE executable/module/context should be registered by the PI ACE Wizard so that the structural information is present in th PI Module Database.