# 4.8. Average again.

In the first example is contained note: in all the examples to the point "Average again" Sekcja 4.8 we assume that the parameter has the options 'Average counted as' set to 'score application of the formula for the average '.

Now is the time to explain what's going on.

Recall again the reading program draws a graph parameter.

For starters, let's assume that we are on the screen annually. The program browsing must draw 12 points, the average monthly for each month of the year. Therefore, the formula produces parameter 12 times for each time setting the following the variables t and pt:

• variable t = 1 day of January, hour 00:00, the variable pt = PT_MONTH

• variable t = 1 day of January, hour 00:00, the variable pt = PT_MONTH

• ...

• variable t = 1 day in December, hour 0:00, the variable pt = PT_MONTH

When will monthly display, eg. at March program browsing trigger formula 31 times, with these parameters:

• variable t = 1 day of January, hour 00:00, the variable pt = PT_MONTH

• variable t = 2 days of March, hour 0:00, the variable pt = PT_MONTH

• variable t = 3 days of March, hour 0:00, the variable pt = PT_MONTH

• ...

• variable t = 31 days of March, hour 0:00, the variable pt = PT_MONTH

Suppose now that we are in the period of the day, then the program will do so:

• variable t = hour 0:00, the variable pt = PT_MIN10

• variable t = hour 0:10, the variable pt = PT_MIN10

• variable t = hour 0:20, the variable pt = PT_MIN10

• ...

• variable t = hour 23:50, the variable pt = PT_MIN10

Now change the options on the 'Average counted as' on' the average of the application of the formula for each sample. "What has changed? The change lies in the fact that the program browsing begins to count the mean "alone." Browsing program, regardless of whether they average we draw, always calls the formula for the 10-minute and from the results thus obtained calculate the average value. Returning to the analyzed example, our formula is made with such parameters:

• variable t = 1 day of January, hour 0:00, the variable pt = PT_MIN10

• variable t = 1 day of January, hour 0:10, the variable pt = PT_MIN10

• variable t = 1 day of January, hour 0:20, the variable pt = PT_MIN10

• variable t = 1 day of January, hour 0:30, the variable pt = PT_MIN10

• ...

• variable t = 1 day of January, hour 23:50, the variable pt = PT_MIN10

• variable t = 2 day of January, hour 0:00, the variable pt = PT_MIN10

• variable t = 2 day of January, hour 0:10, the variable pt = PT_MIN10

• ...

• variable t = 2 day of January, hour 23:50, the variable pt = PT_MIN10

• ...

• variable t = 31 day of January, hour 23:50, the variable pt = PT_MIN10

Notatka: these results are then averaged and the average value is positioned as the parameter value for the month of January, and the program move to next month

• variable t = 1 day of February, hour 0:00, the variable pt = PT_MIN10

• variable t = 1 day of February, hour 0:10, the variable pt = PT_MIN10

• variable t = 1 day of February, hour 0:20, the variable pt = PT_MIN10

• variable t = 1 day of February, hour 0:30, the variable pt = PT_MIN10

• ...

• variable t = 1 day of February, hour 23:50, the variable pt = PT_MIN10

• variable t = 2 day of February, hour 0:00, the variable pt = PT_MIN10

• variable t = 2 day of February, hour 0:10, the variable pt = PT_MIN10

• variable t = 2 day of February, hour 0:20, the variable pt = PT_MIN10

• variable t = 2 day of February, hour 0:30, the variable pt = PT_MIN10

• ...

• variable t = 2 day of January, hour 23:50, the variable pt = PT_MIN10

• variable t = last day of February, hour 23:50, the variable pt = PT_MIN10

Notatka: here again, averaging occurs and the program moves on

• ...

Similarly, the screen will be for a month. Only the case for medium 10-minute like will not vary.

Notatka: These 10-minute resolution stems from the fact that the value of the 10-minute is the largest the resolution with which SZARP keeps data in the archive.

There are several reasons why in the peer-reviewed (and in general the system SZARP) we have these two types of parameters. First of all, some of the parameters because of its features easily is saved as one that will count the other way.

Take, for example, counting parameter quotient of any two parameters (A and B for simplicity). The simplest formula for this parameter record is:

`v = p("A", t, pt) / p("B", t, pt)`

What happens now to count the value of this parameter the first method for for example, the average daily? We obtain the result of executing the following operations:

`v = (average daily parameter A) / (average daily parameter B)`

In most cases, however, it will not be what we want, we we need values:

```v = (
(A value for 00:00 hour) / (value of B for 00:00 hour)
+ (A-values for 0:10 hour) / (value of B for 0:10 hour)
+ (A-values for 0:20 hour) / (value of B for 0:20 hour)
...
+ (A-values for 23:50 hour) / (value of B for 23:50 hour)
) / (24 * 6)```
Exactly this gives us another way. Writing such an operation parameter which averages are calculated first way would be to task much more time-consuming (especially if we wanted to parameter behaved correctly for each type of medium).

Let's take another example of a parameter:

```v = p("xxx:Boiler 4:Driver:Efficiency boiler", t, pt)
local i = 1;
while isnan(v) and i < 10 do
local v1 = p("xxx:Boiler 4:Driver:Efficiency Boiler", szb_move_time(t,-i, pt), pt)
local v2 = p("xxx:Boiler 4:Driver:Efficiency Boiler", szb_move_time(t, i, pt), pt)
if isnan(v1) then
v = v2
elseif isnan(v2) then
v = v1
else
v = (v1 + v2) / 2
end
i = i + 1
end```
This parameter performs a simple task - trying to make a hole in the data parameter "boiler efficiency". If for a given 10-minute no time value of the parameter, then the formula is trying to generate it from the underlying next. For this formula the values of counting a first method, the would not make sense.