11. Gateways, Cloud - Edge Computing

Key Concepts

 Related docs
IoT application topology 
Selective initialization 
Cluster 
 Related docs
Engine-to-engine queries 
Edge-cloud parallel controls 
Edge over-ride and cloud over-ride controls 

Background

In order to model a real-world IoT application or a solution it is imperative to distribute load. In Greenhouse example we have a total of 270+ Sensors and Actuators.

It is impractical to run entire sensors and actuators on one single node (either OnPrem or Cloud)

Cluster Design

 

Greenhouse Model Review

Complete Greenhouse Model (Queries, Macros, Facets, Models, Types) can be found here

Types

  • Primitive Types
  • Cardinality
  • Defaults
  • Composites 
Greenhouse Types
<Def Name="EnvInfo">
      <Number Name="Temperature"/>
      <Number Name="Humidity"/>
      <Number Name="Light"/>
      <Number Name="Pressure"/>
      <Number Name="SoilMoisture"/>
      <Number Name="Wind"/>
      <String Name="LastUpdatedByProvider"/>
</Def>
<Def Name="BoundingBox">
      <GeoLocation Name="Vertex1"/>
      <GeoLocation Name="Vertex2"/>
      <GeoLocation Name="Vertex3"/>
      <GeoLocation Name="Vertex4"/>
</Def>
<Def Name="GeoLocation">
      <Number Name="latitude"/>
      <Number Name="longitude"/>
</Def>
<Def Name="PeripheralParams">
		<String Name="Peripheral" />
		<String Name="InterfacePort" />
		<String Name="Interface" />
		<String Name="UniqueId" default="56789" />
		<String Name="Baudrate" />
		<String Name="Format" default="ascii" />
		<String Name="Operation" />
		<String Name="Payload" />
</Def>
 
<Def Name="PhilipLightState">
      <Boolean Name="On"/>
      <Integer Name="bri"/>
      <Integer Name="hue"/>
      <Integer Name="sat"/>
      <String Name="effect"/>
      <Double Name="xy" cardinality="2"/>
      <Integer Name="ct"/>
      <String Name="alert"/>
      <String Name="colormode"/>
      <Boolean Name="reachable"/>
</Def>
 
<Def Name="ImageSize">
		<Number Name="Height" />
		<Number Name="Width" />
</Def>

<Def Name="CameraConfig">
		<Number Name="Channel" />
		<Number Name="Standard" />
		<Number Name="Brightness" />
		<Number Name="Contrast" />
		<Number Name="Gamma" />
		<Number Name="Saturation" />
		<Number Name="Sharpness" />
		<Number Name="Hue" />
		<Number Name="Gain" />
		<Number Name="Quality" />
</Def>

<Def Name="USBCameraParams">
		<ImageSize Name="Size" />
		<CameraConfig Name="Configuration" />
		<String Name="SaveToDisk" />
		<String Name="ImageFormat" />
		<String Name="ImageName" />
</Def>

DataModel

  • Primitive Types
  • Default Format
  • Hidden Modifiers
  • Simple References

Greenhouse DataModel
<DataModel Name="Greenhouse">
      <Sid Name="GreenhouseID"/>
      <String Name="GreenhouseName"/>
      <GeoLocation Name="Location"/>
      <String Name="LocationName"/>
      <BoundingBox Name="Boundary"/>
      <Integer Name="LaneCount"/>
      <Double Name="LaneWidth"/>
      <Double Name="ZoneLength"/>
      <Integer Name="ZoneInLane"/>
      <Integer Name="ZoneCount"/>
      <Double Name="GHLength"/>
      <Double Name="GHWidth"/>
      <EnvInfo Name="ExternalEnv"/>
      <EnvInfo Name="InternalEnv"/>
      <String Name="VentOnOffState"/>
      <String Name="FansOnOffState"/>
      <Boolean Name="SunnyDay"/>
      <Boolean Name="Running" default="false"/> <!-- true / false -->
      <Reference Name="GHLanes"/>
      <Reference Name="GHExternalEnv"/>
      <Reference Name="GHInternalEnv"/>
</DataModel>

<DataModel Name="Lane">
      <Sid Name="LaneID"/>
      <String Name="LaneName"/>
      <Double Name="LaneLength"/>
      <Double Name="LaneWidth"/>
      <Integer Name="ZoneInLane"/>
      <String Name="BorderLane"/>
      <BoundingBox Name="LaneLocation"/>
      <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
      <Reference Name="LaneZones"/>
