This Serviceis used to create and add one or more MonitoredItemsto a Subscription. A MonitoredItemis deleted automatically by the Serverwhen the Subscriptionis deleted. Deleting a MonitoredItemcauses its entire set of triggered item links to be deleted, but has no effect on the MonitoredItemsreferenced by the triggered items.

Calling the CreateMonitoredItems Servicerepetitively to add a small number of MonitoredItemseach time may adversely affect the performance of the Server. Instead, Clientsshould add a complete set of MonitoredItemsto a Subscriptionwhenever possible.

When a MonitoredItemis added, the Serverperforms initialization processing for it. The initialization processing is defined by the Notificationtype of the item being monitored. Notificationtypes are specified in this document and in the Access Type Specification parts of OPC 10000, such as OPC 10000-8. See OPC 10000-1for a description of the Access Type Parts.

When a user adds a monitored item that the user is denied read access to, the add operation for the item shall succeed and the bad status Bad_NotReadableor Bad_UserAccessDeniedshall be returned in the Publishresponse. This is the same behaviour for the case where the access rights are changed after the call to CreateMonitoredItems. If the access rights change to read rights, the Servershall start sending data for the MonitoredItem. The same procedure shall be applied for an IndexRangethat does not deliver data for the current value but could deliver data in the future. Serversshould return all other errors as CreateMonitoredItemsresults but all possible errors are allowed to be returned in the Publishresponse.

Monitored Nodescan be removed from the AddressSpaceafter the creation of a MonitoredItem. This does not affect the validity of the MonitoredItembut a Bad_NodeIdUnknownshall be returned in the Publishresponse. It is possible that the MonitoredItembecomes valid again if the Nodeis added again to the AddressSpaceand the MonitoredItemstill exists.

If a NodeIdis known to be valid by a Serverbut the corresponding Node Attributesare currently not available, the Servermay allow the creation of a MonitoredItemand return an appropriate Bad StatusCodein the Publishresponse.

The return diagnostic info setting in the request header of the CreateMonitoredItemsor the last ModifyMonitoredItems Serviceis applied to the Monitored Itemsand is used as the diagnostic information settings when sending Notifications in the Publishresponse.

Illegal request values for parameters that can be revised do not generate errors. Instead the Serverwill choose default values and indicate them in the corresponding revised parameter.

It is strongly recommended by OPC UA that a Clientreuses a Subscriptionafter a short network interruption by activating the existing Sessionon a new SecureChannelas described in 6.7. If a Clientcalled CreateMonitoredItemsduring the network interruption and the call succeeded in the Serverbut did not return to the Client, then the Clientdoes not know if the call succeeded. The Clientmay receive data changes for these monitored items but is not able to remove them since it does not know the Serverhandle for each monitored item. There is also no way for the Clientto detect if the create succeeded. To delete and recreate the Subscriptionis also not an option since there may be several monitored items operating normally that should not be interrupted. To resolve this situation, the Server Objectprovides a Method GetMonitoredItemsthat returns the list of Serverand client handles for the monitored items in a Subscription. This Methodis defined in OPC 10000-5. The Servershall verify that the Methodis called within the Sessioncontext of the Sessionthat owns the Subscription.

Table 69defines the parameters for the Service.

Table 69– CreateMonitoredItems Service Parameters

Name

Type

Description

Request

requestHeader

RequestHeader

Common request parameters (see 7.33for RequestHeaderdefinition).

subscriptionId

IntegerId

The Server-assigned identifier for the Subscriptionthat will report Notificationsfor this MonitoredItem(see 7.19for IntegerIddefinition).

timestampsToReturn

Enum

Timestamps ToReturn

An enumeration that specifies the timestamp Attributesto be transmitted for each MonitoredItem. The TimestampsToReturnenumeration is defined in 7.40.

When monitoring Events, this applies only to Event fields that are of type DataValue.

itemsToCreate []

MonitoredItem CreateRequest

A list of MonitoredItemsto be created and assigned to the specified Subscription. This structure is defined in-line with the following indented items.

itemToMonitor

ReadValueId

