Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This pattern allows the ThingFacet to become be 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

Code Block
languagexml
titlePhidgetServoModel combining PhidgetServoFacet
linenumberstrue
<ThingModel Name="PhidgetServoModel" Combines="PhidgetServoFacet">
  <Sid Name="PhidServoId"/>
</ThingModel>

 

Note: One can combine multiple ThingFacets within a single ThingModel using comma separated list of ThingFacets.

For Example Esky ThingModel combining EskyPreset and EskyImage Thing Facets

Code Block
languagexml
titlePhidgetServo Thing Model Part of a Zone
linenumberstrue
<ThingFacet name="EskyPreset">
  <String name="State" KnownBy="SyncPreset"/>
  <String name="Preset" KnownBy="SyncPreset"/>
  <Action name="SyncPreset" documentation="Synchronize camera state and preset">
    <Workflow Limit="1" Live="1" Timeout="PT20S">
      <Task name="Main" while="true">
        <Event name="Argument" as="ActionArgument"/>
        ...
      </Task>
    </Workflow>
  </Action>
</ThingFacet>

<ThingFacet name="EskyImage" combines="Login">
  <String name="State" KnownBy="SyncImage"/>
  <Clob name="Image" KnownBy="SyncImage"/>
  <!-- Actions -->
  <Action name="SyncImage" documentation="Synchronize camera state and snapshot image">
    <Workflow Limit="1" Live="1" Timeout="PT10S">
      <Task name="Main" while="true">
        <Event name="Argument" as="ActionArgument"/>
        ...
      </Task>
    </Workflow>
  </Action>
</ThingFacet>

<ThingModel name="Esky" combines="EskyPreset,EskyImage" documentation="actual single instance camera model">
  <Sid name="CameraId"/>
</ThingModel>

 

Adding application related information to a ThingModel. For Example, assume that the Phidget Servo Motor is part of a Zone within a Greenhouse environment. Greenhouse contains multiple zones.

...

languagexml
titlePhidgetServo Thing Model Part of a Zone
linenumberstrue

...

In summary

  • ThingModels are normally used to represent and define interactions with external physical things. The specifics of interactions are often modeled via ThingFacet.
  • ThingModels combine one or more ThingFacets. ThingFacets are reusable artifacts. In runtime, only instances of ThingModels are created and persisted (not ThingFacets). 
  • ThingModels can contain application related information that are related to things.


Examples of CRUD Operation on a ThingModel:

...