Create a Model for Battery Devices for Device Integration¶
When integrating devices into the IoT, a model needs to be created to abstract functions across dimensions such as attributes, measurement points, commands, and events. This tutorial will guide you on how to configure a model for smart devices. The constructed model will be used for device integration.
Job Description¶
This job uses the battery device integration scenario as an example to guide device integration and management personnel in configuring and using model management for battery devices before their integration.
Operation Personnel |
Operation Location |
---|---|
Device Integration and Management Personnel |
Application Portal |
The overall process includes:
Predefine Model Elements
Create Model
Configure Model
Prerequisites¶
Before starting, ensure the following:
You have registered a personal or corporate account on EnOS to access the Application Portal.
The account has been assigned the necessary permissions to create models. For more information, refer to Model Management Permission Assignment。
The model elements which need to be referenced multiple times have been identified, and the general steps for model design have been determined. For more information on model design, refer to Model Design.
Step 1: Predefine Model Elements¶
In this job, the model element which needs to be referenced multiple times is the brand of the battery device.
Log in to the Application Portal, select the target application, and navigate to Model Element Library.
In the top-left corner, click Custom Elements > Features > Create Features. On the Create Feature page, configure the following information as prompted, including.
Type
Name
Identifier
Data Type
Maximum Length
Description
Attribute
brand
brand
String
64 characters
Information about the device’s brand
Select Save to complete the predefined model element.
Step 2: Create Model¶
In the Developer Console of the Application Portal, select Model.
Click Custom Model > Create Model in the top left of the page and configure the model attributes as prompted, including:
Group: Custom
Name: battery
Business Identifier: battery
Model Purpose: Device Integration
Description: Battery Model
Note
Models under the Custom group are only available to the current OU. The model created in this job is project-specific and does not need to be shared with other OUs. To share the model with other OUs, contact your enterprise tenant administrator to request a model group and select the corresponding model group in this step. For detailed steps on sharing models, refer to Sharing Models.
Select Configure Model to enter the configuration page.
Step 3: Configure Models¶
On the model definition page, click Create > Features, and create the following measurement points in the Create Feature window:
Type
Name
Identifier
Measurement Point Type
Data Type
Description
Measurement Point
temperature
temperature
AI
double
Measurement point for collecting the device’s temperature
On the model definition page, click Create > Commands, and create the following command in the Create Command window:
Type: Command
Name: Control Device Charging State
Identifier: control_charging
Input/Output Parameters:
Parameter Type
Parameter Name
Identifier
Data Type
Input
result
result
Int
Output
point1
point1
Int
Return to the model definition page, click … > Reference to the right of Create, and reference the following attribute in the Reference Feature window:
Name: brand
Identifier: brand
Click Next > Confirm to save the referenced attributes.
Next¶
After completing this job, proceed to configure the integration information for the battery device. When creating the product, check the battery model. For specific operations, refer to Connect Simulated Devices to EnOS.