Model Compiler generated C# Code and ValueRank OneOrMoreDimensions|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Model Compiler generated C# Code and ValueRank OneOrMoreDimensions
Avatar
JJonas
New Member
Members
Forum Posts: 2
Member Since:
10/12/2022
sp_UserOfflineSmall Offline
1
10/20/2022 - 07:43
sp_Permalink sp_Print

Hi all,

currently I am trying to set the EnumDictionaryEntries property value of a MultiStateDictionaryEntryDiscreteBaseType variable.

In the corresponding model compiler information model XML the properties' ValueRank is defined as "OneOrMoreDimensions", but in the generated C# code this is mapped to a PropertyState<NodeId> type. How can I set a (multidimensional) array value on this property?

E.g.:
var multiStateDictionaryEntryDiscreteState = new Opc.Ua.MultiStateDictionaryEntryDiscreteState<uint>(null);
multiStateDictionaryEntryDiscreteState.EnumDictionaryEntries = new PropertyState<NodeId>(multiStateDictionaryEntryDiscreteState);
multiStateDictionaryEntryDiscreteState.EnumDictionaryEntries.Value = new NodeId(); // how to assign (multidimensional) array ?

Any hint is greatly appreciated!

Kind regards,
Jonas

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
10/21/2022 - 01:49
sp_Permalink sp_Print sp_EditHistory

The ModelCompiler has been fixed. It will take a few days to push to the public repo.

You can apply the changes to this function in ModelGenerator2.cs

private string GetClassName(InstanceDesign instance)

Add this to the bottom of the function:

if (variable.ValueRank == ValueRank.OneOrMoreDimensions)
{
    scalarName = "Variant";
}

return String.Format("{0}State<{1}>", FixClassName(variableType), scalarName);

The updated auto generated files are in this pull request:

https://github.com/OPCFoundati...../pull/1955

Avatar
JJonas
New Member
Members
Forum Posts: 2
Member Since:
10/12/2022
sp_UserOfflineSmall Offline
3
10/21/2022 - 07:24
sp_Permalink sp_Print

Thank you Randy!

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 36
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855