Parameters for each calculation:
- ViewServer: Canary Server where to find the data
- SourcePath: ViewName followed by path to the Asset Type or tag
- AssetType: The type of asset to find in the SourcePath (or nothing when an individual tag)
- DestinationPath: Output of where to write the calculated value
- Expression: This controls the value that is calculated
- CalcDelay: a time period delay before making the calculation (for periodic calculations only). If a calculation is made every 1 hours, delay for 1 minute past the hour to make sure the data need for the calculation has been collected and stored.
- BackFillTo: when a new equation is created, calculations will be created from this point forward.
- MetaData: defining the properties for the calculated tag that is generated. e. engineering units (static) or reflection of a property from the source tag. This is needed to assist on building the calculated data back into the Canary Asset Models.
SourcePath and AssetType
The SourcePath is used in conjunction with the AssetType. The valid AssetTypes are defined by the model.
An example could be “Canary Oil Onshore US.Eagle Ford. Catarina.Briggs”. In this case the first branch is “Canary Oil Onshore US” which would be the ViewName on the ViewServer that contains the data. If the AssetType is “Well”, then the Calc Server will find all wells assets that are located in the “Eagle Ford.Catarina.Briggs” route. For each well found, there will be a calculation and the output to the destination path.
If the SourcePath is “Canary Oil Onshore US.Eagle Ford”, all wells in the Eagle Ford field will be selected generating more calculated tags.
Calculations can also be made on non-asset type tags. The AssetType will be empty and only a single calculated output tag will be generated.
DestinationPath
This controls the destination of calculated data.
It is highly recommended that data generated by the Calculation server be written into separate datasets. Maintenance of the data is greatly simplified. Calculated data can be integrated directly in the browse tree by using the model, so that the calc data is logically co-located with the SCADA sourced data.
For example, a destination path of “Calc1.%Asset%.Avg Pressure 3H” would send the data to a dataset called ‘Calc1’. The path would start with the unique Asset. In our case above, it would be the path to the well, followed by “Avg Pressure 3H”.
If there is no AssetType, the full path to the output tag must be defined: “Calc1.Production.BOE”
Expression
The expression is the most complex field for the Calc Server.
An expression of “TimeAverage2(‘Casing.Pressure’, ‘3h’)” will compute an average value every 3 hours. In this case we are using the aggregate function of “TimeAverage2”. These aggregate functions are the same as used by the Canary API and Axiom and in accordance with the OPC specifications. The following aggregate functions are available:
- TimeAverage2
- Interpolative
- Average
- TimeAverage
- Total
- Total2
- TotalPerMinute
- TotalPerHour
- TotalPer24Hours
- Minimum
- Maximum
- Count
- DurationInStateZero
- DurationinStateNonZero
- CountStateZero
- CountStateNonZero
- NumberOfTransistions
- Start
- End
- Delta
- StartBound
- EndBound
- DeltaBounds
- DeltaTotalCount
- DurationGood
- DurationBad
- PercentGood
- WorstQuality
- WorstQuality2
- StandardDeviationSample
- VarianceSample
- StadardDeviationPopulation
- VariancePopulation
An aggregate function can have between 2 and 4 parameters.
- TagName of the source data. This can include a portion of the path. In our example, the SourcePath and AssetType defines the Well, and the TagName of “Casing.Pressure” defines the path and tagname of each Well asset.
- This is the “Trigger Interval”. In our case it is ‘3h’ so it will compute every 3 hours. If the Trigger Interval is 0, it will compute each time the pressure value changes.
- Optional “Trigger Offset”. If we want to compute a value every morning a 7AM, set the Trigger Interval to ‘1d’ and the Trigger Offset to ‘7h’
- Optional “Aggregate Interval” – If the Trigger Interval is zero, and the Aggregate Interval is ‘1h’, each time the pressure values changes, it will compute the average over the previous 1 hour. If the Trigger Interval is ‘15m’ and the Aggregate Interval is ‘2h’, the calc server will generate a ‘rolling average’. Every 15 minutes will compute the average over the last 2 hours.
Equation Expressions:
An equation expression example is “[Casing.Pressure] * [Casing.Temperature]”. This will multiply the two values generating a new value each time either value changes.
Operators:
Logical: or,||, and, &&
Relational: =, ==, !=, <>, <,<=, >, >=
Additive: +,-
Multiplicative: *, /, %
Bitwise: & (bitwise and), | (bitwise or), ^ (xor), << (left shift), >> (right shift)
Unary: !, not, -, ~ (bitwise not)
Primary: ( )
Functions: Abs, Acos, Asin, Atan, Ceiling, Cos, Exp, Floor, IEEERemainder, Log, Log10, Max, Min, Pow, Round, Sign, Sin, Sqrt, Tan, Truncate
General purpose:
- in(1=1. 1,2,3) result: true
- If (3%2 ==2, true, false) result: false
Complex Expressions:
For example: “Avg := TimeAverage(‘Casing.Pressure’, ‘1h’);; Temp := Maximum(‘Casing.Temperature, ‘3h’);; Avg / (Temp + 50)”
Usage of intermediate variable names: A variable name “Avg” is created and holds the TimeAverage of Casing.Pressure for the last hour. A variable named “Temp” is created and holds the Maximum of Casing.Temperature for last 3 hours. The output result is Avg divided by (Temp + 50).
Or
“TimeAverage(‘Casing.Pressure’, ‘1h’) + (Maximum(‘Casing.Temperature, ‘3h’) + 50) + [Flow]”
Rollup Expressions:
These are used to consolidate info from like tags. A Rollup expression cannot be combined with other types of expressions.
Example: “Rollup(‘Sum’, ‘Well’ ‘Flow’, ‘1d’, ‘7h’)”
There are 5 Rollup Function Parameters:
- Type of Rollup: ‘Sum’, ‘Average’, ‘Count’, ‘Minimum’ or ‘Maximum’
- AssetType: e. Well
- TagName: e Flow (should include path below the Well asset)
- Trigger Interval ‘1d’ - one day
- Trigger Offset ‘7h’ – 7 hours
If the AssetType of the overall Calcuation is “Route” and the SourcePath is “Canary Oil US.Eagle Ford”, this equation will find all routes within “Eagle Ford”, and then find all Wells within each route. The ‘Flow’ is found on each well and the sum is computed. This computation happens each day at 7AM
Examples:
SourcePath |
Expression |
DestinationPath |
AssetType |
Canary Onshore US.Eagle Ford.Catarina.BRIGGS NORTH.Well Pad |
TimeAverage2('Casing 01.Pressure.PRXIN', '1h') |
Calc1.%Asset%.AssetTest |
Well |
Compute the TimeAverage2 for the “Casing 01.Pressure.PRXIN” tag every hour for all Wells in the specified Well Pad. Store the tag in the Calc1 DataSet including the asset instance name.
SourcePath |
Expression |
DestinationPath |
AssetType |
Canary Onshore US.Eagle Ford.Catarina.BRIGGS NORTH.Well Pad.Briggs 6H |
TimeAverage2('Casing 01.Pressure.PRXIN', '0', '0', '1h') |
Calc1.OneHourAvg |
|
Compute a one hour TimeAverage2 aggregate for the specific tag specified by the source path and the tagname within the expression whenever the value of the tag changes. Because there is no asset type, this will operate on one tag and produce one tag.
SourcePath |
Expression |
DestinationPath |
AssetType |
Canary Onshore US.Eagle Ford.Catarina |
TimeAverage2('Casing 01.Pressure.PRXIN', '2h', '0', '4h') |
Calc1.%Asset%.4hrAvgEvery2hrs |
Well |
Compute a 4 hour TimeAverage2 aggregate every 2 hours (Rolling aggregate) for all “Casing 01.Pressure.PRXIN” tags in every Well in the Catarina facility.
SourcePath |
Expression |
DestinationPath |
AssetType |
Canary Onshore US |
[Allocation Separator 01.Oil Meter.QTOILD] + ([Allocation Separator 01.Gas Meter.QTGASD] / 6) |
Calc1.%Asset%.BOE |
Well |
Compute the BOE on every Well in “Canary Onshore US”. The calculated BOE value will be stored in a BOE tag for every Well.
SourcePath |
Expression |
DestinationPath |
AssetType |
Canary Onshore US |
Rollup('Sum', 'Well', 'BOE', '15m', '0') |
Calc1.%Asset%.BOE Total |
Route |
Compute a Rollup for every Route in “Canary Onshore US” of the Sum of all BOE values on every Well within each Route every 15 minutes. The calculated value in each Route will be stored in a “BOE Total” tag in each Route asset.
Comments
0 comments
Article is closed for comments.