Hi,
You can integrate MATLAB/Simulink with Azure Digital Twins (ADT) for your use case i.e. reading parameters, running control simulations, and writing telemetry updates.
Connection between MATLAB and Azure ADT
- MATLAB can interact with Azure Digital Twins REST APIs directly using built-in HTTP functions.
- You can use MATLAB’s webread, webwrite, and weboptions functions to communicate with ADT endpoints for reading and updating twin properties or relationships.
Reading/Writing Telemetry and Parameters
- You can periodically poll or subscribe to ADT data to update your Simulink model inputs.
- After simulation, use webwrite to send updated telemetry (e.g., temperatures, valve positions) back to ADT in JSON format.
- MATLAB provides convenient JSON encoding via jsonencode and decoding via jsondecode.
Authentication with Azure
- To authenticate MATLAB with Azure ADT, you’ll need to acquire an OAuth 2.0 bearer token using Azure Active Directory (AAD).
- You can generate tokens programmatically using matlab.net.http.RequestMessage or external tools like the Azure CLI.
While there isn’t a direct example specifically for ADT, similar workflows exist for integrating MATLAB with other RESTful cloud services (e.g., AWS, ThingSpeak, Azure IoT). Here are a few references: