A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sionna-rt-channel-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 * Author: Amir Ashtari <aashtari@cttc.es>
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6#ifndef SIONNA_RT_CHANNEL_MODEL_H
7#define SIONNA_RT_CHANNEL_MODEL_H
8
10
11#include "ns3/angles.h"
12#include "ns3/antenna-model.h"
13#include "ns3/boolean.h"
14#include "ns3/vector.h"
15
16#include <complex.h>
17#include <pybind11/embed.h>
18#include <pybind11/numpy.h>
19#include <unordered_map>
20
21static const std::set<std::string> builtInSceneSionna = {"box",
22 "box_one_screen",
23 "box_two_screens",
24 "double_reflector",
25 "triple_reflector",
26 "simple_wedge",
27 "etoile",
28 "floor_wall",
29 "florence",
30 "munich",
31 "san_francisco",
32 "simple_street_canyon",
33 "simple_street_canyon_with_cars",
34 "simple_reflector",
35 "street_4b"};
36
37namespace py = pybind11;
38
39namespace ns3
40{
41class MobilityModel;
42
43/**
44 * @ingroup spectrum
45 * @brief High-level interface for generating MIMO channel matrices using Sionna RT
46 *
47 * This class bridges ns-3's MatrixBasedChannelModel framework and the
48 * Sionna RT Python library (sionna.rt) to generate realistic, geometry-based
49 * MIMO channels. It embeds a Python interpreter (via pybind11), constructs
50 * scenes (terrain/building geometry), computes propagation paths (LOS,
51 * specular/diffuse reflections, refraction, diffraction, synthetic arrays),
52 * and converts the resulting paths into ns-3 ChannelMatrix and ChannelParams
53 * objects for use by spectrum and wireless modules like nr, wifi, lte, etc
54 *
55 * Design highlights:
56 * - Scenes and path computations are performed with sionna.rt through pybind11.
57 * - Computed CIRs are represented using Complex3DVector (rx x tx x taps).
58 * - Caching: channel matrices and parameters are stored per-Node pair using a
59 * reciprocal uint64_t key derived from antenna/mobility instances.
60 * - The class exposes solver configuration options (RtPathSolverConfig) and
61 * scene configuration (RtSceneConfig).
62 * - Supported Sionna RT versions: 1.1.0, 1.2.2, 2.0.1.
63 *
64 * Threading/Concurrency:
65 * - The Python interpreter is created via pybind11::embed, which must be used
66 * carefully when ns-3 is executed in multi-threaded contexts. The current
67 * implementation assumes single-threaded execution (typical for ns-3).
68 */
70{
71 public:
72 /**
73 * @brief Constructor.
74 */
76
77 /**
78 * @brief Destructor.
79 */
80 ~SionnaRtChannelModel() override;
81
82 /**
83 * @brief Release references and perform cleanup.
84 */
85 void DoDispose() override;
86
87 /**
88 * @brief Get the ns-3 TypeId for this class.
89 * @return the object TypeId
90 */
91 static TypeId GetTypeId();
92
93 /**
94 * @brief Enable or disable shape merging when loading scenes from sionna.rt.
95 *
96 * Controls whether the scene geometry loader merges individual mesh shapes
97 * into larger primitives during scene creation. Merging reduces the
98 * complexity of geometric primitives passed to the path solver and can
99 * improve performance and memory usage for complex scenes at the potential
100 * cost of small geometric inaccuracies.
101 *
102 * Important notes:
103 * - Default behaviour is defined by RtSceneConfig::mergeShapes (default true).
104 * - Changing this setting only affects future scene loads / creations; it
105 * does not retroactively modify already-loaded scenes or cached channel
106 * matrices. To apply this change immediately, existing cached scenes and
107 * channel matrices must be invalidated or regenerated.
108 * - The setting is forwarded to sionna.rt via the "merge_shapes" argument
109 * when calling rt.load_scene(sceneFactory, merge_shapes=...).
110 *
111 * @param cond True to enable shape merging (reduce geometry complexity),
112 * false to preserve original, detailed shapes.
113 */
114 void SetMergeShapeEnable(bool cond);
115
116 /**
117 * @brief Create a new ChannelMatrix object wrapping a precomputed CIR tensor.
118 *
119 * This function converts a 3D array of complex samples into an ns-3
120 * MatrixBasedChannelModel::ChannelMatrix instance. The expected format of
121 * hUsn is a Complex3DVector shaped as:
122 * [numRxPorts][numTxPorts][numTaps],
123 * where each complex entry represents a channel tap (CIR sample) for the
124 * corresponding Rx/Tx element pair for a given delay tap index.
125 *
126 * The function will populate the ChannelMatrix's internal metadata (ports,
127 * tap delays, samplerate assumptions) and will return a Ptr to the created
128 * wrapper object. The mobility and antenna pointers are provided primarily
129 * to capture metadata and orientation for consistent caching and book-keeping.
130 *
131 * @param hUsn 3D complex CIR vector (rx ports x tx ports x taps)
132 * @param sMob Mobility model of the transmitter endpoint
133 * @param uMob Mobility model of the receiver endpoint
134 * @param sAntenna Transmitter PhasedArrayModel
135 * @param uAntenna Receiver PhasedArrayModel
136 * @return A pointer to the created ChannelMatrix instance
137 */
139 const Complex3DVector hUsn,
140 const Ptr<const MobilityModel> sMob,
141 const Ptr<const MobilityModel> uMob,
143 Ptr<const PhasedArrayModel> uAntenna) const;
144
145 /**
146 * @brief Set the propagation scenario name used by sionna.rt scene factories.
147 *
148 * The scenario string selects a pre-defined scene factory within sionna.rt
149 * (for example "munich", "simple_street_canyon_with_cars", etc.). The scene
150 * name is used by LoadScene/CreateScene to instantiate the geometry.
151 *
152 * @param scenario The scene factory name to call in sionna.rt.scene
153 */
154 void SetScenario(const std::string& scenario);
155
156 /**
157 * @brief Return the configured propagation scenario name.
158 *
159 * @return the current propagation scenario name
160 */
161 std::string GetScenario() const;
162
163 /**
164 * @brief Set the center frequency used by the model and scene factories.
165 *
166 * The frequency affects antenna patterns, wavelength-dependent computations,
167 * and where applicable, factory-specific scene generation (e.g., building
168 * materials that might be frequency-specific).
169 *
170 * @param f Center frequency in Hz
171 */
172 void SetFrequency(double f);
173
174 /**
175 * @brief Get the configured center frequency.
176 * @return Center frequency in Hz.
177 */
178 double GetFrequency() const;
179
180 /**
181 * @brief Set the maximum number of propagation paths to retain.
182 *
183 * Controls the upper limit on the number of paths that will be accepted from
184 * the Sionna RT path solver. If the solver generates more paths than this
185 * threshold, the CalculatePaths() method will recursively reduce the solver's
186 * max_depth and recompute until the path count falls within bounds. This
187 * mechanism ensures that channel matrix complexity remains tractable.
188 *
189 * @param p Maximum number of paths (typically 1 to 1000 depending on antenna
190 * arrays and simulation requirements)
191 *
192 * @see GetMaxNumberOfPaths, DoesNumberOfPathsExceedMaximum
193 */
194 void SetMaxNumberOfPaths(double p);
195
196 /**
197 * @brief Get the configured maximum number of propagation paths.
198 *
199 * @return Maximum number of paths allowed in computed channel matrices
200 *
201 * @see SetMaxNumberOfPaths
202 */
203 double GetMaxNumberOfPaths() const;
204
205 /**
206 * @brief Enable or disable normalization of path delays in Sionna RT.
207 *
208 * When true, Sionna RT normalizes delays so the first path is at zero
209 * delay. When false, raw path delays are returned.
210 *
211 * @param cond True to normalize delays, false to preserve raw delays.
212 */
213 void SetNormalizeDelays(bool cond);
214
215 /**
216 * @brief Query whether path delay normalization is enabled.
217 *
218 * @return true if Sionna RT delay normalization is enabled.
219 */
220 bool GetNormalizeDelays() const;
221
222 /**
223 * @brief Return a string describing the antenna element pattern for Sionna.
224 *
225 * This method inspects the ns-3 AntennaModel instance and returns a string
226 * that represents the Sionna element pattern (e.g., "isotropic", "3gpp_antenna").
227 * Sionna expects the element description when creating PlanarArray objects
228 * for element-level responses.
229 *
230 * @param element Pointer to the ns-3 AntennaModel for a single element
231 * @return A string representation of the element pattern suitable for Sionna
232 */
233 std::string GetAntennaElementPattern(Ptr<const AntennaModel> element) const;
234
235 /** Scene high-level configuration */
237 {
238 /// Which scene factory in sionna.rt.scene to call. Example: "munich"
239 std::string sceneName = "munich";
240
241 /// Whether to merge shapes during load_scene(...) to reduce geometry complexity
242 bool mergeShapes = true;
243
244 // Global arrays (installed onto scene.tx_array / scene.rx_array)
245 double frequency; //!< the operating frequency
246 };
247
248 /**
249 * @brief ChannelParams extension to carry Sionna-specific metadata.
250 *
251 * This struct extends MatrixBasedChannelModel::ChannelParams with additional
252 * fields derived from Sionna RT paths (e.g., per-cluster Doppler shifts).
253 */
255 {
256 /**
257 * Doppler shifts per cluster/path (complex vector indexed by path).
258 */
259 std::vector<double> m_doppler;
260 };
261
262 /** Configuration for the Sionna RT PathSolver */
264 {
265 /**
266 * Maximum number of interactions (reflection/refraction depth)
267 */
268 int maxDepth = 2;
269
270 /**
271 * Include direct line-of-sight (LOS) path when true ::It only controls whether the solver
272 * should include the direct path if it exists. When false, only non-LOS paths are
273 * considered.
274 */
275 bool los = true;
276
277 /**
278 * Enable specular reflections (mirror-like)
279 */
281
282 /**
283 * Enable diffuse reflections (scattering)
284 */
285 bool diffuseReflection = true;
286
287 /**
288 * Enable refraction through transparent bodies / materials
289 */
290 bool refraction = true;
291
292 /**
293 * Use synthetic array processing (if supported by scene factory)
294 */
295 bool syntheticArray = true;
296
297 /**
298 * Enable diffraction
299 */
300 bool diffraction = false;
301
302 /**
303 * Enable edge diffraction (alternative diffraction handling)
304 */
305 bool edgeDiffraction = false;
306
307 /**
308 * Random seed for stochastic components (e.g., diffuse scattering)
309 */
310 int seed = 41;
311 };
312
313 /**
314 * @brief Retrieve or generate the channel matrix for the node pair.
315 *
316 * Given mobility and antenna pointers for endpoints A/B, this method returns
317 * a cached ChannelMatrix if available and up-to-date; otherwise it invokes
318 * GetNewChannel to compute a new one using Sionna RT. The cache key is a
319 * reciprocal uint64_t encoding of endpoint identifiers.
320 *
321 * @param aMob Mobility model of node A (transmitter or one endpoint).
322 * @param bMob Mobility model of node B (receiver or the other endpoint).
323 * @param aAntenna Antenna array of node A.
324 * @param bAntenna Antenna array of node B.
325 * @return A pointer to a const ChannelMatrix instance representing the channel.
326 */
330 Ptr<const PhasedArrayModel> bAntenna) override;
331
332 /**
333 * @brief Get channel parameters (path info) for a node pair if available.
334 *
335 * If the pair has associated ChannelParams in m_channelParamsMap this
336 * returns it; otherwise a null pointer is returned.
337 *
338 * @param aMob Mobility model of node A.
339 * @param bMob Mobility model of node B.
340 * @return A pointer to const ChannelParams or nullptr when not available.
341 */
343 Ptr<const MobilityModel> bMob) const override;
344
345 /**
346 * @brief Assign stream indices to any random variables used internally.
347 *
348 * This is used to make simulations reproducible by assigning deterministic
349 * RNG stream indices.
350 *
351 * @param stream First stream index to use.
352 * @return Number of stream indices assigned.
353 */
354 int64_t AssignStreams(int64_t stream);
355
356 /**
357 * @brief Compute a new channel matrix for the given node pair using Sionna RT.
358 *
359 * This method performs the entire flow:
360 * 1. Create or load an sionna.rt scene
361 * 2. Run the path solver to compute propagation paths
362 * 3. Compute CIRs (per Rx/Tx element and path delays)
363 * 4. Package CIRs into a ChannelMatrix instance and return it
364 *
365 * The function accepts the 'paths' object returned by CalculatePaths rather
366 * than the Python scene directly to allow callers to separate scene and path
367 * computation if desired.
368 *
369 * @param paths Python object describing the computed paths (from CalculatePaths)
370 * @param sMob Mobility model of the transmitter endpoint
371 * @param uMob Mobility model of the receiver endpoint
372 * @param sAntenna Transmitter PhasedArrayModel
373 * @param uAntenna Receiver PhasedArrayModel
374 * @return A pointer to the newly created ChannelMatrix instance
375 */
376 virtual Ptr<ChannelMatrix> GetNewChannel(py::object paths,
377 const Ptr<const MobilityModel> sMob,
378 const Ptr<const MobilityModel> uMob,
380 Ptr<const PhasedArrayModel> uAntenna) const;
381
382 /**
383 * @brief Determine whether an existing ChannelMatrix must be updated.
384 *
385 * Checks if the cached ChannelMatrix is stale because of configuration changes
386 * (update period expired or mobility changed). If the update period has passed
387 * or the ChannelMatrix metadata differs from the provided inputs, it will
388 * report that regeneration is required.
389 *
390 * @param channelMatrix The existing channel matrix to check
391 * @return true if the matrix must be updated; false otherwise
392 */
393 bool ChannelMatrixNeedsUpdate(Ptr<const ChannelMatrix> channelMatrix) const;
394
395 /**
396 * @brief Check whether antenna configuration changes require regenerating the channel matrix.
397 *
398 * This compares the provided antenna arrays with the stored ChannelMatrix
399 * metadata to decide if the matrix is stale (for example if number of ports,
400 * element locations, or element types changed).
401 *
402 * @param aAntenna Antenna array of node A
403 * @param bAntenna Antenna array of node B
404 * @param channelMatrix The existing channel matrix to compare against
405 * @return true if the channel matrix must be updated; false otherwise
406 */
409 Ptr<const ChannelMatrix> channelMatrix) const;
410
411 /**
412 * @brief Build a Sionna PlanarArray description from an ns-3 PhasedArrayModel.
413 *
414 * This converts antenna element locations, patterns and polarization into a
415 * Python PlanarArray object suitable for installation into an sionna.rt scene.
416 *
417 * @param rt sionna.rt module used to construct Python objects
418 * @param antenna The ns-3 PhasedArrayModel to convert
419 * @return A Python PlanarArray object (py::object)
420 */
421 py::object MakePlannarArray(const py::module_ rt, Ptr<const PhasedArrayModel> antenna) const;
422
423 /**
424 * @brief Create a sionna.rt scene object for the provided endpoints and antennas.
425 *
426 * The returned py::object is the Python scene instance and ownership is
427 * managed by pybind11. The method uses the RtSceneConfig and frequency set
428 * in this class to configure the scene creation.
429 *
430 * @param rt sionna.rt module used to construct Python objects
431 * @param sMob Mobility model of the transmitter
432 * @param uMob Mobility model of the receiver
433 * @param sAntenna Transmitter phased array model
434 * @param uAntenna Receiver phased array model
435 * @return A Python scene object (py::object)
436 */
437 py::object CreateScene(const py::module_ rt,
438 const Ptr<const MobilityModel> sMob,
439 const Ptr<const MobilityModel> uMob,
441 Ptr<const PhasedArrayModel> uAntenna) const;
442
443 /**
444 * @brief Configure the Sionna RT path solver behavior.
445 *
446 * Sets all options that control how the path solver traces rays through the
447 * scene, including maximum interaction depth, which phenomena to model
448 * (LOS, reflections, diffractions, etc.), and whether to use synthetic array
449 * processing. These settings remain in effect for all subsequent path
450 * computations until changed again.
451 *
452 * @param configs RtPathSolverConfig structure containing solver options
453 *
454 * @see GetRtPathSolverConfig, RtPathSolverConfig
455 */
457
458 /**
459 * @brief Retrieve the current path solver configuration.
460 *
461 * @return A copy of the RtPathSolverConfig currently in use
462 *
463 * @see SetRtPathSolverConfig
464 */
466
467 protected:
468 /**
469 * @brief Load a Sionna RT scene using the configured scenario name.
470 *
471 * Instantiates the scene factory selected by m_sceneConfigs.sceneName. The
472 * method detects whether the scenario is:
473 * - A built-in Sionna scenario name (e.g., "munich", "simple_street_canyon"),
474 * in which case rt.load_scene() is invoked with the scenario name; or
475 * - A custom XML file path (filename ending with ".xml"), in which case
476 * rt.Scene(filename=...) is called to load from file.
477 *
478 * The merge_shapes parameter from m_sceneConfigs is forwarded to control
479 * whether the scene loader should merge individual shapes.
480 *
481 * @param rt The imported sionna.rt Python module for scene creation
482 * @return A Python Scene object (py::object) ready for transmitter/receiver
483 * and path solver configuration
484 *
485 * @see SetScenario, RtSceneConfig
486 */
487 py::object LoadScene(const py::module_ rt) const;
488
489 /**
490 * @brief Render a visualization of the scene and paths to a PNG image file.
491 *
492 * If m_isImageRendered is true, this method invokes the Sionna RT rendering
493 * pipeline using the specified camera parameters and writes the output image
494 * to the file specified by m_outputImageDirectory and m_outputImageName.
495 *
496 * The image provides visual debugging of scene geometry and path interactions,
497 * which can be useful for validating scenario definitions and understanding
498 * propagation mechanisms.
499 *
500 * @param rt The sionna.rt module providing rendering functionality
501 * @param paths The Python Paths object containing computed propagation paths
502 * @param scene The Python Scene object describing the simulation environment
503 */
504 void SceneRenderImageToFile(const py::module_ rt,
505 const py::object paths,
506 const py::object scene) const;
507
508 /**
509 * @brief Convert a polarization slant angle into Sionna RT string representation.
510 *
511 * Maps the polarization configuration (defined by slant angle and element count)
512 * into one of Sionna's standard polarization strings: "V" (vertical), "H"
513 * (horizontal), "VH" (dual polarization), or "cross" (cross-polarization).
514 *
515 * @param polSlantAngle Polarization slant angle in radians (typically 0 or pi/2)
516 * @param numpol Number of polarizations per element (1 = single-pol, 2 = dual-pol)
517 * @return Sionna polarization string suitable for PlanarArray configuration
518 */
519 std::string GetPolarizationFromPolSlantAngle(const double polSlantAngle,
520 const uint8_t numpol) const;
521
522 /**
523 * @brief Compute propagation paths between transmitter and receiver.
524 *
525 * Invokes the Sionna RT PathSolver with the configured RtPathSolverConfig
526 * options (max_depth, los, specular_reflection, etc.). The solver recursively
527 * traces rays through the scene to identify all significant paths up to the
528 * configured maximum depth. If the number of paths exceeds the configured
529 * maximum (m_maxNumberOfPaths), this method automatically adjusts the solver
530 * depth and retries until the path count is acceptable.
531 *
532 * @param rt The imported sionna.rt Python module
533 * @param scene A Python Scene object (from CreateScene or LoadScene)
534 * @return A Python Paths object containing delays, angles, powers, and
535 * other per-path metadata
536 *
537 * @see SetRtPathSolverConfig, GetNumberOfPathsFromCir
538 */
539 py::object CalculatePaths(const py::module_ rt, const py::object scene);
540
541 /**
542 * @brief Convert calculated paths into channel impulse responses (CIRs).
543 *
544 * The returned Complex3DVector is shaped as:
545 * [numRxPorts][numTxPorts][path]
546 * where each path is the complex channel coefficient for a given delay tap.
547 * Delay and power normalization are handled according to the scene and
548 * solver semantics. The function uses internal utilities to extract angles,
549 * Doppler and delays from the paths object.
550 *
551 * @param paths Python object representing computed paths
552 * @return Complex3DVector containing CIRs for Rx/Tx element pairs
553 */
554 Complex3DVector CalculateCirFromPaths(const py::object paths) const;
555
556 /**
557 * @brief Extract delays (tau) per path from RS paths object.
558 *
559 * Returns a vector of delay values for each path aligned with the CIR.
560 *
561 * @param np The numpy_python module reference (py::module_)
562 * @param paths Python paths object computed by Sionna RT
563 * @return Vector of delays [s], ordered to match CIR taps
564 */
566 py::object paths) const;
567 /**
568 * @brief Extract Doppler shifts per path from the Python paths object.
569 *
570 * The Doppler shifts are returned in a PhasedArrayModel::ComplexVector where
571 * each entry is e^{j*2*pi*fd*t} or similar, depending on the calling convention.
572 *
573 * @param np The numpy_python module reference (py::module_)
574 * @param paths Python paths object computed by Sionna RT
575 * @return Complex vector of per-path Doppler shifts (one per path)
576 */
577 std::vector<double> CalculateDopplerFromPaths(const py::module_ np, py::object paths) const;
578 /**
579 * @brief Extract angular measurements (AOD/AOA/ZOA/ZOD) from the paths.
580 *
581 * Returns the requested angle measure for each path in radians. The Angle
582 * parameter is case-sensitive and should be one of:
583 * - "theta_r" (Zenith angles of arrival, ZOA)
584 * - "theta_t" (Zenith angles of departure, ZOD)
585 * - "phi_t" (Azimuth angles of departure, AOD)
586 * - "phi_r" (Azimuth angles of arrival, AOA)
587 *
588 * @param np The numpy_python module reference (py::module_)
589 * @param paths Python paths object computed by Sionna RT
590 * @param Angle String indicating the desired angle type
591 * @return Vector of angle values (radians) per path/tap
592 */
594 py::object paths,
595 std::string Angle) const;
596
597 // void CreateOnePath(py::object& paths);
598
599 /**
600 * @brief Build ChannelParams metadata from Sionna RT paths object.
601 *
602 * Produces an instance of SionnaRtChannelParams, populated with per-path
603 * doppler terms (m_doppler) and any other per-channel metadata extracted
604 * from the paths object.
605 *
606 * @param paths Python paths object returned by CalculatePaths
607 * @param aMob Mobility model of node A
608 * @param bMob Mobility model of node B
609 * @return Ptr to an allocated SionnaRtChannelParams instance
610 */
611
614 Ptr<const MobilityModel> bMob) const;
615
616 /**
617 * @brief Extract the number of propagation paths from the CIR tensor.
618 *
619 * Retrieves the channel impulse response (CIR) data from the Sionna RT paths
620 * object and extracts the total number of propagation paths. The CIR is
621 * organized as a 6-D numpy array with shape:
622 * [num_rx, num_rx_ant, num_tx, num_tx_ant, num_paths, num_time_steps]
623 *
624 * This method works identically for both synthetic array and standard array
625 * configurations, always reading from dimension 4 (num_paths).
626 *
627 * @param paths Python Paths object computed by Sionna RT PathSolver
628 * @return Number of propagation paths in the CIR; returns 0 if the array
629 * has unexpected dimensionality or is malformed
630 *
631 * @see DoesNumberOfPathsExceedMaximum
632 */
633 size_t GetNumberOfPathsFromCir(const py::object paths) const;
634
635 /**
636 * @brief Determine if the path count exceeds the configured maximum threshold.
637 *
638 * Compares a given path count against the m_maxNumberOfPaths attribute to
639 * decide whether the channel matrix computation should be rejected or
640 * recursively recomputed with reduced solver depth.
641 *
642 * @param numPaths Number of paths to check against the threshold
643 * @return true if numPaths > m_maxNumberOfPaths; false otherwise
644 */
645 bool DoesNumberOfPathsExceedMaximum(size_t numPaths) const;
646
647 // Attributes
648 std::unordered_map<uint64_t, Ptr<ChannelMatrix>>
649 m_channelMatrixMap; //!< map containing the channel realizations per pair of
650 //!< PhasedAntennaArray instances, the key of this map is reciprocal
651 //!< uniquely identifies a pair of PhasedAntennaArrays
652 std::unordered_map<uint64_t, Ptr<SionnaRtChannelParams>>
653 m_channelParamsMap; //!< map containing the common channel parameters per pair of nodes, the
654 //!< key of this map is reciprocal and uniquely identifies a pair of
655 //!< nodes
656 /** Channel update period used to decide whether to re-run path computations */
658
659 /** Path solver configuration used when computing paths */
661
662 /** High-level scene configuration */
664
665 /** Output image rendering options (file name/directory) */
666 std::string m_outputImageName; //!< Output file name
667 std::string m_outputImageDirectory; //!< Output directory
668
669 /** Control for whether we should render a scene image */
671 /** Whether Sionna RT should normalize path delays in CIR output. */
673 double m_maxNumberOfPaths; //!< Maximum number of paths to be generated by the path solver
674 /** Camera position/look-at used by the scene rendering pipeline */
675 Vector m_cameraPosition; //!< Camera position for scene rendering
676 Vector m_cameraLookAt; //!< Camera look-at point for scene rendering
677};
678
679} // namespace ns3
680
681#endif // SIONNA_RT_CHANNEL_MODEL_H
This is an interface for a channel model that can be described by a channel matrix,...
std::vector< double > DoubleVector
Type definition for vectors of doubles.
ComplexMatrixArray Complex3DVector
Create an alias for 3D complex vectors.
Keep track of the current position and velocity of an object.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static TypeId GetTypeId()
Get the ns-3 TypeId for this class.
std::vector< double > CalculateDopplerFromPaths(const py::module_ np, py::object paths) const
Extract Doppler shifts per path from the Python paths object.
bool DoesNumberOfPathsExceedMaximum(size_t numPaths) const
Determine if the path count exceeds the configured maximum threshold.
void SetMergeShapeEnable(bool cond)
Enable or disable shape merging when loading scenes from sionna.rt.
double m_maxNumberOfPaths
Maximum number of paths to be generated by the path solver.
virtual Ptr< ChannelMatrix > GetNewChannel(py::object paths, const Ptr< const MobilityModel > sMob, const Ptr< const MobilityModel > uMob, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna) const
Compute a new channel matrix for the given node pair using Sionna RT.
Vector m_cameraPosition
Camera position/look-at used by the scene rendering pipeline.
std::string m_outputImageDirectory
Output directory.
RtPathSolverConfig GetRtPathSolverConfig() const
Retrieve the current path solver configuration.
bool GetNormalizeDelays() const
Query whether path delay normalization is enabled.
Time m_updatePeriod
Channel update period used to decide whether to re-run path computations.
MatrixBasedChannelModel::DoubleVector CalculateAnglesFromPaths(const py::module_ np, py::object paths, std::string Angle) const
Extract angular measurements (AOD/AOA/ZOA/ZOD) from the paths.
~SionnaRtChannelModel() override
Destructor.
Complex3DVector CalculateCirFromPaths(const py::object paths) const
Convert calculated paths into channel impulse responses (CIRs).
void SetRtPathSolverConfig(RtPathSolverConfig configs)
Configure the Sionna RT path solver behavior.
RtPathSolverConfig m_RtPathSolverConfig
Path solver configuration used when computing paths.
void SetNormalizeDelays(bool cond)
Enable or disable normalization of path delays in Sionna RT.
RtSceneConfig m_sceneConfigs
High-level scene configuration.
std::unordered_map< uint64_t, Ptr< SionnaRtChannelParams > > m_channelParamsMap
map containing the common channel parameters per pair of nodes, the key of this map is reciprocal and...
double GetMaxNumberOfPaths() const
Get the configured maximum number of propagation paths.
bool ChannelMatrixNeedsUpdate(Ptr< const ChannelMatrix > channelMatrix) const
Determine whether an existing ChannelMatrix must be updated.
std::string GetAntennaElementPattern(Ptr< const AntennaModel > element) const
Return a string describing the antenna element pattern for Sionna.
Vector m_cameraLookAt
Camera look-at point for scene rendering.
bool m_isImageRendered
Control for whether we should render a scene image.
py::object MakePlannarArray(const py::module_ rt, Ptr< const PhasedArrayModel > antenna) const
Build a Sionna PlanarArray description from an ns-3 PhasedArrayModel.
bool m_normalizeDelays
Whether Sionna RT should normalize path delays in CIR output.
std::string m_outputImageName
Output image rendering options (file name/directory).
double GetFrequency() const
Get the configured center frequency.
py::object LoadScene(const py::module_ rt) const
Load a Sionna RT scene using the configured scenario name.
py::object CalculatePaths(const py::module_ rt, const py::object scene)
Compute propagation paths between transmitter and receiver.
int64_t AssignStreams(int64_t stream)
Assign stream indices to any random variables used internally.
void SetFrequency(double f)
Set the center frequency used by the model and scene factories.
bool AntennaSetupChanged(Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna, Ptr< const ChannelMatrix > channelMatrix) const
Check whether antenna configuration changes require regenerating the channel matrix.
Ptr< const ChannelMatrix > GetChannel(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob, Ptr< const PhasedArrayModel > aAntenna, Ptr< const PhasedArrayModel > bAntenna) override
Retrieve or generate the channel matrix for the node pair.
py::object CreateScene(const py::module_ rt, const Ptr< const MobilityModel > sMob, const Ptr< const MobilityModel > uMob, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna) const
Create a sionna.rt scene object for the provided endpoints and antennas.
std::unordered_map< uint64_t, Ptr< ChannelMatrix > > m_channelMatrixMap
map containing the channel realizations per pair of PhasedAntennaArray instances, the key of this map...
Ptr< MatrixBasedChannelModel::ChannelMatrix > CreateNewMatrixChannel(const Complex3DVector hUsn, const Ptr< const MobilityModel > sMob, const Ptr< const MobilityModel > uMob, Ptr< const PhasedArrayModel > sAntenna, Ptr< const PhasedArrayModel > uAntenna) const
Create a new ChannelMatrix object wrapping a precomputed CIR tensor.
MatrixBasedChannelModel::DoubleVector CalculateTauFromPaths(const py::module_ np, py::object paths) const
Extract delays (tau) per path from RS paths object.
void SetMaxNumberOfPaths(double p)
Set the maximum number of propagation paths to retain.
void SetScenario(const std::string &scenario)
Set the propagation scenario name used by sionna.rt scene factories.
std::string GetPolarizationFromPolSlantAngle(const double polSlantAngle, const uint8_t numpol) const
Convert a polarization slant angle into Sionna RT string representation.
std::string GetScenario() const
Return the configured propagation scenario name.
Ptr< SionnaRtChannelParams > CalculateChannelParamsFromPaths(const py::object paths, Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const
Build ChannelParams metadata from Sionna RT paths object.
void DoDispose() override
Release references and perform cleanup.
size_t GetNumberOfPathsFromCir(const py::object paths) const
Extract the number of propagation paths from the CIR tensor.
Ptr< const ChannelParams > GetParams(Ptr< const MobilityModel > aMob, Ptr< const MobilityModel > bMob) const override
Get channel parameters (path info) for a node pair if available.
void SceneRenderImageToFile(const py::module_ rt, const py::object paths, const py::object scene) const
Render a visualization of the scene and paths to a PNG image file.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const std::set< std::string > builtInSceneSionna
Data structure that stores channel parameters.
Configuration for the Sionna RT PathSolver.
bool diffuseReflection
Enable diffuse reflections (scattering).
bool syntheticArray
Use synthetic array processing (if supported by scene factory).
bool specularReflection
Enable specular reflections (mirror-like).
bool los
Include direct line-of-sight (LOS) path when true It only controls whether the solver should include ...
int seed
Random seed for stochastic components (e.g., diffuse scattering).
int maxDepth
Maximum number of interactions (reflection/refraction depth).
bool edgeDiffraction
Enable edge diffraction (alternative diffraction handling).
bool refraction
Enable refraction through transparent bodies / materials.
std::string sceneName
Which scene factory in sionna.rt.scene to call. Example: "munich".
bool mergeShapes
Whether to merge shapes during load_scene(...) to reduce geometry complexity.
ChannelParams extension to carry Sionna-specific metadata.
std::vector< double > m_doppler
Doppler shifts per cluster/path (complex vector indexed by path).