In the ideal case, a large organization or SDO would define a widely-applicable set of [ModuleClasses](SDT_Components.md#ModuleClass), each of which could be used as needed to compose the description of a complex device. In order to show the appoach, this section will create a few example ModuleClasses based on - or inspired by - featues in the Echonet Lite protocol. Please note that the examples shown in this document are very "cut down" and by no means represent a true representation of Echonet Lite[^echonet].
The following example shows a very simple device that represents a light that can be switched on and off. It contains just a single ModuleClass "Switch", which contains a single boolean data point "status" to control the on/off status of the device.
It is a stand-alone definition without using previously defined ModuleClasses. A more sophisticated use is presented in the next example.
The structure and the according SDT looks like this:
The following code section shows the fully integrated template. The source code can be found in [SimpleExample.xml](../test/SimpleExample.xml) in the "test" directory.
<Doc>This property indicates the ON/OFF status.</Doc>
<DataType>
<SimpleTypetype="boolean"/>
</DataType>
</DataPoint>
</Data>
</ModuleClass>
</ModuleClasses>
</DeviceClass>
</DeviceClasses>
</Domain>
```
<aname="echonetExample"></a>
## A more sophisticated example
In the ideal case, a large organization or SDO would define a widely-applicable set of [ModuleClasses](SDT_Components.md#ModuleClass), each of which could be used as needed to compose the description of a complex device. In order to show the approach, this section will create a few example ModuleClasses based on - or inspired by - features in the Echonet Lite protocol. Please note that the examples shown in this document are very "cut down" and by no means represent a true representation of Echonet Lite[^echonet].
[^echonet]:The Echonet Consortium has standardized their specifications within IEC/ISO (IEC62394, ISO/IEC24767-1, ISO/IEC24767-2, IEC62480, ISO/IEC14543-4-1, ISO/IEC14543-4-2, IEC62457) and they provide a comprehensive collection of various types of home appliances relevant to SmartGrid applications as ECHONET Device objects (see [https://echonet.jp/spec_object_rf_en/](https://echonet.jp/spec_object_rf_en/) ).
The source code can be found in [EchonetLiteExamples.xml](../test/EchonetLiteExamples.xml) in the "test" directory.
<aname="echonetExampleMC"></a>
### ModuleClasses
For the example in this section, to show re-use of ModuleClass definitions, two complex devices are chosen which have some common features and hence could be expected to both use some of the same ModuleClasses: an air conditioner and a washing machine.
|Funtionality | Air Conditioner | Washing Machine |
|Functionality | Air Conditioner | Washing Machine |
|measuredCumulativePowerConsumption |the cumulative power consumption |the cumulative power consumption |
|installationLocation |this sets/reads a string text describing the location (room) of the air-conditioner |this sets/reads a string text describing the location (room) of the washing machine |
|setTimer |(not applicable. there is no preset start for an air-conditioner) |This sets/reads use the on/off timer |
|temperatureSensorDataPoints | this reads the measured temperature | this reads the measured temperature |
Based on the simplified example above, the two appliances will need the ModuleClasses below:
<Doc>This property indicates the measured temperature value in units of 0.1C.</Doc>
<DataTypeunitOfMeasure="celsius">
<SimpleTypetype="integer"/>
</DataType>
</DataPoint>
</Data>
</ModuleClass>
```
<aname="echonetExampleDC"></a>
### DeviceClass
To define a device one would now reference those ModuleClass definitions in a new DeviceClass. For the sake of simplicity only the "SimpleWashingMachine" is implemented here.
In addition to the previously defined ModuleClasses this "SimpleWashingMachine" DeviceClass extends the existing ModuleClass "operationStatus" with an event. It also adds a new ModuleClass "washingMachineDataPoints" with model-specific DataPoints.
At the beginning of the definition some device Properties are defined.
```xml
<DeviceClassid="SimpleWaschingMachine">
<!-- Device Properties -->
<Properties>
<Propertyname="Name"value="washing machine">
<SimpleTypetype="string"/>
</Property>
<Propertyname="Vendor"value="ACME">
<SimpleTypetype="string"/>
</Property>
</Properties>
<ModuleClasses>
<!-- Inheriting ModuleClasses from the global generic ModuleClasses -->
This example is a specification for an imaginged device, a connected extension block with multiple power socket where each of the sockets are modeled as a
separate *SubDevice*.
[mseeb.xml](../test/mseeb.xml)
<!-- The following Module inherits and extends a global generic ModuleClass with an event. Therefore, it is renamed to express