</DataModel>
<DataModel 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)"/>
      <Date Name="LastFertilisationDate" format="$SimpleDateFormat(dd-MM-yyyy)"/>
      <String Name="HarvestingSeason"/>
      <Integer Name="NoOfPlants"/>
      <Double Name="VPD"/>
      <String Name="Live"/> <!-- Yes/No -->
      <Reference Name="LaneID" Type="Lane" Cardinality="1"/>
      <Reference Name="ZoneGrids"/>
</DataModel>

<DataModel Name="Grid">
      <Sid Name="GridID"/>
      <String Name="GridName"/>
      <BoundingBox Name="GridLocation"/>
      <Integer Name="GridNSPosition"/>
      <Integer Name="GridWEPosition"/>
      <Double Name="GridLength"/>
      <Double Name="GridWidth"/>
      <Double Name="SoilMoisture"/>
      <Double Name="AmbientLight"/>
      <Reference Name="ZoneID" Type="Zone" Cardinality="1"/>
</DataModel>
<AppModel Name="ExternalEnv">
      <Sid Name="ExternalEnvID"/>
      <Number Name="ExtTemperature"/>
      <Number Name="ExtHumidity"/>
      <Number Name="ExtLight"/>
      <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</AppModel>

<AppModel Name="InternalEnv">
      <Sid Name="InternalEnvID"/>
      <Number Name="IntTemperature"/>
      <Number Name="IntHumidity"/>
      <Number Name="IntLight"/>
      <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</AppModel>
<DataModel Name="AvgCityTemp">
      <Sid Name="Sid"/>
      <Number Name="Month"/>
      <Number Name="AvgMonthHighTemp"/>
      <Number Name="AvgMonthLowTemp"/>
</DataModel>
<DataModel Name="AvgCityHumidity">
      <Sid Name="Sid"/>
      <Number Name="Month" Modifiers="hidden"/>
      <Number Name="MorningHumidity"/>
      <Number Name="AfternoonHumidity"/>
</DataModel>
<DataModel Name="GHTempSensorCurrentTemp">
        <Sid Name="Sid"/>
        <String Name="TempSensorID"/>
        <Double Name="CurrentTemp"/>
        <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</DataModel>
    
<DataModel Name="GHHumiditySensorCurrentHumidity">
        <Sid Name="Sid"/>
        <String Name="HumiditySensorID"/>
        <Double Name="CurrentHumidity"/>
        <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</DataModel>

ThingModel and ThingFacets

  • Protocol Handlers Used: PERIF, UCAM, HTTP, PHID 
  • Attach Things to Data using Simple References
  • Proxy Sensor Design Pattern (Single MCUThingFacet → All Sensors)
  • ThingFacets with Multiple Actions
  • ThingFacet to load Vendor-Specified MetaData

Greenhouse ThingModel and Facets
<ThingModel Name="GHHumiditySensor" Combines="GHHumiditySensorFacet">
      <Sid Name="SensorId"/>
      <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</ThingModel>

<ThingModel Name="GHTempSensor" Combines="GHTempSensorFacet">
      <Sid Name="sensorId"/>
      <Reference Name="GreenhouseID" Type="Greenhouse" Cardinality="1"/>
</ThingModel>

<ThingModel Name="ServoMotorDevice" combines="ServoMotor">
      <Sid Name="ServoID"/>
</ThingModel>
 
<ThingModel Name="HumiditySensor" Combines="HumiditySensorFacetNS">
      <Sid Name="sensorId"/>
      <Reference Name="ZoneID" Type="Zone" Cardinality="1"/>
</ThingModel>
<ThingModel Name="Heater">
      <Sid Name="HeaterID"/>
      <String Name="OnOffState"/>
      <Integer Name="HeatingLevel"/>
      <Reference Name="ZoneID" Type="Zone" Cardinality="1"/>
</ThingModel> 
<ThingModel Name="LightModel" Combines="LightFacetNS">
      <Sid Name="LightID"/>
      <Reference Name="GridID" Type="Grid" Cardinality="1"/>
</ThingModel>
<ThingModel Name="AmbientLightSensorModel" Combines="AmbientLightSensorFacetNS">
      <Sid Name="AmbientLightID"/>
      <Reference Name="GridID" Type="Grid" Cardinality="1"/>
