Home : Products : Hach WIMS : Interfaces : Hach WIMS Direct Server-Side Interface to Iconics Hyper Historian : Documentation : Topics specific to the operation of this interface : Supported variable configurations for interface Q14397
Q14402 - HOWTO: Supported variable configurations for interface Q14397
Supported variable configurations for the Hach WIMS Direct Server-Side Interface to Iconics HyperHistorian.

To configure a variable to pull values from Hyper Historian, select System Setup>Edit/View Variables in the Hach WIMS client and select the Interface tab.

Then click Interface To radio button. The drop down box next to the option is now enabled, click the drop down arrow and choose the Hyper Historian interface name (name given when configuring the interface).

The SCADA Tag and Statistic are all that are mandatory.

  • SCADA Tag: This is the full tag name in the Hyper Historian system.  Enter the Hyper Historian Folder Name (AKA Group), slash, and the Tag Name.  Note that if there are multiple groups (folder), separate with slash:  Group1/Group2/Group3/TagName.  Make sure to use the actual name, not the display name. 

Example:  Refer to the Random tag in the Signals folder.  The SCADA Tag field would be set to Signals/Random.  In Workbench by ICONICS browse to the Various Signals (the display name for the Signals folder/group).  Then browse to the Random Med tag and see that the Hyper Historian Tag Name is Random:

 

  •  Statistic: The statistic specifies what summary should be done to the historian data before importing to WIMS. The following statistics are supported:

STATISTIC

DESCRIPTION

SQL QUERY (Getting data for hourly variable for the 1st hour of January 3rd, 2017. 

AVERAGE

Take the average of the data points

select Avg(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random'  AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00')  AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00')   AND IsGood(Quality) = 1

With Range Filtering (Low range set to 10 and High Range set to 60):

select Avg(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random'  AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00')  AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00')  AND Value >=10 AND Value <=60  AND IsGood(Quality) = 1

AVERAGEZERO

Take the average of the data points, return zero (0) if result is BLANK.

select Avg(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

SUM

Take the sum total of all values

select Sum(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

SUMZERO

Take the sum total of all values, return zero (0) if result is BLANK.

select Sum(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

MINIMUM

Get the minimum value

select Min(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

MAXIMUM

Get the maximum value

select Max(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

FIRST

Get the first value

select  Value, TimeStamp from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC

LAST

Get the last value

select Value, TimeStamp from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp DESC

DIFF

Typically used with totalizers to calculate the actual usage (runhours, flow, etc... from the meter). Calculate the difference between the first and last values. If the first value is larger than the second it determines that the meter "rolled over" at the next power of 10.

  1. Get FIRST value
  2. Get LAST value
  3. RESULT = LAST - FIRST
  4. IF RESULT < 0 THEN (10 ^ (Ceil(LOG(first_value) / LOG(10)))) - first_value + last_value

RANGE

Calculate the absolute value of the difference between the minimum and maximum values

  1. Get MIN value
  2. Get MAX value
  3. Get ABS(MIN - MAX)

INVENTORY

Return the total use based on a tank level signal. For example, the level is 10 feet at midnight and slowly goes down to 2 feet at 2:00 PM, then gets filled to 15 feet and slowly goes down to 8 feet at midnight. The inventory function would return ((10 - 2) + (15 - 8)) = 15.

  1. select Value, TimeStamp from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC

  2. Loop through the records returned and sum the downward trends greater than the Deadband

TIMEGT(x)

Calculates the number of seconds the value was greater then the given number (x). If left unspecified it will use zero (0).

  1. SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC
  2. Loop through records and sum the times the value is greater than x.  The value is considered greater that x from the record where it was greater than until a record is no longer greater than.  Example TIMEGT(10):

00:00:00  8.2
00:00:10  10.2
00:00:20  10.3
00:00:30  9.8

It would calculate that is greater then for 20 seconds (ie from 00:00:10 until 00:00:30) 

TIMELT(x)

Calculates the number of seconds the value was less then the given number (x). If left unspecified it will use zero (0).

SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC

TIMEEQ(x)

Calculates the number of seconds the value was equal to the given number (x). If left unspecified it will use zero (0).

SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC

CYCLE(x)

Counts the number of times a value cycles to a particular number (x).

1. Get LAST value from previous time period

2. SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC

3. Loop thru records and increment counter every time the value equals X and the previous value was not X.

COUNT

Counts the number of data points.

select Count(Value) as Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1

MINTIME

Returns the time of the minimum value as a text value, sets numeric value to 1 (one). 

  1. SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC
  2. Loop thru records and records the time of the first miniumum value.

MAXTIME

Returns the time of the maximum value as a text value, sets numeric value to 1 (one).

  1. SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC
  2. Loop thru records and records the time of the first maximum value.

PERCENTBAD

Returns the most often seen value.
  1. SELECT UTCToLocalTime(TimeStamp) as TimeStamp,Value, Quality from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2017-01-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp ASC
  2. Loop through records and sum the times the quality is greater than 0.

LASTHOLD

Get the last value. Looks back one month.

select Value, TimeStamp from RawData WHERE TAGNAME = 'Signals/Random' AND TimeStamp >= LocalTimeToUTC('2016-12-03 00:00:00') AND TimeStamp < LocalTimeToUTC('2017-01-03 01:00:00') AND IsGood(Quality) = 1 ORDER BY Timestamp DESC

 

  •  Scale Factor: This is the value to multiply the result by when using parameter variable types. Commonly used to convert from one unit base to another. For example to convert gallons per minute (GPM) to gallons per day (GPD), set the scale factor to 1440 (1440 minutes per day).

  •  Filter: All three fields must have numeric values or the word None (as shown). The Low Range and High Range will crop data from the source. For example to eliminate negative numbers from a particular tag, set the Low Range to 0 (zero) - this will get any values equal to or greater than 0 (zero). The Deadband is used for the statistic Inventory and will elliminate noise levels up to the value specified. For example, if you enter .5 next to Deadband, any value change of .5 or less, will be ignored.

  • Start Time and Stop Time: For the variable frequency (e.g. Daily, hourly, etc...) sets the times to retrieve data within the data slot.  For Daily Detail variables (4 Hour, Hourly, 30 Minute, 15 Minute, 5 minute, and 1 minute) it sets the start and stop time within that time period.  For example, with an hourly variable to get the max value for the first 10 minutes of each hour set the Start Time to 00:00 and the Stop Time to 00:10.  For Daily Variables, the start and stop time allow you to "define the day".  For Midnight to Midnight, set start time to 00:00 and stop time to 23:59 with the Same Day as Start option selected.  For 8AM to 8AM, set start time to 08:00 and stop time to 7:59 with Day After Start selected.  NOTE:  Data is ALWAYS stored on the Start Date, i.e. when retrieving data for Jan 1st, 2017 the interface would query data from 1/1/2017 8:00 AM thru 1/2/2017 7:59 AM and store that result on the FIRST. 

 


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 12/21/2016 7:12 AM.
Last Modified on 12/23/2020 6:20 AM.
Last Modified by Steve Fifer.
Article has been viewed 2625 times.
Rated 6 out of 10 based on 2 votes.
Print Article
Email Article