Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of our transmitting phone
        /// with default configuration and graphics.
        /// </summary>
        /// <returns>A new SimpleDigitalTransmitter.</returns>
        private SimpleDigitalTransmitter CreateTransmittingPhone()
        {
            var earth = CentralBodiesFacet.GetFromContext().Earth;

            // Create a new SimpleDigitalTransmitter and assign its basic properties.
            // Even though we are using a static location for our transmitter,
            // it can easily be changed to a moving one by simply modifying the
            // LocationPoint to something else, for example a route generated
            // with the Route Design Library.
            double longitude = Trig.DegreesToRadians(39.6333);
            double latitude  = Trig.DegreesToRadians(11.1333);
            var    phone     = new SimpleDigitalTransmitter
            {
                Name             = "Dessie, Ethiopia",
                LocationPoint    = new PointCartographic(earth, new Cartographic(longitude, latitude, 0.0)),
                CarrierFrequency = m_intendedSignal.TargetFrequency,
                EffectiveIsotropicRadiatedPower = CommunicationAnalysis.FromDecibels(m_transmitPowerTrackBar.Value),
                DataRate = 50000.0
            };

            //Add a default marker
            phone.Extensions.Add(new MarkerGraphicsExtension(new MarkerGraphics
            {
                Texture = new ConstantGraphicsParameter <Texture2D>(m_phoneTexture)
            }));

            //Add a label based on the name and show just below the marker.
            var textGraphics = new TextGraphics
            {
                Color             = new ConstantGraphicsParameter <Color>(Color.Yellow),
                Font              = new ConstantGraphicsParameter <Font>(m_labelFont),
                Outline           = new ConstantGraphicsParameter <bool>(true),
                OutlineColor      = new ConstantGraphicsParameter <Color>(Color.Black),
                Text              = new ConstantGraphicsParameter <string>(phone.Name),
                Origin            = new ConstantGraphicsParameter <Origin>(Origin.TopCenter),
                PixelOffset       = new ConstantGraphicsParameter <PointF>(new PointF(0, -m_phoneTexture.Template.Height / 2)),
                DisplayParameters =
                {
                    MaximumDistance = new ConstantGraphicsParameter <double>(75000000.0)
                }
            };

            if (TextureFilter2D.Supported(TextureWrap.ClampToEdge))
            {
                textGraphics.TextureFilter = new ConstantGraphicsParameter <TextureFilter2D>(TextureFilter2D.NearestClampToEdge);
            }

            phone.Extensions.Add(new TextGraphicsExtension(textGraphics));

            return(phone);
        }
