/// <summary> /// Adds a new satellite receiver. /// </summary> /// <param name="name">Name of the satellite.</param> /// <param name="requiredTransportTransactionMode">Minimum required transaction mode.</param> /// <param name="runtimeSettings">Transport runtime settings.</param> /// <param name="onMessage">The message func.</param> /// <param name="transportAddress">The autogenerated transport address to listen on.</param> /// <param name="recoverabilityPolicy">Recoverability policy to be if processing fails.</param> public void AddSatelliteReceiver(string name, string transportAddress, TransportTransactionMode requiredTransportTransactionMode, PushRuntimeSettings runtimeSettings, Func <RecoverabilityConfig, ErrorContext, RecoverabilityAction> recoverabilityPolicy, Func <IBuilder, MessageContext, Task> onMessage) { var satelliteDefinition = new SatelliteDefinition(name, transportAddress, requiredTransportTransactionMode, runtimeSettings, recoverabilityPolicy, onMessage); Settings.Get <SatelliteDefinitions>().Add(satelliteDefinition); Settings.Get <QueueBindings>().BindReceiving(transportAddress); }
private static SatelliteDefinition ToDefinition(double startDegrees, double endDegrees, string name = "") { var nonOverlapping = new SatelliteDefinition(name, "", FilenameParserType.Goesproc, 0, new Range(Angle.FromDegrees(-90), Angle.FromDegrees(90)), new Range( Angle.FromDegrees(startDegrees), Angle.FromDegrees(endDegrees))); return(nonOverlapping); }
// note only works for simple overlap on one or other side // only handles one satellite overlapping each side public Range GetNonOverlappingRange(SatelliteDefinition definition) { if (!_initialised) { throw new InvalidOperationException($"Please call {nameof(Initialise)} before performing range calculations"); } var minLongitude = definition.LongitudeRange.Start; var maxLongitude = definition.LongitudeRange.End; // Iterate over other satellites foreach (var other in _definitions !.Where(entry => entry.Key != definition).Select(entry => entry.Value)) { var range = definition.LongitudeRange.UnwrapLongitude(); var otherRange = other.UnwrapLongitude(); var offset = 0.0; // Apply an offset to both satellites being compared if either wraps around -180 to 180 longitude if (definition.LongitudeRange.End < definition.LongitudeRange.Start || other.End < other.Start) { if (other.End < other.Start) { offset = -Math.PI - Math.Min(definition.LongitudeRange.Start, other.Start); } else { offset = -Math.PI - Math.Max(definition.LongitudeRange.Start, other.Start); } range = (range + offset).NormaliseLongitude(); otherRange = (other + offset).NormaliseLongitude(); minLongitude += offset; maxLongitude += offset; } if (range.Start < otherRange.Start && range.End > otherRange.Start) { maxLongitude = (range.End - otherRange.Start) / 2 + otherRange.Start; } else if (range.End > otherRange.End && range.Start < otherRange.End) { minLongitude = (otherRange.End - range.Start) / 2 + range.Start; } // Remove offset which was added to simplify calculations maxLongitude -= offset; minLongitude -= offset; } return(new Range(minLongitude, maxLongitude)); }
public void AddSatelliteReceiver(string name, string transportAddress, TransportTransactionMode requiredTransportTransactionMode, PushRuntimeSettings runtimeSettings, Func <RecoverabilityConfig, ErrorContext, RecoverabilityAction> recoverabilityPolicy, Func <IBuilder, MessageContext, Task> onMessage) { var requiredTransactionMode = Settings.GetRequiredTransactionModeForReceives(); if (requiredTransportTransactionMode != requiredTransactionMode) { throw new Exception($"Requested transaction mode `{requiredTransportTransactionMode}` can't be satisfied since the endpoint requested transaction mode `{requiredTransactionMode}`. Set the transaction mode to `{requiredTransactionMode}` or use the overload `{AddSatelliteOverloadMemberDefinition}` which automatically sets the transaction mode to the endpoint's transaction mode."); } var satelliteDefinition = new SatelliteDefinition(name, transportAddress, requiredTransportTransactionMode, runtimeSettings, recoverabilityPolicy, onMessage); Settings.Get <SatelliteDefinitions>().Add(satelliteDefinition); Settings.Get <QueueBindings>().BindReceiving(transportAddress); }
/// <summary> /// Adds a new satellite receiver. /// </summary> /// <param name="name">Name of the satellite.</param> /// <param name="runtimeSettings">Transport runtime settings.</param> /// <param name="onMessage">The message func.</param> /// <param name="transportAddress">The autogenerated transport address to listen on.</param> /// <param name="recoverabilityPolicy">Recoverability policy to be if processing fails.</param> public void AddSatelliteReceiver(string name, string transportAddress, PushRuntimeSettings runtimeSettings, Func <RecoverabilityConfig, ErrorContext, RecoverabilityAction> recoverabilityPolicy, Func <IBuilder, MessageContext, Task> onMessage) { Guard.AgainstNullAndEmpty(nameof(name), name); Guard.AgainstNullAndEmpty(nameof(transportAddress), transportAddress); Guard.AgainstNull(nameof(runtimeSettings), runtimeSettings); Guard.AgainstNull(nameof(recoverabilityPolicy), recoverabilityPolicy); Guard.AgainstNull(nameof(onMessage), onMessage); var requiredTransactionMode = Settings.GetRequiredTransactionModeForReceives(); var satelliteDefinition = new SatelliteDefinition(name, transportAddress, requiredTransactionMode, runtimeSettings, recoverabilityPolicy, onMessage); Settings.Get <SatelliteDefinitions>().Add(satelliteDefinition); Settings.Get <QueueBindings>().BindReceiving(transportAddress); }
public Registration(string path, SatelliteDefinition definition, DateTime?timestamp) { Path = path; Definition = definition; Timestamp = timestamp; }
public static void ToScanningAngle(LatitudeCalculations latitudeCalculations, double longitude, SatelliteDefinition definition, out double scanningX, out double scanningY) { var satelliteLongitude = definition.Longitude; var satelliteHeight = definition.Height + RadiusEquator; var sx = satelliteHeight - latitudeCalculations.RcCosLatitude * Cos(longitude - satelliteLongitude); var sy = -latitudeCalculations.RcCosLatitude * Sin(longitude - satelliteLongitude); var sy2 = sy * sy; // Check if geodetic angle is visible from satellite if (satelliteHeight * (satelliteHeight - sx) < sy2 + latitudeCalculations.RadiusRatioSz2) { scanningX = scanningY = double.NaN; return; } // Calculate (x,y) scanning angle scanningX = Asin(-sy / Sqrt(sx * sx + sy2 + latitudeCalculations.Sz2)); scanningY = Atan(latitudeCalculations.Sz / sx); }
/// <summary> /// Converts a latitude and longitude to a scanning angle. /// </summary> /// <remarks> /// The <see cref="o:ToScanningAngle(LatitudeCalculations,longitude,Sanchez.Shared.Configuration.SatelliteDefinition,out double,out double)"/> method with /// latitude calculations should be used in preference if performing these calculations in bulk, as it avoids duplicate calculations. /// </remarks> /// <param name="latitude">latitude in radians</param> /// <param name="longitude">longitude in radians</param> /// <param name="definition">satellite definition</param> /// <param name="scanningX">calculated horizontal scanning angle in radians</param> /// <param name="scanningY">calculated vertical scanning angle in radians</param> public static void ToScanningAngle(double latitude, double longitude, SatelliteDefinition definition, out double scanningX, out double scanningY) { var latitudeCalculations = LatitudeCalculations(latitude); ToScanningAngle(latitudeCalculations, longitude, definition, out scanningX, out scanningY); }