Versions Compared

Key

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

...

Importing data in DELFT-FEWS is different from running a wizard in e.g. a much used office software package. To be able to import data a number of xml configuration files need needs to be adjusted or created. In short, this entails the following steps:

  1. The file-type you want to import should be readable by one of the imports available in Delft-Fews
  2. You must configure an instance of this import module
  3. You must add the moduleInstance to an a workflow (usually the ImportExternal Workflow)
  4. In case the locationId's and parameterId's in your Delft-Fews configuration are not identical to those in the files you need to import a IdMap file should be set up and referred to in the import module
  5. You will probably need to adjust one or more locationsets, the filters.xml file and the DisplayGroups.xml file if you need to display or process the newly imported data types.
    Info

    Please note that Delft-Fews DELETES all files after importing them. As such, you should ALWAYS copy files from another directory to the location from which Delft-Fews imports files. If you do not do this you might loose you files.

Setting up the import module

Steps:Setting up the Import module to import data in PI XML format involves the following steps: 

  1. make the Configuration file for the import module and store in the ModuleConfigFiles directory. In this example it should be named Import 1.00 default.xml
  2. register this new module in the ModuleInstanceDescriptors 1.00 default.xml file in the RegionConfigFiles directory
  3. Add the new module at a workflow in order to run it.

...

When configuring the import module we will need to extract get the following information from the file(s) to be imported:

  1. the locationId's in the XML file
  2. the parameterID's in the XML file
  3. the timestep in the XML file

...

Info

Please see the Delft-Fews configuration guide for detailed information on how to configure the Import modules. In addition, the .xsd schema file will provide documentationmay be consulted.

No Format
<?xml version="1.0" encoding="UTF-8"?>
<timeSeriesImportRun xmlns="http://www.wldelft.nl/fews"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/timeSeriesImportRun.xsd">
	<import>
		<general>
			<importType>PI</importType> <!-- Indicated we will read PI Files -->
			<folder>c:/Import/PI</folder> <!-- read the files from here -->
                                                      <!-- Files WILL BE DELETED after import -->
			<failedFolder>c:/Backup/PI</failedFolder>
                                <!-- If specified the imported files will be copied to this location -->
			<idMapId>IdImport</idMapId> <!-- The IdMap for this import -->
			<importTimeZone>
				<timeZoneOffset>+00:00</timeZoneOffset>
			</importTimeZone>
		</general>
		<timeSeriesSet>
			<moduleInstanceId>Import</moduleInstanceId> <!-- The name of this moduleinstance -->
			<valueType>scalar</valueType>
			<parameterId>H.obs</parameterId> <!-- The parameter as it will be stored in Delft-Fews,
                                                          different from the parameter in the XML. Therefore,
                                                          IdMapping has to be set up-->
			<locationSetId>LevelGauges</locationSetId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="hour" multiplier="1"/>
			<readWriteMode>add originals</readWriteMode>
			<synchLevel>1</synchLevel>
		</timeSeriesSet>
	</import>
</timeSeriesImportRun>

In the general section of the configuration the location at which the file(s) are to be found is give given in addition to an optional backup location. Imported data will be copied to the backup location if it is defined and accessible. All imported files in the folder location will be deleted. The contents of the idMapId element refers to the IdMapping table that converts the external locations/parameters to those used in your Delft-Fews application. If the mapping is one-to-one the idmap is not needed.

The timeSeriesSet element defines how the data will be stored in delftDelft-Fews. If you later want to view, use or export the data you will need the same timeseriesset to retrieve or view the data. In the timeseriesset we have defined the following:

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<workflow xmlns="http://www.wldelft.nl/fews"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wldelft.nl/fews
http://fews.wldelft.nl/schemas/version1.0/workflow.xsd" version="1.1">
	<activity>
		<runIndependent>true</runIndependent>
		<moduleInstanceId>Import</moduleInstanceId>
	</activity>
</workflow>

Step 4: Make the locationSet 

