public bool IsEqual(NC_Var ncVar, bool ignoreUnit = false)
 {
     return(this.bausteintyp == ncVar.bausteintyp &&
            this.laenge == ncVar.laenge &&
            this.spalte == ncVar.spalte &&
            this.syntaxId == ncVar.syntaxId &&
            this.typ == ncVar.typ &&
            this.zeile == ncVar.zeile &&
            this.zeilenanzahl == ncVar.zeilenanzahl &&
            (ignoreUnit ? this.Bereich == ncVar.Bereich : this.bereich_u_einheit == ncVar.bereich_u_einheit));
 }
 public NC_Var(NC_Var var, int unitOffset = 0, int rowOffset = 0, int columnOffset = 0)
 {
     this.SYNTAX_ID         = var.SYNTAX_ID;
     this.Bereich_u_einheit = (byte)(var.Bereich_u_einheit + unitOffset);
     this.Spalte            = (ushort)(var.Spalte + columnOffset);
     this.Zeile             = (ushort)(var.Zeile + rowOffset);
     this.Bausteintyp       = var.Bausteintyp;
     this.ZEILENANZAHL      = var.ZEILENANZAHL;
     this.Typ    = var.Typ;
     this.Laenge = var.Laenge;
 }
Beispiel #3
0
        private void LibNoDaveValueEditor_Load(object sender, EventArgs e)
        {
            if (_libnodavevalue != null)
            {
                ncVar = new NC_Var(_libnodavevalue);
            }
            else
            {
                startWasNull    = true;
                _libnodavevalue = new PLCNckTag();
            }

            pGridNCK.SelectedObject = ncVar;
        }
        public static NC_Var GetNC_Var(PLCNckTag nckTag)
        {
            var ret = new NC_Var();

            if (nckTag != null)
            {
                ret.SYNTAX_ID         = 0x82;
                ret.Bereich_u_einheit = (byte)((byte)nckTag.NckArea << 5 | nckTag.NckUnit);
                ret.Spalte            = (UInt16)nckTag.NckColumn;
                ret.Zeile             = (UInt16)nckTag.NckLine;
                ret.Bausteintyp       = (byte)nckTag.NckModule;
                ret.ZEILENANZAHL      = (byte)nckTag.NckLinecount;
                ret.Typ    = GetNckType(nckTag.TagDataType);
                ret.Laenge = (UInt16)nckTag._internalGetSize();
            }
            return(ret);
        }
        public override string ToString()
        {
            string old = "";

            if (_oldvalues != null)
            {
                old = "   -- Old-Values: ";
                foreach (var oldvalue in _oldvalues)
                {
                    old += oldvalue.ToString() + ",";
                }
                old += "";
            }

            //string s = string.Format("0x{0},0x{1},0x{2},0x{3},0x{4},0x{5},{6},0x{7}", NckArea.ToString("X"), NckUnit.ToString("X"), NckColumn.ToString("X"), NckLine.ToString("X"), NckModule.ToString("X"), NckLinecount.ToString("X"), TagDataType, _internalGetSize().ToString("X"));
            NC_Var ncVar = new NC_Var(this);
            string s     = string.Format("0x{0},0x{1},0x{2},0x{3},0x{4},0x{5},0x{6},0x{7}", ncVar.SYNTAX_ID.ToString("X"), ncVar.Bereich_u_einheit.ToString("X"), ncVar.Spalte.ToString("X"), ncVar.Zeile.ToString("X"), ncVar.Bausteintyp.ToString("X"), ncVar.ZEILENANZAHL.ToString("X"), ncVar.Typ.ToString("X"), ncVar.Laenge.ToString("X"));

            if (Value != null)
            {
                return(s + " = " + GetValueAsString() + old);
            }
            return(s);
        }
 /// <summary>
 /// Create an new Nck tag from an existing one by copying its information
 /// </summary>
 /// <param name="ncVar"></param>
 /// <param name="tag"></param>
 public PLCNckTag(NC_Var ncVar, object tag = null)
 {
     CopyTag(ncVar != null ? ncVar.GetNckTag() : null, tag);
 }