4.7. Travel in time.

We know that the program browsing asking us for a parameter value is placed in the variable t for which the time information wants to get the parameter value.

I also know, semi-officially, that this value is stored as the number of seconds some time '0 '. We therefore attempt to write parameter which will consist of eg external temperature rise during 10 minutes, for example like this:

v = p ("xxxx:Network:External temperature controller, t, PT_MIN10) - p("xxxx:Network:External temperature controller, t - 10 * 60, PT_MIN10)

And in fact, the parameter returns what we want. As you can see it can be done so in such a way so but manual operation on the value of the variable t is inconvenient, so the in formulas browser software we have available function szb_move_time. Szb_move_time function takes 3 parameters: start time, if units you must move the start time, the offset. That's what this This function returns the offset time value. Before we give an example is yet to clarify what's going on with these units. By means of function szb_move_time time we move a certain amount: years, months, days, weeks, periods of 8-hour and 10-minute increments. They correspond closely types medium-sized screens draw3 program. Designations units are also the same as the label of the average, and so accordingly PT_YEAR, PT_MONTH, PT_WEEK, PT_DAY, PT_WEEK, PT_HOUR8, PT_MIN10.

Some examples of function calls szb_move_time:

We can now write parameter such that will be administering the difference between outside temperature value for the time for which is calculated parameter and sometimes months earlier.

local month_earlier = szb_move_time(t, -1, PT_MONTH)
v = p("xxxx:Network:External temperature controller, t, PT_MIN10) - p("xxxx:Network:External temperature controller, month_earlier, PT_MIN10)

We can also using the fact that we have a variable called average for the draws a parameter, do the following - a parameter that viewed on the screen is going to give us a decade of growth in the average annual temperature between years; viewed on the screen annual This increase in the average monthly temperature between months; monthly, daily temperature rise between days, etc.

local previous_time = szb_move_time (t, -1 pt)
v = p ("xxxx:Network:External temperature controller", t, pt) - p("xxxx: Network:External temperature controller", previous_time, pt)