Exemple #1
0
        private void pointSelectionChanged(PairDouble coordinates)
        {
            const string format = "F4";
            string       labelX = coordinates.Item1.ToString(format);
            string       labelY = coordinates.Item2.ToString(format);

            setStatus($"Selected point: ({labelX}, {labelY})");
        }
Exemple #2
0
 public Particle(double _x, double _y, IDrawer _drawer)
 {
     Drawer = _drawer;
     m_CoordinatesNew = m_Coordinates = new PairDouble(_x, _y);
     
     Random k = new Random((int) DateTime.Now.ToBinary());
     Random r = new Random(k.GetHashCode());
     m_Speed = new PairDouble(Miscelaneous.ParticleSpeed * (0.5 - r.NextDouble()), Miscelaneous.ParticleSpeed * (0.5 - r.NextDouble()));
     m_Speed.Normalize();
 }
Exemple #3
0
        public virtual void NextStep(IEnumerable<IParticle> _particles, IBorder _border)
        {
            GetNearests(_particles);
            Interract();

            int? check = _border.Check(this);
            
            if (check!=null)
            {
                _border.Interract(this, (int) check);
            }
            else
            {
                m_CoordinatesNew = m_Coordinates + m_Speed;
            }
        }
Exemple #4
0
        public virtual void Interract()
        {
            var cumulativeSpeed = new PairDouble(0, 0);

            foreach (var particle in m_Nearest)
            {
                cumulativeSpeed = cumulativeSpeed + particle.SpeedInDouble;
            }
            PairDouble averSpd = cumulativeSpeed / m_Nearest.Count();

            averSpd.Normalize();

            if (averSpd.IsNaN())
            {
                averSpd = new PairDouble(0, 0);
            }

            m_Speed = averSpd * Miscelaneous.ParticleSpeed;
            AddNoize(Miscelaneous.Noize);
        }
 public override void Interract(IParticle _particle, int _index)
 {
  
     PairDouble newPos = new PairDouble(0,0);
     if (_index == 0)
     {
         newPos = _particle.CoordinatesInDouble +  new PairDouble(m_SizeX, 0);
     }
     if (_index == 1)
     {
         newPos = _particle.CoordinatesInDouble - new PairDouble(0, m_SizeY);
     }
     if (_index == 2)
     {
         newPos = _particle.CoordinatesInDouble - new PairDouble(m_SizeX, 0);
     }
     if (_index==3)
     {
         newPos = _particle.CoordinatesInDouble + new PairDouble(0, m_SizeY);
     }
     _particle.UpdCoordinates(newPos + _particle.SpeedInDouble);
 }
Exemple #6
0
        public bool selectAcceleration(string pathSignal = null)
        {
            if (mProject == null || !mProject.isOpened())
            {
                return(false);
            }
            mSelectedAcceleration = null;
            Response signal = mProject.retrieveSelectedSignal(pathSignal);

            if (signal != null && signal.Type == ResponseType.kAccel)
            {
                mSelectedAcceleration = signal;
            }
            else
            {
                textBoxSelectedAcceleration.Text = "";
                return(false);
            }
            textBoxSelectedAcceleration.Text = mSelectedAcceleration.Name;
            // Set boundaries of levels and frequencies
            PairDouble frequencyBoundaries = mSelectedAcceleration.getFrequencyBoundaries();
            double     minFrequency        = frequencyBoundaries.Item1;
            double     maxFrequency        = frequencyBoundaries.Item2;

            // Left frequency correction
            setFrequencyBoundary(numericLeftFrequencyBoundary, minFrequency, maxFrequency);
            numericLeftFrequencyBoundary.Value = minFrequency;
            // Right frequency correction
            setFrequencyBoundary(numericRightFrequencyBoundary, minFrequency, maxFrequency);
            numericRightFrequencyBoundary.Value = maxFrequency;
            // Resonance frequency
            enableNumericControl(numericResonanceFrequencyReal, minFrequency, maxFrequency);
            enableNumericControl(numericResonanceFrequencyImaginary, minFrequency, maxFrequency);
            enableNumericControl(numericResonanceFrequencyAmplitude, minFrequency, maxFrequency);
            // Decrement by real part
            numericDecrementByReal.Value = null;
            return(true);
        }
Exemple #7
0
 private void frequencyBoundariesChanged(PairDouble boundaries)
 {
     numericLeftFrequencyBoundary.Value  = boundaries.Item1;
     numericRightFrequencyBoundary.Value = boundaries.Item2;
     calculateAndPlot();
 }
Exemple #8
0
        public void calculateCharacteristics()
        {
            PairDouble frequencyBoundaries    = new PairDouble((double)numericLeftFrequencyBoundary.Value, (double)numericRightFrequencyBoundary.Value);
            PairDouble levelsBoundaries       = new PairDouble((double)numericLeftLevelsBoundary.Value, (double)numericRightLevelsBoundary.Value);
            int        numLevels              = (int)numericLevelsNumber.Value;
            int        numInterpolationPoints = (int)numericInterpolationLength.Value;

            if (mSelectedModalSet != null)
            {
                mSelectedModalSet.ReferenceResponse = mSelectedAcceleration;
            }
            ResponseCharacteristics characteristics = new ResponseCharacteristics(mSelectedAcceleration, ref frequencyBoundaries, ref levelsBoundaries,
                                                                                  numLevels, numInterpolationPoints,
                                                                                  numericResonanceFrequencyReal.Value, numericResonanceFrequencyImaginary.Value, numericResonanceFrequencyAmplitude.Value,
                                                                                  mSelectedModalSet);

            // Set signal data to plot
            mSignalGraphModels[SignalModelType.kImaginary].setData(mSelectedAcceleration, frequencyBoundaries, levelsBoundaries, characteristics.ResonanceFrequencyImaginary);
            mSignalGraphModels[SignalModelType.kReal].setData(mSelectedAcceleration, frequencyBoundaries, levelsBoundaries, characteristics.ResonanceFrequencyReal);
            mSignalGraphModels[SignalModelType.kAmplitude].setData(mSelectedAcceleration, frequencyBoundaries, levelsBoundaries, characteristics.ResonanceFrequencyAmplitude);
            mHodographGraphModel.setData(mSelectedAcceleration, characteristics.ResonanceRealPeak, characteristics.ResonanceImaginaryPeak);
            if (mSelectedModalSet != null)
            {
                mMonophaseGraphModel.setData(mSelectedModalSet.Responses);
            }
            // Set results
            mDecrementGraphModel.setData(characteristics.Decrement);
            ModalParameters modalResults = characteristics.Modal;

            if (modalResults != null)
            {
                foreach (ModalGraphModel model in mModalGraphModels)
                {
                    model.setData(modalResults);
                }
            }
            // Correct input parameters
            numericLeftFrequencyBoundary.Value  = frequencyBoundaries.Item1;
            numericRightFrequencyBoundary.Value = frequencyBoundaries.Item2;
            numericLeftLevelsBoundary.Value     = levelsBoundaries.Item1;
            numericRightLevelsBoundary.Value    = levelsBoundaries.Item2;
            if (characteristics.ResonanceFrequencyReal > 0)
            {
                numericResonanceFrequencyReal.Value = characteristics.ResonanceFrequencyReal;
            }
            if (characteristics.ResonanceFrequencyImaginary > 0)
            {
                numericResonanceFrequencyImaginary.Value = characteristics.ResonanceFrequencyImaginary;
            }
            if (characteristics.ResonanceFrequencyAmplitude > 0)
            {
                numericResonanceFrequencyAmplitude.Value = characteristics.ResonanceFrequencyAmplitude;
            }
            numericDecrementByReal.Value = null;
            if (characteristics.Decrement != null)
            {
                if (characteristics.Decrement.Real > 0)
                {
                    numericDecrementByReal.Value = characteristics.Decrement.Real;
                }
            }
        }
Exemple #9
0
 public void Move()
 {
     m_Coordinates = m_CoordinatesNew;
 }
Exemple #10
0
 public void UpdCoordinates(PairDouble _newPos)
 {
     m_CoordinatesNew = _newPos;
 }
Exemple #11
0
 public void UpdSpeed(PairDouble _newSpd)
 {
     m_Speed = _newSpd;
 }