|
| 1 | +metadata description = 'This template deploys CRs that map to the boiler in the OPC simulator.' |
| 2 | + |
| 3 | +/*****************************************************************************/ |
| 4 | +/* Deployment Parameters */ |
| 5 | +/*****************************************************************************/ |
| 6 | + |
| 7 | +param customLocationName string |
| 8 | +param aioNamespaceName string |
| 9 | + |
| 10 | +/*****************************************************************************/ |
| 11 | +/* Existing AIO instance */ |
| 12 | +/*****************************************************************************/ |
| 13 | + |
| 14 | +resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = { |
| 15 | + name: customLocationName |
| 16 | +} |
| 17 | + |
| 18 | +resource namespace 'Microsoft.DeviceRegistry/namespaces@2025-07-01-preview' existing = { |
| 19 | + name: aioNamespaceName |
| 20 | +} |
| 21 | + |
| 22 | +/*****************************************************************************/ |
| 23 | +/* Asset */ |
| 24 | +/*****************************************************************************/ |
| 25 | + |
| 26 | +var assetName = 'boiler' |
| 27 | +var opcUaEndpointName = 'opc-ua-commander-0' |
| 28 | + |
| 29 | +resource device 'Microsoft.DeviceRegistry/namespaces/devices@2025-07-01-preview' = { |
| 30 | + name: 'opc-ua-commander' |
| 31 | + parent: namespace |
| 32 | + location: resourceGroup().location |
| 33 | + extendedLocation: { |
| 34 | + type: 'CustomLocation' |
| 35 | + name: customLocation.id |
| 36 | + } |
| 37 | + properties: { |
| 38 | + endpoints: { |
| 39 | + outbound: { |
| 40 | + assigned: {} |
| 41 | + } |
| 42 | + inbound: { |
| 43 | + '${opcUaEndpointName}': { |
| 44 | + endpointType: 'Microsoft.OpcUa' |
| 45 | + address: 'opc.tcp://opcplc-000000:50000' |
| 46 | + authentication: { |
| 47 | + method: 'Anonymous' |
| 48 | + } |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +resource asset 'Microsoft.DeviceRegistry/namespaces/assets@2025-07-01-preview' = { |
| 56 | + name: assetName |
| 57 | + parent: namespace |
| 58 | + location: resourceGroup().location |
| 59 | + extendedLocation: { |
| 60 | + type: 'CustomLocation' |
| 61 | + name: customLocation.id |
| 62 | + } |
| 63 | + properties: { |
| 64 | + displayName: assetName |
| 65 | + deviceRef: { |
| 66 | + deviceName: device.name |
| 67 | + endpointName: opcUaEndpointName |
| 68 | + } |
| 69 | + description: 'Multi-function boiler simulation.' |
| 70 | + |
| 71 | + enabled: true |
| 72 | + attributes: { |
| 73 | + manufacturer: 'Contoso' |
| 74 | + manufacturerUri: 'http://www.contoso.com/boilers' |
| 75 | + model: 'Oven-003' |
| 76 | + productCode: '12345C' |
| 77 | + hardwareRevision: '2.3' |
| 78 | + softwareRevision: '14.1' |
| 79 | + serialNumber: '12345' |
| 80 | + documentationUri: 'http://docs.contoso.com/boilers/manual' |
| 81 | + } |
| 82 | + |
| 83 | + datasets: [ |
| 84 | + { |
| 85 | + name: 'boiler-simple-write' |
| 86 | + dataPoints: [ |
| 87 | + { |
| 88 | + name: 'Boiler #2' |
| 89 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=5017' |
| 90 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 91 | + } |
| 92 | + { |
| 93 | + name: 'AssetId' |
| 94 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6195' |
| 95 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 96 | + } |
| 97 | + { |
| 98 | + name: 'DeviceHealth' |
| 99 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6198' |
| 100 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 101 | + } |
| 102 | + { |
| 103 | + name: 'Manufacturer' |
| 104 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6202' |
| 105 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 106 | + } |
| 107 | + { |
| 108 | + name: 'ManufacturerUri' |
| 109 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6203' |
| 110 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 111 | + } |
| 112 | + { |
| 113 | + name: 'BaseTemperature' |
| 114 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6210' |
| 115 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 116 | + } |
| 117 | + { |
| 118 | + name: 'CurrentTemperature' |
| 119 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6211' |
| 120 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 121 | + } |
| 122 | + { |
| 123 | + name: 'HeaterState' |
| 124 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6212' |
| 125 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 126 | + } |
| 127 | + { |
| 128 | + name: 'MaintenanceInterval' |
| 129 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6213' |
| 130 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 131 | + } |
| 132 | + { |
| 133 | + name: 'OverheatInterval' |
| 134 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6350' |
| 135 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 136 | + } |
| 137 | + { |
| 138 | + name: 'Overheated' |
| 139 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6214' |
| 140 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 141 | + } |
| 142 | + { |
| 143 | + name: 'OverheatedThresholdTemperature' |
| 144 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6215' |
| 145 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 146 | + } |
| 147 | + { |
| 148 | + name: 'TargetTemperature' |
| 149 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6217' |
| 150 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 151 | + } |
| 152 | + { |
| 153 | + name: 'TemperatureChangeSpeed' |
| 154 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6218' |
| 155 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 156 | + } |
| 157 | + { |
| 158 | + name: 'ProductCode' |
| 159 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6205' |
| 160 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 161 | + } |
| 162 | + { |
| 163 | + name: 'ProductInstanceUri' |
| 164 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6206' |
| 165 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 166 | + } |
| 167 | + { |
| 168 | + name: 'RevisionCounter' |
| 169 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6207' |
| 170 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 171 | + } |
| 172 | + { |
| 173 | + name: 'SerialNumber' |
| 174 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6208' |
| 175 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 176 | + } |
| 177 | + { |
| 178 | + name: 'SoftwareRevision' |
| 179 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6209' |
| 180 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 181 | + } |
| 182 | + ] |
| 183 | + destinations: [ |
| 184 | + { |
| 185 | + target: 'Mqtt' |
| 186 | + configuration: { |
| 187 | + topic: 'azure-iot-operations/data/oven-simple-write' |
| 188 | + retain: 'Never' |
| 189 | + qos: 'Qos1' |
| 190 | + } |
| 191 | + } |
| 192 | + ] |
| 193 | + } |
| 194 | + { |
| 195 | + name: 'boiler-complex-write' |
| 196 | + dataPoints: [ |
| 197 | + { |
| 198 | + name: 'BoilerStatus' |
| 199 | + dataSource: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=15013' |
| 200 | + dataPointConfiguration: '{"samplingInterval":500,"queueSize":1}' |
| 201 | + } |
| 202 | + ] |
| 203 | + destinations: [ |
| 204 | + { |
| 205 | + target: 'Mqtt' |
| 206 | + configuration: { |
| 207 | + topic: 'azure-iot-operations/data/oven-complex-write' |
| 208 | + retain: 'Never' |
| 209 | + qos: 'Qos1' |
| 210 | + } |
| 211 | + } |
| 212 | + ] |
| 213 | + } |
| 214 | + |
| 215 | + ] |
| 216 | + |
| 217 | + managementGroups: [ |
| 218 | + { |
| 219 | + name: 'boiler-call' |
| 220 | + actions: [ |
| 221 | + { |
| 222 | + name: 'Switch' |
| 223 | + targetUri: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=5017' |
| 224 | + actionType: 'Call' |
| 225 | + typeRef: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=5019' |
| 226 | + } |
| 227 | + ] |
| 228 | + } |
| 229 | + { |
| 230 | + name: 'boiler-explicit-write' |
| 231 | + actions: [ |
| 232 | + { |
| 233 | + name: 'simple-write' |
| 234 | + targetUri: 'nsu=http://microsoft.com/Opc/OpcPlc/Boiler;i=6217' |
| 235 | + actionType: 'Write' |
| 236 | + } |
| 237 | + ] |
| 238 | + } |
| 239 | + ] |
| 240 | + |
| 241 | + defaultDatasetsConfiguration: '{"publishingInterval":1000,"samplingInterval":500,"queueSize":1}' |
| 242 | + defaultEventsConfiguration: '{"publishingInterval":1000,"samplingInterval":500,"queueSize":1}' |
| 243 | + } |
| 244 | +} |
| 245 | + |
| 246 | + |
0 commit comments