Versions Compared

Key

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

...

For the purpose of this tutorial, let's create a Greenhouse, Lane, Zone, Grid and combine Temperature Sensor from tutorial 1 to a particular zone.

...

DataModel to store non-thing related data

TQLEngine provides DataModel to store "pure" data, DataModels do not combine facets. They are simply models to store application data that is essential to create a meaningful real-world IoT application.

...

  1. Greenhouse : Overall DataModel holder for Greenhouse. GHLanes is defined of type reference. There are two types of references - simple reference and smart reference. Smartness can be defined by providing a "Find" Query at the time of model definition or at the time of instantiating the model. GHLanes is defined as Reference to include all the Lanes from Lane model.

    Code Block
    languagexml
    titleGreenhouse DataModel
    linenumberstrue
    <DataModel Name="Greenhouse">
          <Sid Name="GreenhouseID"/>
       <BoundingBox   <String Name="GreenhouseLocationGreenhouseName"/>
      <Integer    <GeoLocation Name="LaneCountLocation"/>
      <Double    <String Name="LaneWidthLocationName"/>
          <Double<BoundingBox Name="ZoneLengthBoundary"/>
          <Integer Name="ZoneInLaneLaneCount"/>
          <Integer<Double Name="ZoneCountLaneWidth"/>
          <Double Name="GHLengthZoneLength"/>
          <Double<Integer Name="GHWidthZoneInLane"/>
       <EnvInfo   <Integer Name="ExternalEnvZoneCount"/>
      <EnvInfo    <Double Name="InternalEnvGHLength"/>
      <String    <Double Name="VentOnOffStateGHWidth"/>
          <String<EnvInfo Name="FansOnOffStateExternalEnv"/>
      <Boolean    <EnvInfo Name="SunnyDayInternalEnv"/>
    </DataModel>

    Grid - DataModel for storing Grid information.

    Code Block
    languagexml
    titleGrid DataModel
    linenumberstrue
    <DataModel
          <String Name="VentOnOffState"/>
          <String Name="GridFansOnOffState"/>
      <Sid Name="GridID"/>   <String<Boolean Name="ZoneIDSunnyDay"/>
      <String Name="GridName"/>   <BoundingBox<Boolean Name="GridLocationRunning"/>
      <Integer Name default="GridNSPositionfalse"/>   <Integer Name="GridWEPosition"/><!-- true / false -->
          <Double<Reference Name="GridLengthGHLanes"/>
      <Double Name="GridWidth"/>   <Double<Reference Name="SoilMoistureGHExternalEnv"/>
      <Double Name="AmbientLight"/>   <Reference Name="ZoneGrid" Type="Zone" Cardinality="1"GHInternalEnv"/>
    </DataModel>
  2. Zone - DataModel for storing Zone information. Does a Smart Reference  to Grid at instantiation time by simply defining ZoneGrids as Reference type. The Find query can be add at the instantiation time.GHExternalEnv & GHInternalEnv

    Code Block
    languagexml
    titleZone DataModelGHExternalEnv and GHInternalEnv Data Model
    linenumberstrue
    <DataModel Name="ZoneExternalEnv">
          <Sid Name="ZoneIDExternalEnvID"/>
       <String   <Number Name="LaneIDExtTemperature"/>
      <String    <Number Name="ZoneNameExtHumidity"/>
      <BoundingBox    <Number Name="ZoneLocationExtLight"/>
          <Double<Reference Name="ZoneWidthGreenhouseID"/>   <Double NameType="Greenhouse" Cardinality="ZoneLength1"/>
      <Integer  </DataModel>
    <DataModel Name="GridOnLengthInternalEnv"/>
      <Integer Name="GridOnWidth"/>   <Integer<Sid Name="GridCountInternalEnvID"/>
      <Double Name="GridLength"/>   <Double<Number Name="GridWidthIntTemperature"/>
      <String Name="EndZone"/>   <Double<Number Name="ZoneTemperatureIntHumidity"/>
      <Double Name="ZoneHumidity"/>   <Double<Number Name="ZoneAvgSMIntLight"/>
      <Double Name="ZoneAvgLight"/>   <String<Reference Name="CropTypeGreenhouseID"/>
      <Date Name Type="SeedingDateGreenhouse" formatCardinality="$SimpleDateFormat(dd-MM-yyyy)1"/>
      <Date </DataModel>


  3. Grid - DataModel for storing Grid information.

    Code Block
    languagexml
    titleGrid DataModel
    linenumberstrue
    <DataModel Name="LastFertilisationDateGrid" format="$SimpleDateFormat(dd-MM-yyyy)"/>>
       <String Name  <Sid Name="HarvestingSeasonGridID"/>
      <Integer    <String Name="NoOfPlantsGridName"/>
          <Double<BoundingBox Name="VPDGridLocation"/>
      <Reference Name="LaneZone" Type="Lane" Cardinality="1    <Integer Name="GridNSPosition"/>
          <Reference<Integer Name="ZoneGridsGridWEPosition"/>
         <Find> <Double Name="GridLength"/>
        <Grid>  <Double Name="GridWidth"/>
         <GridID <Double neName="SoilMoisture"/>
          <Double </Grid>Name="AmbientLight"/>
          </Find>
      </Reference><Reference Name="ZoneID" Type="Zone" Cardinality="1"/>
     </DataModel>
  4. Lane Zone -  DataModel to hold Lane DataModel for storing Zone information. Defines Smart Reference to ZonesDoes a Smart Reference  to Grid at instantiation time by simply defining ZoneGrids as Reference type. The Find query can be add at the instantiation time.

    Code Block
    languagexml
    titleLane Zone DataModel
    linenumberstrue
    <DataModel Name="Lane" Name="Zone">
          <Sid Name="ZoneID"/>
          <String Name="ZoneName"/>
          <BoundingBox Name="ZoneLocation"/>
          <GeoLocation Name="Location"/>
          <Double Name="ZoneWidth"/>
          <Double Name="ZoneLength"/>
          <Integer Name="GridOnLength"/>
          <Integer Name="GridOnWidth"/>
          <Integer Name="GridCount"/>
          <Double Name="GridLength"/>
          <Double Name="GridWidth"/>
          <String Name="EndZone"/>
          <Double Name="ZoneTemperature"/>
          <Double Name="ZoneHumidity"/>
          <Double Name="ZoneAvgSM"/>
          <Double Name="ZoneAvgLight"/>
          <String Name="CropType"/>
          <Date Name="SeedingDate" format="$SimpleDateFormat(dd-MM-yyyy)"/>
          <Sid<Date Name="LastFertilisationDate" format="LaneID$SimpleDateFormat(dd-MM-yyyy)"/>
          <String Name="LaneNameHarvestingSeason"/>
          <String<Integer Name="GreenhouseIDNoOfPlants"/>
          <Double Name="LaneLengthVPD"/>
          <Double<String Name="LaneWidth"/>Live"/> <!-- Yes/No -->
          <Reference Name="LaneID"  <Integer NameType="Lane" Cardinality="ZoneInLane1"/>
          <String<Reference Name="BorderLaneZoneGrids"/>
          <BoundingBox Name="LaneLocation"/</DataModel>
  5. Lane - DataModel to hold Lane information. Defines Smart Reference to Zones.

    Code Block
    languagexml
    titleLane DataModel
    linenumberstrue
    <DataModel Name="Lane">
          <Reference<Sid Name="GreenhouseLane" Type="Greenhouse" Cardinality="1LaneID"/>
          <Reference<String Name="LaneZonesLaneName"/>
          <Double Name="LaneLength"/>
     <Find>     <Double Name="LaneWidth"/>
          <Zone>
    <Integer Name="ZoneInLane"/>
                  <ZoneID ne<String Name="BorderLane"/>
                </Zone><BoundingBox Name="LaneLocation"/>
          <Reference Name="GreenhouseID"  </Find>Type="Greenhouse" Cardinality="1"/>
          <Reference <Name="LaneZones"/Reference>
    </DataModel>

Data + Things

...

Code Block
languagexml
titleTempSensorModel with reference to Zone
linenumberstrue
<ThingModel Name="TempSensorModelTempSensor" Combines="TempSensorFacetTempSensorFacetNS">
      <Sid Name="TempSensorIdsensorId"/>
      <Reference Name="TempSensorInZoneZoneID" Type="Zone" Cardinality="1"/>
</ThingModel>

...