4 Create and Manage Device Policies
Oracle has simplified edge computing implementation on Oracle Internet of Things Cloud Service by letting you create and modify policies externally from the device application. You do not need to write or compile any code. Instead, you create policies on the Management Console that define the data to collect, the data computation(s) to perform, and the frequency of data transmission.
After you create your policy, it is transferred to the client library. Moving policies out of the device application to the client library reduces the size and complexity of the device application and reduces the amount of data sent by the device. With policies, data no longer needs to be sent over the network as it is generated. The policy instructs the edge device to compile the data and send it to the central server at a defined interval. By only sending important data, edge computing significantly reduces network traffic.
What is Edge Computing?
With edge computing, data computations are processed at the edge of the cloud as close to the originating source as possible. Instead of sending raw data to a central server for computation, basic data computations are done at the collection point. Moving basic computations closer to the originating source reduces the amount of data that is sent to a central server, reduces the computing power needed by the central server, and improves the speed of data computations.
Edge computing is an ideal solution if your IoT devices have poor or intermittent connectivity to the cloud, or your data processing is latency-sensitive. With edge computing, devices do not need to be constantly connected to the cloud and latency is reduced or eliminated by performing data processing at the source. More importantly, edge computing lets you respond to local events in near real-time and helps you resolve issues quickly.
A Use Case for Edge Computing
Consider a manufacturing enterprise with factories and machines. Sensors installed on production machinery help a manufacturing facility determine when production line equipment requires maintenance or replacement.
A critical component of the production line is a labelling machine. The labelling machine must have a constant supply of ink and the ink must be kept at a specific temperature. Sensors installed in the labelling machine liquid storage containers and the valves and pumps that move the ink constantly send sensor data to a central server. When the sensor data arrives at the central server, computations are performed on the data to determine if any action is required. A lot of data is constantly communicated back and forward from the labelling machine to the central server. A loss in communication can shut the labelling machine down and disrupt production.
With edge computing, the labelling machine is equipped with a local computing solution that performs all of the computations that are typically performed by the central server. All decision making is performed locally and a package of collated data is sent to the central server daily where it can be monitored and human intervention can occur as required.
Edge computing prevents a preventative shutdown of the labelling machine when a communication error occurs. Manufacturing operations continue for a much longer period and the likelihood of a production disruption is significantly reduced.
Before You Create and Use Device Policies
Useful information before you start creating device policies for your devices.
About Device Policies
- Make sure that the device policies when processing data validates that the data adheres to the device model rules, such as checking whether the range of the device data is valid.
- For accurate assigning of a device policy to a device, make sure that you have associated the device with the correct device model.
- A device can be associated with only one device policy at a time, which means that assigning a new policy to a device may remove the previously assigned policy.
- Using device policies may change the data transmitting from the device to the Cloud Service. It may stop and alter the data flow such as in
filter and summary
device policies. It may change the original data such as insummary
device policies. - Device policies may affect IoT analytics data by:
- Changing the timing of the device data coming into the server. For example, the Eliminate Duplicates function of a policy will eliminate duplicate device values.
- Changing the device data completely. For example, the Mean function of policy will send a calculated mean value of device values.
- Preventing device data from coming into the server. For example, the Filter Condition function of a policy will filter values, preventing some device values from coming into the server.
Create a Device Policy
Create a device policy to define the data to collect, to filter unimportant data, to perform data computation(s), and to specify the frequency of data transmission.
A device model can contain one or more policies but a device can belong to only one policy at a time. Each policy contains one or more functions that form a policy pipeline. The functions will process the device data in the order of their occurrence in the pipeline. A function can filter and alter some or all of the device data before the subsequent function in the pipeline processes that data.
Assign a Policy to a Device
Assign a policy to a device to make the device return the data specified in the policy.
Add a Policy Function
Add a policy function to perform an additional data computation on the device to which the policy is assigned.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select a device policy.
- Click Add Device Function (
) in the Function area.
- Select one of these functions in the Function list:
-
Action Condition: Select this option to invoke an action when the specified condition is true.
-
Alert Condition: Select this option to generate an alert when the specified condition is true.
-
Computed Metric: Select this option to compute a value from the specified formula.
-
Detect Duplicates: Select this option to generate an alert when a duplicate attribute value occurs within the specified period.
-
Eliminate Duplicates: Select this option to delete any message containing a duplicate attribute within the specified period.
-
Filter Condition: Select this option to filter data when the specified condition is true.
-
Max: Select this option to capture the maximum value for the specified period.
-
Mean: Select this option to capture the average value for the specified period.
-
Min: Select this option to capture the minimum value for the specified period.
-
Sample Quality: Select this option to take a data sample at the specified rate.
-
Standard Deviation: Select this option to calculate a standard deviation for the specified period.
-
- To insert a formula for the Condition field of the functions, see Use the Formula Editor.
- Click OK.
- Click Save.
- (Optional) Click Back to return to the device model list.
Add Attributes to a Policy
Add attributes to a policy to request additional data from the device to which the policy is assigned.
Edit Policy Details
Use the Edit Policy dialog to change the policy name and description.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select a device policy.
- Click Edit (
).
- Enter a name or an optional description for the policy, and then click OK.
- Click Save.
- (Optional) Click Back to return to the device model list.
Edit Policy Function Settings
Edit policy function settings to update the settings for the policy. For example, you can change the severity setting or the alert trigger.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select a device policy.
- Click Edit (
) in the Function area.
- Update the policy function settings.
- Click OK.
- Click Save.
- (Optional) Click Back to return to the device model list.
Increase or Decrease Device Policy Priority
Increase the device policy priority to assign the selected device policy precedence over the device policies that follow it. Decrease a device policy to reduce its precedence over the device policies that precede it.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select a device policy.
- Select one of these options:
- Click Decrease Priority (
) to decrease the priority of the device policy.
- Click Increase Priority (
) to increase the priority of the device policy.
- Click Decrease Priority (
- Click Save.
- (Optional) Click Back to return to the device model list.
Delete a Policy Function
Delete a policy function when it is no longer required.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select a device policy.
- Click Delete Device Function (
) in the Function area.
- Update the policy function settings.
- Click Delete.
- Click Save.
- (Optional) Click Back to return to the device model list.
Delete a Policy
Delete a policy when it is no longer required. When a policy is deleted, the device that used the policy is assigned the next available policy in the order defined on the Device Policies dashboard.
- Sign in to the Oracle Internet of Things Cloud Service Management Console.
- Click Menu (
) next to Oracle Internet of Things Cloud Service.
- Select Devices and then select Model.
- Select a device model in the device model list.
- Click Device Policies (
).
- Select the policy that you wish to delete and click Delete (
).
- To confirm, click Delete.
- (Optional) Click Back to return to the device model list.
Enable Device Policies
Use the Disabled slider button to enable a device policy to which device filters have been added. When required, you can use the same slider button to disable the device policy.
Use the Formula Editor
Use the formula editor to define an expression that evaluates a condition for a function of a device attribute. The function becomes a part of the policy pipeline.
The formula editor appears with a function associated with a device attribute. You can build your expression using the elements of the formula editor.
The following example shows a condition that validates if an attribute value is not equal to a specific number. In this example, the formula editor was used to select humidity as the attribute, != as the operator, and 13 as the numeric value.
![Add Policy Pipeline dialog box for a function of a device policy Add Policy Pipeline dialog box for a function of a device policy](img/formula_editor.png)
Start building your formula by selecting properties, functions or operators from the formula menu.
The image displays the elements of the formula editor explained after the image.
- Parenthesis: Use parenthesis to group operations and indicate precedence.
- Boolean: Use boolean to select true or false in the expression.
- Number: Use number to enter a numeric value.
- Text: Use text to enter alphabetic characters.
- Property: A list of attributes that you can use to build your own expression. This list is based on the device model attributes and function that you selected. Click property to select an attribute from a list of attributes.
- Functions: Use functions to select the
UPPER
orLOWER
functions. - Operators: You can use arithmetic (
), relational (+, -, *, /
), and logic (=, <, >, <=, >=, !=
) operators.AND, OR, LIKE