Exemplo n.º 2
0
        /// <summary>
        /// "Places" the call by enabling the display of
        /// the link budget results as well as showing a line
        /// indicating if the link is currently valid. If links
        /// signal to noise ratio gets to high, it becomes invalid
        /// and the line disappears.
        /// </summary>
        private void OnPlaceCallClick(object sender, EventArgs e)
        {
            m_callPlaced = true;
            m_placeCallButton.Enabled                 = false;
            m_hangUpButton.Enabled                    = true;
            m_transmitPowerTrackBar.Enabled           = false;
            m_linkBudgetOverlayHelper.Overlay.Display = true;

            // We want to draw link lines representing the link, but we don't want to draw the
            // lines unless the signal quality is acceptable. We already configured the
            // link itself to take the curvature of the earth into account to ensure line
            // of sight for our assets. The next step is to choice an acceptable signal
            // quality. Below we create an AccessQuery that is only valid when the
            // carrier to noise ratio of the final downlink is over -16 dB.
            // We then pass this query to UpdateLinkGraphics which will use it to
            // configure the Display property of the link graphics. Finally, we call
            // ApplyChanges to update the display.
            var         linkBudgetScalars = m_communicationSystem.GetLinkBudgetScalars(m_iridium4ToReceiverDownLink, m_intendedSignal);
            AccessQuery query             = new ScalarConstraint(linkBudgetScalars.CarrierToNoise, CommunicationAnalysis.FromDecibels(-16.0));

            UpdateLinkGraphics(m_callerToIridium49UpLink, query);
            UpdateLinkGraphics(m_iridium4ToReceiverDownLink, query);
            UpdateLinkGraphics(m_iridium49To58Crosslink, query);
            UpdateLinkGraphics(m_iridium58To4Crosslink, query);
            m_display.ApplyChanges();

            // Manually fire the combo box change event in order to
            // properly initialize the link budget overlay.
            OnLinkComboBoxSelectedIndexChanged(this, EventArgs.Empty);

            // Start animation if it's not going.
            if (!SceneManager.Animation.IsAnimating)
            {
                SceneManager.Animation.PlayForward();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// We allow the user to modify the transmission power via a track bar. Whenever it is changed,
 /// assign the new power. This does not affect anything until until we create new evaluators.
 /// </summary>
 private void OnTransmitPowerValueChanged(object sender, EventArgs e)
 {
     m_transmittingPhone.EffectiveIsotropicRadiatedPower = CommunicationAnalysis.FromDecibels(m_transmitPowerTrackBar.Value);
 }
Exemplo n.º 4
0
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            textBox1.Clear();

            // determine the user's selected receiver type
            GpsSignalConfiguration selectedReceiver = GetSelectedReceiver();

            // create a GPS Comm front end
            var frontEnd = new GpsCommunicationsFrontEnd(m_gpsConstellation, selectedReceiver, m_location, m_orientation)
            {
                // set the front end's epoch - essentially when it starts receiving signals
                Epoch = m_analysisTime
            };

            // apply the front end to the receiver's Antenna property
            m_receiver.Antenna = frontEnd;

            // create a new communications-based noise model for the receiver
            m_receiver.NoiseModel = new GpsCommunicationsNoiseModel(frontEnd);

            // Jammer location - 10 km directly above the receiver
            var jammerLocationPoint = new PointFixedOffset(frontEnd.ReferenceFrame, new Cartesian(0, 0, 10000));

            if (cbL1Jammer.Checked)
            {
                // 1 watt, narrow band jammer centered at L1
                // increase to 10 watts to see a more dramatic effect
                // adds interferers to the front end's internal CommunicationSystem
                frontEnd.InterferingSources.Add(new SimpleAnalogTransmitter("L1Jammer", jammerLocationPoint, 1575.42e6, 1.0, 1.023e6));
            }

            if (cbL2Jammer.Checked)
            {
                // 1 watt, narrow band jammer centered at L2
                frontEnd.InterferingSources.Add(new SimpleAnalogTransmitter("L2Jammer", jammerLocationPoint, 1227.6e6, 1.0, 1.023e6));
            }

            if (cbL5Jammer.Checked)
            {
                // 1 watt, narrow band jammer centered at L5
                frontEnd.InterferingSources.Add(new SimpleAnalogTransmitter("L5Jammer", jammerLocationPoint, 1176.45e6, 1.0, 1.023e6));
            }

            var builder = new StringBuilder();

            // get an evaluator for the receiver that reports which satellites are tracked
            // we could get the standard DilutionOfPrecision, AssessedNavigationAccuracy or PredictedNavigationAccuracy
            // evaluators here as well.
            PlatformCollection trackedSatellites;

            using (var satelliteTrackingEvaluator = m_receiver.GetSatelliteTrackingEvaluator())
            {
                // evaluate the satellite tracking evaluator at a single time
                trackedSatellites = satelliteTrackingEvaluator.Evaluate(m_analysisTime);
            }

            builder.AppendFormat("{0} SVs tracked", trackedSatellites.Count)
            .AppendLine();

            var prnsTracked = new List <int>();

            if (trackedSatellites.Count > 0)
            {
                // create the link budget scalars by hand for just the tracked SVs.
                // we'll use the link budgets we received from the front end later
                // this section shows how to create them from scratch if necessary

                // get the propagation graph from the front end
                var graph = frontEnd.GetFrontEndSignalPropagationGraph();

                foreach (var satellite in trackedSatellites)
                {
                    int prn = ServiceHelper.GetService <IGpsPrnService>(satellite).PseudoRandomNumber;
                    prnsTracked.Add(prn);

                    var satelliteInformation = ServiceHelper.GetService <IGpsSatelliteInformationService>(satellite).Information;

                    builder.AppendFormat("SVN {0}, PRN {1}, Block: {2}", satelliteInformation.SatelliteVehicleNumber, prn, satelliteInformation.Block)
                    .AppendLine();

                    var receiverChannels = frontEnd.GetReceiverChannels();
                    if (receiverChannels.ContainsSatelliteID(prn))
                    {
                        // gets the first channel in the receiver tracking the specified PRN.
                        // there should only be one.
                        var channel = receiverChannels.FindFirst(prn);

                        // get the link for the primary signal on that channel
                        var linkService           = ServiceHelper.GetService <ILinkService>(channel.FindFirst(NavigationSignalPriority.Primary).ChannelLink);
                        var primarySignalReceiver = linkService.Receiver;

                        // use the transmitter on that link to identify the proper signal to analyze
                        var strategy = new IntendedSignalByTransmitter(linkService.Transmitter);

                        // create the desired scalars
                        if (cbOutputCNI.Checked)
                        {
                            var scalar = new ScalarCarrierToNoiseDensityPlusInterference(primarySignalReceiver, graph, strategy);
                            using (var evaluator = scalar.GetEvaluator())
                            {
                                builder.AppendFormat("C/(N0+I): {0:F5} dB-Hz", CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                                .AppendLine();
                            }
                        }

                        if (cbOutputJS.Checked)
                        {
                            var scalar = new ScalarJammingToSignal(primarySignalReceiver, graph, strategy);
                            using (var evaluator = scalar.GetEvaluator())
                            {
                                builder.AppendFormat("J/S: {0:F5} dB", Math.Abs(CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime))))
                                .AppendLine();
                            }
                        }

                        if (cbOutputNI.Checked)
                        {
                            var scalar = new ScalarNoisePlusInterference(linkService.Receiver, graph, strategy);
                            using (var evaluator = scalar.GetEvaluator())
                            {
                                builder.AppendFormat("N+I: {0:F5} dB", CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                                .AppendLine();
                            }
                        }

                        if (cbOutputRcvrNoise.Checked)
                        {
                            var scalar = new ScalarGpsCommunicationsReceiverChannelNoise(m_receiver, prn);
                            using (var evaluator = scalar.GetEvaluator())
                            {
                                builder.AppendFormat("Receiver Noise: {0:F5} meters", evaluator.Evaluate(m_analysisTime))
                                .AppendLine();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("No Channel tracking that PRN!");
                    }
                }
            }

            // Use the link budgets provided by the front-end.
            // Note that GpsReceiver noise is not a LinkBudget parameter.
            foreach (var linkBudgetScalars in frontEnd.GetAllLinkBudgets(m_receiver))
            {
                if (cbForTrackedSVsOnly.Checked)
                {
                    if (prnsTracked.Contains(linkBudgetScalars.SatelliteID))
                    {
                        if (cbOutputCNI.Checked)
                        {
                            using (var evaluator = linkBudgetScalars.CarrierToNoiseDensityPlusInterference.GetEvaluator())
                            {
                                builder.AppendFormat("C/(N0+I) for PRN {0}, on {1}: {2:F5} dB-Hz",
                                                     linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                                .AppendLine();
                            }
                        }

                        if (cbOutputJS.Checked)
                        {
                            using (var evaluator = linkBudgetScalars.JammingToSignal.GetEvaluator())
                            {
                                builder.AppendFormat("J/S for PRN {0}, on {1}: {2:F5} dB",
                                                     linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, Math.Abs(CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime))))
                                .AppendLine();
                            }
                        }

                        if (cbOutputNI.Checked)
                        {
                            using (var evaluator = linkBudgetScalars.NoisePlusInterference.GetEvaluator())
                            {
                                builder.AppendFormat("N+I for PRN {0}, on {1}: {2:F5} dB",
                                                     linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                                .AppendLine();
                            }
                        }
                    }
                }
                else
                {
                    if (cbOutputCNI.Checked)
                    {
                        using (var evaluator = linkBudgetScalars.CarrierToNoiseDensityPlusInterference.GetEvaluator())
                        {
                            builder.AppendFormat("C/(N0+I) for PRN {0}, on {1}: {2:F5} dB-Hz",
                                                 linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                            .AppendLine();
                        }
                    }

                    if (cbOutputJS.Checked)
                    {
                        using (var evaluator = linkBudgetScalars.JammingToSignal.GetEvaluator())
                        {
                            builder.AppendFormat("J/S for PRN {0}, on {1}: {2:F5} dB",
                                                 linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, Math.Abs(CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime))))
                            .AppendLine();
                        }
                    }

                    if (cbOutputNI.Checked)
                    {
                        using (var evaluator = linkBudgetScalars.NoisePlusInterference.GetEvaluator())
                        {
                            builder.AppendFormat("N+I for PRN {0}, on {1}: {2:F5} dB",
                                                 linkBudgetScalars.SatelliteID, linkBudgetScalars.SignalType, CommunicationAnalysis.ToDecibels(evaluator.Evaluate(m_analysisTime)))
                            .AppendLine();
                        }
                    }
                }
            }

            textBox1.Text = builder.ToString();
        }