Ejemplo n.º 1
0
            public void ChangeRotor(RotorType type)
            {
                var position = _rotor.PositionShift;

                _rotor = _componentFactory.CreateRotor(type, _slot, position);
                _settingsAggregator.PublishOnUIThread(_rotor);
            }
Ejemplo n.º 2
0
        public Rotor(RotorSlot slot, int position, char[] connections, RotorType type, IEventAggregator eventAggregator, IUtilityFactory utilityFactory)
        {
            _utilityFactory = utilityFactory;

            Connections     = connections;
            Slot            = slot;
            PositionShift   = position;
            Type            = type;
            RotorAggregator = eventAggregator;
        }
Ejemplo n.º 3
0
        public Rotor(string mapping, RotorType type, bool ignoreInvalidMapping = false)
        {
            this.mapping = GenerateConnectionsFromMapping(mapping, ignoreInvalidMapping);

            CalculateReverseOffsets();

            this.initialMapping = this.mapping;

            this.length = this.mapping.Length;

            this.type = type;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public Rotor()
        {
            // Use the default rotor type.
            type = RotorType.Rotor;

            mapping = GenerateReverseAlphabeticalConnections(26);

            CalculateReverseOffsets();

            length = 26;
            this.initialMapping = mapping;
        }
Ejemplo n.º 5
0
        public async void Process_GetCorrectOutput(char inputLetter, char expectedLetter, bool step, bool expectedStep, int position, int expectedPosition,
                                                   RotorType type = RotorType.I, RotorSlot slot = RotorSlot.One)
        {
            // Arrange
            var utilityFactory   = new UtilityFactory();
            var componentFactory = new ComponentFactory(utilityFactory);
            var rotor            = componentFactory.CreateRotor(type, slot, position);
            var inputValue       = CommonHelper.LetterToNumber(inputLetter);
            var signal           = await utilityFactory.CreateSignal(inputValue, step, SignalDirection.In);

            // Act
            var resultSignal = await rotor.Process(signal);

            var resultValue  = resultSignal.Value;
            var resultLetter = CommonHelper.NumberToLetter(resultValue);
            var resultStep   = resultSignal.Step;

            // Assert
            Assert.Equal(expectedLetter, resultLetter);
            Assert.Equal(expectedStep, resultStep);
            Assert.Equal(expectedPosition, rotor.PositionShift);
        }
Ejemplo n.º 6
0
        }                                           // String de relatório

        public InputParms(double altura, double rotacao, double vazao, double rendimentoV, double rendMeca, double rendInterno)
        {
            this.altura      = altura;
            this.rotacaoRPM  = rotacao;
            this.vazao       = vazao;
            this.rendimentoV = rendimentoV;
            this.rendInterno = rendInterno;
            this.rendMeca    = rendMeca;

            this.rpmToRps(rotacao);
            this.hToY(altura);
            this.nqa();
            this.vazaoRendimento();
            this.report += $"A Turbina, com os parâmetros de entrada:\naltura:{altura}[m]\nvazão: {vazao}[m³/s\nrotação: {rotacao}[rpm]\nrendimento volumétrico: {rendimentoV}\n";
            RotorType type = new RotorType();

            type.Type(this.nqa());
            this.report += "\n---------Cálculos Iniciais---------------\n\n";
            this.report += $"O valor da nqa = {this.nqa()} e o tipo de rotor é {type.rotor}\n";
            this.report += $"A vazão com rendimento volumátrico é {vazaoR}[m³/s]\n";
            this.nqar11();
            this.report += $"O Valor de nqa1/1: {nqar_11}\n";
            this.qr();
            this.report += $"Vazão Regular: {vazaoRegular}[m³/s]\n";
            this.n_qar();
            this.report += $"A rotação especifíca nqar: {nqar}[rpm]\n";
            this.tomae();
            this.report += $"O valor do toma: {toma} \n";

            this.pot_max_eixo();
            this.report += $"A potência máxima no eixo P_max: {potMaxEixo} [kW]\n";

            OutputParmsGeometry output = new OutputParmsGeometry(nqar, altura, rotacaoRPM, vazaoRegular, rendimentoV);

            this.report += output.report;
        }
Ejemplo n.º 7
0
        private void SetRotorType(string type)
        {
            switch (type)
            {
                case "rotor": this.type = RotorType.Rotor;
                    break;

                case "stator": this.type = RotorType.Stator;
                    break;

                case "reflector": this.type = RotorType.Reflector;
                    break;

                default: throw new RotorTypeException(string.Format("The type {0} is not a valid rotor type", type));
            }
        }
Ejemplo n.º 8
0
        public IRotor CreateRotor(RotorType type, RotorSlot slot, int position)
        {
            var aggregator = CreateEventAggregator();

            return(new Rotor(slot, position, _rotorConnections[type], type, aggregator, UtilityFactory));
        }
Ejemplo n.º 9
0
 public Rotor(RotorClass rc, RotorType rt, int sp)
 {
     rotorClass = rc;
     dynamic ro;
     switch (rt)
     {
         case RotorType.I:
             ro = new RotorI();
             break;
         case RotorType.II:
             ro = new RotorII();
             break;
         case RotorType.III:
             ro = new RotorIII();
             break;
         case RotorType.IV:
             ro = new RotorIV();
             break;
         case RotorType.V:
             ro = new RotorV();
             break;
         case RotorType.B:
             ro = new ReflectorB();
             break;
         case RotorType.C:
             ro = new ReflectorC();
             break;
         default:
             ro = null;
             break;
     }
     rotorObject = ro;
     startingPosition = sp;
     currentPosition = startingPosition;
 }