Ejemplo n.º 1
0
        /// <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);
                }
            }
        }
Ejemplo n.º 2
0
 /// <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);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// This event saves the information of the DataSet.
 /// </summary>
 /// <param name="sender">
 /// Name of the object.
 /// </param>
 /// <param name="e">
 /// This class contains no event data; it is used by events that do not pass state information to an event
 /// handler when an event is raised. If the event handler requires state information, the application must
 /// derive a class from this class to hold the data.
 /// </param>
 private void OKButtonClick(object sender, EventArgs e)
 {
     if (this.DestinyDataSetListBox.Items.Count > 0)
     {
         this.treeSCL.TreeView.SelectedNode = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(treeSCL, typeof(tAnyLN));
         object lN = this.treeSCL.TreeView.SelectedNode.Tag;
         if (this.dataSetSCL != null)
         {
             this.dataSetSCL.FCDA = null;
         }
         else
         {
             this.dataSetSCL = new tDataSet();
         }
         tFCDA[] fCDAs = new tFCDA[this.DestinyDataSetListBox.Items.Count];
         for (int x = 0; x < this.DestinyDataSetListBox.Items.Count; x++)
         {
             fCDAs[x] = (this.DestinyDataSetListBox.Items[x] as FCDAListBox).fCDA;
         }
         this.dataSetSCL.FCDA = fCDAs;
         this.dataSetSCL.name = this.NameTextBox.Text;
         this.dataSetSCL.desc = this.DescTextBox.Text;
         this.objectManagement.AddObjectToArrayObjectOfParentObject(this.dataSetSCL, lN);
         treeViewSCL.GetNodesItemOfArray((lN as tAnyLN).DataSet, lN.GetType(), this.treeSCL.TreeView.SelectedNode);
         if (this.bandModify)
         {
             RegularExpressionTree         regularExpressionTree         = new  RegularExpressionTree();
             AutomataForValidateToTreeNode automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeSCL,
                                                                                                             regularExpressionTree.GetRegExpToDelete(this.treeSCL));
             automataForValidateToTreeNode.InterpretString();
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("No data has been added to the DataSet");
     }
 }
Ejemplo n.º 4
0
        public FcdaNode(tFCDA fcda)
        {
            if (fcda == null)
            {
                return;
            }

            string r = fcda.ldInst + "/" +
                       fcda.prefix +
                       fcda.lnClass +
                       fcda.lnInst;

            if (fcda.doName != "")
            {
                r += "." + fcda.doName;
            }
            if (fcda.daName != "")
            {
                r += "." + fcda.daName;
            }
            Name = r;
            Tag  = fcda;
        }
Ejemplo n.º 5
0
 public FCDAListBox(tFCDA fCDA, string lNType)
 {
     this.fCDA   = fCDA;
     this.lNType = lNType;
 }
Ejemplo n.º 6
0
 /// <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;
         }
     }
 }