Static calculation of fields (definition of calculated field master)

<< Click to Display Table of Contents >>

Manual > Monitoring system construction guide > Establishing the main functions > Daily reports > Establishing the daily report function > Using the field calculation function >

Static calculation of fields (definition of calculated field master)

About Calculated Field Master

One of the configuration files for summary actions is a configuration file called "Calculated Field Master." By defining a calculated field master file, you can calculate fields when aggregating daily reports and include the calculation results in the aggregation log. The calculation results of calculated fields can be freely displayed on each page of the daily report just like normal fields.

 

■ Calculation and aggregation of calculated fields

 

As explained in "About Summary Master", the sample Summary Master defines the standard aggregation processes of raw data logging (RAW), daily report aggregation (DAY), monthly report aggregation (MONTH), and annual report aggregation (YEAR).

 

The diagram below shows the flow of calculation field processing in standard logging and aggregation of summary actions.

 

p_rep_0096

 

The processing of calculated fields is divided into calculation processing and aggregation processing. Specifically, calculations according to the formula in the calculated field are performed only when the daily report is compiled from RAW data, while the aggregation processing is performed when the monthly and yearly reports are compiled.

 

1.First, logging stores tag values as raw time series data (RAW).

2.Next, in the daily report aggregation, immediately after the daily report of the tag field is aggregated based on the time series log of the RAW data (i.e., immediately after the daily report data of the field referenced by the calculation formula of the calculation field is collected),Calculated Field Master [Expression] columnThe field is calculated according to the formula defined in . The calculation result is saved and included in the daily report data (DAY).

3.Next, the monthly report is calculated based on the daily report data of DAY (MONTH).[SummaryType1] column in the calculated field masterThe calculation will be done according to the calculation method specified in .

4.Finally, the annual report is compiled based on the monthly report data of MONTH (YEAR). As with the monthly report,[SummaryType1] column in the calculated field masterThe calculation will be done according to the calculation method specified in .

 

The important points here are:In daily report aggregation, calculations are performed according to the formula defined in the [Expression] column of the calculation field master, whereas in monthly report aggregation (from DAY to MONTH) and annual report aggregation (from MONTH to YEAR), aggregation is performed according to the aggregation method specified in the [SummaryType1] column of the calculation field master based on the aggregated data for each aggregation target.That is the point.

 

 

hint

The results of calculation field processing are not included in the root log (RAW). They are output to aggregate logs such as DAY, MONTH, and YEAR.

 

 

 

■ Calculated field master for client connection sample

 

The "Client Configuration Guide" provides a "Client Connection Sample" as an example of connection from FA-Client. This sample has a summary action named "Summary" registered in advance.

 

 

The calculated field master for the above "Summary" action is stored below.

 

(Project folder) \server\summary\fieldmaster_calculation.csv

 

 

The calculation field master is a text file in CSV format, and can be freely edited using a text editor such as Notepad or an application such as Excel.

 

 

How to edit calculated field master

 

attention

Sample data may be defined in the calculated field master of the sample project. If you do not use calculated fields, be sure to delete the sample data from the second row onwards in the calculated field master.

 

When you open the sample calculation field master "fieldmaster_calculation.csv" in Excel etc., the following content is displayed.

 

p_rep_0094

 

Currently, sample data is registered. When actually building a system, edit the calculation formula, aggregation method, header names to be output in daily reports, etc. to suit your actual environment. Also, delete any unnecessary sample data rows included in the sample. The first row of the calculation field master is the header row, which defines which parameters are to be entered in which columns. Then, from the second row onwards, define the type of calculation to be performed, line by line.

 

Below is an overview of each parameter. For details, see "Calculated Field Master" in the Action Reference.

 

Header Name

Contents

[Name]

 

Specify the field name. The field name must be a unique string.

 

[Comment]

 

You can specify any comment.

 

[Expression]

 

Specify the calculation expression.The formula specified here will be used when aggregating daily reports from RAW.The field names defined in the tag field master and the calculation field master can be used in the calculation expression. The operators and functions that can be used in the calculation expression are based on "Calculation expression syntax".

 

Example: General operators

(T000 + T001) / 100

 

[UncertainIsZero]

 

This setting specifies how to handle undefined values (NULL values) during calculation. If you specify "F" (or n) for this parameter, the calculation result will also be undefined if the formula contains an undefined value.

For details on how to specify this parameter, see "Calculated Field Master" in the Action Reference.

[TermOfValidity]

 

This parameter is used when you want to process the aggregation by dividing the time unit. For example, you can use this parameter when you want to perform aggregation separately for daytime and nighttime. If you do not use this parameter, leave it blank.

[DecimalNum1]

 

Specifies the number of decimal places.

[SummaryType1]

 

Specifies the aggregation method (such as AVERAGE or TOTAL) when aggregating daily reports into monthly reports and monthly reports into annual reports.

For information on the aggregation methods that can be specified, please refer to "Tag Field Master".

[ReportHeader1]

 

You can specify the default value for the first line of the header that is output to the daily report.

 

[ReportHeader2]

 

You can specify the default value for the second line of the header that is output to the daily report.

 

[ReportHeader3]

 

You can specify the default value for the third line of the header that is output to the daily report.

 

[ReportHeader4]

 

You can specify the default value for the fourth line of the header that is output to the daily report.

 

 

The strings set in [ReportHeader1] to [[ReportHeader4] above will be used as the initial values for the header settings displayed in the report setting dialog on the daily report screen. These header strings are not fixed settings and can be changed manually from the setting screen during operation.

 

 

hint

For details about the various configuration files for summary actions, see "Summary action configuration files and folder structure".

 

hint

If you want to define multiple languages simultaneously in the master file description (for example, if you want to mix Japanese and Chinese in the comments), be sure to save the file in UTF-8 (with BOM) format.

 

hint

In addition to simple arithmetic operations, you can also write functions such as Math methods that can be specified with "Calculation formula syntax" in the calculation field master. If you edit the field master file directly with a text editor, you must write it as follows if the calculation formula contains a comma "," or double quotation mark "".

 

example)

[Name],[Comment],[Expression],[UncertainIsZero],[TermOfValidity],[DecimalNum1]

C002,,"Math.summary(""max"",T000,T001,T002)",F,,2

 

*If you use Excel to edit, you don't need to worry about adding the necessary characters because Excel will automatically add them.