Example #1
0
        /// <summary>
        /// Calculate the measured phase for simulation
        /// </summary>
        /// <param name="antX">Antenna position x</param>
        /// <param name="antY">Antenna position y</param>
        /// <param name="tagX">Tag position x</param>
        /// <param name="tagY">Tag position y</param>
        /// <param name="freq">Frequency</param>
        /// <returns>Measured Phase</returns>
        public double CaculatingSimulationMeasuredPhase(double antX, double antY, double antZ, double tagX, double tagY, double tagZ, int freq)
        {
            double simulationMeasuredPhase = Double.MinValue;

            double waveLength = SARParameter.C / Convert.ToDouble(freq);
            double distance   = Math.Sqrt(Math.Pow(antX - tagX, 2) + Math.Pow(antY - tagY, 2) + Math.Pow(antZ - tagZ, 2));

            if (cbPhaseAmbiguity.Checked)
            {
                // Phase with ambiguity
                simulationMeasuredPhase = GeneratePhaseAmbiguity(4 * Math.PI * distance / waveLength) % (2 * Math.PI);
            }
            else
            {
                // Phase without ambiguity
                simulationMeasuredPhase = (4 * Math.PI * distance / waveLength) % (2 * Math.PI);
            }

            simulationMeasuredPhase = AppMath.GetNormalDistribution(simulationMeasuredPhase + Convert.ToDouble(tbxMu.Text.Trim()), Convert.ToDouble(tbxSigma.Text.Trim()));
            return(simulationMeasuredPhase);
        }