コード例 #1
0
ファイル: Acquisitor.cs プロジェクト: fr830/SCADA-3
 public Acquisitor(AutoResetEvent acquisitionTrigger, FunctionExecutor commandExecutor, IStateUpdater stateUpdater)
 {
     this.stateUpdater       = stateUpdater;
     this.acquisitionTrigger = acquisitionTrigger;
     this.commandExecutor    = commandExecutor;
     this.InitializeAcquisitionThread();
     this.StartAcquisitionThread();
 }
コード例 #2
0
ファイル: FunctionExecutor.cs プロジェクト: fr830/SCADA-3
 public FunctionExecutor(IStateUpdater stateUpdater)
 {
     this.stateUpdater         = stateUpdater;
     connection                = new TCPConnection(stateUpdater, this);
     this.processConnection    = new AutoResetEvent(false);
     connectionProcessorThread = new Thread(new ThreadStart(ConnectionProcessorThread));
     connectionProcessorThread.Start();
 }
コード例 #3
0
ファイル: Acquisitor.cs プロジェクト: vukisic/WEB_SCADA
 /// <summary>
 /// Initializes a new instance of the <see cref="Acquisitor"/> class.
 /// </summary>
 /// <param name="acquisitionTrigger">The acquisition trigger.</param>
 /// <param name="processingManager">The processing manager.</param>
 /// <param name="stateUpdater">The state updater.</param>
 /// <param name="configuration">The configuration.</param>
 public Acquisitor(AutoResetEvent acquisitionTrigger, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration)
 {
     this.stateUpdater       = stateUpdater;
     this.acquisitionTrigger = acquisitionTrigger;
     this.processingManager  = processingManager;
     this.configuration      = configuration;
     this.InitializeAcquisitionThread();
     this.StartAcquisitionThread();
 }
コード例 #4
0
ファイル: BasePointItem.cs プロジェクト: fr830/SCADA-3
 public BasePointItem(PointType type, ushort address, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater)
 {
     this.type                         = type;
     this.address                      = address;
     this.commandExecutor              = commandExecutor;
     this.name                         = name;
     this.stateUpdater                 = stateUpdater;
     commandExecutor.UpdatePointEvent += CommandExecutor_UpdatePointEvent;
     WriteCommand                      = new RelayCommand(WriteCommand_Execute);
     ReadCommand                       = new RelayCommand(ReadCommand_Execute);
 }
コード例 #5
0
ファイル: BasePointItem.cs プロジェクト: vukisic/WEB_SCADA
        public BasePointItem(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i)
        {
            this.configItem        = c;
            this.processingManager = processingManager;
            this.stateUpdater      = stateUpdater;
            this.configuration     = configuration;

            this.type     = c.RegistryType;
            this.address  = (ushort)(c.StartAddress + i);
            this.name     = $"{configItem.Description} [{i}]";
            this.rawValue = configItem.DefaultValue;
            this.pointId  = PointIdentifierHelper.GetNewPointId(new PointIdentifier(this.type, this.address));
        }
コード例 #6
0
        public BasePointItem(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i)
        {
            this.configItem      = c;
            this.commandExecutor = commandExecutor;
            this.stateUpdater    = stateUpdater;
            this.configuration   = configuration;

            this.type     = c.RegistryType;
            this.address  = (ushort)(c.StartAddress + i);
            this.gid      = configItem.Gid;
            this.name     = $"{configItem.Description}";
            this.rawValue = configItem.DefaultValue;
            //	commandExecutor.UpdatePointEvent += CommandExecutor_UpdatePointEvent;
            WriteCommand = new RelayCommand(WriteCommand_Execute, WriteCommand_CanExecute);
            ReadCommand  = new RelayCommand(ReadCommand_Execute);
        }
