@smartnet360/svelte-components 0.0.101 → 0.0.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/apps/antenna-pattern/index.d.ts +1 -0
  2. package/dist/apps/antenna-pattern/index.js +1 -0
  3. package/dist/apps/antenna-pattern/utils/load-static-antennas.d.ts +17 -0
  4. package/dist/apps/antenna-pattern/utils/load-static-antennas.js +83 -0
  5. package/dist/apps/site-check/SiteCheck.svelte +4 -6
  6. package/dist/core/Charts/ChartCard.svelte +122 -12
  7. package/dist/core/Charts/ChartCard.svelte.d.ts +2 -0
  8. package/dist/core/Charts/ChartComponent.svelte +8 -6
  9. package/dist/core/CoverageMap/ai/AITools.d.ts +117 -0
  10. package/dist/core/CoverageMap/ai/AITools.js +380 -0
  11. package/dist/core/CoverageMap/core/CoverageCalculator.d.ts +138 -0
  12. package/dist/core/CoverageMap/core/CoverageCalculator.js +375 -0
  13. package/dist/core/CoverageMap/core/GridCalculator.d.ts +115 -0
  14. package/dist/core/CoverageMap/core/GridCalculator.js +484 -0
  15. package/dist/core/CoverageMap/core/PathLossModels.d.ts +253 -0
  16. package/dist/core/CoverageMap/core/PathLossModels.js +380 -0
  17. package/dist/core/CoverageMap/core/SignalProcessor.d.ts +288 -0
  18. package/dist/core/CoverageMap/core/SignalProcessor.js +424 -0
  19. package/dist/core/CoverageMap/data/AntennaStore.d.ts +165 -0
  20. package/dist/core/CoverageMap/data/AntennaStore.js +327 -0
  21. package/dist/core/CoverageMap/data/SiteStore.d.ts +155 -0
  22. package/dist/core/CoverageMap/data/SiteStore.js +355 -0
  23. package/dist/core/CoverageMap/index.d.ts +74 -0
  24. package/dist/core/CoverageMap/index.js +103 -0
  25. package/dist/core/CoverageMap/types.d.ts +252 -0
  26. package/dist/core/CoverageMap/types.js +7 -0
  27. package/dist/core/CoverageMap/utils/geoUtils.d.ts +223 -0
  28. package/dist/core/CoverageMap/utils/geoUtils.js +374 -0
  29. package/dist/core/CoverageMap/utils/rfUtils.d.ts +329 -0
  30. package/dist/core/CoverageMap/utils/rfUtils.js +434 -0
  31. package/dist/core/CoverageMap/visualization/ColorSchemes.d.ts +149 -0
  32. package/dist/core/CoverageMap/visualization/ColorSchemes.js +377 -0
  33. package/dist/core/TreeView/index.d.ts +4 -4
  34. package/dist/core/TreeView/index.js +5 -5
  35. package/dist/core/TreeView/tree-utils.d.ts +12 -0
  36. package/dist/core/TreeView/tree-utils.js +115 -6
  37. package/dist/core/TreeView/tree.store.svelte.d.ts +94 -0
  38. package/dist/core/TreeView/tree.store.svelte.js +274 -0
  39. package/dist/map-v2/features/cells/controls/CellFilterControl.svelte +16 -27
  40. package/dist/map-v2/features/cells/utils/cellGeoJSON.js +1 -0
  41. package/dist/map-v2/features/repeaters/controls/RepeaterFilterControl.svelte +33 -42
  42. package/dist/map-v2/features/sites/controls/SiteFilterControl.svelte +12 -19
  43. package/dist/map-v3/core/components/Map.svelte +4 -0
  44. package/dist/map-v3/core/stores/map.store.svelte.js +2 -0
  45. package/dist/map-v3/demo/DemoMap.svelte +31 -5
  46. package/dist/map-v3/demo/demo-cells.js +51 -22
  47. package/dist/map-v3/features/cells/components/CellFilterControl.svelte +24 -30
  48. package/dist/map-v3/features/cells/layers/CellsLayer.svelte +29 -9
  49. package/dist/map-v3/features/cells/logic/geometry.js +3 -0
  50. package/dist/map-v3/features/cells/stores/cell.data.svelte.d.ts +27 -0
  51. package/dist/map-v3/features/cells/stores/cell.data.svelte.js +65 -0
  52. package/dist/map-v3/features/coverage/index.d.ts +12 -0
  53. package/dist/map-v3/features/coverage/index.js +16 -0
  54. package/dist/map-v3/features/coverage/layers/CoverageLayer.svelte +198 -0
  55. package/dist/map-v3/features/coverage/layers/CoverageLayer.svelte.d.ts +10 -0
  56. package/dist/map-v3/features/coverage/logic/coloring.d.ts +28 -0
  57. package/dist/map-v3/features/coverage/logic/coloring.js +77 -0
  58. package/dist/map-v3/features/coverage/logic/geometry.d.ts +33 -0
  59. package/dist/map-v3/features/coverage/logic/geometry.js +112 -0
  60. package/dist/map-v3/features/coverage/stores/coverage.data.svelte.d.ts +46 -0
  61. package/dist/map-v3/features/coverage/stores/coverage.data.svelte.js +95 -0
  62. package/dist/map-v3/features/coverage/stores/coverage.display.svelte.d.ts +33 -0
  63. package/dist/map-v3/features/coverage/stores/coverage.display.svelte.js +90 -0
  64. package/dist/map-v3/features/coverage/types.d.ts +52 -0
  65. package/dist/map-v3/features/coverage/types.js +7 -0
  66. package/dist/map-v3/features/repeaters/components/RepeaterFilterControl.svelte +14 -20
  67. package/dist/map-v3/features/selection/components/FeatureSelectionControl.svelte +82 -65
  68. package/dist/map-v3/features/selection/components/FeatureSelectionControl.svelte.d.ts +5 -9
  69. package/dist/map-v3/features/selection/index.d.ts +1 -2
  70. package/dist/map-v3/features/selection/index.js +0 -1
  71. package/dist/map-v3/features/selection/stores/selection.store.svelte.d.ts +44 -15
  72. package/dist/map-v3/features/selection/stores/selection.store.svelte.js +163 -40
  73. package/dist/map-v3/features/selection/types.d.ts +4 -2
  74. package/dist/map-v3/features/sites/components/SiteFilterControl.svelte +23 -33
  75. package/dist/map-v3/index.d.ts +4 -0
  76. package/dist/map-v3/index.js +5 -0
  77. package/package.json +2 -2
  78. package/dist/core/TreeView/tree.store.d.ts +0 -10
  79. package/dist/core/TreeView/tree.store.js +0 -320
  80. package/dist/map-v3/features/selection/layers/SelectionHighlightLayers.svelte +0 -209
  81. package/dist/map-v3/features/selection/layers/SelectionHighlightLayers.svelte.d.ts +0 -13
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Signal Processor
3
+ *
4
+ * This module processes antenna patterns and calculates signal strength
5
+ * in specific directions, accounting for:
6
+ * - Horizontal antenna pattern (azimuth plane)
7
+ * - Vertical antenna pattern (elevation plane)
8
+ * - Mechanical tilt (physical antenna tilt)
9
+ * - Electrical tilt (built into antenna design)
10
+ * - Combined 3D antenna pattern
11
+ *
12
+ * The signal processor is the bridge between:
13
+ * - Antenna pattern data (stored as attenuation values)
14
+ * - Geographic calculations (angles, distances)
15
+ * - RF link budget (EIRP, path loss, received power)
16
+ */
17
+ import type { AntennaPattern, Position2D, RFParameters } from '../types';
18
+ /**
19
+ * Get horizontal pattern attenuation for a specific azimuth angle
20
+ *
21
+ * The horizontal pattern describes how antenna gain varies in the
22
+ * azimuth plane (looking down from above). This is critical for
23
+ * determining coverage in different directions.
24
+ *
25
+ * Pattern interpretation:
26
+ * - 0° = main beam direction (maximum gain, 0 dB attenuation)
27
+ * - Positive angles = rotation clockwise from main beam
28
+ * - Pattern stored as attenuation values (0 = max, higher = weaker)
29
+ *
30
+ * Process:
31
+ * 1. Calculate relative angle (target bearing - antenna azimuth)
32
+ * 2. Normalize to 0-360° range
33
+ * 3. Look up attenuation from pattern array
34
+ * 4. Interpolate if angle is non-integer
35
+ *
36
+ * @param pattern - Horizontal antenna pattern (360 values)
37
+ * @param targetBearing - Bearing to target (0-360°, 0 = North)
38
+ * @param antennaAzimuth - Antenna pointing direction (0-360°, 0 = North)
39
+ * @returns Attenuation in dB (positive value, 0 = maximum gain direction)
40
+ *
41
+ * @example
42
+ * // Antenna pointing North (0°), target to Northeast (45°)
43
+ * const atten = getHorizontalAttenuation(pattern, 45, 0);
44
+ * // Returns pattern[45], e.g., 3 dB attenuation
45
+ * // Meaning: 3 dB less gain than main beam direction
46
+ */
47
+ export declare function getHorizontalAttenuation(pattern: number[], targetBearing: number, antennaAzimuth: number): number;
48
+ /**
49
+ * Get vertical pattern attenuation for a specific elevation angle
50
+ *
51
+ * The vertical pattern describes how antenna gain varies in the
52
+ * elevation plane (looking from the side). This is critical for:
53
+ * - Understanding coverage at different distances
54
+ * - Applying mechanical and electrical tilt
55
+ * - Optimizing coverage vs interference
56
+ *
57
+ * Elevation angle sign convention:
58
+ * - Negative = below horizon (typical for cellular)
59
+ * - Zero = horizontal
60
+ * - Positive = above horizon
61
+ *
62
+ * Tilt application:
63
+ * - Mechanical tilt: Physical antenna rotation (tilts entire pattern)
64
+ * - Electrical tilt: Phase shift between elements (tilts beam electronically)
65
+ * - Total tilt = mechanical + electrical
66
+ *
67
+ * Why tilt matters:
68
+ * - 0° tilt: Maximum range, but strong interference to neighbors
69
+ * - 6° tilt: Focuses energy closer, reduces interference
70
+ * - 12° tilt: Short range, minimal interference (urban/dense areas)
71
+ *
72
+ * Pattern interpretation:
73
+ * - Vertical patterns typically stored with 0° = horizon
74
+ * - Need to account for both elevation angle AND tilt
75
+ * - Pattern lookup angle = elevation + total_tilt
76
+ *
77
+ * @param verticalPattern - Vertical antenna pattern (360 values)
78
+ * @param elevationAngle - Elevation angle to target (degrees, negative = below)
79
+ * @param mechanicalTilt - Physical antenna tilt (degrees, positive = downward)
80
+ * @param electricalTilt - Electrical tilt from antenna specs (degrees, positive = downward)
81
+ * @returns Attenuation in dB (positive value)
82
+ *
83
+ * @example
84
+ * // Target 2° below antenna, 3° mechanical + 3° electrical tilt
85
+ * const atten = getVerticalAttenuation(pattern, -2, 3, 3);
86
+ * // Effective angle: -2 + 3 + 3 = 4°
87
+ * // Returns pattern[4], e.g., 1 dB attenuation
88
+ */
89
+ export declare function getVerticalAttenuation(verticalPattern: number[], elevationAngle: number, mechanicalTilt: number, electricalTilt: number): number;
90
+ /**
91
+ * Calculate combined 3D antenna gain
92
+ *
93
+ * Antennas are 3D structures, so we need to combine:
94
+ * 1. Horizontal pattern (azimuth variation)
95
+ * 2. Vertical pattern (elevation variation)
96
+ *
97
+ * Combination methods:
98
+ *
99
+ * Method 1: Add attenuations (conservative, used here)
100
+ * Total_Attenuation = H_Attenuation + V_Attenuation
101
+ * This assumes patterns are independent (reasonable approximation)
102
+ *
103
+ * Method 2: Multiply field patterns (more accurate but complex)
104
+ * Would require field pattern data (not just power patterns)
105
+ *
106
+ * Why Method 1 works:
107
+ * - In dB domain, attenuation addition = power multiplication
108
+ * - For most cellular antennas, H and V patterns are ~independent
109
+ * - Error typically < 1 dB compared to measured 3D patterns
110
+ *
111
+ * Process:
112
+ * 1. Get maximum antenna gain (from specs)
113
+ * 2. Get horizontal attenuation at target bearing
114
+ * 3. Get vertical attenuation at target elevation
115
+ * 4. Combined gain = max_gain - h_atten - v_atten
116
+ *
117
+ * @param antennaPattern - Complete antenna pattern data
118
+ * @param targetBearing - Bearing to target (0-360°)
119
+ * @param antennaAzimuth - Antenna pointing direction (0-360°)
120
+ * @param elevationAngle - Elevation angle to target (degrees)
121
+ * @param mechanicalTilt - Physical tilt (degrees)
122
+ * @param electricalTilt - Electrical tilt (degrees)
123
+ * @returns Combined antenna gain in direction (dBi)
124
+ *
125
+ * @example
126
+ * const gain = calculateCombinedGain(
127
+ * antenna, // 15 dBd max gain antenna
128
+ * 45, // Target bearing: 45° (NE)
129
+ * 0, // Antenna points: 0° (N)
130
+ * -2, // Target elevation: -2° (below)
131
+ * 3, // Mechanical tilt: 3°
132
+ * 3 // Electrical tilt: 3°
133
+ * );
134
+ * // H pattern at 45°: -3 dB
135
+ * // V pattern at -2+6=-4°: -1 dB
136
+ * // Max gain: 15 dBd = 17.15 dBi
137
+ * // Combined: 17.15 - 3 - 1 = 13.15 dBi
138
+ */
139
+ export declare function calculateCombinedGain(antennaPattern: AntennaPattern, targetBearing: number, antennaAzimuth: number, elevationAngle: number, mechanicalTilt: number, electricalTilt: number): number;
140
+ /**
141
+ * Calculate signal strength at a specific point
142
+ *
143
+ * This is the core function that brings everything together:
144
+ * 1. Calculate geometry (distance, bearing, elevation)
145
+ * 2. Determine antenna gain in direction
146
+ * 3. Calculate EIRP (TX power + antenna gain)
147
+ * 4. Apply path loss
148
+ * 5. Account for receiver characteristics
149
+ *
150
+ * Link budget equation (dB domain):
151
+ * P_rx = EIRP - PathLoss + RX_Gain - RX_Losses
152
+ *
153
+ * Where:
154
+ * - EIRP = TX_Power + Antenna_Gain(direction) - Cable_Loss
155
+ * - PathLoss = f(distance, frequency, environment)
156
+ * - RX_Gain = Receiver antenna gain (≈0 dBi for mobile)
157
+ * - RX_Losses = Body loss, cable loss, etc. (≈3 dB for mobile)
158
+ *
159
+ * For mobile devices:
160
+ * - Omnidirectional antenna (0 dBi gain)
161
+ * - Body loss when held to head (3 dB)
162
+ * - Net effect: -3 dB
163
+ *
164
+ * Signal interpretation:
165
+ * -70 dBm or better: Excellent (max throughput)
166
+ * -85 dBm or better: Good (high throughput)
167
+ * -95 dBm or better: Fair (medium throughput)
168
+ * -105 dBm or better: Poor (low throughput, voice OK)
169
+ * Worse than -105: No service
170
+ *
171
+ * @param rfParams - Complete RF parameter set (antenna, position, power, etc.)
172
+ * @param targetPosition - Geographic position to calculate signal at
173
+ * @param pathLoss - Path loss in dB (from path loss model)
174
+ * @param options - Receiver characteristics (gain, losses)
175
+ * @returns Received signal strength in dBm
176
+ *
177
+ * @example
178
+ * const rssi = calculateSignalStrength(
179
+ * {
180
+ * position: { lat: 40.7128, lng: -74.0060, height: 30 },
181
+ * azimuth: 45,
182
+ * mechanicalTilt: 3,
183
+ * electricalTilt: 3,
184
+ * txPower: 43,
185
+ * frequency: 1800,
186
+ * antennaPattern: myAntenna
187
+ * },
188
+ * { lat: 40.7150, lng: -74.0070 },
189
+ * 110 // 110 dB path loss at 1 km
190
+ * );
191
+ * // Process:
192
+ * // 1. Calculate bearing: ~45° (matches antenna)
193
+ * // 2. Calculate elevation: -1.5° (below antenna)
194
+ * // 3. Antenna gain: 15 dBi - 0 dB (h) - 1 dB (v) = 14 dBi
195
+ * // 4. EIRP: 43 + 14 - 0.5 = 56.5 dBm
196
+ * // 5. RX power: 56.5 - 110 + 0 - 3 = -56.5 dBm (excellent!)
197
+ */
198
+ export declare function calculateSignalStrength(rfParams: RFParameters, targetPosition: Position2D, pathLoss: number, options?: {
199
+ rxGain?: number;
200
+ rxLosses?: number;
201
+ cableLoss?: number;
202
+ }): number;
203
+ /**
204
+ * Calculate signal strength for multiple sectors at once
205
+ *
206
+ * Common scenario: A cell site has 3 sectors (Alpha, Beta, Gamma),
207
+ * each covering 120°. We want to know signal from all sectors at a point.
208
+ *
209
+ * This function:
210
+ * 1. Calculates signal from each sector independently
211
+ * 2. Returns results as an object keyed by sector ID
212
+ * 3. Identifies which sector provides strongest signal
213
+ *
214
+ * Use cases:
215
+ * - Multi-sector cell sites
216
+ * - Handover zone analysis
217
+ * - Interference calculations
218
+ * - Dominant server prediction
219
+ *
220
+ * @param sectors - Array of RF parameter sets (one per sector)
221
+ * @param targetPosition - Position to calculate signal at
222
+ * @param pathLosses - Path loss for each sector (must match order)
223
+ * @returns Object with signal strength from each sector plus dominant sector
224
+ *
225
+ * @example
226
+ * const result = calculateMultiSectorSignal(
227
+ * [alphaParams, betaParams, gammaParams],
228
+ * { lat: 40.7150, lng: -74.0070 },
229
+ * [110, 110, 110]
230
+ * );
231
+ * // Returns:
232
+ * // {
233
+ * // signals: { 'alpha': -60, 'beta': -70, 'gamma': -85 },
234
+ * // dominantSector: 'alpha',
235
+ * // dominantSignal: -60
236
+ * // }
237
+ */
238
+ export declare function calculateMultiSectorSignal(sectors: Array<RFParameters & {
239
+ sectorId: string;
240
+ }>, targetPosition: Position2D, pathLosses: number[]): {
241
+ signals: Record<string, number>;
242
+ dominantSector: string | null;
243
+ dominantSignal: number;
244
+ };
245
+ /**
246
+ * Check if a target is within antenna's main lobe
247
+ *
248
+ * Main lobe = directions where antenna provides significant gain
249
+ * Typically defined as attenuation < 3 dB (half-power beamwidth)
250
+ *
251
+ * @param pattern - Antenna pattern
252
+ * @param targetBearing - Bearing to target
253
+ * @param antennaAzimuth - Antenna pointing direction
254
+ * @param threshold - Attenuation threshold in dB (default: 3 dB)
255
+ * @returns true if target is in main lobe
256
+ */
257
+ export declare function isInMainLobe(pattern: number[], targetBearing: number, antennaAzimuth: number, threshold?: number): boolean;
258
+ /**
259
+ * Calculate half-power beamwidth from antenna pattern
260
+ *
261
+ * Beamwidth is the angular width where gain is within 3 dB of maximum.
262
+ * Typical values:
263
+ * - Omnidirectional: 360°
264
+ * - Wide beam: 90-120°
265
+ * - Sector antenna: 60-90°
266
+ * - Narrow beam: 30-60°
267
+ * - Pencil beam: < 30°
268
+ *
269
+ * @param pattern - Horizontal antenna pattern
270
+ * @returns Beamwidth in degrees
271
+ */
272
+ export declare function calculateBeamwidth(pattern: number[]): number;
273
+ /**
274
+ * Estimate front-to-back ratio
275
+ *
276
+ * F/B ratio compares gain in main beam direction vs opposite direction.
277
+ * Higher = better (less backside radiation)
278
+ *
279
+ * Typical values:
280
+ * - Omnidirectional: 0 dB (equal all around)
281
+ * - Basic sector: 15-20 dB
282
+ * - Good sector: 20-25 dB
283
+ * - Excellent sector: > 25 dB
284
+ *
285
+ * @param pattern - Horizontal antenna pattern
286
+ * @returns Front-to-back ratio in dB
287
+ */
288
+ export declare function calculateFrontToBackRatio(pattern: number[]): number;