diff --git a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
index 5126b30e..fc46e00a 100644
--- a/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
+++ b/dotnet/IEC61850forCSharp/IEC61850ServerAPI.cs
@@ -299,40 +299,70 @@ namespace IEC61850
}
+ ///
+ /// Logical device. Representation of a logical device (LD) in a data model.
+ ///
public class LogicalDevice : ModelNode
{
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr LogicalDevice_create(string name, IntPtr parent);
- private IedModel iedModel = null;
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr LogicalDevice_createEx(string name, IntPtr parent, string ldName);
- public IedModel IedModel { get => iedModel; }
+ public IedModel IedModel { get; }
public LogicalDevice (IntPtr self, IedModel iedModel) : base (self)
{
- this.iedModel = iedModel;
+ this.IedModel = iedModel;
}
- public LogicalDevice(string name, IedModel parent)
+ ///
+ /// Create a new logical device in a data model
+ ///
+ /// LD instance
+ /// Model containing this logical device
+ public LogicalDevice(string inst, IedModel parent)
{
- this.iedModel = parent;
+ this.IedModel = parent;
- self = LogicalDevice_create(name, parent.self);
+ self = LogicalDevice_create(inst, parent.self);
+ }
+
+ ///
+ /// Create a new logical device in a data model (support for functional naming)
+ ///
+ /// LD instance
+ /// Model containing this logical device
+ /// LD name (for functional naming). When set, the exernally visible domain name for this LD
+ public LogicalDevice(string inst, IedModel parent, string ldName)
+ {
+ this.IedModel = parent;
+
+ self = LogicalDevice_createEx(inst, parent.self, ldName);
}
}
+ ///
+ /// Logical node. Representation of a logical node (LN) in a data model.
+ ///
public class LogicalNode : ModelNode
{
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr LogicalNode_create(string name, IntPtr parent);
+ internal Dictionary rcbs = new Dictionary();
+
public LogicalNode (IntPtr self, ModelNode parent) : base(self)
{
this.parent = parent;
}
- internal Dictionary rcbs = new Dictionary();
-
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// LN name
+ /// Logical device containing this logical node.
public LogicalNode(string name, LogicalDevice parent)
{
this.parent = parent;
diff --git a/dotnet/model_browsing/ModelBrowsing.cs b/dotnet/model_browsing/ModelBrowsing.cs
index 1322118e..bc9328c1 100644
--- a/dotnet/model_browsing/ModelBrowsing.cs
+++ b/dotnet/model_browsing/ModelBrowsing.cs
@@ -12,6 +12,27 @@ namespace model_browsing
{
class ModelBrowsing
{
+ private static void PrintChildSpec(MmsVariableSpecification spec, int indent)
+ {
+ string indentStr = "";
+
+ for (int i = 0; i < indent; i++)
+ indentStr += " ";
+
+ if (spec.GetType() == MmsType.MMS_STRUCTURE)
+ {
+ foreach (MmsVariableSpecification elementSpec in spec)
+ {
+ Console.WriteLine(indentStr + "DA: " + elementSpec.GetName() + " : " + elementSpec.GetType());
+
+ if (elementSpec.GetType() == MmsType.MMS_STRUCTURE || elementSpec.GetType() == MmsType.MMS_ARRAY)
+ {
+ PrintChildSpec(elementSpec, indent + 2);
+ }
+ }
+ }
+ }
+
public static void Main (string[] args)
{
IedConnection con = new IedConnection ();
@@ -73,11 +94,22 @@ namespace model_browsing
ObjectReference.getElementName(dataDirectoryElement) + " : " + specification.GetType()
+ "(" + specification.Size() + ")");
- if (specification.GetType() == MmsType.MMS_STRUCTURE) {
- foreach (MmsVariableSpecification elementSpec in specification) {
- Console.WriteLine(" " + elementSpec.GetName() + " : " + elementSpec.GetType());
- }
- }
+ if (specification.GetType() == MmsType.MMS_STRUCTURE)
+ {
+ foreach (MmsVariableSpecification elementSpec in specification)
+ {
+ PrintChildSpec(elementSpec, 8);
+ //Console.WriteLine(" " + elementSpec.GetName() + " : " + elementSpec.GetType());
+ }
+ }
+ else if (specification.GetType() == MmsType.MMS_ARRAY)
+ {
+ MmsVariableSpecification arrayElementspec = specification.getArrayElementType();
+ PrintChildSpec(arrayElementspec, 8);
+
+
+ //Console.WriteLine(" elements: " + arrayElementspec.GetType());
+ }
}
}