Modelling Rule-Optional.

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
Talha.Ejaz
Sr. Member
Sr. Member
Posts: 11
Joined: 24 Jul 2018, 09:33

Modelling Rule-Optional.

Post by Talha.Ejaz »

Hey Guys ,

I have a question regarding the Modelling Rules. If i create some variables in an ObjectType as the Children of that ObjectType, and i want to make these variables having Optional Modelling Rule , How can i expose them in an Instance ? ,I am trying it in server , when i create an Instance of that ObjectType in server , then UaExpert client is unable to browse those variables whose Modelling Rule was optional in ObjectType , I want actually , that the client can also see and browse those variables of Instance who had modelling rule optional in ObjectType. How can we do that , can anyone help me please ? What i read from the Book is that If we make an InstanceDeclaration with Optional Modelling Rule. then each instance may have such a counterpart ,but it is not required that each instance hast such a counterpart.,
i will be greatfull if anyone can help,

Many Thanks,

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Modelling Rule-Optional.

Post by Support Team »

Hello,

If you want to create optional children, you have to specify the in CreateInstanceSettings.OptionalBrowsePaths (documentation).
You should call AbsoluteName.ToString (documentation) to get the string foreach optional child.
Best regards
Unified Automation Support Team

Talha.Ejaz
Sr. Member
Sr. Member
Posts: 11
Joined: 24 Jul 2018, 09:33

Re: Modelling Rule-Optional.

Post by Talha.Ejaz »

Hey Support Team ,

Thank you very much for your help , It worked fine . Now i wanted to ask whether is it also possible to expose the optional children while the server is running , For example i have an Object Type with 10 variables and all created with optional modelling rule , and then i create the instance of that ObjectType, In my application , i want to expose sometimes all 10 variables , sometimes only 5 different variables should be exposed , sometimes 8 different variables should be exposed , like the number of variables with data should be exposed but variables with value 0 should not be exposed , i want to see the variables only with specific values but not with 0 value , that was just an example related to my application.
i will be very thankful to you if you can guide me in this regard

many Thanks

Regards

Talha

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Modelling Rule-Optional.

Post by Support Team »

Hello,

You can specify the optional nodes directly only when creating the instance. If you want to add optional children after creating the instance, you need to call CreateObject or CreateVariable for the child. The settings have to be copied from the instance declaration node.
Best regards
Unified Automation Support Team

Talha.Ejaz
Sr. Member
Sr. Member
Posts: 11
Joined: 24 Jul 2018, 09:33

Re: Modelling Rule-Optional.

Post by Talha.Ejaz »

Hey Support Team ,

OK i will try like this as you have suggested. Thank you again for your help . I appreciate it. one last thing i wanna make sure is , that if i want to have a Type creation in the program without using the UA Modeler software , in that case i would not need to embed that XML file created by UA Modeler i guess ?, like i can directly create the identifiers, and then type creation like in lesson 2, i have deleted the XML file from the Node Manager then i was trying to create the ObjectTypes but " Node manager Failed" error was popping up again and again , and i couldnt figure out how to do it without the UA modeler software , as i am Student and new to OPC UA and just started using SDK from Unified Automation few weeks ago,

Many Thanks ,

Regards

Talha

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: Modelling Rule-Optional.

Post by Support Team »

Hello Talha,

Please have a look at server getting started lesson2. Please remove the ImportNodeSet command and remove the comment for CreateObjectTypesInCode() in Lesson2NodeManager.cs.
Best regards
Unified Automation Support Team

Talha.Ejaz
Sr. Member
Sr. Member
Posts: 11
Joined: 24 Jul 2018, 09:33

Re: Modelling Rule-Optional.

Post by Talha.Ejaz »

Hey Support Team ,

Alright ,I will try again. Thanks alot for your help . Your support is very much helpful in figuring out things faster.

Many Thanks ,

Regards

Talha

Post Reply