TimeProportionedPidController(float windowSize, IOnOff relay, TimeSpan samplingRate,
                                      Func <float> readProcess, Func <float> readOutput, Func <float> readSetPoint,
                                      float proportionalGain, float integralGain, float derivativeGain,
                                      ControllerDirection controllerDirection = ControllerDirection.Direct,
                                      ControllerMode controllerMode           = ControllerMode.Automatic)
        {
            _windowSize = windowSize;
            _relay      = relay;
            if (readProcess == null)
            {
                throw new ArgumentNullException(nameof(readProcess), "Read process must not be null.");
            }
            if (readOutput == null)
            {
                throw new ArgumentNullException(nameof(readOutput), "Read output must not be null.");
            }
            if (readSetPoint == null)
            {
                throw new ArgumentNullException(nameof(readSetPoint), "Read set-point must not be null.");
            }

            SamplingRate = samplingRate;
            SetOutputLimits(0, _windowSize);
            _readProcess        = readProcess;
            _readOutput         = readOutput;
            _writeOutput        = writeOutput;
            _readSetPoint       = readSetPoint;
            ProportionalGain    = proportionalGain;
            IntegralGain        = integralGain;
            DerivativeGain      = derivativeGain;
            ControllerDirection = controllerDirection;
            ControllerMode      = controllerMode;
        }
示例#2
0
        public void Undo(IDataCommand dataCommand)
        {
            IOnOff onOff = dataCommand.GetDevice() as IOnOff;

            if (onOff != null)
            {
                onOff.On();
            }
        }
示例#3
0
        public void Execute(IDataCommand dataCommand)
        {
            IOnOff onOff = dataCommand.GetDevice() as IOnOff;

            if (onOff != null)
            {
                onOff.Off();
            }
        }
 public void OnOffDvd()
 {
     if (State == StateOnOff.On)
     {
         IOnOff onOff = GetDvd();
         if (onOff != null)
         {
             if (onOff.State == StateOnOff.On)
             {
                 onOff.Off();
             }
             else
             {
                 onOff.On();
             }
         }
     }
     else
     {
         throw new Exception("Нужно сначала включить домашний кинотеатр");
     }
 }
示例#5
0
 public Facade(Kitty kitty, IOnOff light, IOnOff music)
 {
     _kitty = kitty;
     _light = light;
     _music = music;
 }
示例#6
0
 public MySwitch(string id, IOnOff outlet)
     : this(id, new IOnOff[] { outlet })
 {
 }