...
However, as a recommended practice, the Attributes and Actions related to the interactions with an external thing (sensors, actuators, machines) are often defined in a reusable structure called ThingFacet, and combined into a ThingModel. This relationship was explained in the concept of Models and Model Facets. Application related information are often defined directly as attributes of the ThingModel.
Purpose of ThingModels:
- ThingModels are normally defined by users when interacting with Physical Things. The behavior of Physical Things are modeled via ThingFacet.
- ThingModels are driver for ThingFacets. ThingFacet (s) are reusable models and TQL CRUD operations can not be performed on ThingFacet. ThingFacet(s) are put to use only when combined within a ThingModel.
- ThingModels can contain application related information that are related to things.
Simplest form of defining a ThingModel is to provide a Name and Attributes. Example of a PhidgetServoModel ThingModel with one attribute PhidServoId In the following example, the ThingModel PhidgetServoModel combines the ThingFacet PhidgetServoFacet, where:
- PhidgetServoFacet contains the device interaction specific Attributes (e.g. ServoProtocolURL) and Actions (e.g. PhidgetServoAction);
- PhidgetServoModel contains application related Attributes: PhidServoId and InstalledAtZone (assuming the Phidget servo motor is installed in a particular zone within a Greenhouse environment, which has multiple zones).
- Combines is a modifier of ThingModel
In the most simple case, a ThingModel may only have one single directly defined attribute of type Sid.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<ThingModel Name="PhidgetServoModel" Combines="PhidgetServoFacet"> <Sid Name="PhidServoId"/> <String Name="InstalledAtZone"/> </ThingModel> <ThingFacet Name="PhidgetServoFacet"> <String Name="ServoProtocolURL" Default="phid://" /> <String Name="DeviceInterfaceIndex" /> <String Name="PhidgetDeviceType" /> <Integer Name="ServoAngle" KnownBy="PhidgetServoAction" /> <Action Name="PhidgetServoAction" Documentation="Control servo motor"> ... </Action> </ThingFacet> |
This pattern allows the ThingFacet to become a reusable artifact, and potentially combined by multiple ThingModels.
Purpose of ThingModels:
- ThingModels are normally defined by users when interacting with Physical Things. The behavior of Physical Things are modeled via ThingFacet.
- ThingModels are driver for ThingFacets. ThingFacet (s) are reusable models and TQL CRUD operations can not be performed on ThingFacet. ThingFacet(s) are put to use only when combined within a ThingModel.
- ThingModels can contain application related information that are related to things.
ThingsFacets are used within ThingModels using Combines modifier. Example of a PhidgetServoModel ThingModel combining a PhidgetServoFacet ThingFacet
...