Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


What

whatifTemplates.xml

Required

no

Description

Definitions of the What-If templates that can be edited in the WhatifEditor display

schema location

https://fewsdocs.deltares.nl/schemas/version1.0/whatIfTemplates.xsd

Table of Contents

The new What-If functionality was introduced in version 2021.01,

Table of Contents

As of 2021.01 the new WhatIf functionality is being introduced with the intention to remove replace the outdated WhatIf What-If functionality by 20232024. This new WhatIf What-If functionality uses WhatIfTemplates, which can be populated in the WhatIf What-If Editor, i.e. the display to create whatif-instances that can be applied to a workflow. The new WhatIf functionality works in In Delft-FEWS 2021.01 and 2021.02, the new What-If functionality only works in Stand-Alone, while from . From version 2022.01 and onwards all ,  the features also work also on in live systems (OCs).

Code Block
languagexml
titleExplorer task definition for WhatIfEditor
		<explorerTask name="WhatIf">
			<predefinedDisplay>what if editor</predefinedDisplay>
			<toolbarTask>true</toolbarTask>
			<menubarTask>true</menubarTask>
			<loadAtStartup>true</loadAtStartup>
		</explorerTask>

The connection between WhatIfs-instances and workflows is (as off of 2022.01) established via the the WorkflowDescriptors, where a <whatIfTemplateId> can be defined (one of the last elements).

Note: this is a non-backward compatible change from 2021.02 and earlier releases, where the connection betwen between workflows and WhatIfTemplates was defined in the Topology.xml.

Code Block
titleConnecting a whatif template to a workflow
	<workflowDescriptor id="Test_WhatIfSettings" name="Test_WhatIfSettings" forecast="true" visible="true" autoApprove="true">
		...
		<whatIfTemplateId>test_whatif</whatIfTemplateId>
	</workflowDescriptor>

What-ifs are, by default, non-approved runs, unless the user puts a check in the approve checkbox of the GUI.

...

Code Block
languagexml
titleEnabling the auto-approve checkbox in the IFD
        <node id="run_whatif_properties" name="wf1 t1 Properties">
            <workflowId>Test_WhatIfSettings</workflowId>
			<enableAutoApprove>false</enableAutoApprove>

The WhatIf Editor uses the whatifTemplates.xsd schema. This schema allows the configuration of a whatif-template, which is used in the WhatifEditor GUI to allows allow the specification of properties and modifiers to be applied in a whatif-instance. Multiple whatIfTemplate.xml files are supported as long as their prefix is WhatIfTemplates_....xml and no duplicate identifiers are used across the files. Identifiers defined in one xml-file can be used in another xml-file.

Properties can be specified directly (string, int, double, boolean) or , by selection selecting from an enumeration, or by selection selecting from a configuration file (e.g. moduledataset, module parameter file). 
Note: if a whatif-property is used as a key in a time series settimeSeriesSet, this time series set timeSeriesSet has to be simulated forecasting.

...

  1. always apply in workflow (default)
  2. apply according to creation method (since 2022.02)
  3. apply modifier if referenced in a what-if workflow
  4. never apply in a what-if workflow (i.e. always apply unless running a workflow with a whatif attached)

Code Block
titleSpecifying modifier behavior in relation to the whatif in the ModifierTypes.xml.
    <timeSeriesModifier id="modify_timeseries_only_applied_in_whatif" name="Modify time series (only applied in whatif)">
        <whatIfModifierType>apply if referenced in what-if workflow</whatIfModifierType>
        <timeSeries>....

...

The whatifTemplates-schema contains two main sections:

  • valueTypes: to specify the kinds of properties and their limitationsproperty types and their limits (e.g. min/max values)
  • whatifTemplates: to compose define which properties and modifiers can be specified in the template. whatifTemplates can be nested (but not unlimited in the GUI)

valueTypes

valueTypes define the kind type of properties that can be associated to used in a whatIfTemplate. Each valueType has a number of attributes with at least an id (required) and an optional default value. Additional attributes depend on the valueType. By allowing multiple valueTypes instances of the same kindvalueTypes, different display behaviour can be accommodated (e.g. different min/max . ranges for numeric properties).

Attribute id refers to the the identifier used to refer to connect this value type to the this valueType when defining a new property in the a whatIfTemplate.

Optional attribute default refers to is the default value incoporated associated with the valueType, which will be used in the whatIf-instance and shown in the displayGUI (where a user can then change it).

enumeration

The valueType enumeration results in a string-property value. The enumeration Using this valueType will list the items available in the enumeration in a dropdown box of in the WhatIfEditor.

Required attribute code refers to the value which is stored when this option is chosen.

Optional attribute label refers to the Caption of specifies how this value is captioned in the display.

If no default value default is defined, the first item in the enumeration will be shown as selected value in the display.

configFile

The valueType configFile results in a string-property value refering referring to a moduleDataSet-fileModuleDataSetFile, a moduleParameterFile ModuleParameterFile, or a coldState-fileColdStateFile. Based on the search pattern, the Configuration configuration (either available in the database or the file system) will be queried for items to populated the populate a dropdown box of in the WhatIfEditor.

Attribute type refers to specifies the type of config file (i.e. module dataset, module parameter, cold state).

Attribute pattern refers to specifies the search pattern to apply. The result will be a list of config configuration files for the dropdown box that meets meet this search pattern and are shown in a drop-down menu.

Attribute hidePattern option indicates (true/false) specifies whether the specified pattern should be stripped removed from the value values shown in the dropdownboxdropdown menu. By default this is false.

