Esempio n. 1
0
 //-------------
 //methods
 //-------------
 public GlobalObject()
 {
     mTagStorage = new TagStorage();
     csvLogger   = new CsvLogger();
     timer       = new Timer();
     mode        = Mode.Test;
 }
Esempio n. 2
0
 /// <summary>
 /// Открытие XML-файла
 /// </summary>
 private void LoadToTreeViewFromFile()
 {
     Microsoft.Win32.OpenFileDialog myDialog = new Microsoft.Win32.OpenFileDialog();
     myDialog.Filter          = "XML-документ(*.XML)|*.XML" + "|Все файлы (*.*)|*.*";
     myDialog.CheckFileExists = true;
     myDialog.Multiselect     = false;
     if (myDialog.ShowDialog() == true)
     {
         openPath    = myDialog.FileName;          //назначаем путь к файлу
         tagTree     = tagTree.LoadTree(openPath); //загружаем из файла наш XML
         rootTagTree = new TagStorage();
         rootTagTree.RootPath.Add(tagTree);
     }
 }
Esempio n. 3
0
        public void tagStorageTest()
        {
            const int  MAXTAG     = 65535;
            TagStorage tagStorage = new TagStorage();

            for (int i = 0; i <= MAXTAG; i++)
            {
                tagStorage.setTag(new ModbusAddress(Space.Coils, (UInt16)i), (UInt16)(i % 2));
                tagStorage.setTag(new ModbusAddress(Space.DiscreteInputs, (UInt16)i), (UInt16)(i % 2));
                tagStorage.setTag(new ModbusAddress(Space.AnalogInputs, (UInt16)i), (UInt16)i);
                tagStorage.setTag(new ModbusAddress(Space.Holdings, (UInt16)i), (UInt16)i);
            }
            for (int i = 0; i <= MAXTAG; i++)
            {
                Assert.IsTrue(tagStorage.getTag(new ModbusAddress(Space.Coils, (UInt16)i)) == (UInt16)(i % 2));
                Assert.IsTrue(tagStorage.getTag(new ModbusAddress(Space.DiscreteInputs, (UInt16)i)) == (UInt16)(i % 2));
                Assert.IsTrue(tagStorage.getTag(new ModbusAddress(Space.AnalogInputs, (UInt16)i)) == i);
                Assert.IsTrue(tagStorage.getTag(new ModbusAddress(Space.Holdings, (UInt16)i)) == i);
            }
        }