Live Data Computation Agent – Examples

<< Click to Display Table of Contents >>

Navigation:  Live > Agents > Transformation Agents > Data Computation >

Live Data Computation Agent – Examples

{ "sourceSeriesId": [130041], "value": "d.datum_value + equis.fn_logger_measure_datum(@facility_id, @sys_loc_code, d.datum_utc_dt)" }
 
Computed series datum = source series (LOGGER_SERIES_ID = 130041) datum + the result of function equis.fn_logger_measure_datum(...).

 

{ "sourceSeriesId": [130041, 130032, 130033], "value": "MAX(d.datum_value + equis.fn_logger_measure_datum(@facility_id, @sys_loc_code, d.datum_utc_dt))", "procedure": "EXEC [equis].[sp_insert_dt_water_level_daily_max] @target_series_id, @start_date, @end_date, @facility_id, @sys_loc_code;" }
 
See Example 1. An aggregate function (MAX, in this example) is needed in case more than 1 source datum has the same DATUM_UTC_DT.

 

{ "sourceSeriesId": [130041, 130032, 130033], "procedure": "EXEC [equis].[sp_insert_dt_logger_datum_plus_measure] @target_series_id, @source_series_ids, @start_date, @end_date, @facility_id, @sys_loc_code;" }
 
See Example 2.

 

{ "sourceSeriesId": [130091, 130092], "value": "SUM(d.datum_value)" }
 
or
 
{ "sourceSeriesId": [130091, 130092], "value": "SUM(?)" }
 
Series 130091 = raw data, series 130092 = offset; computed series = series 130091 + series 130092.

 

{ "sourceSeriesId": [187381936], "procedure": "EXEC [equis].[sp_percent_uptime] @target_series_id, @source_series_ids, @start_date, @end_date;" }
 
See Example 3.

 

{ "sourceSeriesId": [130057], "value": "equis.logger_depth(@logger_id) - equis.unit_conversion(d.datum_value, 'Pa', 'mH2O', DEFAULT) - equis.measure_datum(@facility_id, @sys_loc_code, d.datum_utc_dt)" }
 
See Example 4.
 
Computed series datum = logger depth - source series datum (pressure, in Pa, converted to water level elevation, in mH2O) - reference elevation.

 

{ "sourceSeriesId": [46869], "declare": "DECLARE @depth REAL, @angle REAL; SELECT @depth = CAST(custom_field_1 AS REAL), @angle = CAST(custom_field_2 AS REAL) FROM dt_logger_series WHERE logger_series_id = @target_series_id;", "value": "(@depth/SIN(@angle)) - (?/9.81)" }
 
User-defined SQL variables @depth and @angle are declared, set to the computed series' (SQL variable: @target_series_id) CUSTOM_FIELD_1 and CUSTOM_FIELD_2, and used to calculate the value.

 

{ "sourceSeriesId": [300003, 300013], "value": "AVG(CASE WHEN d.logger_series_id = 300003 THEN ? ELSE NULL END) - AVG(CASE WHEN d.logger_series_id = 300013 THEN ? ELSE NULL END)" }
 
Difference between series 300003 and 300013 datum. (The AVGs are needed for this agent's SQL, even though there can only be one DATUM_VALUE for series  300003, and one DATUM_VALUE for series 300013, for each DATUM_UTC_DT.)