...
- TQLEngine running in Private Subnet of VPC with Elastic IP Address
- Simply follow Download and install TQLEngine Steps.
- Import the Greenhouse Models
Initialization Variation
Cloud Initialization
- None
- Wait and watch!
Live Gateway Init
We only need to Initialize one things and data for 1 zone
Code Block language xml theme Emacs title Pi - Init Queries linenumbers true collapse true <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
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<!-- 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> |
Cluster Definition
Same Network definition in all the nodes participating in the cluster.
Code Block language xml theme Emacs title Create Network FacetInstance linenumbers true collapse true <!-- Define Cluster / Network --> <NewFacetInstance fid="cluster" name="cluster" type="SffNetworkFacet"> <OnActivate> <Process> <Network> <Group name="GHCloudGroup" /> <TqlEngine name="Cloud" url="ws://ghsim52.39.atomiton105.com254: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
Code Block language xml theme Emacs title Attach Network Facet to TQL Facet linenumbers true collapse true <!-- 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>