Ejemplo n.º 1
0
        public override void ReadInit(ILambdaWorker worker)
        {
            try
            {
                var tryCount = 2;
                do
                {
                    _unit.ClearMeasuredParameters();
                    var result = _protocol.Dvc(_unit.ExpectedIdentifier, _unit.Address, _unit.Voltage);
                    _unit.MeasuredParameters(result[0], result[1], result[2], result[3], result[4], result[5]);

                    if (!Process())
                    {
                        break;
                    }
                    tryCount--;
                    Thread.Sleep(100);
                } while (tryCount >= 0);

                if (tryCount < 0)
                {
                    throw new LambdaFailureException(
                              string.Format(Properties.Resources.UnableToEstablishVaotageOrCurrent,
                                            _unit.Voltage, _unit.Current));
                }

                worker.Goto(worker.StateRead);
            }
            catch (Exception)
            {
                worker.Goto(worker.StateFailure);
                throw;
            }
        }
Ejemplo n.º 2
0
        public override void PowerOn(ILambdaWorker worker)
        {
            try
            {
                _unit.Available(false);
                _protocol.Adr(_unit.ExpectedIdentifier, _unit.Address, _unit.Address);
                _unit.Available(true);

                _protocol.OutOn(_unit.ExpectedIdentifier, _unit.Address, _unit.Voltage);

                _protocol.Idn(_unit.ExpectedIdentifier, _unit.Address);

                worker.Goto(worker.StateReadInit);
            }
            catch (Exception)
            {
                worker.Goto(worker.StateFailure);
                throw;
            }
        }
Ejemplo n.º 3
0
        public override void Read(ILambdaWorker worker)
        {
            try
            {
                _unit.ClearMeasuredParameters();
                var result = _protocol.Dvc(_unit.ExpectedIdentifier, _unit.Address, _unit.Voltage);
                _unit.MeasuredParameters(result[0], result[1], result[2], result[3], result[4], result[5]);

                Process();
            }
            catch (Exception)
            {
                worker.Goto(worker.StateFailure);
                throw;
            }
        }