10:46, EET
December 20, 2021
Good morning,
I am using the prosys-opc-ua-sdk-for-java-4.9.0-43-client-server-binary library.
I’m trying to implement an OPC UA server with classes generated by the codegen tool (information model: EUROMAP 82.1 url: https://www.euromap.org/euromap82-1).
Please can you explain me how to handle MultiStateValueDiscreteType? I don’t understand how to set the possible values and how to read the selected value.
I am working with the following variable:
– Parent: DeviceZoneType
– Node Class: Variable
– BrowseName: InternalMeasuringPoint
– DataType: 0:UInt16
– TypeDefinition: 0:MultiStateValueDiscreteType
– Other: O, RW
– file: EUROMAP82.1_Release_1.01.pdf
– page: 17.
Thanks in advance for the support,
Francesco
12:15, EET
Moderators
February 11, 2020
Hello,
First of all, since InternalMeasuringPoint is an Optional component of DeviceZoneType, you must specify that it is created when creating an instance of DeviceZoneType. If you’ve already done this, you can skip the next part.
To create Optional components, you must set the NodeBuilderConfiguration of your NodeManager. To create InternalMeasuringPoint, you would use the following configuration:
TypeDefinitionBasedNodeBuilderConfiguration.Builder conf = TypeDefinitionBasedNodeBuilderConfiguration.builder();
conf.addOptional(UaQualifiedName.from(“http://opcfoundation.org/UA/PlasticsRubber/TCD/”, “InternalMeasuringPoint”));
nodeManager.setNodeBuilderConfiguration(conf.build());
You would then create an instance of DeviceZoneType using the following method:
DeviceZoneType deviceZone = nodeManager.createInstance(DeviceZoneType.class, “DeviceZone”);
At this point you should have an instance of DeviceZoneType that has InternalMeasuringPoint component. You can access this component by calling:
MultiStateValueDiscreteType internalMeasuringPoint = deviceZone.getInternalMeasuringPointNode();
You can then get and set the Values of ValueAsText and EnumValues Properties with the following methods:
internalMeasuringPoint.getValueAsTextNode();
internalMeasuringPoint.setValueAsText(LocalizedText value);
internalMeasuringPoint.getEnumValues();
internalMeasuringPoint.setEnumValues(EnumValueType[] value);
Since the NodeSet file doesn’t specify an initial Value for the EnumValues Property, you will need to set it following the Table 8 of EUROMAP 82.1 companion specification. You would also need to manually set the Value of ValueAsText Property whenever the Value of InternalMeasuringPoint changes. You can do this with an IoManagerListener that uses onWriteValue method to check if a Value is being written to InternalMeasuringPoint and have it update the Value of the ValueAsText Property depending on the Value being written.
Most Users Ever Online: 1919
Currently Online:
14 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 735
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1