8 Replies Latest reply on Sep 8, 2011 1:09 PM by cmanhard

    ACE calculation using AF contexts

    mhalhead

      I'm curious how others have done calculation against AF elements that are persisted in the PI database. The obvious method (and the one I'm using) is to construct you're AF elements and then seperately create a MDB hierarchy (this can be automated fairly easily or simply wait for PI 3.5.380 to be released); naturally you would use the same PI Points in the AF element and MBD alias. You would then simply create an ACE calculation that runs against the MDB context. Is this the best method or has anyone come up with another approach?

       

      The ideal would be to tie the ACE calculations directly but I don't believe this is possible yet; the AF 2.2 release will re-introduce analysis rules, time rules and I gather attribute analysis rule (forgive me if my terminology is incorrect).

        • Re: ACE calculation using AF contexts
          andreas

          Hi Michael,

           

          that is what we usually do here. Our AF zealot typicaly creates a copy of the AF structure in the MDB and uses ACE just the way it is.

           

          regards,

            • Re: ACE calculation using AF contexts
              Mohammad

              Hello Andres

               

              I would like to do the same as Michael.

               

              I am using AF 2.X and I have built my templates and elements and everything and also I have my processbook display ready and I assigned all elements to display. Now I would like to use ACE to do more calculations. Since the ACE  is using MDB , I cannot search tag in ACE based on AF and it gives me the MDB search.

               

              Could you please tell me what AF zealot is and how I can do the integration?

               

              Or could you please let me know which codes and namespaces I need to use?

               

              Regards

               

              Mohammad

                • Re: ACE calculation using AF contexts

                  By "AF zealot", Andreas simply meant an "AF user". He was referring to simply transferring your AF structure over to ModuleDB and then PI ACE as it is designed (i.e. against ModuleDB). That's in the case you want to make use of the "Module Context" technique in PI ACE: reusing the same calculation logic over identical Aliases that belong to various PI Modules.

                   

                  As far as the roadmap for native support of AF in PI ACE, I invite you to read this post in the PI ACE forum.

                   

                   

                   

                  On the other hand, if all you need to do is a single ACE calculation (as opposed to reusing a calculation over different contexts) and you want to access AF elements, then you should simply use the AF SDK within your code. If that's what you are looking for, then please allow me to reiterate my suggestion to watch the "PI Programming 101" webinar (see this post).

                    • Re: ACE calculation using AF contexts
                      mbryant

                      I'd like to use PI AF client attribute values in a PI ACE calculation...

                       

                      I'm running VS 2010,  PI ACE 2010 R2/SP1, & PI AF (client) 2010R2

                       

                      If I set my compile options to .Net 3.5 - my ACE assembly won't load

                       

                      If I set my compile options to .Net 3.0 - the AF SDK won't load:

                       

                      Warning     1     The primary reference "OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.0". To resolve this problem, either remove the reference "OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".     

                       

                        any hints here?

                        • Re: ACE calculation using AF contexts
                          Ahmad Fattahi

                          You should be able to give reference to AF SDK in your PI ACE environment as it is mentioned in this thread and this one and this one. Can you give reference to AF SDK on the machine at all (i.e. can you run any AF SDK application on the machine)? Does PI ACE work fine separately without any reference to AF SDK?

                            • Re: ACE calculation using AF contexts
                              mbryant

                              PI AF 2.0 used .Net 3.0  and the PI AF SDK could be included directly into PI ACE code.  With PI AF 2.1 (and subsequent releases) - the PI AF SDK uses .Net 3.5.  and is not even readily available from the "Add" menu as a reference to the project.    I'm looking into workarounds.

                                • Re: ACE calculation using AF contexts
                                  Ahmad Fattahi

                                  This is what I got from Noah, one of our PI ACE gurus:

                                   

                                  "AF SDK doesn’t show up on the default list of available assemblies, but neither does PI SDK. However , you can browse to the AF\public assemblies and add the reference. Visual studio will give a loud warning because the AF components require .net 3.5. Change the project properties to use 3.5 (the default is .net 2):

                                   

                                  6406.PI-ACE-thread.png

                                   

                                   

                                   

                                  I’ve tested this with VS 2010 with no problems. I assume that you can do the same in VS 2008."

                                   

                                  Hope it helps.

                                    • Re: ACE calculation using AF contexts
                                      cmanhard

                                      There should not be a problem with setting your compile options for your ACE assembly to .NET 3.5.  Note, however, that if you set your compile option to .NET 4.0, you will not be able to load this assembly unless you also modify the ACE Host configuration file to direct it to use .NET 4.0.  Also note that in the case of .NET 4.0, if you make a reference to PISDK in your project, you will need to change the "Embed Interop Types" setting for the PISD reference to "False".

                                       

                                      Regarding AFSDK not showing up on the .NET available assemblies in VS 2010 - this is only true for AF Client 2.2 and earlier.  In AF Client 2.3, we register in the new location that VS 2010 created, so it will be seen there.