Information

Transformation:

ValuesAfterChangeWithTimeWindow

Transformation Group:

Selection

Description:

This transformation can be used e.g. to filter out measurement values during periods where the measured system is not in a (quasi) steady state due to changes happening in the system. This transformation creates a time window after each change in a configured condition variable. The length of each time window is determined by a custom expression in the configuration. Depending on the configured selection type the input values inside or outside the time windows are selected. All selected input values are then copied to the output variable.

Hydrological Information

Purpose and use of Transformation:

Can be used e.g. to filter out measurement values during periods where the measured system is not in a (quasi) steady state due to changes happening in the system. For example when a pump is switched on/off in a system of pipes, then the pressure in the pipes will fluctuate for some time until reaching an equilibrium value. If data analysis depends only on the equilibrium value, then this transformation can be used to filter out the fluctuating values just after a pump has been switched on/off in the system.

Background and Exceptions:

Produces missing output values at times where there is not enough reliable or doubtful data available in the condition and/or expression variables to determine if there is a change or to determine the length of a time window. Any such missing output values are truncated from the start and end of the run period of the transformation, to avoid overwriting data from previous runs with overlapping run periods.

Example

The image below shows an example of the function of this transformation. The upper graph shows the condition variable, in this case the status of a pump in a sewer system. The pump switches on and off. The grey line in the lower graph is the water level at the suction side. The transformation is used to select those values in this timeserie, that are outside a period after a change in the condition time serie (the pump status). So every time the pump switches on or off, the values in the input timeserie (waterlevel) are not selected for an X period of time. The result of the transformation is the red line in the lower graph.

Detailed description

This transformation copies values from the inputVariable to the outputVariable under certain conditions. The specified conditionVariable is searched for changes during the run period of the transfomation. When the conditionVariable value changes, then a time window is created. This time window starts at the time of the change. The length of the time window (in seconds) is determined by evaluating the specified timeWindowLengthExpression at the time of the change. For each change in the conditionVariable a new time window is created (time windows can overlap). If the specified selectionType is select_inside_time_window, then all inputVariable values that are within at least one time window are copied to the outputVariable and all other inputVariable values are ignored. If selectionType is select_outside_time_window then all inputVariable values that are within at least one time window are ignored and all other inputVariable values are copied to the outputVariable. This can be used e.g. to filter out measurement values during periods where the measured system is not in a (quasi) steady state due to changes happening in the system. Produces missing output values at times where there is not enough reliable or doubtful data available in the condition and/or expression variables to determine if there is a change or to determine the length of a time window. Any such missing output values are truncated from the start and end of the run period of the transformation, to avoid overwriting data from previous runs with overlapping run periods.

variableDefinitions

It is possible to define embedded variables in this transformation. For inputVariable, conditionVariable, outputVariable and in the timeWindowLength expression both embedded variables and variables defined at the start of the transformations configuration file can be used. If an embedded variable and a variable defined at the start of the transformations configuration file have the same variableId, then the embedded variable will be used.

inputVariable

Input variable. This contains the times and values that are copied to the output variable if they are selected by this transformation.

conditionVariable

This condition variable is searched for changes during the run period of the transfomation. If for a given timeStep this variable has a value that is different from the value for the previous timeStep, then that counts as a change for the given timeStep. This triggers the creation of a selection time window that starts at the given timeStep.

timeWindowLength expression

Free format expression that is evaluated at the time of a change in the condition variable to determine the length of the time window (in seconds) for that change. For instance "X1 + X2". In the expression reference input variables or coefficients using their id, e.g. "X1 + a" where "X1" is the variableId of a variable and "a" is the id of a coefficient. Variables can be defined in this transformation or at the start of this transformations file. If a variable definition in this transformation has the same id as a variable definition at the start of this transformations file, then the variable definition in this transformation is used. Coefficients can be defined in a coefficientSet.

For examples of expressions and for all the options that can be used in a free format expression see UserSimple Transformation.

coefficientSet or coefficientSetFunctions

Should contain the coefficients that are used in the timeWindowLength expression. Define the ids and values of the coefficients here, then refer to the ids of these coefficients in the expression. Make sure that for all the coefficient ids in the expression the values are defined here.

When using coefficient set functions (available since build 30246), the value elements can contain tags between "@" signs (e.g. " (NUMBER)") that refer to location attributes that are defined in the locationSets configuration file. The tags are replaced by actual values. These values can be different for different locations and time periods. See 22 Locations and attributes defined in CSV files, Shape-DBF files or external tables for more information.

selectionType

If this is select_inside_time_window, then all inputVariable values that are within at least one time window are copied to the outputVariable and all other inputVariable values are ignored. If this is select_outside_time_window then all inputVariable values that are within at least one time window are ignored and all other inputVariable values are copied to the outputVariable.

outputVariable

Output variable. Only the selected times and values are written in this outputVariable.

Configuration Example

<transformation id="SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest">
	<selection>
		<valuesAfterChangeWithTimeWindow>
			<variableDefinition>
				<variableId>input</variableId>
				<timeSeriesSet>
					<moduleInstanceId>SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationId>H-2001</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="nonequidistant"/>
					<relativeViewPeriod unit="minute" start="0" end="40"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</variableDefinition>
			<variableDefinition>
				<variableId>condition</variableId>
				<timeSeriesSet>
					<moduleInstanceId>SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>Q.value.resolution</parameterId>
					<locationId>H-2001</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="nonequidistant"/>
					<relativeViewPeriod unit="minute" start="0" end="40"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</variableDefinition>
			<variableDefinition>
				<variableId>expression1</variableId>
				<timeSeriesSet>
					<moduleInstanceId>SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>Q.obs</parameterId>
					<locationId>H-2001</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="nonequidistant"/>
					<relativeViewPeriod unit="minute" start="0" end="40"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</variableDefinition>
			<variableDefinition>
				<variableId>expression2</variableId>
				<timeSeriesSet>
					<moduleInstanceId>SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>Q.m</parameterId>
					<locationId>H-2001</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="nonequidistant"/>
					<relativeViewPeriod unit="minute" start="0" end="40"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</variableDefinition>
			<variableDefinition>
				<variableId>output</variableId>
				<timeSeriesSet>
					<moduleInstanceId>SelectionValuesAfterChangeWithTimeWindowSelectOutsideTest</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>P.m</parameterId>
					<locationId>H-2001</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="nonequidistant"/>
					<relativeViewPeriod unit="minute" start="0" end="40"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</variableDefinition>
			<inputVariable>
				<variableId>input</variableId>
			</inputVariable>
			<conditionVariable>
				<variableId>condition</variableId>
			</conditionVariable>
			<timeWindowLengthExpression>10*a*b*expression1 + expression2</timeWindowLengthExpression>
			<coefficientSet>
				<coefficient id="a" value="2"/>
				<coefficient id="b" value="5"/>
			</coefficientSet>
			<selectionType>select_outside_time_window</selectionType>
			<outputVariable>
					<variableId>output</variableId>
			</outputVariable>
		</valuesAfterChangeWithTimeWindow>
	</selection>
</transformation>
  • No labels