AnsweredAssumed Answered

Help with setting TimeTrue

Question asked by mikespath on Apr 14, 2017
Latest reply on Apr 17, 2017 by pmartin

Can someone help me out with the differences in the code below? I'm trying to set the TimeTrue value in a Analysis Template Trigger. The picture below shows the result of the code with nothing in the True For column. I can set it fine in the Element itself (see commented code that works)

Is there a step I'm missing for Templates?




                // ****************** Start Create Analysis Template  *************************

                AFAnalysisTemplate myATtemplate = elmTemplate.AnalysisTemplates[strAnalysisTemplateName];

                if (myATtemplate == null)


                    myATtemplate = elmTemplate.AnalysisTemplates.Add(strAnalysisTemplateName);



                // Define analysis rule plug in and build config string

                myATtemplate.AnalysisRulePlugIn = MyPISystem.AnalysisRulePlugIns["EventFrame"];

                myATtemplate.AnalysisRule.ConfigString = String.Format("EFTGUID={0};EFTNAME={1}", myEFTemplate.UniqueID, myEFTemplate.Name);


                // Define plug in type and config string for child analysis rules

                AFAnalysisRule triggerRule = myATtemplate.AnalysisRule.AnalysisRules.Add(MyPISystem.AnalysisRulePlugIns["PerformanceEquation"]);

                triggerRule.ConfigString = "DO_HH:= 'DO' > 'DO|HiHi';";


                AFAnalysisRule timeTrueRule = myATtemplate.AnalysisRule.AnalysisRules.Add(MyPISystem.AnalysisRulePlugIns["TimeTrue"]);

                timeTrueRule.ConfigString = "TimeTrueValue=10";


                /* reference code below works for TimeTrue

            // Define analysis rule plug in and build config string 

            efAnalysis.AnalysisRulePlugIn = MyPISystem.AnalysisRulePlugIns["EventFrame"];

            efAnalysis.AnalysisRule.ConfigString = String.Format("EFTGUID={0};EFTNAME={1}", efTemplate.UniqueID, efTemplate.Name);



            // Define plug in type and config string for child analysis rules 

            AFAnalysisRule triggerRule = efAnalysis.AnalysisRule.AnalysisRules.Add(MyPISystem.AnalysisRulePlugIns["PerformanceEquation"]);

            triggerRule.ConfigString = "StartTrigger:= 'Temperature' > 200;";

            AFAnalysisRule timeTrueRule = efAnalysis.AnalysisRule.AnalysisRules.Add(MyPISystem.AnalysisRulePlugIns["TimeTrue"]);

            timeTrueRule.ConfigString = "TimeTrueValue=56";



            // Define natural time rule to trigger at any input 

            efAnalysis.TimeRulePlugIn = MyPISystem.TimeRulePlugIns["Natural"];


             //end of reference code   */


                // Define natural time rule to trigger at any input

                myATtemplate.TimeRulePlugIn = MyPISystem.TimeRulePlugIns["Natural"];




                // ****************** End Create Analysis Template  *************************