Home : Working with Daily Detail variables in Calculations
Q14297 - INFO: Working with Daily Detail variables in Calculations

Working with Daily Detail variables in Calculations

To work with variables with different frequencies you must understand how WIMS handles them in calculations. In most equations, we use variables that have the same frequency and the values are used from the same data slot.  For example, when we want to add V1 and V2 into V3 all three variables are the same frequency (say hourly).  When V3 is calculated, it calculates for a data slot and finds the values for V1 and V2 in that same slot.

Example 1: Calculate an hourly value from two hourly inputs.

V1 - Hourly Parameter
V2 - Hourly Parameter
V3 - Hourly Calculation, equation = V1+V2

 

 

Example 2: Calculate a daily average from an hourly variable

Variable 1 is an hourly, parameter tracking Raw Water Flow. 

Setup a daily, calculated variable that refers to the hourly source variable (Variable 1) using the DDAVG (daily detail average) function.  You can also use the GAVG function if you do not need to specify the hours to be used (i.e. GAVG when the target variable is daily will summarize Midnight to Midnight)



Example 3: Calc an hourly result from Daily and an hourly Variable
In this case, the daily variable's value for the day will be used for each hour of the day in the calc.

V2 - Hourly Parameter
V41 - Daily Parameter
V44 - Hourly Calculation with Equation set to V2 * V41 * 8.34

 

Example 4: Calculate the Weekly Maximum of a four hour variable.

Since we are only calculating one value a week, we will setup our calculated var as a Daily Calculation.  We MUST use the optional Time Increment parameter of the WMAXn math toolbox function.  Since the source variable's frequency is 4 hour we need to set the Time Increment to BY4HOUR. 

V17536 - A four hour parameter.
V17537 - A Daily Calculation with equation set to WMAX7(C17356,BY4HOUR).  The formula will return the maximum value of variable 17356 for the week definition 7 (Sunday thru Saturday) and will look for data every 4 hours(BY4HOUR). 

WARNING:  The Time Increment should match the frequency of the source or input variable (V17536).  If we do not specify the Time Increment the function will use a time increment of the target or calculated variable(V17537).  Since that variable is daily, BYDAY would be used.  This would return the wrong result.  Since the formula Time Increment would be BYDAY, the formula would look at the first 4 hour period of Sunday, July 6th, increment by 1 day and look at the first 4 hour period of the 7th (and find .07, NOT .14), increment by 1 day, etc...  Therefore, it would only look at the first value of each day to find the Max.  It would therefore not find the .14 at 8:00AM. 

If a function does not allow the Time Increment to be set (such as MOVn) you should use an advanced Math Toolbox function (GETAVG)

Example 5: Calculate the ratio of Volatile Acids (tracked every 4 hours) to Alkalinity (tracked hourly)

V8001 is a 4 hour parameter
V8002 is a Hourly Parameter
V8003 is a 4 hour calculation

V8003 = V8001/GAVG(C8002)

Since the target variable is 4 Hour, use the Group function GAVG to calculate the average of the 4 hourly values in the 4 hour slot:

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 2/4/2015 5:12 PM.
Last Modified on 2/23/2015 4:24 PM.
Last Modified by Scott Dorner.
Article has been viewed 6442 times.
Rated 5 out of 10 based on 4 votes.
Print Article
Email Article