/src/ocudu/lib/ntn/ntn_sat_switch_helpers.cpp
Line | Count | Source |
1 | | // SPDX-FileCopyrightText: Copyright (C) 2021-2026 Software Radio Systems Limited |
2 | | // SPDX-FileCopyrightText: Copyright (C) 2026 OCUDU contributors |
3 | | // SPDX-License-Identifier: BSD-3-Clause-Open-MPI |
4 | | // Portions of this file may implement 3GPP specifications, which may be subject to additional licensing requirements. |
5 | | |
6 | | #include "ntn_sat_switch_helpers.h" |
7 | | |
8 | | using namespace ocudu; |
9 | | using namespace ocudu_ntn; |
10 | | |
11 | | std::optional<ntn_cell_config> ocudu_ntn::derive_post_switch_config(const ntn_cell_config& current) |
12 | 0 | { |
13 | 0 | if (!current.ntn_cfg || !current.sat_switch || !current.ntn_cfg->t_service || |
14 | 0 | !current.sat_switch->promote_to_serving) { |
15 | 0 | return std::nullopt; |
16 | 0 | } |
17 | | |
18 | 0 | ntn_cell_config derived = current; |
19 | |
|
20 | 0 | derived.ntn_cfg->satellite_index = current.sat_switch->satellite_index; |
21 | 0 | if (current.sat_switch->ntn_ul_sync_validity_dur) { |
22 | 0 | derived.ntn_cfg->ntn_ul_sync_validity_dur = *current.sat_switch->ntn_ul_sync_validity_dur; |
23 | 0 | } |
24 | 0 | if (current.sat_switch->cell_specific_koffset) { |
25 | 0 | derived.ntn_cfg->cell_specific_koffset = *current.sat_switch->cell_specific_koffset; |
26 | 0 | } |
27 | 0 | if (current.sat_switch->k_mac) { |
28 | 0 | derived.ntn_cfg->k_mac = current.sat_switch->k_mac; |
29 | 0 | } |
30 | 0 | if (current.sat_switch->polarization) { |
31 | 0 | derived.ntn_cfg->polarization = current.sat_switch->polarization; |
32 | 0 | } |
33 | 0 | if (current.sat_switch->ta_report) { |
34 | 0 | derived.ntn_cfg->ta_report = current.sat_switch->ta_report; |
35 | 0 | } |
36 | 0 | if (current.sat_switch->use_state_vector) { |
37 | 0 | derived.ntn_cfg->use_state_vector = current.sat_switch->use_state_vector; |
38 | 0 | } |
39 | 0 | if (!current.sat_switch->promote_neighbors) { |
40 | 0 | derived.ncells.clear(); |
41 | 0 | } |
42 | | // t_service described when the source satellite stops serving; that moment has passed once the derived config is |
43 | | // active, and the new satellite's own service stop time is unknown here. |
44 | 0 | derived.ntn_cfg->t_service.reset(); |
45 | 0 | derived.sat_switch.reset(); |
46 | |
|
47 | 0 | return derived; |
48 | 0 | } |