Skip to content

Commit 303c4e2

Browse files
authored
Merge pull request #88900 from KingdomOfEnds/dt-refresh-tutorials
DT tutorials refresh
2 parents 0e22a2c + 0fcf9a0 commit 303c4e2

File tree

8 files changed

+27
-22
lines changed

8 files changed

+27
-22
lines changed

articles/digital-twins/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ landingContent:
4545
url: tutorial-facilities-udf.md
4646
- text: Notify with Logic Apps
4747
url: tutorial-facilities-events.md
48-
- text: Visualize events with TSI
48+
- text: Visualize events with Time Series Insights
4949
url: tutorial-facilities-analyze.md
5050

5151
- title: Develop with Azure Digital Twins
13.7 KB
Loading
-5.63 KB
Loading
-54.2 KB
Loading

articles/digital-twins/tutorial-facilities-analyze.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ author: alinamstanciu
66
ms.custom: seodec18
77
ms.service: digital-twins
88
ms.topic: tutorial
9-
ms.date: 08/05/2019
9+
ms.date: 09/23/2019
1010
ms.author: alinast
11+
#Customer intent: As an Azure IoT developer, I want to walk through a sample application to learn how to analyze events from an Azure Digital Twins instance.
1112
---
1213

1314
# Tutorial: Visualize and analyze events from your Azure Digital Twins spaces by using Time Series Insights
@@ -33,6 +34,9 @@ This tutorial assumes that you have [configured](tutorial-facilities-setup.md) a
3334
- The [Digital Twins C# samples](https://github.com/Azure-Samples/digital-twins-samples-csharp) downloaded and extracted on your work machine.
3435
- [.NET Core SDK version 2.1.403 or later](https://www.microsoft.com/net/download) on your development machine to run the sample. Run `dotnet --version` to verify that the right version is installed.
3536

37+
> [!TIP]
38+
> Use a unique Digital Twins instance name if you're provisioning a new instance.
39+
3640
## Stream data by using Event Hubs
3741

3842
You can use the [Event Hubs](../event-hubs/event-hubs-about.md) service to create a pipeline to stream your data. This section shows you how to create your event hub as the connector between your Azure Digital Twins and Time Series Insights instances.
@@ -125,7 +129,7 @@ You can use the [Event Hubs](../event-hubs/event-hubs-about.md) service to creat
125129

126130
1. In the left pane of the [Azure portal](https://portal.azure.com), select **Create a resource**.
127131

128-
1. Search for and select a new **Time Series Insights** resource. Select **Create**.
132+
1. Search for and select a **Time Series Insights** General Availability (GA) resource. Select **Create**.
129133

130134
1. Enter a **Name** for your Time Series Insights instance, and then select your **Subscription**. Select the **Resource group** that you used for your Digital Twins instance, and your **Location**. Select **Next: Event Source** button or the **Event Source** tab.
131135

articles/digital-twins/tutorial-facilities-events.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ author: alinamstanciu
66
ms.custom: seodec18
77
ms.service: digital-twins
88
ms.topic: tutorial
9-
ms.date: 08/05/2019
9+
ms.date: 09/23/2019
1010
ms.author: alinast
11+
#Customer intent: As an Azure IoT developer, I want to walk through a sample application to learn how to capture events from a Azure Digital Twins space.
1112
---
1213

1314
# Tutorial: Receive notifications from your Azure Digital Twins spaces by using Logic Apps
@@ -34,6 +35,9 @@ This tutorial assumes that you have [configured](tutorial-facilities-setup.md) a
3435
- [.NET Core SDK version 2.1.403 or later](https://www.microsoft.com/net/download) on your development machine to run the sample. Run `dotnet --version` to verify that the right version is installed.
3536
- An Office 365 account to send notification e-mails.
3637

38+
> [!TIP]
39+
> Use a unique Digital Twins instance name if you're provisioning a new instance.
40+
3741
## Integrate events with Event Grid
3842

3943
In this section, you set up [Event Grid](../event-grid/overview.md) to collect events from your Azure Digital Twins instance, and redirect them to an [event handler](../event-grid/event-handlers.md) such as Logic Apps.

articles/digital-twins/tutorial-facilities-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ In the extracted sample folder, open the file **digital-twins-samples-csharp\dig
7676
- The **getAvailableAndFreshSpaces.cs** file gets the results of a custom function called a user-defined function.
7777
- The **createEndpoints.cs** file creates endpoints to interact with other services.
7878

79-
* The simulation sample **device-connectivity** simulates sensor data and sends it to the IoT hub that's provisioned for your Digital Twins instance. You'll use this sample in [the next tutorial after you provision your spatial graph](tutorial-facilities-udf.md#simulate). The sensor and device identifiers that you use to configure this sample should be the same as what you'll use to provision your graph.
79+
* The simulation sample **device-connectivity** simulates sensor data and sends it to the IoT hub that's provisioned for your Digital Twins instance. You'll use this sample in [the next tutorial after you provision your spatial graph](tutorial-facilities-udf.md#simulate-sensor-data). The sensor and device identifiers that you use to configure this sample should be the same as what you'll use to provision your graph.
8080

8181
### Configure the provisioning sample
8282

articles/digital-twins/tutorial-facilities-udf.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ author: alinamstanciu
66
ms.custom: seodec18
77
ms.service: digital-twins
88
ms.topic: tutorial
9-
ms.date: 08/16/2019
9+
ms.date: 09/20/2019
1010
ms.author: alinast
11+
#Customer intent: As an Azure IoT developer, I want to walk through a sample application to monitor a space using Azure Digital Twins.
1112
---
1213

1314
# Tutorial: Provision your building and monitor working conditions with Azure Digital Twins Preview
@@ -32,6 +33,9 @@ This tutorial assumes that you have [finished your Azure Digital Twins setup](tu
3233
- [.NET Core SDK version 2.1.403 or later](https://www.microsoft.com/net/download) on your development machine to build and run the sample. Run `dotnet --version` to verify that the right version is installed.
3334
- [Visual Studio Code](https://code.visualstudio.com/) to explore the sample code.
3435

36+
> [!TIP]
37+
> Use a unique Digital Twins instance name if you're provisioning a new instance.
38+
3539
## Define conditions to monitor
3640

3741
You can define a set of specific conditions to monitor in the device or sensor data, called *matchers*. You can then define functions called *user-defined functions*. User-defined functions execute custom logic on data that comes from your spaces and devices, when the conditions specified by the matchers occur. For more information, read [Data processing and user-defined functions](concepts-user-defined-functions.md).
@@ -45,25 +49,23 @@ Add the following matcher below the existing matchers. Make sure the keys are al
4549
dataTypeValue: Temperature
4650
```
4751
48-
This matcher will track the SAMPLE_SENSOR_TEMPERATURE sensor that you added in [the first tutorial](tutorial-facilities-setup.md).
49-
50-
<a id="udf"></a>
52+
This matcher will track the `SAMPLE_SENSOR_TEMPERATURE` sensor that you added in [the first tutorial](tutorial-facilities-setup.md).
5153

5254
## Create a user-defined function
5355

5456
You can use user-defined functions to customize the processing of your sensor data. They're custom JavaScript code that can run within your Azure Digital Twins instance, when specific conditions as described by the matchers occur. You can create matchers and user-defined functions for each sensor that you want to monitor. For more information, read [Data processing and user-defined functions](concepts-user-defined-functions.md).
5557

56-
In the sample provisionSample.yaml file, look for a section that begins with the type **userdefinedfunctions**. This section provisions a user-defined function with a given **Name**. This UDF acts on the list of matchers under **matcherNames**. Notice how you can provide your own JavaScript file for the UDF as the **script**.
58+
In the sample *provisionSample.yaml* file, look for a section that begins with the type **userdefinedfunctions**. This section provisions a user-defined function with a given **Name**. This UDF acts on the list of matchers under **matcherNames**. Notice how you can provide your own JavaScript file for the UDF as the **script**.
5759

5860
Also note the section named **roleassignments**. It assigns the Space Administrator role to the user-defined function. This role allows it to access the events that come from any of the provisioned spaces.
5961

60-
1. Configure the UDF to include the temperature matcher by adding or uncommenting the following line in the `matcherNames` node of the provisionSample.yaml file:
62+
1. Configure the UDF to include the temperature matcher by adding or uncommenting the following line in the `matcherNames` node of the *provisionSample.yaml* file:
6163

6264
```yaml
6365
- Matcher Temperature
6466
```
6567

66-
1. Open the file **src\actions\userDefinedFunctions\availability.js** in your editor. This is the file referenced in the **script** element of provisionSample.yaml. The user-defined function in this file looks for conditions when no motion is detected in the room and carbon dioxide levels are below 1,000 ppm.
68+
1. Open the file **src\actions\userDefinedFunctions\availability.js** in your editor. This is the file referenced in the **script** element of *provisionSample.yaml*. The user-defined function in this file looks for conditions when no motion is detected in the room and carbon dioxide levels are below 1,000 ppm.
6769

6870
Modify the JavaScript file to monitor temperature and other conditions. Add the following lines of code to look for conditions when no motion is detected in the room, carbon dioxide levels are below 1,000 ppm, and temperature is below 78 degrees Fahrenheit.
6971

@@ -130,15 +132,12 @@ Also note the section named **roleassignments**. It assigns the Space Administra
130132
if(carbonDioxideValue < carbonDioxideThreshold && !presence) {
131133
log(`${availableFresh}. Carbon Dioxide: ${carbonDioxideValue}. Presence: ${presence}.`);
132134
setSpaceValue(parentSpace.Id, spaceAvailFresh, availableFresh);
133-
134-
// Set up custom notification for air quality
135-
parentSpace.Notify(JSON.stringify(availableFresh));
136135
}
137136
else {
138137
log(`${noAvailableOrFresh}. Carbon Dioxide: ${carbonDioxideValue}. Presence: ${presence}.`);
139138
setSpaceValue(parentSpace.Id, spaceAvailFresh, noAvailableOrFresh);
140139

141-
// Set up custom notification for air quality
140+
// Set up custom notification for poor air quality
142141
parentSpace.Notify(JSON.stringify(noAvailableOrFresh));
143142
}
144143
```
@@ -177,7 +176,7 @@ Also note the section named **roleassignments**. It assigns the Space Administra
177176
> [!IMPORTANT]
178177
> To prevent unauthorized access to your Digital Twins Management API, the **occupancy-quickstart** application requires you to sign in with your Azure account credentials. It saves your credentials for a brief period, so you might not need to sign in every time you run it. The first time this program runs, and when your saved credentials expire after that, the application directs you to a sign-in page and gives a session-specific code to enter on that page. Follow the prompts to sign in with your Azure account.
179178

180-
1. After your account is authenticated, the application starts creating a sample spatial graph as configured in provisionSample.yaml. Wait until the provisioning finishes. It will take a few minutes. After that, observe the messages in the command window and notice how your spatial graph is created. Notice how the application creates an IoT hub at the root node or the `Venue`.
179+
1. After your account is authenticated, the application starts creating a sample spatial graph as configured in *provisionSample.yaml*. Wait until the provisioning finishes. It will take a few minutes. After that, observe the messages in the command window and notice how your spatial graph is created. Notice how the application creates an IoT hub at the root node or the `Venue`.
181180

182181
1. From the output in the command window, copy the value of `ConnectionString`, under the `Devices` section, to your clipboard. You'll need this value to simulate the device connection in the next section.
183182

@@ -186,8 +185,6 @@ Also note the section named **roleassignments**. It assigns the Space Administra
186185
> [!TIP]
187186
> If you get an error message similar to "The I/O operation has been aborted because of either a thread exit or an application request" in the middle of the provisioning, try running the command again. This might happen if the HTTP client timed out from a network issue.
188187

189-
<a id="simulate"></a>
190-
191188
## Simulate sensor data
192189

193190
In this section, you'll use the project named *device-connectivity* in the sample. You'll simulate sensor data for detecting motion, temperature, and carbon dioxide. This project generates random values for the sensors, and sends them to the IoT hub by using the device connection string.
@@ -204,9 +201,9 @@ In this section, you'll use the project named *device-connectivity* in the sampl
204201

205202
a. **DeviceConnectionString**: Assign the value of `ConnectionString` in the output window from the previous section. Copy this string completely, within the quotes, so the simulator can connect properly with the IoT hub.
206203

207-
b. **HardwareId** within the **Sensors** array: Because you're simulating events from sensors provisioned to your Azure Digital Twins instance, the hardware ID and the names of the sensors in this file should match the `sensors` node of the provisionSample.yaml file.
204+
b. **HardwareId** within the **Sensors** array: Because you're simulating events from sensors provisioned to your Azure Digital Twins instance, the hardware ID and the names of the sensors in this file should match the `sensors` node of the *provisionSample.yaml* file.
208205

209-
Add a new entry for the temperature sensor. The **Sensors** node in appsettings.json should look like the following:
206+
Add a new entry for the temperature sensor. The **Sensors** node in *appsettings.json* should look like the following:
210207

211208
```JSON
212209
"Sensors": [{
@@ -246,7 +243,7 @@ The output window shows how the user-defined function runs and intercepts events
246243

247244
![Output for the UDF](./media/tutorial-facilities-udf/udf-running.png)
248245

249-
If the monitored condition is met, the user-defined function sets the value of the space with the relevant message, as we saw [earlier](#udf). The `GetAvailableAndFreshSpaces` function prints out the message on the console.
246+
If the monitored condition is met, the user-defined function sets the value of the space with the relevant message, as we saw [earlier](#create-a-user-defined-function). The `GetAvailableAndFreshSpaces` function prints out the message on the console.
250247

251248
## Clean up resources
252249

0 commit comments

Comments
 (0)