Identifies an item in the AddressSpaceto monitor. To monitor for Events, the attributeIdelement of the ReadValueIdstructure is the id of the EventNotifier Attribute. The ReadValueIdtype is defined in 7.29.

monitoringMode

Enum

MonitoringMode

The monitoring mode to be set for the MonitoredItem. The MonitoringModeenumeration is defined in 7.23.

requestedParameters

Monitoring Parameters

The requested monitoring parameters. Serversnegotiate the values of these parameters based on the Subscriptionand the capabilities of the Server. The MonitoringParameterstype is defined in 7.21.

Response

responseHeader

Response Header

Common response parameters (see 7.34for ResponseHeaderdefinition).

results []

MonitoredItem CreateResult

List of results for the MonitoredItemsto create. The size and order of the list matches the size and order of the itemsToCreaterequest parameter. This structure is defined in-line with the following indented items.

statusCode

StatusCode

StatusCodefor the MonitoredItemto create (see 7.39for StatusCodedefinition).

monitoredItemId

IntegerId

Server-assigned id for the MonitoredItem(see 7.19for IntegerIddefinition). This id is unique within the Subscription, but might not be unique within the Serveror Session. This parameter is present only if the statusCodeindicates that the MonitoredItemwas successfully created.

revisedSampling Interval

Duration

The actual sampling interval that the Serverwill use.

This value is based on a number of factors, including capabilities of the underlying system. The Servershall always return a revisedSamplingIntervalthat is equal or higher than the requestedsamplingInterval. If the requestedsamplingIntervalis higher than the maximum sampling interval supported by the Server, the maximum sampling interval is returned.

revisedQueueSize

Counter

The actual queue size that the Serverwill use.

filterResult

Extensible Parameter

MonitoringFilterResult

Contains any revised parameter values or error results associated with the MonitoringFilter specified in requestedParameters. This parameter may be null if no errors occurred. The MonitoringFilterResultparameter type is an extensible parameter type specified in 7.22.

diagnosticInfos []

DiagnosticInfo

List of diagnostic information for the MonitoredItemsto create (see 7.12for DiagnosticInfo definition). The size and order of the list matches the size and order of the itemsToCreaterequest parameter. This list is empty if diagnostics information was not requested in the request header or if no diagnostic information was encountered in processing of the request.

Table 70defines the Serviceresults specific to this Service. Common StatusCodesare defined in Table 182.

Table 70– CreateMonitoredItems Service Result Codes

Symbolic Id

Description

Bad_NothingToDo

See Table 182for the description of this result code.

Bad_TooManyOperations

See Table 182for the description of this result code.

Bad_TimestampsToReturnInvalid

See Table 182for the description of this result code.

Bad_SubscriptionIdInvalid

See Table 182for the description of this result code.

Table 71defines values for the operation level statusCodeparameter that are specific to this Service. Common StatusCodesare defined in Table 183.

Table 71– CreateMonitoredItems Operation Level Result Codes

Symbolic Id

Description

Bad_MonitoringModeInvalid

See Table 183for the description of this result code.

Bad_NodeIdInvalid

See Table 183for the description of this result code.

Bad_NodeIdUnknown

See Table 183for the description of this result code.

Bad_AttributeIdInvalid

See Table 183for the description of this result code.

Bad_IndexRangeInvalid

See Table 183for the description of this result code.

Bad_IndexRangeNoData

See Table 183for the description of this result code.

If the ArrayDimensionshave a fixed length that cannot change and no data exists within the range of indexes specified, Bad_IndexRangeNoData is returned in CreateMonitoredItems. Otherwise if the length of the array is dynamic, the Servershall return this status in a Publishresponse for the MonitoredItemif no data exists within the range.

Bad_DataEncodingInvalid

See Table 183for the description of this result code.

Bad_DataEncodingUnsupported

See Table 183for the description of this result code.

Bad_MonitoredItemFilterInvalid

See Table 183for the description of this result code.

Bad_MonitoredItemFilterUnsupported

See Table 183for the description of this result code.

Bad_FilterNotAllowed

See Table 183for the description of this result code.

Bad_TooManyMonitoredItems

The Serverhas reached its maximum number of monitored items.