2 of 2 people found this helpful
I had a look at your xml file, the reason your getting this error is because of the configuration that is already applied to your "Value" Attribute.
Could you remove the formula reference at your Value attribute and make it none and then try the analysis given by Stephen and that will work
Thanks everyone, it "works" but not as I intended and maybe this isn't the right way to do it.
I'd like this analysis to run whenever the three attributes I reference changes but it seems the attributes I reference aren't made for triggering this type of analysis.
I guess I could trigger it manually everytime I need the updated Value when I access it from AF SDK but I'm wondering if it's the right way to do it, is there any better solution? (Or am I trying to kill an ant with a bazooka? meaning I shouldn't bother trying to optimize these things).
Thanks in advance, again.
p.s.This is the code I'm using to run the analysis, I've noticed that the code that should trace the error isn't logging anything to AFTrace, this occurred if CurrentCase was null.
analysis.AnalysisRule.CurrentCase = new AFCase(analysis); OSIsoft.AF.Analysis.AFAnalysisRuleState rs = new OSIsoft.AF.Analysis.AFAnalysisRuleState(analysis.AnalysisRule.GetConfiguration()); rs.SetExecutionTimeAndPopulateInputs(new AFTime(DateTime.Now)); analysis.AnalysisRule.CurrentCase.Run(); var publishResult = analysis.AnalysisRule.Publish(); return attribute.GetValue().ToString();
1 of 1 people found this helpful
Have you configured the Scheduling for Event-Triggered for “Any Input”? According to my tests, this option works as long as the input is using the PI Point Data Reference. If no data reference is defined, then the trigger won't work. This is the result I have obtained on my environment.
Therefore, there are 3 things for you to try:
- Keep using your code to trigger the calculation which isn’t a great solution.
- Use Periodic Scheduling with a small time period if possible.
-Create string PI Points on the PI Data Archive and map the attributes you already have to those PI Points by setting up the PI Point data reference for each attribute.
Hope it helps!