In order to refer to all four locations in one go (Instead of having to create four different timeseriesset) a locationset is defined in the file LocationSets 1.00 Default.xml in the RegionConfigFiles directory:

Set up Id Mapping

Step 4: Make the idmap file

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<idMap xmlns="http://www.wldelft.nl/fews"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.wldelft.nl/fews 
http://fews.wldelft.nl/schemas/version1.0/idMap.xsd" version="1.1">
	<parameter internal="H.obs" external="WaterLevel"/>
	<location internal="one" external="LocA"/>
	<location internal="two" external="LocB"/>
	<location internal="three" external="LocC"/>
	<location internal="four" external="LocD"/>
</idMap>

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<idMapDescriptors xmlns="http://www.wldelft.nl/fews"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.wldelft.nl/fews 
http://fews.wldelft.nl/schemas/version1.0/idMapDescriptors.xsd" version="1.0">
	<idMapDescriptor id="IdImport"/>
</idMapDescriptors>

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<displayGroups version="1.0" 
xmlns="http://www.wldelft.nl/fews" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.wldelft.nl/fews 
http://fews.wldelft.nl/schemas/version1.0/displayGroups.xsd">
	<displayGroup name="Test">
		<display name="Gauge One">
			<relativeViewPeriod unit="hour" start="-12" end="36"/>
			<subplot>
				<timeSeriesSet>
					<moduleInstanceId>Import</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationId>one</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="hour" multiplier="1"/>
					<relativeViewPeriod unit="hour" end="48" start="-48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</subplot>
		</display>
		<display name="Gauge Two">
			<relativeViewPeriod unit="hour" start="-12" end="36"/>
			<subplot>
				<timeSeriesSet>
					<moduleInstanceId>Import</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationId>two</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="hour" multiplier="1"/>
					<relativeViewPeriod unit="hour" end="48" start="-48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</subplot>
		</display>
		<display name="Gauge Three">
			<relativeViewPeriod unit="hour" start="-12" end="36"/>
			<subplot>
				<timeSeriesSet>
					<moduleInstanceId>Import</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationId>three</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="hour" multiplier="1"/>
					<relativeViewPeriod unit="hour" end="48" start="-48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</subplot>
		</display>
		<display name="Gauge Four">
			<relativeViewPeriod unit="hour" start="-12" end="36"/>
			<subplot>
				<timeSeriesSet>
					<moduleInstanceId>Import</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationId>four</locationId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="hour" multiplier="1"/>
					<relativeViewPeriod unit="hour" end="48" start="-48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</subplot>
		</display>
		<display name="All together">
			<relativeViewPeriod unit="hour" start="-12" end="36"/>
			<subplot>
				<timeSeriesSet>
					<moduleInstanceId>Import</moduleInstanceId>
					<valueType>scalar</valueType>
					<parameterId>H.obs</parameterId>
					<locationSetId>LevelGauges</locationSetId>
					<timeSeriesType>external historical</timeSeriesType>
					<timeStep unit="hour" multiplier="1"/>
					<relativeViewPeriod unit="hour" end="48" start="-48"/>
					<readWriteMode>add originals</readWriteMode>
				</timeSeriesSet>
			</subplot>
		</display>
	</displayGroup>
</displayGroups>

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<filters version="1.1" 
xmlns="http://www.wldelft.nl/fews" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.wldelft.nl/fews 
http://fews.wldelft.nl/schemas/version1.0/filters.xsd">
	<filter name="Gauges" id="Gauges">
		<timeSeriesSet>
			<moduleInstanceId>Import</moduleInstanceId>
			<valueType>scalar</valueType>
			<parameterId>H.obs</parameterId>
			<locationSetId>LevelGauges</locationSetId>
			<timeSeriesType>external historical</timeSeriesType>
			<timeStep unit="hour" multiplier="1"/>
			<relativeViewPeriod unit="hour" end="48" start="-48"/>
			<readWriteMode>add originals</readWriteMode>
		</timeSeriesSet>
	</filter>
</filters>