</ThingModel>
<ThingModel Name="IrrigationNozzleModel" Combines="IrrigationNozzleFacetNS">
      <Sid Name="IrrigationNozzleID"/>
      <Reference Name="GridID" Type="Grid" Cardinality="1"/>
</ThingModel>
<ThingModel Name="MCUSensorModel" combines="MCUSensorFacet">
		<Sid Name="SensorId"/>
</ThingModel>

Macros

  • Pipeline Macros - ExecuteQuery, ScheduleJob, UnScheduleJob, SubscribeToTQL
  • Greenhouse Creation (Bulk Initialization)
  • Simulate Sensors & Actuators
  • Internal Activation of ThingFacets
Greenhouse Macros
<Macro Name="ExecuteQuery">
  <Argument>
    <QueryString>
      <Query/>
    </QueryString>
  </Argument>
  <Result>
    <OnRequest Target="[:RuntimeParams.FacetIDName:]" Disable="CMD_SERVER">
      <Process Return="CMD_NOP">
        <Message>
          <Value>
            [:$Macro.Argument.QueryString:]
          </Value>
        </Message>
      </Process>
    </OnRequest>
  </Result>
</Macro>

Gateway Setup

  • The gateway selected for the Greenhouse setup is ADVANTECH UTX-3115 sold by Intel
    Operating System: Running Wind River Linux [Linux WR-IDP-689C 3.14.56_IDP-XT_3.1-WR7.0.0.11_idp].

  • This gateway represents 1 zone and 1 Grid
  • How things are connected to Gateways

    Gateway TypeThingsProtocolGridZone
    Intel ADVANTECHAmbient Light SensorXbee/Serial
     
    Intel ADVANTECHSoil SensorXbee/Serial
     
    Intel ADVANTECHLightXbee/IP
     
    Intel ADVANTECHIrrigation Nozzle (Selonoid)Xbee/Serial  
    Intel ADVANTECHTemperature SensorXbee/Serial 
    Intel ADVANTECHHumidity SensorXbee/Serial 
    Raspberry Pi - 3CameraUCAM/Serial 
    TQLEngineHeater- Simulated
    Intel ADVANTECHIrrigation MotorPHID/Serial 

Cloud Setup (AWS)

Initialization Variation

Cloud Initialization

  • None
  • Wait and watch!

