<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:fews="http://www.wldelft.nl/fews" targetNamespace="http://www.wldelft.nl/fews" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
	<include schemaLocation="sharedTypes.xsd"/>
	<element name="fewsPiServiceConfig" type="fews:PiServiceConfigComplexType">
		<annotation>
			<documentation>LEGACY, NO LONGER USED</documentation>
		</annotation>
	</element>
	<complexType name="TimeSeriesConfigComplexType">
		<sequence>
			<element name="description" type="string" minOccurs="0">
				<annotation>
					<documentation>Optional description for the activity.</documentation>
				</annotation>
			</element>
			<element name="id" type="fews:idStringType">
				<annotation>
					<documentation>ID of file to which the data will be exported. This file is always placed in exportDir.</documentation>
				</annotation>
			</element>
			<element name="exportBinFile" type="boolean" default="false" minOccurs="0">
				<annotation>
					<documentation>When true the events in the PI time series file are written to a binary file instead of the xml file.
                        The written xml file will only contain the time series headers and optionally a time zone.
                        The binary file has the same name as the xml file only the extension is "bin" instead of "xml"
                        During PI time series import the bin file is automatically read when available. The byte order in the bin file is always
                        Intel x86.
                </documentation>
				</annotation>
			</element>
			<choice>
				<element name="timeSeriesSet" type="fews:TimeSeriesSetComplexType" maxOccurs="unbounded">
					<annotation>
						<documentation>TimeSeriesSet that defines what data is to be exported.</documentation>
					</annotation>
				</element>
				<element name="selectedTimeSeries" type="fews:emptyElement"/>
				<element name="selectedSegmentTimeSeries" type="fews:emptyElement"/>
			</choice>
			<element name="omitMissingValues" type="boolean" minOccurs="0">
				<annotation>
					<documentation>Are missing values to be written to the export file or should they be left out.</documentation>
				</annotation>
			</element>
			<element name="missingValue" type="float" minOccurs="0">
				<annotation>
					<documentation>Missing value definition for this TimeSeries. Defaults to NaN if not defined.</documentation>
				</annotation>
			</element>
			<element name="convertDatum" type="boolean" minOccurs="0">
				<annotation>
					<documentation>Convert datum from Ordnance level during Import.
Convert datum to Ordnance level during Export.</documentation>
				</annotation>
			</element>
            <element name="externalUnit" minOccurs="0" maxOccurs="unbounded">
				<complexType>
					<attribute name="parameterId" type="fews:idStringType" use="required">
                        <annotation>
                            <documentation>ID of internal parameter to which pi timeseries is mapped. The external data
                            values will be converted from the unit defined by attribute 'unit' to the unit value
                            belonging to the internal parameter.</documentation>
                        </annotation>
					</attribute>
					<attribute name="unit" type="string" use="required">
                        <annotation>
                            <documentation>Unit value of the external PI timeseries that is mapped to the internal parameter
                                defined by attribute 'parameterId'.</documentation>
                        </annotation>
					</attribute>
				</complexType>
			</element>
		</sequence>
	</complexType>
	<complexType name="ModuleDataConfigComplexType">
		<sequence>
			<element name="description" type="string" minOccurs="0">
				<annotation>
					<documentation>Optional description for the activity.</documentation>
				</annotation>
			</element>
			<element name="id" type="fews:idStringType">
				<annotation>
					<documentation>ID of file to which the data will be exported. This file is always placed in exportDir.</documentation>
				</annotation>
			</element>
			<element name="moduleInstanceId" type="fews:idStringType">
				<annotation>
					<documentation>ID of the module instance for which the state will be exported.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="GeneralConfigComplexType">
		<sequence>
			<element name="importDir" type="fews:directoryStringType" minOccurs="0">
				<annotation>
					<documentation>Directory where input for plugin is written.</documentation>
				</annotation>
			</element>
			<element name="importIdMap" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Id of a file that contains mapping from external to internal location and parameter ID's.</documentation>
				</annotation>
			</element>
			<element name="importUnitConversionsId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Id of UnitConversions to be used for unit mapping from external to internal parameters.</documentation>
				</annotation>
			</element>
			<element name="exportDir" type="fews:directoryStringType" minOccurs="0">
				<annotation>
					<documentation>Directory where plugin output is written</documentation>
				</annotation>
			</element>
			<element name="exportIdMap" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Id of a file that contains mapping from  internal to external location and parameter ID's.</documentation>
				</annotation>
			</element>
			<element name="exportUnitConversionsId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Id of UnitConversions to be used for unit mapping from internal to external parameters.</documentation>
				</annotation>
			</element>
			<element name="writeToFile" type="boolean" minOccurs="0">
				<annotation>
					<documentation>Write all data transactions to file.</documentation>
				</annotation>
			</element>
			<element name="timeZone" type="fews:TimeZoneComplexType" minOccurs="0">
				<annotation>
					<documentation>Import data is converted from this timezone to GMT.
Export data is converted from GMT to this timezone.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="PiServiceConfigComplexType">
		<sequence>
			<element name="general" type="fews:GeneralConfigComplexType" minOccurs="0"/>
			<element name="timeSeries" type="fews:TimeSeriesConfigComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Exports time series.</documentation>
				</annotation>
			</element>
			<element name="moduleDataSet" type="fews:ModuleDataConfigComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Exchange a data set. Triggers export/import of data set for active module instance.</documentation>
				</annotation>
			</element>
			<element name="moduleParameterSet" type="fews:ModuleDataConfigComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Exchange a module parameter set. Triggers export/import of parameter set for active module instance.</documentation>
				</annotation>
			</element>
			<element name="moduleState" type="fews:ModuleDataConfigComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Exchange a module state file. Triggers export/import of state file for active module instance.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
</schema>
