- small code format updates

v1.6
Michael Zillgith 4 months ago
parent 1e1e9045ba
commit a0ee6c816c

@ -225,8 +225,6 @@ namespace IEC61850
if (IedName != null) if (IedName != null)
name += IedName; name += IedName;
//name += lnClass;
if (inst != null) if (inst != null)
name += inst; name += inst;
@ -240,7 +238,6 @@ namespace IEC61850
} }
public string Inst public string Inst
{ {
get get
@ -251,17 +248,9 @@ namespace IEC61850
{ {
inst = value; inst = value;
UpdateName(); UpdateName();
} }
} }
public List<LogicalNode> LogicalNodes public List<LogicalNode> LogicalNodes
{ {
get get
@ -288,13 +277,9 @@ namespace IEC61850
SclDocument = sclDocument; SclDocument = sclDocument;
this.name = name; this.name = name;
this.inst = inst; this.inst = inst;
//
objRef = this.name; objRef = this.name;
//
this.sclLDevice = sclLDevice; this.sclLDevice = sclLDevice;
} }
} }
public class LogicalNode : IEDModelNode public class LogicalNode : IEDModelNode
@ -304,7 +289,6 @@ namespace IEC61850
private string inst; private string inst;
private Namespace nameSpace = null; private Namespace nameSpace = null;
private SclLN sclElement = null; private SclLN sclElement = null;
private List<DataSet> dataSets = null; private List<DataSet> dataSets = null;
@ -317,7 +301,6 @@ namespace IEC61850
private Inputs inputs = null; private Inputs inputs = null;
private SclSettingControl settingControl = null; private SclSettingControl settingControl = null;
public SclLN SclElement { get => sclElement; set => sclElement = value; } public SclLN SclElement { get => sclElement; set => sclElement = value; }
public void UpdateName() public void UpdateName()
@ -538,7 +521,6 @@ namespace IEC61850
{ {
settingControl = sclElement.SettingControl; settingControl = sclElement.SettingControl;
settingControl.Parent = this; settingControl.Parent = this;
} }
} }
} }
@ -588,13 +570,9 @@ namespace IEC61850
public class DataObjectOrAttribute : IEDModelNode public class DataObjectOrAttribute : IEDModelNode
{ {
public DataObjectOrAttribute(string name, IEDModelNode parent) : base(name, parent) public DataObjectOrAttribute(string name, IEDModelNode parent) : base(name, parent)
{ {
} }
} }
public class DataObject : DataObjectOrAttribute public class DataObject : DataObjectOrAttribute
@ -869,11 +847,6 @@ namespace IEC61850
public SclLogControl SclLogControl { get => sclLogControl; set => sclLogControl = value; } public SclLogControl SclLogControl { get => sclLogControl; set => sclLogControl = value; }
} }
} }
} }
} }

@ -108,8 +108,6 @@ namespace IEC61850.SCL
XmlAttribute when = xmlNode.Attributes["when"]; XmlAttribute when = xmlNode.Attributes["when"];
if (when == null) if (when == null)
SclxmlDocument.AddIssue(xmlNode, "ERROR", "Model integrity", "No when attribute on Hitem", this, "when"); SclxmlDocument.AddIssue(xmlNode, "ERROR", "Model integrity", "No when attribute on Hitem", this, "when");
} }
public SclHitem(XmlDocument xmlDocument) public SclHitem(XmlDocument xmlDocument)
@ -292,6 +290,7 @@ namespace IEC61850.SCL
return false; return false;
} }
public XmlNode Node public XmlNode Node
{ {
get { return xmlNode; } get { return xmlNode; }
@ -324,7 +323,6 @@ namespace IEC61850.SCL
if (historyNode != null) if (historyNode != null)
history = new SclHistory(SclxmlDocument, historyNode, nsManager); history = new SclHistory(SclxmlDocument, historyNode, nsManager);
} }
public SclHeader(SclDocument SclDocument, XmlNamespaceManager nsManager) public SclHeader(SclDocument SclDocument, XmlNamespaceManager nsManager)
@ -336,8 +334,6 @@ namespace IEC61850.SCL
history = new SclHistory(SclDocument.XmlDocument); history = new SclHistory(SclDocument.XmlDocument);
xmlNode.AppendChild(history.XmlNode); xmlNode.AppendChild(history.XmlNode);
} }
} }
} }

