AnsweredAssumed Answered

Totalizer via C#

Question asked by dpurkiss on Oct 14, 2016
Latest reply on Oct 14, 2016 by dpurkiss

Hi all,

 

So a basic question, im setting up a new tag through C# using the PI AF SDK, I have the following code (Note: PiUtilities is a class of my own) :

 

                IDictionary<string, IDictionary<string, object>> pointDictionary = new Dictionary<string, IDictionary<string, object>>();
                IDictionary<string, object> attributeValues = new Dictionary<string, object>();

                attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.PointSource, "..."));
                attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.PointClassName, "totals"));
                attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.Scan, 1));
                attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.SourceTag, "sorceTag"));

                if (tag.Type != null)
                    attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.PointType, PiUtilities.MapPointType(tag.Type)));
                if (tag.Description != null)
                    attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.Descriptor, tag.Description));
                if (tag.Zero != null)
                    attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.Zero, tag.Zero));
                if (tag.Span != null)
                    attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.Span, tag.Span));
                if (tag.Step!= null)
                    attributeValues.Add(PiUtilities.AttributeValueConnector(PICommonPointAttributes.Step, tag.Step));

                pointDictionary.Add(tag.Name, attributeValues);

 

Im confused as to how to set time periods to calculate over, standard list of calculations to use, where to add conditions (such as another tag to look at to check if i need to calculate ie. run signal)...

 

Below is the most I could find in the documentation. But nothing on what MovingCount is or so on...

 

        //Attribute         Type        Default value
        //CalcMode          String      timeweighted
        //CompValue         String      ON
        //Conversion        Float32    1
        //EventExpr         String
        //FilterExpr        String
        //Function          String      Total
        //MovingCount       Int16    2
        //Offset            String    +0m
        //Offset2           String    +0m
        //Options           String
        //PctGood           Float32    85
        //Period            String    +1h
        //Period2           String    +2m
        //RateSampleMode    String      natural
        //ReportMode        String      Running
        //Srcptid           Int32    0
        //TotalCloseMode    String      clock
        //Zerobias          Float32    0

 

Thanks so much for any help

Outcomes