コード例 #7
0
ファイル: BasePointItem.cs プロジェクト: Mistra7/Diplomski
        public BasePointItem(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i)
        {
            this.configItem        = c;
            this.processingManager = processingManager;
            this.stateUpdater      = stateUpdater;
            this.configuration     = configuration;
            this.alarm             = AlarmType.NO_ALARM;
            this.type     = c.RegistryType;
            this.address  = (ushort)(c.StartAddress + i);
            this.name     = $"{configItem.Description} [{i}]";
            this.rawValue = configItem.DefaultValue;
            this.pointId  = PointIdentifierHelper.GetNewPointId(new PointIdentifier(this.type, this.address));

            WriteCommand = new RelayCommand(WriteCommand_Execute, WriteCommand_CanExecute);
            ReadCommand  = new RelayCommand(ReadCommand_Execute);
        }
コード例 #8
0
        public static Text TranslateFromGerman(
            Text text,
            Location location,
            IStateUpdater <ServerCommunicationStatistics> statisticsStateUpdater)
        {
            bool useServer1 = DateTime.Now.Millisecond < 500;

            if (useServer1)
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                var result = TranslateFromGermanViaServer1(text, location);

                var elapsed = stopwatch.Elapsed;

                statisticsStateUpdater.UpdateState(statisticsState =>
                                                   statisticsState
                                                   .WithTotalTimeSpentCommunicatingWithServer1(
                                                       statisticsState.TotalTimeSpentCommunicatingWithServer1 + elapsed)
                                                   .WithNumberOfTimesCommunicatedWithServer1(
                                                       statisticsState.NumberOfTimesCommunicatedWithServer1 + 1));

                return(result);
            }

            Stopwatch stopwatch2 = Stopwatch.StartNew();

            var resultFromServer2 = TranslateFromGermanViaServer2(text, location);

            var elapsed2 = stopwatch2.Elapsed;

            statisticsStateUpdater.UpdateState(statisticsState =>
                                               statisticsState
                                               .WithTotalTimeSpentCommunicatingWithServer2(
                                                   statisticsState.TotalTimeSpentCommunicatingWithServer2 + elapsed2)
                                               .WithNumberOfTimesCommunicatedWithServer2(
                                                   statisticsState.NumberOfTimesCommunicatedWithServer2 + 1));

            return(resultFromServer2);
        }
コード例 #9
0
 public AnalaogInput(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i)
     : base(c, commandExecutor, stateUpdater, configuration, i)
 {
 }
コード例 #10
0
 public TCPConnection(IStateUpdater stateUpdater, FunctionExecutor commandExecutor)
 {
     this.stateUpdater    = stateUpdater;
     this.commandExecutor = commandExecutor;
     this.remoteEP        = CreateRemoteEndpoint();
 }
コード例 #11
0
 public AnalogOutput(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i)
     : base(c, processingManager, stateUpdater, configuration, i)
 {
 }
コード例 #12
0
ファイル: AnalogBase.cs プロジェクト: fr830/SCADA-3
 public AnalogBase(IConfigItem c, IFunctionExecutor commandExecutor, IStateUpdater stateUpdater, IConfiguration configuration, int i)
     : base(c, commandExecutor, stateUpdater, configuration, i)
 {
     ProcessRawValue(RawValue);
 }
コード例 #13
0
ファイル: DigitalInput.cs プロジェクト: fr830/SCADA-3
 public DigitalInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, commandExecutor, name, stateUpdater)
 {
     State = (DState)defaultValue;
 }
コード例 #14
0
 public DigitalInput(PointType type, ushort address, int rawValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, rawValue, commandExecutor, name, stateUpdater)
 {
 }
コード例 #15
0
 public AnalaogInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater) : base(type, address, commandExecutor, name, stateUpdater)
 {
     Value = defaultValue;
 }
コード例 #16
0
 public AnalaogInput(PointType type, ushort address, ushort defaultValue, FunctionExecutor commandExecutor, string name, IStateUpdater stateUpdater, ushort minValue, ushort maxValue) : this(type, address, defaultValue, commandExecutor, name, stateUpdater)
 {
     this.Min = minValue;
     this.Max = maxValue;
 }
コード例 #17
0
 public DigitalBase(IConfigItem c, IProcessingManager processingManager, IStateUpdater stateUpdater, IConfiguration configuration, int i)
     : base(c, processingManager, stateUpdater, configuration, i)
 {
 }