public DataTypeTemplateNode(tDataTypeTemplates dt) { if (dt == null) { return; } Name = "Data Type Templates"; Tag = dt; var cxm = new System.Windows.Forms.ContextMenuStrip(); add_lnt = new System.Windows.Forms.ToolStripMenuItem("Add Logical Node Type Container", null, on_add_lnt); add_dot = new System.Windows.Forms.ToolStripMenuItem("Add Data Object Type Container", null, on_add_dot); add_dta = new System.Windows.Forms.ToolStripMenuItem("Add Data Type Attribute Container", null, on_add_dta); cxm.Items.Add(add_lnt); cxm.Items.Add(add_dot); cxm.Items.Add(add_dta); base.ContextMenuStrip = cxm; update_nodes(UpdateContext.All); }
/// <summary> /// This method sets and gets the FCDA of an LN0. /// </summary> /// <param name="ldInst"> /// Attribute "inst" that belongs to LDevice class, it is used on the FCDA class. /// </param> /// <param name="lN"> /// Logical node selected where FCDA will be assigned. /// </param> /// <param name="dataTypeTemplates"> /// DataTypeTemplates Node of the SCL project. This node is used to create and assign the information /// to the Logical Node. /// </param> /// <returns> /// It returns the FCDA of the logical Node selected. /// </returns> public tDataSet GetLN0FCDAs(tLDevice ld, LN0 lN, tDataTypeTemplates dataTypeTemplates) { this.ldevice = ld; this.ldInst = ld.inst; //this.objectManagement = new ObjectManagement(); this.lnClass = lN.lnClass.ToString(); this.lnInst = lN.inst; this.lnType = lN.lnType; this.CreateFCDAs(lN, dataTypeTemplates); return(this.dataSet); }
/// <summary> /// This method creates the FCDA of the BDA. /// </summary> /// <param name="dataTypeTemplates"> /// DataTypeTemplates Node of the SCL project. This node is used to create and assign the information /// to the Logical Node. /// </param> /// <param name="index"> /// Position of the DAType array. /// </param> /// <param name="doName"> /// DO name that contains the DA used to create the FCDA. /// </param> /// <param name="daNameParent"> /// SDO name that contains the DA used to create the FCDA. /// This name could contain the following structure: SDO.name+"."+DA.name (this one is related to /// the DAType that is been used). /// </param> private void InsertDaNameParent(tDataTypeTemplates dataTypeTemplates, ref int index, string doName, string daNameParent) { int indexTemp = index; // The variable "index2" is the index of the BDA (Don't change this class!!) for (int index2 = 0; dataTypeTemplates.DAType[indexTemp].BDA != null && index2 < dataTypeTemplates.DAType[indexTemp].BDA.Length; index2++) { if (dataTypeTemplates.DAType[indexTemp].BDA[index2].bTypeEnum == tBasicTypeEnum.Struct) { // The variable "index" is the index for the DAType (This class can be modified) int i = 0; while (i < dataTypeTemplates.DAType.Length) { if (i < dataTypeTemplates.DAType.Length && dataTypeTemplates.DAType[i].id == dataTypeTemplates.DAType[indexTemp].BDA[index2].type) { tFCDA fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = doName; fCDA.daName = daNameParent + "." + dataTypeTemplates.DAType[indexTemp].BDA[index2].name; if (this.ldevice != null) { //fCDA.LDevice = this.tLDevice; //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); this.InsertDaNameParent(dataTypeTemplates, ref i, doName, daNameParent + "." + dataTypeTemplates.DAType[indexTemp].BDA[index2].name); break; } i++; } } else { tFCDA fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = doName; fCDA.daName = daNameParent + "." + dataTypeTemplates.DAType[indexTemp].BDA[index2].name; if (this.ldevice != null) { //fCDA.LDevice = this.tLDevice; //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); } } }
/// <summary> /// This method creates the FCDA for the DA of the SDO data. /// </summary> /// <param name="dataTypeTemplates"> /// DataTypeTemplates Node of the SCL project. This node is used to create and assign the information /// to the Logical Node. /// </param> /// <param name="dOType"> /// DA information where their names will be gotten and are necessaries for the creation of the FCDAs. /// </param> /// <param name="doName"> /// DO name that contains the DA used to create the FCDA. /// </param> /// <param name="daNameParent"> /// SDO name that contains the DA used to create the FCDA. /// </param> private void InsertDaNameParent(tDataTypeTemplates dataTypeTemplates, tDOType dOType, string doName, string daNameParent) { // The variable "d" is the index of the DA (Don't change this class!!) for (int d = 0; d < dOType.DA.Length; d++) { if (dOType.DA[d].bTypeEnum == tBasicTypeEnum.Struct) { // The variable "e" is the index of the DA (This class can be modified) for (int e = 0; e < dataTypeTemplates.DAType.Length; e++) { if (dOType.DA[d].type.Equals(dataTypeTemplates.DAType[e].id)) { tFCDA fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = doName; fCDA.daName = daNameParent + "." + dOType.DA[d].name; if (this.ldevice != null) { //fCDA.LDevice = this.tLDevice; //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); this.InsertDaNameParent(dataTypeTemplates, ref e, doName, daNameParent + "." + dOType.DA[d].name); break; } } } else { tFCDA fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = doName; fCDA.daName = daNameParent + "." + dOType.DA[d].name; if (this.ldevice != null) { //fCDA.LDevice = this.tLDevice; //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); } } }
public TopDataObjectTypeNode(tDataTypeTemplates dt) { if (dt == null) { return; } Name = "Data Objects Types"; Tag = dt.DOType; templates = dt; var cxm = new System.Windows.Forms.ContextMenuStrip(); var add_dot = new System.Windows.Forms.ToolStripMenuItem("Add Data Object Type", null, on_add_dot); cxm.Items.Add(add_dot); base.ContextMenuStrip = cxm; update_nodes(); }
public TopLogicalNodeTypeNode(tDataTypeTemplates dt) { if (dt == null) { return; } Name = "Logical Nodes Types"; Tag = dt.LNodeType; templates = dt; var cxm = new System.Windows.Forms.ContextMenuStrip(); var add_lnt = new System.Windows.Forms.ToolStripMenuItem("Add Logical Node Type", null, on_add_lnt); cxm.Items.Add(add_lnt); base.ContextMenuStrip = cxm; update_nodes(); }
public IedNode(tIED ied, tDataTypeTemplates dt) { if (ied == null) { return; } Name = ied.name; templates = dt; this.ied = ied; Tag = ied; ied.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(on_changed); var cxm = new System.Windows.Forms.ContextMenuStrip(); var addld = new System.Windows.Forms.ToolStripMenuItem("Add Access Point", null, on_add_ap); cxm.Items.Add(addld); base.ContextMenuStrip = cxm; update_nodes(); }
public AccessPointNode(int iap, tIED ied, tDataTypeTemplates dt) { if (iap < 0 || ied == null || dt == null || ied == null) { return; } Tag = ied.AccessPoint[iap]; this.ied = ied; this.iap = iap; this.templates = dt; ied.AccessPoint[iap].PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(on_changed); update_name(); update_nodes(); var cxm = new System.Windows.Forms.ContextMenuStrip(); var addld = new System.Windows.Forms.ToolStripMenuItem("Add Logical Device", null, on_add_ld); cxm.Items.Add(addld); base.ContextMenuStrip = cxm; }
/// <summary> /// This method allows to create the FCDA on the LN selected. /// </summary> /// <param name="lN"> /// Logical node selected where FCDA will be assigned. /// </param> /// <param name="dataTypeTemplates"> /// DataTypeTemplates Node of the SCL project. This node is used to create and assign the information /// to the Logical Node. /// </param> private void CreateFCDAs(tAnyLN lN, tDataTypeTemplates dataTypeTemplates) { //The variable "a" is the index for the LNodeType (Don't change this class!!) for (int a = 0; dataTypeTemplates != null && dataTypeTemplates.LNodeType != null && a < dataTypeTemplates.LNodeType.Length; a++) { if (lN.lnType.Equals(dataTypeTemplates.LNodeType[a].id)) { //The variable "c" is the index of the DOType (This class can be manipulated) int c = 0; //The variable "b" is the index of the DO (Don't change this class!!) for (int b = 0; dataTypeTemplates.LNodeType[a].DO != null && b < dataTypeTemplates.LNodeType[a].DO.Length; b++) { tFCDA fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = dataTypeTemplates.LNodeType[a].DO[b].name; if (this.ldevice != null) { // FIXME: FindVariableAndSetValue works but set tFCDA.LDevice not!!! //tLDevice d = new tLDevice(); //d = this.ldevice; //fCDA.LDevice = d; //fCDA.LDevice = this.tLDevice; //ObjectManagement om = new ObjectManagement(); //om.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); for (c = 0; c < dataTypeTemplates.DOType.Length; c++) { if (dataTypeTemplates.LNodeType[a].DO[b].type.Equals(dataTypeTemplates.DOType[c].id)) { this.InsertDaName(dataTypeTemplates, dataTypeTemplates.DOType[c], dataTypeTemplates.LNodeType[a].DO[b].name); int count2 = c + 1; // The variable "count" is the SDO's index (Don't change this class!!) for (int count = 0; dataTypeTemplates.DOType[c].SDO != null && count < dataTypeTemplates.DOType[c].SDO.Length; count++) { //The variable "count2" is the DOType index (This class can be used). while (count2 < dataTypeTemplates.DOType.Length) { if (dataTypeTemplates.DOType[c].SDO[count].type == dataTypeTemplates.DOType[count2].id) { fCDA = new tFCDA(); fCDA.ldInst = this.ldInst; fCDA.prefix = this.prefix; fCDA.lnClass = this.lnClass; fCDA.lnInst = this.lnInst; fCDA.doName = dataTypeTemplates.LNodeType[a].DO[b].name; fCDA.daName = dataTypeTemplates.DOType[c].SDO[count].name; if (this.ldevice != null) { //fCDA.LDevice = this.tLDevice; //this.objectManagement.FindVariableAndSetValue(fCDA, this.tLDevice.GetType().Name, this.tLDevice); } dataSet.AddFCDA(fCDA); //this.objectManagement.AddObjectToArrayObjectOfParentObject(fCDA, dataSet); this.InsertDaNameParent(dataTypeTemplates, dataTypeTemplates.DOType[count2], dataTypeTemplates.LNodeType[a].DO[b].name, dataTypeTemplates.DOType[c].SDO[count].name); break; } count2++; } } c = count2; break; } } } break; } } }