Attribute default refers to specifies the default value selected and to be shown in the dropdown boxmenu. Be aware that the default value should account for the hidePattern option. When hidePattern is false, the default should include the full string including the search pattern. When hidePattern is true, the default value should include only the selected postfixsuffix.

Code Block
languagexml
titleSpecifying default values in relation to the hidePattern option (WhatIfTemplates.xml)
    <valueTypes>
        <configFile hidePattern="truefalse" id="select_moduledatasetmoduleparfile" pattern="moduledatasetmoduleparfile_fixed_*" type="module datasetparameter" default="gridmoduleparfile_fixed_Abase"/>
        		<configFile hidePattern="falsetrue" id="select_moduleparfilemoduledataset" pattern="moduleparfilemoduledataset_fixed_*" type="module parameterdataset" default="moduleparfilegrid_fixed_baseA"/>
	</valueTypes>

If no default value is defined specified, the first item returned by the search will be shown as selected default value in the display.

string

The valueType string allows the user to specify any string value they like in a text field in the WhatIfEditor display.

If no default value is defined, the item has an field is empty value in the display.

int

The valueType int allows the user to specify any string integer value they like in a text numeric field.

Optional attribute min specifies the minimum value accepted in the display.

Optional attribute max specifies the maximum value accepted in the display.

If no default value is defined, the numeric field contains a 0 in the display.

double

The valueType double allows the user to specify any string numeric value they like in a text numeric field.

Optional attribute min specifies the minimum value accepted in the display.

Optional attribute max specifies the maximum value accepted in the display.

If no default value is defined, the numeric field contains a 0.0 in the display.

bool

The valueType bool allows the user to turn on/off a checkbox value.

whatIfTemplateId (since 2022.01)

 The valueType The valueType whatIfTemplateId allows the user to specify that the input series to this the whatif run need being created needs to come from another (previous) whatif run. A typical use case is a situation where one the user wants to choose from a set of computed hydrological inflow scenarios to select a specific (climate/weather) scenario as an input to a 'light' reservoir or water quality model to investigate various intervention strategies.

This is deviation of default Delft-FEWS behaviour, where a workflow always uses simulated series of the "Current" run. By referencing a whatif to be used as input, the timeseries of this that (approved) whatif run will be selectedused, neglecting ignoring the Current run. Please note that, due to code complexity, this feature is explicitly not intended to inherit other whatif content (i.e. property values and modifier values) from one whatif-template into another template.

...

The valueType dateTime is not implemented yet.

whatIfTemplate

The whatIfTemplate This section defines the actual whatIfTemplate shown in the display to populate specific whatIf-instances with data WhatIfEditor display, where users can create new what-if scenarios by defining different property values.

Required attribute id refers to the identifier of is a unique identifier for the whatIfTemplate. This id can be referenced in the Topology WorkflowDescriptors to make the connection with a workflow where for which the whatif whatifTemplate can be appliedused.

Required attribute name refers to specifies the template name (i.e. caption) used in the display.

whatIfExpiryTime (since 2022.01)

The expiry time of whatIf is the amount of time that the what-if scenario (created with the WhatIfEditor) remains in the Topology menu. The default expiry time of the whatIf can be overruled with the a custom expiry time configured in whatIfTemplate with the element ‘whatIfExpiryTime’. This custom expiry time will be used also for the modifiers associated with the whatIf’s created using the whatIfTemplate. If no whatIfExpiryTime is specified, the default expiry time for the workflow will be used instead.

properties

Lists This is a list of all properties to be defined in the whatIf and that are shown in the WhatIfEditor display, either as text field or dropdown item dependent on the valuetypedrop-down menu (dependending on the valueType), that need to be defined in each instance of the what-if scenario.

property

Required attribute id is the property-key $PROPERTY$ as applied used in the workflow

Optional attribute name is the name/caption as shown in the WhatIfEditor display.

Required attribute valueTypeId refers to one specifies which of the valueTypes defined earlierpreviously specified valueTypes apply to the property.

Optional element description is text which will appear as tooltip in the editor when hovering over the property (since 2024.01).

modifierType

Identifies the modfierType modifierType for which all available committed modifier-instances will be shown in the dropdown boxmenu. By default, no modifier is selected.

Note: By selecting a modifier-instance, a copy of this selected modifier is created which is tightly related to the whatif-instance. Value changes in the original modifier (resulting in a new modifier-instance) will therefore not be reflected in the whatif scenario. To incorporate changed modifier values, the modifier-instance should be reselected in the display to obtain a copy of this new modifier-instance.

whatIfTemplateId

Accommodates nesting of This makes it possible to nest whatIfTemplate sections to bring within one another, to allow for some structure in the WhatIfEditor display appearance.

Final

...

notes

  1. WhatIfTemplate identifiers WhatIfTemplates are stored as part of the whatif-instance, also when archived. Changing whatIfTemplate-identifiers a whatIfTemplate (while maintaining the same whatIfTemplateId) may thus break retrieval of archived whatifs (i.e. no similar as other archive exchanges)whatif scenarios.
  2. The relation between modifiers and whatifs whatif scenarios is stored at the modifier side. Exported whatifs whatif scenarios are unaware of associated modifiers, although the exported zip-file will include both the whatif.xml and the modifiers.xml if needed.
  3. As of 2022.01, a TypicalProfile modifier is was introduced to enable full replacement of the legacy whatif-functionality.
  4. Attached This configuration example demonstrates various alternatives to prepare and utilize includes several examples of how to configure and use properties and modifiers in whatifs scenarios.