Copy of Introduction

If you have not heard of TQL before, here is a useful overview on WHY TQL.

The application you write using TQL is called a TQL application, and here is the structure:

 

In short, TQL Studio is the entry to your TQL account. You create projects in the TQL Studio, and deploy them onto TQLEninges to run. You can run TQLEngines on your local computer, Raspberry Pi, Gateway, or cloud, or use the TQLEngine instance from sandbox we provide.

You can directly deploy your projects to your local computer, or to computers with public IP addresses. Alternatively, you can export your project and then import to a local TQLEngine which runs on a computer without public IP address.

In this set of tutorials, we will use TQL to build a Smart Greenhouse, with sensors, actuators, thing models, data models and application models. 

Now let's create a TQLStudio account and look at a sample project. We will download and install TQLEngine at the end of this session.

TQLStudio account creation

Try out a sample project from TQLStudio

For Class3, find the summary of schedule here.

If you followed steps, you will have seen the source code for a sample temperature sensor ThingModel and ThingFacet. This project that you have imported and tried has the following structure:

 

 More details on project and project structure

Project

A Project is a logical name or entity that contains list of all the resources that is created at the time of model definition. Note that a Project is NOT a TQL or Atomic Domain Language construct. It is a concept used in TQLStudio to make the process of creating and managing the models simpler for developers. The project concept can be used as a design pattern when developing models without using TQLStudio's model editor.

Here is the development process to create applications using TQL.

Project Structure

Subdirectory NamePurposeCreated ByAuto generated?
cmodels

Complete Model Definitions. Consists of single file CModel.dbm.xml which holds

entire model content of the project (facets, models, macros).

Model EditorNo. The content is written by Model Developers either through the source code editor window or Model Editor Grammar Palette.
deploy

Contains default A-Stack Package Definition for your project. After the project is deployed

a single GenericTQLInterface.mqp.xml is automatically generated by the TQLStudio / ThingSpaces /Deploy

(or) A-Stack / ThingSpaces / Deploy.

Thing Spaces/

Deploy

Yes. The parameterized content is provided by model developers using Project Settings.
facets

Contains list of all ThingFacet(s) and AppFacet(s). There is one single file for each ThingFacet / AppFacet definition

that is found when creating models. ThingFacets are stored in files that end with <FacetName>.tf.xml and AppFacets

are stored in files end with <FacetName>.af.xml

Model Editor

(Split Models Option)

Yes. But the content is provided by model developers.
modelsContains list of ThingModel, DataModel, AppModel. There is one single file with <ProjectName>.dbm.xml.

Model Editor

(Split Models Option)

Yes. But the content is provided by model developers.
macros

Contains list of all the Macro definitions founds at the time of creating models. There is one single file with <MacroName>.mc.xml

created.

Model Editor

(Split Models Option)

Yes. But the content is provided by model developers.
tqlsContains list of all the TQL Queries thatQuery EditorNo
spaces
Thing Spaces / InstantiateYes. The Create / Save TQL Statements are generated based on content provided by Model Developers for against the model definition (either manually or import csv file)

Project Export / Import

Export: Project Content can be exported from the TQLStudio using Export option provided as part of Project Settings. Once project is exported a compresses zip file is sent to registered developer's email account. The Zip file is sent as a downloadable URL. The zip file contains:

  • Zip File Name: <UniqueID given to your project>.zip
  • Subdirectories (cmodels, deploy, facets, macros, tqls, spaces, models) with individual files

Import: Once the project is exported from TQLStudio, the content can be imported into your locally installed A-Stack. A-Stack can be installed on micro controllers (Raspberry pi), your development laptops, edge gateways, public or private clouds.

Note: Once the project is exported and imported into your local A-Stack any edits that are made on the local copy are NOT synced back with the version of models that are on the TQLStudio. It is developers responsibility to ensure project versions of models are source controlled and reimported back into the studio for further editing.


Go to page

There are several key components in the sample project you tested from the TQLStudio. For example, you will see a ThingModel that "combines" a ThingFacet. The ThingFacet has a number of Attributes and an Action. You will know more about these concepts in the Greenhouse tutorial-1.

    ThingModel and ThingFacet

 Click here to expand

ThingFacet is a reusable TQL component that defines the software interactions with a "thing" and represent the "thing" in the software. A "thing" can be sensors, actuators, devices, or a particular aspect or function of a more complex machine. A ThingFacet has a name, Model Attributes and Actions.

Attributes

Attributes are containers of values. They can be used for the following purposes in ThingFacets:

(1) Store parameters required to make a protocol specific invocation to the thing, such as <String Name="InterfacePort"/>

(2) Store information received from the thing, such as <Number Name="TempValue"/> (The TempValue from the temperature sensor)

(3) Hold fixed information about the thing, such as <String Name="Unit" default="Celsius"/>

(4) Act as control variables - variable that can activate certain actions. They are called "actionable attributes". Actionable attributes are linked with one or more actions in the same ThingFacet by a modifier "KnownBy". For example: <Number Name="TempValue" KnownBy="SerialReadAction"/>

Actions

Action is where the processes to interact with things are defined.


An example of Camera ThingFacet.

Go to page

You have also tried TQL Queries from the sample project you tested from the TQLStudio. In TQL, queries can cause actuation on things via CRUD operations on data. This is a unique cornerstone feature by TQL.

Finally, let's go ahead and download and install TQLEngine on your local environment.