Methods with varying/inherited arguments

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
wrn
Jr. Member
Jr. Member
Posts: 4
Joined: 30 Apr 2024, 10:13

Methods with varying/inherited arguments

Post by wrn »

Hello together,

I have multiple machines/types of machines. The overall structure of my OPC UA model is the same for all machine types, but the machines differ in some places.
For example all programs of all machine types are subtypes of the 0:Structure, but the programs of the different machines differ from machine type to machine type.

Now I want to define some methods, which implement the same functionality for all machine types. These functions also should be include the programs of the machines.

e.g.:

Code: Select all

Signature:
DemoMethod(
	[in]	Int32		SomeValue,
	[in]	String		SomeOtherValue,
	[out]	<ProgramType>	Program
);
For the DemoMethod the <ProgramType> should differ from machine type to machine type, but the rest of the Arguments should stay the same.


I tried different things to get it to work with UaModeler.

1. Create an ObjectType and set the Program Argument of the Method to the abstract DataType 0:Structure and select the specific subtype of the structure later.
-> Did not work. I couldn't change the data type later on. E.g. when creating the instance of the ObjectType.

2. Define the method in an ObjectType and create an subtype of the object and overwrite the function.
When I used the ModelingRule Optional or Mandatory I could not change the DataType of the Arguments later on.
When I used the ModelingRule OptionalPlaceholder or MandatoryPlaceholder I could not even select to overwrite these methods.

For me it seams, that the way to go is by using the OptionalPlaceholder or MandatoryPlaceholder (depending, if it should be Optional or Mandatory later).
This should be the preferred way, because it is mentioned in the OPC UA reference documentation:
For Methods, the ModellingRule OptionalPlaceholder is used to define the BrowseName where subtypes and instances provide more information. The Method definition with the OptionalPlaceholder only defines the BrowseName. An instance or subtype defines the InputArguments and OutputArguments. A subtype shall also change the ModellingRule to Optional or Mandatory.
https://reference.opcfoundation.org/Core/Part3/v104/docs/6.4.4.5.5


What would be the correct/best way to model my methods with the UaModeler?

Thanks in advance and best regards
wrn

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

Re: Methods with varying/inherited arguments

Post by Support Team »

Hello,

assuming you use latest UaModeler:

If you want to define an ObjectType having a Method with a specific BrowseName, but with Method arguments that need to be defined at an instance, you should use the ModellingRule MandatoryPlaceholder or OptionalPlaceholder.

When creating an instance of the ObjectType you can select the Method in case of OptionalPlaceholder. In case of MandatoryPlaceholder the Method is already present. In the step you can select the Method node. Now you are able to modify the Method arguments in the Children tab.
Best regards
Unified Automation Support Team

Post Reply