Live Gateway Init

  • We only need to Initialize one things and data for 1 zone

    Live Gateway - Init Queries
    <Query>
      <DeleteAll format="version,current">
        <Greenhouse>
          <GreenhouseID ne=""/>
        </Greenhouse>
      </DeleteAll>
      <Create>
        <Greenhouse>
          <GreenhouseID>
            livegreenhouse
          </GreenhouseID>
          <GreenhouseName>
            Intel-GreenHouse
          </GreenhouseName>
          <BoundingBox>
            <Vertex1>
              0
    
            </Vertex1>
    
            <Vertex2>
    
              0
    
            </Vertex2>
    
            <Vertex3>
    
              110
    
            </Vertex3>
    
            <Vertex4>
    
              40
    
            </Vertex4>
    
          </BoundingBox>
    
          <LaneCount>
    
            3
    
          </LaneCount>
    
          <LaneWidth>
    
            110
    
          </LaneWidth>
    
          <ZoneLength>
    
            10
    
          </ZoneLength>
    
          <ZoneInLane>
    
            5
    
          </ZoneInLane>
    
          <ZoneCount>
    
            15
    
          </ZoneCount>
    
          <GHLength>
    
            110
    
          </GHLength>
    
          <GHWidth>
    
            40
    
          </GHWidth>
    
          <ExternalEnv>
    
            <Temperature>
    
              26
    
            </Temperature>
    
            <Humidity>
    
              53
    
            </Humidity>
    
            <Light>
    
              1
    
            </Light>
    
            <SoilMoisture>
    
              20
    
            </SoilMoisture>
    
            <Wind>
    
              19.5
    
            </Wind>
    
          </ExternalEnv>
    
          <InternalEnv>
    
            <Temperature>
    
              20
    
            </Temperature>
    
            <Humidity>
    
              53
    
            </Humidity>
    
            <Light>
    
              1
    
            </Light>
    
            <SoilMoisture>
    
              1
    
            </SoilMoisture>
    
          </InternalEnv>
    
          <GHLanes>
    
          </GHLanes>
    
          <SunnyDay>
    
            True
    
          </SunnyDay>
    
          <Location>
    
            <latitude>
    
              37.3718999
    
            </latitude>
    
            <longitude>
    
              -122.0022377
    
            </longitude>
    
          </Location>
    
        </Greenhouse>
    
      </Create>
    
      <DeleteAll format="version,current">
    
        <Lane>
    
          <LaneID ne=""/>
    
        </Lane>
    
      </DeleteAll>
    
      <Create>
    
        <Lane>
    
          <LaneID>
    
            livelane
    
          </LaneID>
    
          <GreenhouseID>
    
            livegreenhouse
    
          </GreenhouseID>
    
          <LaneName>
    
            lane-1
    
          </LaneName>
    
          <LaneLength>
    
            5
    
          </LaneLength>
    
          <LaneWidth>
    
            1
    
          </LaneWidth>
    
          <ZoneInLane>
    
            4
    
          </ZoneInLane>
    
          <BorderLane>
    
            1
    
          </BorderLane>
    
          <BoundingBox>
    
            <Vertex1>
    
              5
    
            </Vertex1>
    
            <Vertex2>
    
              28
    
            </Vertex2>
    
            <Vertex3>
    
              105
    
            </Vertex3>
    
            <Vertex4>
    
              38
    
            </Vertex4>
    
          </BoundingBox>
    
        </Lane>
    
      </Create>
    
      <DeleteAll format="version,current">
    
        <Zone>
    
          <ZoneID ne=""/>
    
        </Zone>
    
      </DeleteAll>
    
      <Create>
    
        <Zone>
    
          <ZoneID>
    
            livezone
    
          </ZoneID>
    
          <ZoneName>
    
            Intel-Zone
    
          </ZoneName>
    
          <LaneID>
    
            livelane
    
          </LaneID>
    
          <ZoneLength>
    
            1
    
          </ZoneLength>
    
          <ZoneWidth>
    
            1
    
          </ZoneWidth>
    
          <ZoneLocation>
    
            <Vertex1>
    
              1
    
            </Vertex1>
    
            <Vertex2>
    
              1
    
            </Vertex2>
    
            <Vertex3>
    
              1
    
            </Vertex3>
    
            <Vertex4>
    
              1
    
            </Vertex4>
    
          </ZoneLocation>
    
          <EndZone>
    
            endzone
    
          </EndZone>
    
          <GridOnLength>
    
            1
    
          </GridOnLength>
    
          <GridOnWidth>
    
            1
    
          </GridOnWidth>
    
          <GridCount>
    
            1
    
          </GridCount>
    
          <GridLength>
    
            1
    
          </GridLength>
    
          <GridWidth>
    
            1
    
          </GridWidth>
    
          <ZoneTemperature>
    
            26
    
          </ZoneTemperature>
    
          <ZoneHumidity>
    
            53
    
          </ZoneHumidity>
    
          <ZoneAvgSM>
    
            20
    
          </ZoneAvgSM>
    
          <ZoneAvgLight>
    
            2
    
          </ZoneAvgLight>
    
          <CropType>
    
            Apple
    
          </CropType>
    
          <SeedingDate>
    
            11-04-2016
    
          </SeedingDate>
    
          <LastFertilisationDate>
    
            14-04-2016
    
          </LastFertilisationDate>
    
          <HarvestingSeason>
    
            April
    
          </HarvestingSeason>
    
          <NoOfPlants>
    
            5
    
          </NoOfPlants>
    
          <VPD>
    
            0
    
          </VPD>
    
          <Location>
    
            <latitude>
    
              1.11
    
            </latitude>
    
            <longitude>
    
              1.12
    
            </longitude>
    
          </Location>
    
          <Live>
    
            yes
    
          </Live>
    
        </Zone>
    
      </Create>
    
      <DeleteAll format="version,current">
    
        <Grid>
    
          <GridID ne=""/>
    
        </Grid>
    
      </DeleteAll>
    
      <Create>
    
        <Grid>
    
          <GridName>
    
            Intel-Grid
    
          </GridName>
    
          <GridID>
    
            livegrid
    
          </GridID>
    
          <ZoneID>
    
            livezone
    
          </ZoneID>
    
          <GridLength>
    
            1
    
          </GridLength>
    
          <GridWidth>
    
            1
    
          </GridWidth>
    
          <GridNSPosition>
    
            N
    
          </GridNSPosition>
    
          <GridWEPosition>
    
            E
    
          </GridWEPosition>
    
          <GridLocation>
    
            <Vertex1>
    
              1
    
            </Vertex1>
    
            <Vertex2>
    
              1
    
            </Vertex2>
    
            <Vertex3>
    
              1
    
            </Vertex3>
    
            <Vertex4>
    
              1
    
            </Vertex4>
    
          </GridLocation>
    
          <SoilMoisture>
    
            53
    
          </SoilMoisture>
    
          <AmbientLight>
    
            0
    
          </AmbientLight>
    
        </Grid>
    
      </Create>
    
      <DeleteAll format="version,current">
    
        <MCUSensorModel>
    
          <sensorId ne=""/>
    
        </MCUSensorModel>
    
      </DeleteAll>
    
      <Save format="version,current">
    
        <!-- This will read -->
    
        <MCUSensorModel>
    
          <PerifParams>
    
            <Peripheral>
    
              serial
    
            </Peripheral>
    
            <Baudrate>
    
              115200
    
            </Baudrate>
    
            <InterfacePort>
    
              /dev/ttyUSB0
    
            </InterfacePort>
    
            <Interface>
    
              serial
    
            </Interface>
    
            <Format>
    
              ascii
    
            </Format>
    
            <Operation>
    
              receive
    
            </Operation>
    
            <UniqueId>
    
              76522
    
            </UniqueId>
            <Payload>
              $Null()
            </Payload>
          </PerifParams>
          <SensorData>
            $Null()
          </SensorData>
          <InitSubscribers>
            true
          </InitSubscribers>
        </MCUSensorModel>
      </Save>
    
      <DeleteAll format="version,current">
        <TempSensor>
          <sensorId ne=""/>
        </TempSensor>
      </DeleteAll>
      <Create>
        <TempSensor>
          <TempValue>
            0
          </TempValue>
          <ZoneID>
            livezone
          </ZoneID>
        </TempSensor>
      </Create>
    
      <DeleteAll format="version,current">
        <SoilSensorModel>
          <SoilSensorID ne=""/>
        </SoilSensorModel>
      </DeleteAll>
      <Create>
        <SoilSensorModel>
          <SoilMoisture>
            0
          </SoilMoisture>
          <GridID>
            livegrid
          </GridID>
        </SoilSensorModel>
      </Create>
    
      <DeleteAll format="version,current">
        <HumiditySensor>
          <sensorId ne=""/>
        </HumiditySensor>
      </DeleteAll>
      <Create>
        <HumiditySensor>
          <HumidityValue>
            0
          </HumidityValue>
          <ZoneID>
            livezone
          </ZoneID>
        </HumiditySensor>
      </Create>
    
      <DeleteAll format="version,current">
        <AmbientLightSensorModel>
          <AmbientLightID ne=""/>
        </AmbientLightSensorModel>
      </DeleteAll>
    
      <Create>
        <AmbientLightSensorModel>
          <AmbientLight>
            0
          </AmbientLight>
          <GridID>
            livegrid
          </GridID>
        </AmbientLightSensorModel>
      </Create>
    
      <DeleteAll>
        <PhilipLightManagerModel>
          <ManagerId ne=""/>
        </PhilipLightManagerModel>
      </DeleteAll>
    
      <Create>
        <PhilipLightManagerModel>
          <LoadLights>
            True
          </LoadLights>
        </PhilipLightManagerModel>
      </Create>
    
      <DeleteAll>
        <IrrigationMotor>
          <DeviceInterfaceIndex eq="0"/>
        </IrrigationMotor>
      </DeleteAll>
      <Save format="version,current">
        <IrrigationMotor>
          <ZoneID>
            livezone
          </ZoneID>
          <ServoProtocolURL>
            phid://
          </ServoProtocolURL>
          <PhidgetDeviceType>
            PhidgetAdvancedServo
          </PhidgetDeviceType>
          <DeviceInterfaceIndex>
            0
          </DeviceInterfaceIndex>
          <ServoAngle>
            90
          </ServoAngle>
        </IrrigationMotor>
      </Save>
    
      <Find format="All">
        <LightModel>
          <LightNumber ne=""/>
        </LightModel>
      </Find>
      <SetResponseData>
        <Key>
          Message.Value.Find.Result.LightModel.GridID.Value
        </Key>
        <Value>
          livegrid
        </Value>
      </SetResponseData>
      <Save>
        <From>
          Result
        </From>
        <Include>
          $Response.Message.Value.Find
        </Include>
      </Save>
    </Query>

