Exemplo n.º 1
0
        public void BoolTag_AddAddress()
        {
            BoolTag myTag = new BoolTag(StatusFunction.InputStatus);

            myTag.AddAddress(5);
            myTag.AddAddress(12);
            myTag.SetData(GetModbusBoolValues());
        }
Exemplo n.º 2
0
        public void BoolTag_OrMerge3()
        {
            BoolTag myTag = new BoolTag(StatusFunction.InputStatus);

            myTag.AddAddress(8); // false
            myTag.AddAddress(9); // false
            myTag.MergeType = TagAddressMergeType.OrMerge;
            myTag.SetData(GetModbusBoolValues());
            Assert.AreEqual(false, myTag.Value);
        }
Exemplo n.º 3
0
        public void BoolTag_AndMerge2()
        {
            BoolTag myTag = new BoolTag(StatusFunction.InputStatus);

            myTag.AddAddress(3); // true
            myTag.AddAddress(4); // true
            myTag.MergeType = TagAddressMergeType.AndMerge;
            myTag.SetData(GetModbusBoolValues());
            Assert.AreEqual(true, myTag.Value);
        }
Exemplo n.º 4
0
        public void BoolTag_OrMask5()
        {
            BoolTag myTag = new BoolTag(StatusFunction.InputStatus);

            myTag.AddAddress(5); // false
            myTag.MaskType = TagAddressMaskType.None;
            myTag.Mask     = true;
            myTag.SetData(GetModbusBoolValues());
            Assert.AreEqual(false, myTag.Value);
        }
Exemplo n.º 5
0
        public void BoolTag_OrMask2()
        {
            BoolTag myTag = new BoolTag(StatusFunction.InputStatus);

            myTag.AddAddress(3); // true
            myTag.MaskType = TagAddressMaskType.OrMask;
            myTag.Mask     = false;
            myTag.SetData(GetModbusBoolValues());
            Assert.AreEqual(true, myTag.Value);
        }
Exemplo n.º 6
0
 public void RefreshValues(ReadMap map, bool[] modbusvalues)
 {
     //TODO : May performance better
     for (int i = 0; i < modbusvalues.Length; i++)
     {
         ushort address = (ushort)(i + map.StartAddress);
         if (!CoilValues.ContainsKey(address))
         {
             CoilValues.Add(address, modbusvalues[i]);
         }
         else
         {
             CoilValues[address] = modbusvalues[i];
         }
     }
     foreach (var item in Values)
     {
         BoolTag tag = item as BoolTag;
         tag.SetData(CoilValues);
     }
 }