AnsweredAssumed Answered

Event Frames AF SDK backfilling issue

Question asked by eradwan on May 7, 2018
Latest reply on May 8, 2018 by Rick Davin

Hi There,

 

I'm using the following code to auto create an analysis with event frames backfilling, all works fine but it doesn't backfill and gives an error like the one in the screenshot. If I try to manually invoke backfill, it works!. Appreciate your thoughts, please.

 

 

 

        static void Main(string[] args)
        {
            try
            {
                PISystem ps;
                AFDatabase AF_Pilot;
                AFElement ocd1SourAfElement;
               


                var connection = new AfConnectionHelper("SRLAAP81", "AF Pilot");
                ps = connection.GetPiSystem();
                connection.Connect();
                AF_Pilot = ps.Databases.DefaultDatabase;
               


                Guid ocd1SourGuid = new Guid("bc8ac68b-4dc4-11e8-be45-005056a312a2");
                ocd1SourAfElement = AFElement.FindElement(ps, ocd1SourGuid);


                AFElementTemplate efTemplate = AF_Pilot.ElementTemplates["INHIBIT"];


                AFAnalysis efAnalysis = ocd1SourAfElement.Analyses.Add("EF_Calc");


                efAnalysis.AnalysisRulePlugIn = ps.AnalysisRulePlugIns["EventFrame"];
                efAnalysis.AnalysisRule.ConfigString = String.Format("EFTGUID={0};EFTNAME={1}", efTemplate.UniqueID, efTemplate.Name);


                AFAnalysisRule triggerRule = efAnalysis.AnalysisRule.AnalysisRules.Add(ps.AnalysisRulePlugIns["PerformanceEquation"]);
                triggerRule.ConfigString = "StartTrigger:= '1300NDFPHLM14A028.PV' = \"INHIBIT\" ";
                AFAnalysisRule timeTrueRule = efAnalysis.AnalysisRule.AnalysisRules.Add(ps.AnalysisRulePlugIns["TimeTrue"]);
                timeTrueRule.ConfigString = "TimeTrueValue=0";


                efAnalysis.TimeRulePlugIn = ps.TimeRulePlugIns["Natural"];
                efAnalysis.SetStatus(AFStatus.Enabled);
               


                efAnalysis.CheckIn();


                List<AFAnalysis> myAnalyses = new List<AFAnalysis>();
                myAnalyses.Add(efAnalysis);


                string startTime = "*-15d";
                string endTime = "*";
                AFAnalysisService myAFAnalysisSvc = ps.AnalysisService;
                myAFAnalysisSvc.QueueCalculation(myAnalyses, new AFTimeRange(startTime, endTime),
                AFAnalysisService.CalculationMode.DeleteExistingData);


                efAnalysis.CheckIn();
            }
            catch (Exception ex)
            {
               
                throw;
            }
        }

 

 

Outcomes