The bootstrap of the usecase that allows to deploy the WoDT Platform and the involved HWoDT-compliant Digital Twins. The scenario is about controlling traffic lights in a city to create a "green-route" for the ambulance.
images from https://www.flaticon.com/
- Make sure you have a running and active version of Docker and docker compose.
- Clone the repo
- Create a
.env
file in the root directory with the following variables:PLATFORM_EXPOSED_PORT
: the port where the Smartcity WoDT Digital Twins Platform expose its servicesAMBULANCE_SIGNALR_NEGOTIATION_URL
: Azure SignalR Negotiation url for the Ambulance Digital TwinAMBULANCE_SIGNALR_TOPIC_NAME
: the topic name used to publish events on SignalR for the Ambulance Digital TwinAMBULANCE_DIGITAL_TWIN_URI
: the uri of the exposed WoDT Digital Twin for the Ambulance Digital TwinAMBULANCE_EXPOSED_PORT
: the port where the Ambulance Digital Twin expose its servicesAMBULANCE_AZURE_CLIENT_ID
: ID of the Azure AD application for the Ambulance Digital TwinAMBULANCE_AZURE_TENANT_ID
: ID of the application's Azure AD tenant for the Ambulance Digital TwinAMBULANCE_AZURE_CLIENT_SECRET
: the Azure application's client secret for the Ambulance Digital TwinAMBULANCE_AZURE_DT_ENDPOINT
: the Azure Digital Twins instance endpoint for the Ambulance Digital TwinAMBULANCE_AZURE_DT_ID
: the id of the Digital Twin on Azure Digital Twins for the Ambulance Digital TwinAMBULANCE_PHYSICAL_ASSET_ID
: the Id of the Physical Asset for the Ambulance Digital TwinTRAFFIC_LIGHT_A_EXPOSED_PORT
: the port where the Traffic Light A Digital Twin expose its servicesTRAFFIC_LIGHT_A_PHYSICAL_ASSET_ID
: the Physical Asset Identifier for the Traffic Light A Digital TwinTRAFFIC_LIGH_A_PLATFORM_URL
: the url of the WoDT Digital Twins Platform to register for the Traffic Light A Digital TwinTRAFFIC_LIGHT_B_EXPOSED_PORT
: the port where the Traffic Light B Digital Twin expose its servicesTRAFFIC_LIGHT_B_PHYSICAL_ASSET_ID
: the Physical Asset Identifier for the Traffic Light B Digital TwinTRAFFIC_LIGH_B_PLATFORM_URL
: the url of the WoDT Digital Twins Platform to register for the Traffic Light B Digital TwinTRAFFIC_LIGHT_C_EXPOSED_PORT
: the port where the Traffic Light C Digital Twin expose its servicesTRAFFIC_LIGHT_C_PHYSICAL_ASSET_ID
: the Physical Asset Identifier for the Traffic Light C Digital TwinTRAFFIC_LIGHT_C_PLATFORM_URL
: the url of the WoDT Digital Twins Platform to register for the Traffic Light C Digital TwinINTERSECTION_EXPOSED_PORT
: the port where the Intersection Digital Twin expose its servicesTRAFFIC_LIGHT_A_URI
: the URI of the Traffic Light A Digital TwinTRAFFIC_LIGHT_B_URI
: the URI of the Traffic Light B Digital TwinINTERSECTION_PLATFORM_URL
: the url of the WoDT Digital Twins Platform to register for the Intersection Digital TwinGITHUB_PACKAGES_USERNAME
: GitHub Packages UsernameGITHUB_PACKAGES_PASSWORD
: GitHub Packages Password
- Run the following command:
docker-compose up -d
- Start observing the Platform KG of the Smart City WoDT Platform;
- Retrive the DTD and play with the
switch
action of the traffic light A and B (this allow to send the traffic lights current status to the platform); - Retrieve the ambulance DT DTD;
- Add the ambulance DT to the Platform to include it in the Smart City DT ecosystem;
- Create the relationship between the ambulance DT and the intersection DT (to simulate an ambulance approaching an intersection) -- how relationships are managed in Azure-based DT is described in the ambulance DT repository;
- now you should notice an update in the Platform KG
- Perform the following SPARQL query on the Smart City Platform to understand which traffic lights are interested and their available actions;
PREFIX smc: <https://smartcityontology.com/ontology#> PREFIX wodt: <https://purl.org/wodt/> SELECT ?trafficLight ?availableAction WHERE { <ambulance cached uri> smc:isApproaching ?intersection . ?intersection smc:containsTrafficLight ?trafficLight . ?trafficLight wodt:availableActionId ?availableAction . }
- Obtain the DTD of the involved traffic lights to understand how to invoke actions;
- Invoke the preferred and available action based on your logic.