MicroController (Pi) Init

  • We only need to initialize USB Camera and Data Model
Pi - Init Queries
<Query>
  <DeleteAll format="version,current">
    <Greenhouse>
      <GreenhouseID ne = ""/>
    </Greenhouse>
  </DeleteAll>
  <Create>
    <Greenhouse>
      <GreenhouseID>
        livegreenhouse
      </GreenhouseID>
      <GreenhouseName>
        Intel-GreenHouse
      </GreenhouseName>
      <BoundingBox>
        <Vertex1>
          0
        </Vertex1>
        <Vertex2>
          0
        </Vertex2>
        <Vertex3>
          110
        </Vertex3>
        <Vertex4>
          40
        </Vertex4>
      </BoundingBox>
      <LaneCount>
        3
      </LaneCount>
      <LaneWidth>
        110
      </LaneWidth>
      <ZoneLength>
        10
      </ZoneLength>
      <ZoneInLane>
        5
      </ZoneInLane>
      <ZoneCount>
        15
      </ZoneCount>
      <GHLength>
        110
      </GHLength>
      <GHWidth>
        40
      </GHWidth>
      <ExternalEnv>
        <Temperature>
          26
        </Temperature>
        <Humidity>
          53
        </Humidity>
        <Light>
          1
        </Light>
        <SoilMoisture>
          20
        </SoilMoisture>
        <Wind>
          19.5
        </Wind>
      </ExternalEnv>
      <InternalEnv>
        <Temperature>
          20
        </Temperature>
        <Humidity>
          53
        </Humidity>
        <Light>
          1
        </Light>
        <SoilMoisture>
          1
        </SoilMoisture>
      </InternalEnv>
      <GHLanes>
      </GHLanes>
      <SunnyDay>
        True
      </SunnyDay>
      <Location>
        <latitude>
          37.3718999
        </latitude>
        <longitude>
          -122.0022377
        </longitude>
      </Location>
    </Greenhouse>
  </Create>
  <DeleteAll format="version,current">
    <Lane>
      <LaneID ne = ""/>
    </Lane>
  </DeleteAll>
  <create>
    <Lane>
      <LaneID>
        livelane
      </LaneID>
      <GreenhouseID>
        livegreenhouse
      </GreenhouseID>
      <LaneName>
        lane-1
      </LaneName>
      <LaneLength>
        5
      </LaneLength>
      <LaneWidth>
        1
      </LaneWidth>
      <ZoneInLane>
        4
      </ZoneInLane>
      <BorderLane>
        1
      </BorderLane>
      <BoundingBox>
        <Vertex1>
          5
        </Vertex1>
        <Vertex2>
          28
        </Vertex2>
        <Vertex3>
          105
        </Vertex3>
        <Vertex4>
          38
        </Vertex4>
      </BoundingBox>
    </Lane>
  </create>
  <DeleteAll format="version,current">
    <Zone>
      <ZoneID ne = ""/>
    </Zone>
  </DeleteAll>
  <create>
    <Zone>
      <ZoneID>
        livezone
      </ZoneID>
      <ZoneName>
        Intel-Zone
      </ZoneName>
      <LaneID>
        livelane
      </LaneID>
      <ZoneLength>
        1
      </ZoneLength>
      <ZoneWidth>
        1
      </ZoneWidth>
      <ZoneLocation>
        <Vertex1>
          1
        </Vertex1>
        <Vertex2>
          1
        </Vertex2>
        <Vertex3>
          1
        </Vertex3>
        <Vertex4>
          1
        </Vertex4>
      </ZoneLocation>
      <EndZone>
        endzone
      </EndZone>
      <GridOnLength>
        1
      </GridOnLength>
      <GridOnWidth>
        1
      </GridOnWidth>
      <GridCount>
        1
      </GridCount>
      <GridLength>
        1
      </GridLength>
      <GridWidth>
        1
      </GridWidth>
      <ZoneTemperature>
        26
      </ZoneTemperature>
      <ZoneHumidity>
        53
      </ZoneHumidity>
      <ZoneAvgSM>
        20
      </ZoneAvgSM>
      <ZoneAvgLight>
        2
      </ZoneAvgLight>
      <CropType>
        Apple
      </CropType>
      <SeedingDate>
        11-04-2016
      </SeedingDate>
      <LastFertilisationDate>
        14-04-2016
      </LastFertilisationDate>
      <HarvestingSeason>
        April
      </HarvestingSeason>
      <NoOfPlants>
        5
      </NoOfPlants>
      <VPD>
        0
      </VPD>
      <Location>
        <latitude>
          1.11
        </latitude>
        <longitude>
          1.12
        </longitude>
      </Location>
      <Live>
        yes
      </Live>
    </Zone>
  </create>
  <DeleteAll format="version,current">
    <Grid>
      <GridID ne=""/>
    </Grid>
  </DeleteAll>
  <create>
    <Grid>
      <GridName>
        Intel-Grid
      </GridName>
      <GridID>
        livegrid
      </GridID>
      <ZoneID>
        livezone
      </ZoneID>
      <GridLength>
        1
      </GridLength>
      <GridWidth>
        1
      </GridWidth>
      <GridNSPosition>
        N
      </GridNSPosition>
      <GridWEPosition>
        E
      </GridWEPosition>
      <GridLocation>
        <Vertex1>
          1
        </Vertex1>
        <Vertex2>
          1
        </Vertex2>
        <Vertex3>
          1
        </Vertex3>
        <Vertex4>
          1
        </Vertex4>
      </GridLocation>
      <SoilMoisture>
        53
      </SoilMoisture>
      <AmbientLight>
        0
      </AmbientLight>
    </Grid>
  </create>
  <DeleteAll>
    <Camera>
      <CameraID ne=""/>
    </Camera>
  </DeleteAll>
  <Save>
    <Camera>
      <ZoneID>
        livezone
      </ZoneID>
      <Image>
        $Null()
      </Image>
      <USBCameraParameters>
        <Size>
          <Height>
            0
          </Height>
          <Width>
            0
          </Width>
        </Size>
        <Configuration>
          <Channel>
            0
          </Channel>
          <Standard>
            0
          </Standard>
          <Brightness>
            0
          </Brightness>
          <Contrast>
            0
          </Contrast>
          <Gamma>
            286
          </Gamma>
          <Saturation>
            65
          </Saturation>
          <Sharpness>
            6
          </Sharpness>
          <Hue>
            0
          </Hue>
          <Gain>
            0
          </Gain>
          <Quality>
          </Quality>
        </Configuration>
        <SaveToDisk>
          true
        </SaveToDisk>
        <ImageFormat>
          jpeg
        </ImageFormat>
        <ImageName>
          ucam_testpic.jpeg
        </ImageName>
      </USBCameraParameters>
    </Camera>
  </Save>
</Query>

Cluster Definition

  • Same Network definition in all the nodes participating in the cluster.

    Create Network FacetInstance
    <!-- Define Cluster / Network -->
    <NewFacetInstance fid="cluster" name="cluster" type="SffNetworkFacet">
    		<OnActivate>
    			<Process>
    				<Network>
    					<Group name="GHCloudGroup" />
    					<TqlEngine name="Cloud" url="ws://52.39.105.254:8080/fid-cluster"
    						group="GHCloudGroup" documentation="GH Cloud Summary Holder" />
    					<Group name="GHLiveGroup" />
    					<TqlEngine name="GHLive" url="ws://10.0.1.35:8080/fid-cluster"
    						group="GHEdgeGroup" replicateTo="GHCloudGroup" documentation="Live Holder" />
    				</Network>
    			</Process>
    		</OnActivate>
    		<OnOpen ModifyPipeline="WsServerExtensionArgs" />
    </NewFacetInstance>

    Attach the network facet to TQL Facet Type

    Attach Network Facet to TQL Facet
    <!-- Attach Network Facet to TQL Facet -->
    <NewFacetInstance fid="[:RuntimeParams.FacetIDName:]"
    		Name="TQL" Type="SffTqlFacet">
    		<OnActivate>
    			<Include>[:GetProjectModelsMacro:]</Include>
    			<Include>[:InstantiateModelMacro:]</Include>
    			<NewFacetInstance name="tqlwf" type="SffWdlFacet" />
    			<TopicFacet>?TQLGenericTopic</TopicFacet>
    			<NetworkFacet>?cluster</NetworkFacet>
        ....
    </NewFacetInstance>