<?xml version="1.0" encoding="UTF-8"?>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!--                                                                       -->
<!-- Boundary conditions file                                              -->
<!--                                                                       -->
<!-- Author: Dennis Gabriel (A01)                                          -->
<!--                                                                       -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<xsd:schema elementFormDefault="qualified"
  targetNamespace="https://www.trr154.fau.de/transient-data"
  xmlns="https://www.trr154.fau.de/transient-data"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:annotation>
    <xsd:documentation>
      File describing boundary conditions for transient gas networks.
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="initialdata">
    <xsd:annotation>
      <xsd:documentation>
       This contains a list of nodes and a list of edges with data.
       The additional meta information allows to specify a time, file version, etc.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="metadata"/>
        <xsd:element ref="nodes"/>
        <xsd:element ref="edges"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="metadata">
    <xsd:annotation>
      <xsd:documentation>
        This contains additional information.
        Mandatory is the version of the file, the date and the time interval with start, end and its unit.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="network" type="xsd:string" minOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              The network file that belongs to the boundary conditions.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="author" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>
              An optional tag to specify the author.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="version" type="xsd:string" minOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
              The version of the file.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="date" type="xsd:string" minOccurs="1">
          <xsd:annotation>
            <xsd:documentation>
	      The date when the file was created.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="timeInterval" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      The time interval (start, end, time unit) for which pressure, flow, valve status, ... is available in this file
            </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="start" type="xsd:double" use="required"/>
	    <xsd:attribute name="end" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="speedOfSound" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      A value for the speed of sound.
            </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="frictionCoefficient" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      A value for the friction coefficient.
            </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	  </xsd:complexType>
        </xsd:element>
	<xsd:element name="pipemodel" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>
              The pipemodel used to create the data. Possible choices are ISO1, ISO2, ISO3, ISO4.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="nodes">
    <xsd:annotation>
      <xsd:documentation>
        A list of nodes for which data is provided.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence minOccurs="1" maxOccurs="unbounded">
	<xsd:element ref="node"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="node">
    <xsd:annotation>
      <xsd:documentation>
	A specific node on the list of nodes.
	Information for nodes. Possible choices for nodes: boundary nodes and innodes.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence minOccurs="1" maxOccurs="unbounded">
	<xsd:element ref="nodedata"/>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:string" use="required"/>
      <xsd:attribute name="type" type="xsd:string" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="nodedata">
    <xsd:annotation>
      <xsd:documentation>
	Can contain information on time, pressure and/or massflow.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="time" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      A certain timepoint that is considered.
            </xsd:documentation>
	  </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="massflow" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      Massflow at the current node at a certain timepoint.
            </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="pressure" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
	      Pressure at the current node at a certain timepoint.
            </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="edges">
    <xsd:annotation>
      <xsd:documentation>
	A list of edges for which data is provided.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence minOccurs="1" maxOccurs="unbounded">
	<xsd:element ref="edge"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="edge">
    <xsd:annotation>
      <xsd:documentation>
	A specific edge on the list of edges.
	Information for edges. Possible choices for edges: pipes, compressors and valves.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence minOccurs="0" maxOccurs="unbounded">
	<xsd:element ref="edgedata"/>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:string" use="required"/>
      <xsd:attribute name="type" type="xsd:string" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="edgedata">
    <xsd:annotation>
      <xsd:documentation>
	Can contain information on time, pressure and/or massflow.
	In addition, for pipes it can contain information on the space (spatial point according to a space discretization),
	for compressors information on the pressure difference and for valves on the status (open/closed).
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="time" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      A certain timepoint that is considered.
	      Not mandatory.
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="space" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      A certain spacial point that is considered.
	      Not mandatory and only for pipes.
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="massflow" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      Massflow at the current edge (at a certain timepoint and spacial point).
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
        <xsd:element name="pressure" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      Pressure at the current pipe (at a certain timepoint and spacial point).
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
	<xsd:element name="pressureDifference" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      Increase of pressure at the current compressor (at a certain timepoint).
	      Mandatory for compressor stations.
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	    <xsd:attribute name="unit" type="xsd:string" use="required"/>
	  </xsd:complexType>
        </xsd:element>
	<xsd:element name="open" minOccurs="0">
	  <xsd:annotation>
	    <xsd:documentation>
	      Status of the current valve. 1 if open, 0 if closed.
	      Mandatory for valves.
	    </xsd:documentation>
          </xsd:annotation>
	  <xsd:complexType>
	    <xsd:attribute name="value" type="xsd:double" use="required"/>
	  </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  
</xsd:schema>
