/// <summary> /// Positions the camera to view a given bounding sphere from a given azimuth and elevation angle. /// </summary> public static void ViewBoundingSphere(Insight3D insight3D, CentralBody centralBody, BoundingSphere sphere, double azimuthAngle, double elevationAngle) { var boundingSphereCenter = new PointFixedOffset(centralBody.FixedFrame, sphere.Center); var boundingSphereAxes = new AxesEastNorthUp(centralBody, boundingSphereCenter); var camera = insight3D.Scene.Camera; var offset = new Cartesian(new AzimuthElevationRange(azimuthAngle, elevationAngle, camera.DistancePerRadius * sphere.Radius)); camera.ViewOffset(boundingSphereAxes, boundingSphereCenter, offset); }
/// <summary> /// Create an aircraft with two sensors. /// The aircraft will be visually represented by a labeled glTF model. /// </summary> private void CreateAircraft() { // Define waypoints for the aircraft's path and use the propagated point as the location point. Cartographic point1 = new Cartographic(Trig.DegreesToRadians(-122.0), Trig.DegreesToRadians(46.3), 4000.0); Cartographic point2 = new Cartographic(Trig.DegreesToRadians(-122.28), Trig.DegreesToRadians(46.25), 4100.0); Cartographic point3 = new Cartographic(Trig.DegreesToRadians(-122.2), Trig.DegreesToRadians(46.1), 6000.0); Cartographic point4 = new Cartographic(Trig.DegreesToRadians(-121.5), Trig.DegreesToRadians(46.0), 7000.0); Waypoint waypoint1 = new Waypoint(m_epoch, point1, 20.0, 0.0); Waypoint waypoint2 = new Waypoint(waypoint1, m_earth.Shape, point2, 20.0); Waypoint waypoint3 = new Waypoint(waypoint2, m_earth.Shape, point3, 20.0); Waypoint waypoint4 = new Waypoint(waypoint3, m_earth.Shape, point4, 20.0); var waypointPropagator = new WaypointPropagator(m_earth, waypoint1, waypoint2, waypoint3, waypoint4); var locationPoint = waypointPropagator.CreatePoint(); m_aircraft = new Platform { Name = "Aircraft", LocationPoint = locationPoint, OrientationAxes = new AxesVehicleVelocityLocalHorizontal(m_earth.FixedFrame, locationPoint), }; // Set the identifier for the aircraft in the CZML document. m_aircraft.Extensions.Add(new IdentifierExtension("Aircraft")); // Hermite interpolation works better for aircraft-like vehicles. m_aircraft.Extensions.Add(new CesiumPositionExtension { InterpolationAlgorithm = CesiumInterpolationAlgorithm.Hermite }); // Configure a glTF model for the aircraft. m_aircraft.Extensions.Add(new ModelGraphicsExtension(new ModelGraphics { // Link to a binary glTF file. Model = new CesiumResource(GetModelUri("aircraft.glb"), CesiumResourceBehavior.LinkTo), // Flip the model visually to point Z in the correct direction. NodeTransformations = new Dictionary <string, NodeTransformationGraphics> { { "Aircraft", new NodeTransformationGraphics { Rotation = new UnitQuaternion(new ElementaryRotation(AxisIndicator.Third, Math.PI)) } } }, RunAnimations = false, })); // Show the path of the aircraft. m_aircraft.Extensions.Add(new PathGraphicsExtension(new PathGraphics { Width = 2.0, LeadTime = Duration.FromHours(1.0).TotalSeconds, TrailTime = Duration.FromHours(1.0).TotalSeconds, Material = new PolylineOutlineMaterialGraphics { Color = Color.White, OutlineColor = Color.Black, OutlineWidth = 1.0, }, })); // Configure label for the aircraft. m_aircraft.Extensions.Add(new LabelGraphicsExtension(new LabelGraphics { Text = m_aircraft.Name, // Change label color over time. FillColor = new TimeIntervalCollection <Color> { // Green by default... TimeInterval.Infinite.AddData(Color.Green), // Red between first and second waypoints. new TimeInterval <Color>(waypoint1.Date, waypoint2.Date, Color.Red), }, // Only show label when camera is far enough from the aircraft, // to avoid visually clashing with the model. DistanceDisplayCondition = new Bounds(1000.0, double.MaxValue), })); // Define a description for the aircraft which will be shown when selected in Cesium. m_aircraft.Extensions.Add(new DescriptionExtension(new Description("Aircraft with two offset sensors"))); // Create 30 degree simple conic sensor definition var sensorCone = new ComplexConic(); sensorCone.SetHalfAngles(0.0, Trig.DegreesToRadians(15)); sensorCone.SetClockAngles(Trig.DegreesToRadians(20), Trig.DegreesToRadians(50)); sensorCone.Radius = double.PositiveInfinity; // Create a sensor pointing "forward". // Position sensor underneath the wing. var sensorOneLocationPoint = new PointFixedOffset(m_aircraft.ReferenceFrame, new Cartesian(-3.0, 8.0, 0.0)); var sensorAxesOne = new AxesAlignedConstrained(m_aircraft.OrientationAxes.GetVectorElement(CartesianElement.Z), AxisIndicator.Third, m_aircraft.OrientationAxes.GetVectorElement(CartesianElement.X), AxisIndicator.First); // This rotation points the z-axis of the volume back along the x-axis of the ellipsoid. var rotationOne = new UnitQuaternion(new ElementaryRotation(AxisIndicator.Second, Constants.HalfPi / 4)); m_aircraftSensorOne = new Platform { LocationPoint = sensorOneLocationPoint, OrientationAxes = new AxesFixedOffset(sensorAxesOne, rotationOne), }; // Set the identifier for the sensor in the CZML document. m_aircraftSensorOne.Extensions.Add(new IdentifierExtension("AircraftSensorOne")); m_aircraftSensorOne.Extensions.Add(new CesiumPositionExtension { InterpolationAlgorithm = CesiumInterpolationAlgorithm.Hermite }); // Define the sensor geometry. m_aircraftSensorOne.Extensions.Add(new FieldOfViewExtension(sensorCone)); // Configure graphical display of the sensor. m_aircraftSensorOne.Extensions.Add(new FieldOfViewGraphicsExtension(new SensorFieldOfViewGraphics { // Configure the outline of the projection onto the earth. EllipsoidSurfaceMaterial = new SolidColorMaterialGraphics(Color.White), IntersectionWidth = 2.0, LateralSurfaceMaterial = new GridMaterialGraphics { Color = Color.FromArgb(171, Color.Blue), }, })); // Create sensor pointing to the "side". // Position sensor underneath the wing. var sensorTwoLocationPoint = new PointFixedOffset(m_aircraft.ReferenceFrame, new Cartesian(-3.0, -8.0, 0.0)); var sensorAxesTwo = new AxesAlignedConstrained(m_aircraft.OrientationAxes.GetVectorElement(CartesianElement.Z), AxisIndicator.Third, m_aircraft.OrientationAxes.GetVectorElement(CartesianElement.Y), AxisIndicator.Second); // This rotation points the z-axis of the volume back along the x-axis of the ellipsoid. var rotationTwo = new UnitQuaternion(new ElementaryRotation(AxisIndicator.First, Constants.HalfPi / 2)); m_aircraftSensorTwo = new Platform { LocationPoint = sensorTwoLocationPoint, OrientationAxes = new AxesFixedOffset(sensorAxesTwo, rotationTwo), }; // Set the identifier for the sensor in the CZML document. m_aircraftSensorTwo.Extensions.Add(new IdentifierExtension("AircraftSensorTwo")); m_aircraftSensorTwo.Extensions.Add(new CesiumPositionExtension { InterpolationAlgorithm = CesiumInterpolationAlgorithm.Hermite }); // Define the sensor geometry. m_aircraftSensorTwo.Extensions.Add(new FieldOfViewExtension(sensorCone)); // Configure graphical display of the sensor. m_aircraftSensorTwo.Extensions.Add(new FieldOfViewGraphicsExtension(new SensorFieldOfViewGraphics { // Configure the outline of the projection onto the earth. EllipsoidSurfaceMaterial = new SolidColorMaterialGraphics(Color.White), IntersectionWidth = 2.0, LateralSurfaceMaterial = new GridMaterialGraphics { Color = Color.FromArgb(171, Color.Red), }, })); // Create an access link between the aircraft and the observer position // on Mount St. Helens, using the same azimuth elevation mask to constrain access. m_aircraftAzimuthElevationMaskLink = new LinkInstantaneous(m_maskPlatform, m_aircraft); // Set the identifier for the link in the CZML document. m_aircraftAzimuthElevationMaskLink.Extensions.Add(new IdentifierExtension("AircraftMountStHelensAccess")); // Constrain access using the azimuth-elevation mask. var query = new AzimuthElevationMaskConstraint(m_aircraftAzimuthElevationMaskLink, LinkRole.Transmitter); // Configure graphical display of the access link. m_aircraftAzimuthElevationMaskLink.Extensions.Add(new LinkGraphicsExtension(new LinkGraphics { // Show the access link only when access is satisfied. Show = new AccessQueryCesiumProperty <bool>(query, true, false, false), Material = new SolidColorMaterialGraphics(Color.Yellow), })); }
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(); }