Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        public int AddLDevice(string inst, string ap, tDataTypeTemplates tpl)
        {
            if (tpl == null)
            {
                return(-1);
            }
            if (accessPointField == null)
            {
                AddAP(ap);
            }

            var ld = new tLDevice();

            if (inst == null)
            {
                ld.inst = "TEMPLATE_LD" + (++tIED.nld).ToString();
            }
            else
            {
                ld.inst = inst;
            }

            tLNodeType tln0;
            int        lnt0 = tpl.GetLNType("TEMPLATE.LLN0");

            if (lnt0 != -1)
            {
                tln0 = tpl.LNodeType [lnt0];
            }
            else
            {
                tln0 = new tLNodeType(name, "LLN0", name + ".LLN0");
                tpl.AddLNodeType(tln0);
            }

            tLNodeType tln;
            int        lnt = tpl.GetLNType("TEMPLATE.LPHD");

            if (lnt != -1)
            {
                tln = tpl.LNodeType [lnt];
            }
            else
            {
                tln = new tLNodeType(name, "LPHD", name + ".LPHD");
                tpl.AddLNodeType(tln);
            }

            var ln0 = new LN0();

            ln0.lnType = tln0.id;
            ld.LN0     = ln0;

            var ln = new tLN();

            ln.inst    = 1;
            ln.lnType  = tln.id;
            ln.lnClass = tln.lnClass;
            ld.AddLN(ln);

            int api = this.GetAP(ap);

            if (api == -1)
            {
                api = this.AddAP(ap);
            }
            return(this.AccessPoint[api].Server.AddLDevice(ld));
        }