<?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="boundarydata">
    <xsd:annotation>
      <xsd:documentation>
       This contains a list of nodes 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:sequence>
    </xsd:complexType>
  </xsd:element>
  
  <xsd:element name="metadata">
    <xsd:annotation>
      <xsd:documentation>
        This contains some 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="1">
	  <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: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.
      </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>
	Information for nodes. Possible choices for nodes: boundary nodes and innodes.
	Can contain information on time, pressure and/or massflow.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="time" minOccurs="1">
	  <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="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: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:sequence>
    </xsd:complexType>
  </xsd:element>

</xsd:schema>
