5 Replies Latest reply on Apr 28, 2014 8:58 AM by Gregor

    Steam Function in ACE


      Hi there,




      I've implement the Steam functions in to ACE and have things functional in test


      Is there a 'special' way to deploy this to the PI server?




      I'm using VS.Net 2013


      Have PI Steam Table Functions added as a reference (COM)


      Have the compile set to x86


      Tests perfectly fine and no issues on debug




      When run on the server and enabled via ACE Manager, I get this showing up in my logs (Have Try/catch throughout the script)




      Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.




      Not sure if this is helpful (defaults that were used when added as reference):



        • Re: Steam Function in ACE

          Hello Trevor,


          Your question indicates you plan using your PI Server node as ACE Server. This isn't illegal but in a production environment I would prefer using dedicated ACE Server(s).


          Just for the case your issue is because of the way you deployed your ACE calculations Please see PI ACE User Guide -> "Tutorial Examples" -> "Example 5 - Deploying ACE Calculations".


          The error you posted however indicates the problem might be a totally different one. Are you using other library references? STA refers to Single Thread Apartment in opposite to MTA Multi Threaded Apartment. There exist other threads discussing issues with STA/MTA like e.g. this one. 


          The issue might also because of the way you've implemented pisteamtablefunctions.dll. You may want to check with PI ACE User Guide on this one too. Please see "In-process COM Servers".


          Generally, please consider starting simple e.g. by creating a very simple ACE calculation without any reference to external libraries and deploy it to your ACE Server. If that works, try a new ACE Module with reference to pisteamtablefunctions.dll and deploy it. With another ACE Module you may again want to improve the level of complexity. This way you become familiar with the deployment process and recognize at what point you are running into trouble. At a later time you can decide about taking "test" modules just offline or deleting them from ACE Scheduler via PI ACE Manager.

            • Re: Steam Function in ACE

              You are correct, the PI server and ACE server are the same machine.  Because this is out testing/proving ground (vCampus version), we are ok with this.  Deployment plans are to separate them out and allow ACE to get a little more horsepower and not bog PI down


              After reviewing this and starting up a test script adding things in slowly, I found the issue


              I quoted out all the msgbox instances I had in for stepping through the script while testing, but missed one instance of:


              which I use to paste blocks of info to notepad during testing.  once I quoted that out, it works as expected


              Lol, always something silly it seems!


              Too bad things like that and msgbox can't simply be ignored at runtime

                • Re: Steam Function in ACE

                  Hello Trevor,


                  Thank you for the update. That's indeed a funny one

                    • Re: Steam Function in ACE

                      Funny wasn't the word I used when I tore it all apart and rebuilt it from the ground up, albeit the word did start with an F


                      I've debated on adding a Dim variable at the start of the script for something like this:



                      Dim DebugScript as Boolean
                      'True for debug, otherwise False for runtime
                      DebugScript = True
                      'various code
                      'anytime I want to use something that I never want to see in actual run time:
                      If DebugSript = True Then
                      End IF
                      'other code
                      If DebugSript = True Then
                      MsgBox("Something of note")
                      End IF