@ -527,19 +527,15 @@ namespace ModelGenerator
c_DataAttributeStructure.sclFC = SclFC.SG; c_DataAttributeStructure.sclFC = SclFC.SG;
} }
if (dataAttribute.subDataAttributes.Count > 0) if (dataAttribute.subDataAttributes.Count > 0)
c_DataAttributeStructure.child = c_DataAttributeStructure.objRef + "_" + dataAttribute.subDataAttributes.First().Name; c_DataAttributeStructure.child = c_DataAttributeStructure.objRef + "_" + dataAttribute.subDataAttributes.First().Name;
if (dataAttribute.Count > 0) if (dataAttribute.Count > 0)
{ {
for (int idx = 0; idx < dataAttribute.Count; idx++) for (int idx = 0; idx < dataAttribute.Count; idx++)
{ {
C_DataAttributeStructure arrayElement = new C_DataAttributeStructure(); C_DataAttributeStructure arrayElement = new C_DataAttributeStructure();
c_DO_DA_Structures.Add(arrayElement); c_DO_DA_Structures.Add(arrayElement);
arrayElement.name = "NULL"; arrayElement.name = "NULL";
@ -556,7 +552,6 @@ namespace ModelGenerator
arrayElement.elementCount = 0; arrayElement.elementCount = 0;
arrayElement.arrayIndex = idx; arrayElement.arrayIndex = idx;
if (idx == 0) if (idx == 0)
c_DataAttributeStructure.child = arrayElement.objRef; c_DataAttributeStructure.child = arrayElement.objRef;
@ -579,7 +574,6 @@ namespace ModelGenerator
createDataAttributeCStructure(c_DO_DA_Structures, c_DataAttributeStructure.objRef, dataObjectOrAttribute, dataAttribute, isDoTransient, sclSDI, -1); createDataAttributeCStructure(c_DO_DA_Structures, c_DataAttributeStructure.objRef, dataObjectOrAttribute, dataAttribute, isDoTransient, sclSDI, -1);
} }
} }
SclDAI sclDAI = getDAI(daiObj, dataAttribute.Name); SclDAI sclDAI = getDAI(daiObj, dataAttribute.Name);
@ -587,7 +581,6 @@ namespace ModelGenerator
if (sclDAI != null) if (sclDAI != null)
if (sclDAI.Val != null) if (sclDAI.Val != null)
printValue(c_DataAttributeStructure, sclDAI.Val); printValue(c_DataAttributeStructure, sclDAI.Val);
} }
SclDAI getDAI(object parent, string name) SclDAI getDAI(object parent, string name)
@ -601,8 +594,6 @@ namespace ModelGenerator
return sclSDI.SclDAIs.Find(x => x.Name == name); return sclSDI.SclDAIs.Find(x => x.Name == name);
else else
return null; return null;
} }
SclSDI getSDI(object parent, string name) SclSDI getSDI(object parent, string name)
@ -616,8 +607,6 @@ namespace ModelGenerator
return sclSDI.SclSDIs.Find(x => x.Name == name); return sclSDI.SclSDIs.Find(x => x.Name == name);
else else
return null; return null;
} }
private void printValue(C_DataAttributeStructure c_DataAttributeStructure, string value) private void printValue(C_DataAttributeStructure c_DataAttributeStructure, string value)
@ -791,7 +780,6 @@ namespace ModelGenerator
c_SettingGroupControlStructure.settingControl = settingControl; c_SettingGroupControlStructure.settingControl = settingControl;
c_SettingGroupControlStructure.parent = lnPrefix; c_SettingGroupControlStructure.parent = lnPrefix;
c_SettingGroupControlStructure.externName = lnPrefix + "_sgcb"; c_SettingGroupControlStructure.externName = lnPrefix + "_sgcb";
} }
private void createDataCStructure(IEDDataModel iedModel, string modelPrefix, bool isTransient) private void createDataCStructure(IEDDataModel iedModel, string modelPrefix, bool isTransient)
@ -856,8 +844,6 @@ namespace ModelGenerator
{ {
Console.WriteLine("GSE not found for GoCB " + gSEControl.Name); Console.WriteLine("GSE not found for GoCB " + gSEControl.Name);
} }
} }
int gseIndex = 0; int gseIndex = 0;
@ -930,7 +916,6 @@ namespace ModelGenerator
c_IEDModelStructure.logs = c_LogStructures.First().externName; c_IEDModelStructure.logs = c_LogStructures.First().externName;
} }
if (logicalNode.SettingControl != null) if (logicalNode.SettingControl != null)
{ {
addSettingGroulBlockInstance(c_LogicalNodeStructure.objRef, logicalNode.SettingControl); addSettingGroulBlockInstance(c_LogicalNodeStructure.objRef, logicalNode.SettingControl);
@ -991,19 +976,16 @@ namespace ModelGenerator
clientAddress[j + 1] = iPAddress.GetAddressBytes()[j]; clientAddress[j + 1] = iPAddress.GetAddressBytes()[j];
} }
} }
} }
addReportControlBlockInstance(c_LogicalNodeStructure.objRef, reportControl, index, logicalNode.ReportControlBlocks.Count, reportsCount, clientAddress); addReportControlBlockInstance(c_LogicalNodeStructure.objRef, reportControl, index, logicalNode.ReportControlBlocks.Count, reportsCount, clientAddress);
reportsCount++; reportsCount++;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
} }
} }
else else
{ {
@ -1011,7 +993,6 @@ namespace ModelGenerator
clientAddress[0] = 0; clientAddress[0] = 0;
addReportControlBlockInstance(c_LogicalNodeStructure.objRef, reportControl, "", logicalNode.ReportControlBlocks.Count, reportsCount, clientAddress); addReportControlBlockInstance(c_LogicalNodeStructure.objRef, reportControl, "", logicalNode.ReportControlBlocks.Count, reportsCount, clientAddress);
reportsCount++; reportsCount++;
} }
int rptIndex = 0; int rptIndex = 0;
@ -1030,9 +1011,6 @@ namespace ModelGenerator
c_IEDModelStructure.rcbs = c_ReportContorlBlockStructures.First().externName; c_IEDModelStructure.rcbs = c_ReportContorlBlockStructures.First().externName;
} }
} }
int datasetCOunt = 0; int datasetCOunt = 0;
@ -1100,6 +1078,7 @@ namespace ModelGenerator
componentName = componentNamePart; componentName = componentNamePart;
} }
} }
if (componentName != "") if (componentName != "")
c_DatasetEntry.componentName = componentName; c_DatasetEntry.componentName = componentName;
@ -1170,14 +1149,12 @@ namespace ModelGenerator
hOut.WriteLine("#include <stdlib.h>"); hOut.WriteLine("#include <stdlib.h>");
hOut.WriteLine("#include \"iec61850_model.h\""); hOut.WriteLine("#include \"iec61850_model.h\"");
hOut.WriteLine(); hOut.WriteLine();
} }
private void printHeaderFileFooter(StreamWriter hOut, string hDefineName) private void printHeaderFileFooter(StreamWriter hOut, string hDefineName)
{ {
hOut.WriteLine(); hOut.WriteLine();
hOut.WriteLine("#endif /* " + hDefineName + " */\n"); hOut.WriteLine("#endif /* " + hDefineName + " */\n");
} }
private void printCFileHeader(string filename, string outputFileName, StreamWriter cOut) private void printCFileHeader(string filename, string outputFileName, StreamWriter cOut)
@ -1196,6 +1173,5 @@ namespace ModelGenerator
cOut.WriteLine("#include \"" + include); cOut.WriteLine("#include \"" + include);
cOut.WriteLine(); cOut.WriteLine();
} }
} }
} }

Loading…
Cancel
Save