Digital Twins: Analyst Gartner has recently released 2018 Technology Trends. Along with expected technologies like Artificial Intelligence, Immersive User Experiences, Blockchain..one import trend is about Digital Twin.
As the name suggest is Digital Twin is the Digital representation of a real world entity, typically available in Cloud and maintains the current status about the Device along with its properties. As it reduces the need to Query the Physical Device (which is generally costly and subject to connectivity issues), Digital Twins find lot of value in Asset Management of large machinery , especially in reducing the Maintenance and Repair Operations. Also Device twins facilitate Remote Management of machinery making them more efficient.
Digital Twins practically can extend any industry, starting with Smart Cities, Government, Manufacturing, Healthcare, Retail and more.
BigchainDB As Asset Management Solution : BigchainDB is a scalable database with Blockchain characteristics. As mentioned in my previous articles, BigchainDB while can be used for many situations, one of the important use case being 'Asset Registrations and Transfers'. When you make a CREATE transaction in BigChainDB it registers an Asset and tags it with the respective metadata. BigchainDB subsequently tracks the Asset ownership till its life time.
Azure Iot Hub : IoT hub is part of Azure's IoT services and provides secure bi-directional connectivity to Devices. It provides Per Devices Authentication and Secure Connectivity. IoT Hub also provides options to send configuration and maintenance operations to Device and in turn record the status of Devices after those operations.
So considering the use cases of above 2 products it would be worth while to implement Digital Twins (Device Twins) using BigChainDB and Azure IoT Hub.
Scenario : Consider a Scenario where a large Crane Manufacturer , leases cranes to be used by various real estate builders and other organizations. In this scenario BigChainDB is used to maintain the larger Device Specifications about the Crane itself and also maintain the current lessee (owner). The specific agreements for the usage and other legal and regulatory compliance of the Crane can be maintained in a blockchain network like BigchainDB. However the crane is also monitored for functional efficiencies using IoT and status of the crane is updated in real time to Azure IoT Hub. Now the following piece of implementation will link both Bigchain DB and IoT Hub and will show cause the value of Digital Twins.
Register Device In BigchainDB :
bdb_root_url = 'http://localhost:9984' # Use YOUR BigchainDB Root URL here
bdb = BigchainDB(bdb_root_url)
crane_asset = {
'data': {
'crane': {
'manufacturer':'crane manufacturer',
'model': 'my model',
'engine':{
'model':'engine model',
'type':'4 cycle, 6 cylinder',
'pistondisplacement':'12000',
'maxoutput':'100'
},
'tires':{
'front':'12R22',
'rear':'12R22'
},
'tankcapacity':'300L',
'performance':{
'maxtravellingspeed':'64km/h',
'gradeability':'65'
},
'frontjack':{
'floatsize':'250'
},
},
},
}
crane_asset_metadata = {
'currentlocation': 'new york'
}
prepared_creation_tx = bdb.transactions.prepare(
operation='CREATE',
signers=crane_owner_public,
asset=crane_asset,
metadata=crane_asset_metadata
)
fulfilled_creation_tx = bdb.transactions.fulfill(
prepared_creation_tx,
private_keys=crane_owner_private
)
sent_creation_tx = bdb.transactions.send(fulfilled_creation_tx)
The above piece of code creates the initial registration of the Crane. While the set of metadata is not an exhaustive set of attributes for a crane it does provide an idea about how a Device's meta data will be maintained in the BigchainDB along with the information about current owner.
Now let us assume that after registration, BigChainDB creates a DeviceID as follows.
Create Azure Iot Hub: Azure IoT Hub is quite easy to create from Azure Portal, the following screen shot shows an implementation of Azure IoT Hub.
The Important values to look are the Shared Access Policies which provides connectivity and authentication information for connecting to this IoT Hub.
Register the Device Created In BigChainDB with Azure IoT Hub;
As the name suggest is Digital Twin is the Digital representation of a real world entity, typically available in Cloud and maintains the current status about the Device along with its properties. As it reduces the need to Query the Physical Device (which is generally costly and subject to connectivity issues), Digital Twins find lot of value in Asset Management of large machinery , especially in reducing the Maintenance and Repair Operations. Also Device twins facilitate Remote Management of machinery making them more efficient.
Digital Twins practically can extend any industry, starting with Smart Cities, Government, Manufacturing, Healthcare, Retail and more.
BigchainDB As Asset Management Solution : BigchainDB is a scalable database with Blockchain characteristics. As mentioned in my previous articles, BigchainDB while can be used for many situations, one of the important use case being 'Asset Registrations and Transfers'. When you make a CREATE transaction in BigChainDB it registers an Asset and tags it with the respective metadata. BigchainDB subsequently tracks the Asset ownership till its life time.
Azure Iot Hub : IoT hub is part of Azure's IoT services and provides secure bi-directional connectivity to Devices. It provides Per Devices Authentication and Secure Connectivity. IoT Hub also provides options to send configuration and maintenance operations to Device and in turn record the status of Devices after those operations.
So considering the use cases of above 2 products it would be worth while to implement Digital Twins (Device Twins) using BigChainDB and Azure IoT Hub.
Scenario : Consider a Scenario where a large Crane Manufacturer , leases cranes to be used by various real estate builders and other organizations. In this scenario BigChainDB is used to maintain the larger Device Specifications about the Crane itself and also maintain the current lessee (owner). The specific agreements for the usage and other legal and regulatory compliance of the Crane can be maintained in a blockchain network like BigchainDB. However the crane is also monitored for functional efficiencies using IoT and status of the crane is updated in real time to Azure IoT Hub. Now the following piece of implementation will link both Bigchain DB and IoT Hub and will show cause the value of Digital Twins.
Register Device In BigchainDB :
bdb_root_url = 'http://localhost:9984' # Use YOUR BigchainDB Root URL here
bdb = BigchainDB(bdb_root_url)
crane_asset = {
'data': {
'crane': {
'manufacturer':'crane manufacturer',
'model': 'my model',
'engine':{
'model':'engine model',
'type':'4 cycle, 6 cylinder',
'pistondisplacement':'12000',
'maxoutput':'100'
},
'tires':{
'front':'12R22',
'rear':'12R22'
},
'tankcapacity':'300L',
'performance':{
'maxtravellingspeed':'64km/h',
'gradeability':'65'
},
'frontjack':{
'floatsize':'250'
},
},
},
}
crane_asset_metadata = {
'currentlocation': 'new york'
}
prepared_creation_tx = bdb.transactions.prepare(
operation='CREATE',
signers=crane_owner_public,
asset=crane_asset,
metadata=crane_asset_metadata
)
fulfilled_creation_tx = bdb.transactions.fulfill(
prepared_creation_tx,
private_keys=crane_owner_private
)
sent_creation_tx = bdb.transactions.send(fulfilled_creation_tx)
The above piece of code creates the initial registration of the Crane. While the set of metadata is not an exhaustive set of attributes for a crane it does provide an idea about how a Device's meta data will be maintained in the BigchainDB along with the information about current owner.
Now let us assume that after registration, BigChainDB creates a DeviceID as follows.
Crane Device Id In BigchainDB : 9da06f5a07c3d8a3ae27cd9d5bb7019ec276651d0d49fc4275d2771834b344c2
Create Azure Iot Hub: Azure IoT Hub is quite easy to create from Azure Portal, the following screen shot shows an implementation of Azure IoT Hub.
The Important values to look are the Shared Access Policies which provides connectivity and authentication information for connecting to this IoT Hub.
Register the Device Created In BigChainDB with Azure IoT Hub;
The next step is to register the Device that is created in BigchainDB with Azure IoT Hub, so that it provides a link between the two systems. Such that the Asset ownership and legal needs can be tracked using BigchainDB and the Device Telemetry and Remote Monitoring and Preventive Maintenance can be tracked using Azure IoT Services. However due to linkage of the metadata both the implementations can be viewed in sync.
var iothub = require('azure-iothub');
var connectionString = 'HostName=bigcazureiot.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=**********=';
var registry = iothub.Registry.fromConnectionString(connectionString);
var device = {
deviceId: '9da06f5a07c3d8a3ae27cd9d5bb7019ec276651d0d49fc4275d2771834b344c2'
}
registry.create(device, function(err, deviceInfo, res) {
if (err) {
registry.get(device.deviceId, printDeviceInfo);
}
if (deviceInfo) {
printDeviceInfo(err, deviceInfo, res)
}
});
deviceId: '9da06f5a07c3d8a3ae27cd9d5bb7019ec276651d0d49fc4275d2771834b344c2'
}
registry.create(device, function(err, deviceInfo, res) {
if (err) {
registry.get(device.deviceId, printDeviceInfo);
}
if (deviceInfo) {
printDeviceInfo(err, deviceInfo, res)
}
});
function printDeviceInfo(err, deviceInfo, res) {
if (deviceInfo) {
console.log('Device ID: ' + deviceInfo.deviceId);
console.log('Device key: ' + deviceInfo.authentication.symmetricKey.primaryKey);
}
}
if (deviceInfo) {
console.log('Device ID: ' + deviceInfo.deviceId);
console.log('Device key: ' + deviceInfo.authentication.symmetricKey.primaryKey);
}
}
Now the above code will create the device identity in Azure IoT Hub. While the code is self explanatory and uses the connectivity string as obtained under the 'shared access policies', the important thing to look into is about the Device Id.
Device ID can be any meaningful identity for the Device which will act as a primary key for the device, However in this case we have used the Asset ID that is created by BigchainDB and thus the linkage between the Asset representation for legality purposes and Device Representation from Telemetry perspective are linked.
After the above program is executed, you will find the Device is registered in IoT Hub with the same ID as established by BigchainDB.
Device Twins may provide much more benefits when it comes to large machinery whose maintenance and legal management of compliance needs are always complicated. This kind of solution involving BigchainDB and Azure IoT Hub may be of interest to enterprises.
This solution not only makes the Machinery Operations smarter with Device Telemetry, by linking with the Asset Management solution of BigchainDB, device ownership over a period and its history can be tracked and transparently available. This will help with lot of maintenance issues and associated legal compliances.
(Please note that in this post Device/Digital and Asset have been used interchangeably).
Very nice blog. This blog share complete information on digital twins. I really appreciate your knowledge. Thanks for sharing
ReplyDelete