コード例 #1
0
ファイル: StringTests.cs プロジェクト: fengxing1121/Mosaic
        public void SetUp()
        {
            var logger = new Log4NetLogger();

            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort, logger);
            _tagListener   = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock(), logger);

            _tagController.StartConnection();
            _tagListener.StartListening();
        }
コード例 #2
0
        public void SetUp()
        {
            _logger        = new Log4NetLogger();
            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort, _logger);
            _tagListener   = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock(), _logger);

            _tagController.StartConnection();
            _tagListener.StartListening();

            _tagImporter = new BeckhoffOnlineTagImporter(_logger);
            _tagImporter.Initialize(Global.AdsAddress, Global.AdsPort);
        }
コード例 #3
0
        public void SetUp()
        {
            _tagController  = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort);
            _tagListener    = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _alarmsImporter = new BeckhoffOnlineAlarmsImporter(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _alarmsImporter.Initialize(_tagListener);

            _tagController.StartConnection();
            _tagListener.StartListening();

            // prepare test by clear out all alarms
            _tagController.WriteTag(WriteTags.GlobalAlarmsCommandTag, WriteTags.ClearAllAlarmsCommand).Wait();
            Thread.Sleep(500);
        }
コード例 #4
0
        public void SetUp()
        {
            _tag           = new Tag("fbAGS_1.udiAlarmId", "MiddlePRG_1", "UDINT", Global.AdsPort);
            _tagController = new BeckhoffTagController(Global.AdsAddress, Global.AdsPort);
            _tagController.StartConnection();
            _tagListener = new BeckhoffPollingTagListener(Global.AdsAddress, Global.AdsPort, new GlobalLock());
            _tagListener.StartListening();

            try
            {
                _tagController.WriteTag(_tag, 0).Wait(1000);
            }
            catch (Exception e)
            {
                Assert.Fail("Cannot setup test because writing initial values to PLC failed. " + e.Message);
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes this instance with all necessary information needed to import controller trees.
 /// </summary>
 /// <param name="tagListener">The tag listener used to register the tags of the imported controller on.</param>
 /// <param name="path">The connection string or path (file path or IP address depending on implementation). In case of Beckhoff this is the AdsAddress.</param>
 /// <param name="port">The ADS Port in case of Beckhoff implementation.</param>
 /// <param name="rootController">The plcAddress of the root controller</param>
 public virtual void Initialize(
     ITagListener tagListener,
     string path,
     int port = 0,
     string rootController = "")
 {
     if (_controllerTree.IsInitialized)
     {
         return;
     }
     _tagListener    = tagListener;
     _adsAddress     = path;
     _adsPort        = port;
     _rootController = rootController;
     _logger.Init(typeof(BeckhoffOnlineControllerTreeImporter));
     _twinCatClient.Initialize(path, port);
     _tagController.StartConnection(path, port);
     _alarmsImporter.Initialize(tagListener);
     _findControllerTags.Initialize(_tagListener, _adsAddress, _adsPort);
 }