AnsweredAssumed Answered

No output is defined on generated analysis

Question asked by stephen.oconnor on Jan 15, 2016
Latest reply on Jan 20, 2016 by pthivierge

If you look through my posting history you can see that I've been building a C# application to manage some advanced analyses, and the result is it works fairly well. My process is an application scans attributes marked with a particular category and creates a new element to house the attributes and analyses built around the found attribute. Further it monitors the created elements for any maintenance that is required.

 

The catch is that while the code seems to work, I'm hitting some strange behavior with the analysis service.As of right now, I have 27 analyses that are displaying "No output is defined" compared with 631 that have been created successfully.

 

 

Yeah, this doesn't make sense, and the corresponding attribute does show that it is linked to the analysis via that little raspberry symbol:

 

 

As for corrective actions, here's two solutions that I've attempted:

 

  • Stop the analysis.
  • Clear the output attribute from the analysis.
  • Check in.
  • Set the output attribute back to the proper attribute.
  • Check in.
  • Start the analysis.

 

That does not work unfortunately. Here's another procedure I tried:

 

  • Stop the analysis.
  • Clear the output attribute from the analysis.
  • Delete the attribute.
  • Check in.
  • Map a new attribute with the same name.
  • Create associated Pi Point.
  • Check in.
  • Start the analysis.

 

This does work! And hints that the problem may be with the attribute...

 

Here's the code that manages these analyses. It's based off of this excellent post by Mr. Marcos Vainer Loeff:

 

Log("{0} - Creating subtotal {1}", totalizer_name, name);
elem.CheckOut();
sub_attr = elem.Attributes.Add(name);
sub_attr.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(AF);
string pnt_name = String.Format("{0}.{1}.{2}.{3}", source.Element.Name, source.Name, name, sub_attr.ID);
PIPoint pnt = PI.CreatePIPoint(pnt_name, new Dictionary<string, object> {
    {"Step", subtotal.Value[3] == "1"}
});
sub_attr.ConfigString = pnt.GetPath();
sub_attr.DataReference.CreateConfig();
elem.CheckIn();


AFAnalysis sub_analysis = elem.Analyses[name];
if (sub_analysis != null)
{
    elem.Analyses.Remove(sub_analysis);
}
sub_analysis = elem.Analyses.Add(name);
sub_analysis.AnalysisRulePlugIn = AF.AnalysisRulePlugIns["PerformanceEquation"];
sub_analysis.AnalysisRule.ConfigString = "OUT := " + subtotal.Value[1];
sub_analysis.AnalysisRule.MapVariable("OUT", sub_attr);
sub_analysis.TimeRulePlugIn = AF.TimeRulePlugIns["Periodic"];
sub_analysis.TimeRule.ConfigString = "Frequency="+subtotal.Value[2];
sub_analysis.SetStatus(AFStatus.Enabled);
sub_analysis.CheckIn();

 

So In summary, weird stuff happens, but only sometimes. Currently running AF Server 2.6.1.6238 with SDK version of 2.7.0.6937. And thank you for taking the time to read this. :-)

Outcomes