Thing Model

2022-07-19
No Rating

Introduction

A thing model refers to digitizing an entity in physical space and building a data model of that entity in the cloud. In the IoT platform, defining the thing model means defining the product function. After finishing the function definition, the system will automatically generate the thing model of the product. The thing model describes what the product is, what it can do, and what services it can provide to the public.

The Thing Model TSL (Thing Specification Language) is a JSON formatted file. It is an entity in physical space, such as drones, cameras, airports, etc. In the cloud, the digital representation describes what the entity is, what it can do, and what information it can provide to the public in three dimensions: properties, services, and events. Once these three dimensions are defined, the definition of product functionality is completed.

TypeDescription
PropertyGenerally used to describe the state of a device when it is running. For example, aircraft attitude, battery level, camera mode, etc. Properties support GET and SET request methods, and the application can initiate requests to read and set the properties. Please note: The GET and SET methods of the corresponding properties are automatically generated when the properties are set, and do not need to be added additionally through Service.
ServiceCapabilities and methods that can be called externally by the device and can set input parameters and output parameters. Services can implement more complex business logic with a single instruction than properties, and there is no need to set Set or Get the contents of a Property.
EventEvents when the device is running. Events generally include notification that needs to be externally perceived and processed, and can include multiple output parameters. Such as the aircraft approaching the no-fly zone, device failure and other events. Events are generally subscribed by additional systems for alarms or subsequent processing actions.

Note: When the property is set, the GET and SET methods of the corresponding property will be automatically generated, and there is no need to add additionally through the Service.

Why We Need Thing Model

DJI, as a design manufacturer of smart space hardware, will have various types of hardware products not limited to drones, payloads, ground terminals, handheld devices, etc. The thing model is digital modeling of hardware devices from the perspective of their ability to be exposed to the user externally. After the devices are connected to the cloud, the mapping of the thing model enables the display of automatic interaction pages. Theoretically, with the enrichment of thing model parameter types, the cost of subsequent access to hardware is to be greatly reduced because the components and capabilities with the same attributes have been developed and can be directly reused, and consistency can be achieved across various different device front-end components.

At the same time, the thing model definition can shield the complex logic inside the hardware, which can help the user to focus more on the use, rather than the internal implementation details of the hardware, greatly enhancing the threshold of hardware access.

Thing Model File Specification

The thing model file of any product consists of four parts.

{
	"profile": {},		# indicates what the product is
	"properties": [],	# indicates what properties the product has
	"services": [],		# indicates the capabilities and methods of the product that can be called externally
	"events": []		# indicates what notification are available for this product that need to be perceived and processe
}

Data Triggering Mechanism

ChannelTypeTransmission mechanismFrequency
PropertiesPushMode = 0The device side will publish messages with a specific frequency.0.5 Hz
PropertiesPushMode = 1The device side will not publish at regular intervals. If the Property changes, it will be published to the server immediately.
PropertiesPushMode = 2The device side will not publish at regular intervals. If the Property changes, the server is not notified and needs to obtain it itself.
ServiceThe event is triggered. The cloud gets it through the service channel.
EventThe event is triggered. If the trigger event requirement defined by the thing model is met, the device side will notify actively.