fixed issue in addressing array elements in DOs

v1.6
unknown 4 months ago
parent 37b9d88c7e
commit c52eff5231

@ -311,10 +311,19 @@ namespace ModelGenerator.C_Structures
public override string ToString()
{
string cText = "DataObject " + parent + "_" + name + " = {\n";
string cText = "";
if(arrayIndex == -1)
cText = "DataObject " + parent + "_" + name + " = {\n";
else
cText = "DataObject " + parent + "_" + name + "_" + arrayIndex + " = {\n";
//cText = "DataObject " + parent + "_" + name + " = {\n";
cText += " " + ModelNodeType + ",\n";
cText += " \"" + name + "\",\n";
cText += " (ModelNode*) &" + parent + ",\n";
if(arrayIndex != -1)
cText += " (ModelNode*) &" + parent + "_" + name + ",\n";
else
cText += " (ModelNode*) &" + parent + ",\n";
if (sibling == "NULL")
cText += " " + sibling + ",\n";
@ -327,8 +336,11 @@ namespace ModelGenerator.C_Structures
cText += " NULL,\n";
cText += " " + elementCount + ",\n";
cText += " " + arrayIndex + "\n";
if(elementCount == 0)
cText += " " + arrayIndex + "\n";
else
cText += " 0" + arrayIndex + "\n";
cText += "};";
return cText;

@ -14,6 +14,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices.ComTypes;
using DataSet = IEC61850.SCL.DataModel.DataSet;
namespace ModelGenerator
@ -328,7 +329,10 @@ namespace ModelGenerator
c_DataObjectStructure.parent = lnRef;
c_DataObjectStructure.name = dataObject.Name;
c_DataObjectStructure.objRef = lnRef + "_" + dataObject.Name;
if(c_DataObjectStructure.arrayIndex != -1)
c_DataObjectStructure.name = dataObject.Name + "_" + c_DataObjectStructure.arrayIndex;
else
c_DataObjectStructure.objRef = lnRef + "_" + dataObject.Name;
if (dataObject.DataObjectsAndAttributes.Count > 0)
c_DataObjectStructure.child = c_DataObjectStructure.objRef + "_" + dataObject.DataObjectsAndAttributes.First().Name;
@ -377,7 +381,8 @@ namespace ModelGenerator
c_ArrayDataObjectStructure.DataObject = dataObject;
c_ArrayDataObjectStructure.parent = lnRef;
//c_ArrayDataObjectStructure.parent = lnRef;
c_ArrayDataObjectStructure.parent = lnRef + "_" + dataObject.Name;
c_ArrayDataObjectStructure.name = dataObject.Name;
c_ArrayDataObjectStructure.objRef = lnRef + "_" + dataObject.Name + "_" + idx;
@ -457,6 +462,12 @@ namespace ModelGenerator
c_DataAttributeStructure.name = dataAttribute.Name;
c_DataAttributeStructure.sclFC = dataAttribute.Fc;
c_DataAttributeStructure.DataAttribute = dataAttribute;
if (c_DataAttributeStructure.arrayIndex != -1)
c_DataAttributeStructure.name = dataAttribute.Name + "_" + c_DataAttributeStructure.arrayIndex;
else
c_DataAttributeStructure.objRef = doName + "_" + dataAttribute.Name;
c_DataAttributeStructure.objRef = doName + "_" + dataAttribute.Name;
c_DataAttributeStructure.elementCount = dataAttribute.Count;

Loading…
Cancel
Save