
10/12/2022

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

05/30/2017

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:
1 Guest(s)