<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="plcConfiguration">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="melDevices" minOccurs="1"/>
        <xs:element name="logCycle" type="xs:integer" minOccurs="0"/>
        <xs:element ref="readBlocks" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="melDevices">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="melDevice" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="melDevice">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="logSize" type="xs:integer" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="name" type="xs:string" use='required'/>
      <xs:attribute name="id"   type="xs:integer" use='required'/>
      <xs:attribute name="maxsize" type="xs:integer" use='required'/>
      <xs:attribute name="type" default="BIT">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="BIT"/>
            <xs:enumeration value="WORD"/>
            <xs:enumeration value="ZR"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

  <xs:element name="readBlocks">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="readBlock" minOccurs="1" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="readBlock">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="readDevice" type="xs:string" minOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="maxblock" type="xs:integer"/>
    </xs:complexType>
  </xs:element>

</xs:schema>
