├── .gitmodules ├── doc ├── satellite-gwstructure.png ├── satellite-utstructure.png ├── satellite-gain-72beams.png ├── sns3-theme │ ├── static │ │ ├── bc_s.png │ │ └── ns3_stylesheet.css │ ├── ns3_doxy_footer.html │ ├── layout.html │ └── theme.conf ├── satellite-full72-gain-map.png ├── satellite-geosatstructure.png ├── satellite-helper-structure.png ├── satellite-general-architecture.pdf ├── satellite-general-architecture.png ├── satellite-forward-composite-sinr.png ├── satellite-full72-dominance-map-userfreq.png ├── satellite.rst ├── README.md └── main.h ├── examples ├── generic-input-attributes.xml ├── sat-tutorial-input.xml ├── sat-generic-launcher.cc ├── sat-rayleigh-example.cc ├── CMakeLists.txt ├── sat-loo-example.cc └── sat-mobility-position-generator.cc ├── .gitignore ├── .hgignore ├── .gitlab-ci.yml ├── model ├── satellite-base-fader.cc ├── satellite-base-fader-conf.cc ├── satellite-base-fading.cc ├── satellite-arq-buffer-context.cc ├── satellite-interference-elimination.cc ├── satellite-superframe-allocator.cc ├── satellite-sgp4io.h ├── satellite-node-info.cc ├── satellite-arp-cache.cc ├── lorawan-ground-mac-gateway.h ├── lorawan-orbiter-mac-gateway.h ├── iers-data.h ├── satellite-arp-cache.h ├── satellite-lora-phy-tx.cc ├── satellite-fwd-carrier-conf.cc ├── lora-beam-tag.cc ├── satellite-constant-position-mobility-model.h ├── satellite-isl-arbiter.cc ├── satellite-sgp4ext.h ├── satellite-base-fader-conf.h ├── satellite-arq-buffer-context.h ├── lora-beam-tag.h ├── satellite-fading-input-trace.cc ├── satellite-constant-position-mobility-model.cc ├── vector-extensions.cc ├── satellite-fading-input-trace.h ├── satellite-free-space-loss.cc ├── satellite-free-space-loss.h ├── lorawan-mac-gateway.h ├── satellite-orbiter-user-llc.h ├── satellite-base-fader.h ├── satellite-orbiter-feeder-llc.h ├── satellite-propagation-delay-model.h ├── satellite-encap-pdu-status-tag.cc ├── lora-device-address-generator.cc ├── satellite-propagation-delay-model.cc ├── satellite-look-up-table.h ├── satellite-arq-header.cc ├── satellite-const-variables.h ├── satellite-node-info.h ├── satellite-on-off-application.h ├── lora-network-controller.h ├── satellite-address-tag.cc ├── satellite-packet-classifier.h ├── satellite-loo-conf.h ├── satellite-rayleigh-conf.h ├── satellite-base-trace-container.cc ├── satellite-base-fading.h ├── satellite-scheduling-object.cc ├── satellite-fwd-carrier-conf.h ├── satellite-isl-arbiter.h ├── lora-network-controller.cc ├── lora-network-scheduler.h ├── satellite-simple-channel.h ├── satellite-ground-station-address-tag.cc ├── lora-device-address-generator.h └── satellite-arq-sequence-number.h ├── ext-utils ├── pre-commit.hook ├── run-sim.sh ├── uncrustify.cfg ├── runSatTests.sh ├── writeExtFadingIndexFile.m └── get_beam_center.py ├── stats ├── satellite-stats-backlogged-request-helper.h ├── satellite-stats-capacity-request-helper.h ├── satellite-stats-waveform-usage-helper.h ├── satellite-stats-beam-service-time-helper.h ├── satellite-stats-resources-granted-helper.h └── satellite-stats-packet-drop-rate-helper.h ├── utils ├── satellite-input-fstream-wrapper.cc ├── satellite-output-fstream-wrapper.cc ├── satellite-input-fstream-wrapper.h └── satellite-output-fstream-wrapper.h └── helper ├── satellite-point-to-point-isl-helper.h ├── satellite-isl-arbiter-unicast-helper.h ├── satellite-lora-conf.h ├── satellite-on-off-helper.cc ├── lora-forwarder-helper.h ├── lora-network-server-helper.h └── satellite-beam-user-info.cc /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "data"] 2 | path = data 3 | url = ../sns3-data.git -------------------------------------------------------------------------------- /doc/satellite-gwstructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-gwstructure.png -------------------------------------------------------------------------------- /doc/satellite-utstructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-utstructure.png -------------------------------------------------------------------------------- /doc/satellite-gain-72beams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-gain-72beams.png -------------------------------------------------------------------------------- /doc/sns3-theme/static/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/sns3-theme/static/bc_s.png -------------------------------------------------------------------------------- /doc/satellite-full72-gain-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-full72-gain-map.png -------------------------------------------------------------------------------- /doc/satellite-geosatstructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-geosatstructure.png -------------------------------------------------------------------------------- /doc/satellite-helper-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-helper-structure.png -------------------------------------------------------------------------------- /doc/satellite-general-architecture.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-general-architecture.pdf -------------------------------------------------------------------------------- /doc/satellite-general-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-general-architecture.png -------------------------------------------------------------------------------- /doc/satellite-forward-composite-sinr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-forward-composite-sinr.png -------------------------------------------------------------------------------- /doc/satellite-full72-dominance-map-userfreq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sns3/sns3-satellite/HEAD/doc/satellite-full72-dominance-map-userfreq.png -------------------------------------------------------------------------------- /examples/generic-input-attributes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/sat-tutorial-input.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | ext-utils/.uncrustifyignore 3 | *.xz 4 | .hgignore 5 | 6 | cmake-cache/ 7 | cmake-build-debug/ 8 | cmake-build-relwithdebinfo/ 9 | cmake-build-minsizerel/ 10 | cmake-build-release/ 11 | CMakeFiles/ -------------------------------------------------------------------------------- /doc/satellite.rst: -------------------------------------------------------------------------------- 1 | ================================= 2 | Satellite Module 3 | ================================= 4 | 5 | .. toctree:: 6 | 7 | satellite-design 8 | satellite-usage 9 | satellite-testing 10 | 11 | -------------------------------------------------------------------------------- /.hgignore: -------------------------------------------------------------------------------- 1 | ^data/antennapatterns 2 | ^data/linkresults 3 | ^data/utpositions 4 | ^data/ext-fadingtraces 5 | ^data/fadingtraces 6 | ^data/rxpowertraces 7 | ^data/interferencetraces 8 | ^data/sinrmeaserror 9 | ^data/sims 10 | \.xz$ 11 | -------------------------------------------------------------------------------- /doc/sns3-theme/ns3_doxy_footer.html: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /doc/sns3-theme/layout.html: -------------------------------------------------------------------------------- 1 | {# 2 | ns-3/layout.html 3 | ~~~~~~~~~~~~~~~~~~~ 4 | 5 | Sphinx layout template for ns-3. 6 | 7 | :copyright: Copyright 2012 by ns-3, see AUTHORS. 8 | :license: GPL, see LICENSE for details. 9 | #} 10 | {% extends "basic/layout.html" %} 11 | 12 | {% set reldelim1 = ' ' %} 13 | {# set reldelim1 = ' @' #} 14 | 15 | {% if theme_collapsiblesidebar|tobool %} 16 | {% set script_files = script_files + ['_static/sidebar.js'] %} 17 | {% endif %} 18 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | It is possible to generate the SNS-3 doxygen and sphinx documentation 2 | without the need to have/compile the NS-3 source code. 3 | 4 | You can see which kind of documentation is buildable using `make help`. 5 | 6 | For instance, to generate the doxygen documentation, use: `make doxygen`. 7 | 8 | Or to generate the sphinx documentation, use: `make html singlehtml`. 9 | 10 | When using several targets, we strongly advise to use the `-k` option of 11 | `make` to continue building remaining targets in case one of them fail. You 12 | can also pass options to sphinx using the make variable `SPHINXOPTS`. _e.g._: 13 | 14 | ``` 15 | make SPHINXOPTS=-N -k doxygen html singlehtml latexpdf 16 | ``` 17 | 18 | 19 | All generated documentation will be stored in a new folder named `build` 20 | 21 | --- 22 | 23 | In case `ImageMagic` complains that you cannot generate some of the required 24 | images, you can refer to the following thread to get insights of how to solve 25 | the issue: 26 | 27 | https://stackoverflow.com/q/52998331/5069029 28 | -------------------------------------------------------------------------------- /doc/sns3-theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = default.css 4 | pygments_style = sphinx 5 | 6 | [options] 7 | projectname = sns-3 8 | 9 | homepage = https://sns3.org 10 | 11 | customstylesheet = ns3_stylesheet.css 12 | last_updated_fmt = '%%b %%d, %%Y' 13 | 14 | docstitle = Documentation 15 | 16 | rightsidebar = false 17 | stickysidebar = false 18 | collapsiblesidebar = false 19 | externalrefs = false 20 | 21 | bgcolor = white 22 | textcolor = black 23 | linkcolor = #337AB7 24 | visitedlinkcolor = #337AB7 25 | 26 | headbgcolor = #E3E3E3 27 | headtextcolor = #373737 28 | headlinkcolor = #337AB7 29 | 30 | relbarbgcolor = #D5D5D5 31 | relbarlinkcolor = #337AB7 32 | relbartextcolor = #373737 33 | 34 | sidebarbgcolor = #FAFAFA 35 | sidebartextcolor = #373737 36 | sidebarlinkcolor = #337AB7 37 | sidebarbtncolor = #D5D5D5 38 | 39 | footerbgcolor = #D5D5D5 40 | footertextcolor = #364D7C 41 | 42 | codebgcolor = #FBFCFD 43 | codetextcolor = black 44 | 45 | bodyfont = 'Lucida Grande', Verdana, Geneva, Arial, sans-serif 46 | headfont = 'Lucida Grande', Verdana, Geneva, Arial, sans-serif 47 | -------------------------------------------------------------------------------- /doc/main.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Main page of the Doxygen-generated documentation. 4 | */ 5 | 6 | /** 7 | * \mainpage sns-3 Documentation 8 | * 9 | * \section intro-sec Introduction 10 | * sns-3 documentation is maintained using 11 | * Doxygen. 12 | * Doxygen is typically used for 13 | * API documentation, and organizes such documentation across different 14 | * modules. This project uses Doxygen for building the definitive 15 | * maintained API documentation. 16 | * 17 | * This project is built on top of ns-3 18 | * and, as such, the full documentation is maintained at the 19 | * ns-3 project web site. 20 | * 21 | * \section module-sec Module overview 22 | * 23 | * The ns-3 library is split across many modules organized under the 24 | * Modules tab. 25 | * 26 | * This project adds a new module, named satellite, to the ns-3 ecosystem. This documentation 27 | * is for this module only. 28 | * Missing entries from this documentation should be searched in the ns-3 documentation for 29 | * further information. 30 | * 31 | */ 32 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # You can override the included template(s) by including variable overrides 2 | # SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings 3 | # Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings 4 | # Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings 5 | # Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings 6 | # Note that environment variables can be set in several places 7 | # See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence 8 | 9 | --- 10 | 11 | workflow: 12 | rules: 13 | - if: $CI_PIPELINE_SOURCE == "merge_request_event" 14 | - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS 15 | when: never 16 | - if: $CI_COMMIT_BRANCH 17 | 18 | stages: 19 | - delegate 20 | 21 | default: 22 | tags: 23 | - Usine_Logicielle 24 | 25 | delegate_to_build_job: 26 | variables: 27 | BRANCH_NAME: $CI_COMMIT_REF_NAME 28 | REPO_NAME: satellite 29 | TRAFFIC_REF: master 30 | STATS_REF: master 31 | stage: delegate 32 | trigger: sns3/sns3-ci 33 | -------------------------------------------------------------------------------- /model/satellite-base-fader.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-base-fader.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatBaseFader"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatBaseFader); 33 | 34 | TypeId 35 | SatBaseFader::GetTypeId(void) 36 | { 37 | static TypeId tid = TypeId("ns3::SatBaseFader").SetParent(); 38 | return tid; 39 | } 40 | 41 | SatBaseFader::SatBaseFader() 42 | { 43 | NS_LOG_FUNCTION(this); 44 | } 45 | 46 | SatBaseFader::~SatBaseFader() 47 | { 48 | NS_LOG_FUNCTION(this); 49 | } 50 | 51 | } // namespace ns3 52 | -------------------------------------------------------------------------------- /model/satellite-base-fader-conf.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-base-fader-conf.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatBaseFaderConf"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatBaseFaderConf); 33 | 34 | TypeId 35 | SatBaseFaderConf::GetTypeId(void) 36 | { 37 | static TypeId tid = TypeId("ns3::SatBaseFaderConf").SetParent(); 38 | return tid; 39 | } 40 | 41 | SatBaseFaderConf::SatBaseFaderConf() 42 | { 43 | NS_LOG_FUNCTION(this); 44 | } 45 | 46 | SatBaseFaderConf::~SatBaseFaderConf() 47 | { 48 | NS_LOG_FUNCTION(this); 49 | } 50 | 51 | } // namespace ns3 52 | -------------------------------------------------------------------------------- /model/satellite-base-fading.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-base-fading.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatBaseFading"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatBaseFading); 33 | 34 | TypeId 35 | SatBaseFading::GetTypeId(void) 36 | { 37 | static TypeId tid = TypeId("ns3::SatBaseFading").SetParent(); 38 | return tid; 39 | } 40 | 41 | SatBaseFading::SatBaseFading() 42 | { 43 | NS_LOG_FUNCTION(this); 44 | } 45 | 46 | SatBaseFading::~SatBaseFading() 47 | { 48 | NS_LOG_FUNCTION(this); 49 | } 50 | 51 | double 52 | SatBaseFading::GetFading(Address macAddress, SatEnums::ChannelType_t channelType) 53 | { 54 | NS_LOG_FUNCTION(this); 55 | 56 | return DoGetFading(macAddress, channelType); 57 | } 58 | 59 | } // namespace ns3 60 | -------------------------------------------------------------------------------- /model/satellite-arq-buffer-context.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-arq-buffer-context.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatArqBufferContext"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatArqBufferContext); 33 | 34 | SatArqBufferContext::SatArqBufferContext() 35 | : m_pdu(), 36 | m_seqNo(0), 37 | m_retransmissionCount(0), 38 | m_waitingTimer(), 39 | m_rxStatus(false) 40 | { 41 | } 42 | 43 | TypeId 44 | SatArqBufferContext::GetTypeId() 45 | { 46 | static TypeId tid = TypeId("ns3::SatArqBufferContext").SetParent(); 47 | return tid; 48 | } 49 | 50 | void 51 | SatArqBufferContext::DoDispose() 52 | { 53 | NS_LOG_FUNCTION(this); 54 | 55 | m_pdu = 0; 56 | m_waitingTimer.Cancel(); 57 | } 58 | 59 | } // namespace ns3 60 | -------------------------------------------------------------------------------- /ext-utils/pre-commit.hook: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2018 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License version 2 as 7 | # published by the Free Software Foundation; 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | # 18 | # Author: Mathias Ettinger 19 | # 20 | 21 | # 22 | # Hook to check for NS-3 coding style violations. 23 | # 24 | # To enable this hook, move it to the .git/hooks folder 25 | # and rename the file to "pre-commit". 26 | 27 | # Redirect output to stderr. 28 | exec 1>&2 29 | 30 | # Be sure to check only stuff that has been added to the index 31 | git stash -q --keep-index 32 | 33 | # If there are coding-style errors in source files, print the offending file names and fail. 34 | ext-utils/coding_style.sh git-check 35 | result=$? 36 | 37 | # Restore working version 38 | git stash pop -q 39 | 40 | # Check whether the user whish to commit when coding-style errors are present 41 | if [ $result -ne 0 ] 42 | then 43 | echo 44 | read -n 1 -p 'Commit anyway? [y/N] ' answer < /dev/tty 45 | if [ "Y$answer" != "Y" ]; then echo; fi 46 | if [ "Y$answer" != "Yy" ] && [ "Y$answer" != "YY" ] 47 | then 48 | exit 1 49 | else 50 | echo -e "\nApplying commit anyway:\n" 51 | fi 52 | fi 53 | 54 | exit 0 55 | -------------------------------------------------------------------------------- /model/satellite-interference-elimination.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2018 CNES 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mathias Ettinger 19 | */ 20 | 21 | #include "satellite-interference-elimination.h" 22 | 23 | #include "satellite-signal-parameters.h" 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | NS_LOG_COMPONENT_DEFINE("SatInterferenceElimination"); 31 | 32 | namespace ns3 33 | { 34 | 35 | NS_OBJECT_ENSURE_REGISTERED(SatInterferenceElimination); 36 | 37 | TypeId 38 | SatInterferenceElimination::GetTypeId(void) 39 | { 40 | static TypeId tid = TypeId("ns3::SatInterferenceElimination").SetParent(); 41 | 42 | return tid; 43 | } 44 | 45 | TypeId 46 | SatInterferenceElimination::GetInstanceTypeId(void) const 47 | { 48 | return GetTypeId(); 49 | } 50 | 51 | SatInterferenceElimination::SatInterferenceElimination() 52 | { 53 | } 54 | 55 | SatInterferenceElimination::~SatInterferenceElimination() 56 | { 57 | } 58 | 59 | } // namespace ns3 60 | -------------------------------------------------------------------------------- /doc/sns3-theme/static/ns3_stylesheet.css: -------------------------------------------------------------------------------- 1 | /* ns-3 changes to the default CSS from Doxygen and Sphinx */ 2 | 3 | div.related { 4 | background-image: linear-gradient(to bottom, white 0%, #d5d5d5 80%); 5 | } 6 | 7 | /* Dark mode is not supported in Doxygen versions earlier than 1.9.6 */ 8 | @media (prefers-color-scheme: dark) { 9 | body, 10 | table, 11 | div, 12 | p, 13 | dl, 14 | div.body, 15 | div.sphinxsidebar h3, 16 | div.sphinxsidebar h4 , 17 | div.sphinxsidebar h3 a{ 18 | color: ivory; 19 | background:black; 20 | } 21 | div.sphinxsidebar input{ 22 | background: #2c2d24; 23 | } 24 | div.related{ 25 | background-image: linear-gradient(to bottom, #66696a 0%, #d5d5d5 80%); 26 | } 27 | } 28 | 29 | a { 30 | font-weight: bold; 31 | } 32 | 33 | /* Sphinx figure captions */ 34 | p.caption { 35 | font-weight: bold; 36 | } 37 | 38 | /* Doxygen side bar */ 39 | #nav-tree { 40 | font-size: 12px; 41 | } 42 | 43 | #nav-tree a { 44 | font-weight: normal; 45 | } 46 | 47 | div.related h3 { 48 | display: none; 49 | } 50 | 51 | div.related a { 52 | font-size: 14px; 53 | font-weight: bold; 54 | } 55 | 56 | div.related li { 57 | background-image: url('bc_s.png'); 58 | background-position: 100% 40%; 59 | background-repeat: no-repeat; 60 | padding-left: 10px; 61 | padding-right: 15px; 62 | } 63 | 64 | div.related li.right { 65 | background-image: none; 66 | padding-left: 0px; 67 | padding-right: 0px; 68 | } 69 | 70 | /* Sphinx side bar */ 71 | div.sphinxsidebar { 72 | font-size: 12px; 73 | } 74 | 75 | div.sphinxsidebar a { 76 | font-weight: normal; 77 | } 78 | 79 | 80 | /* Title bar elements */ 81 | 82 | div.related:first-of-type { 83 | margin-top: 56px; 84 | } 85 | 86 | li { 87 | font-size: 100%; 88 | } 89 | 90 | .arrow { 91 | padding: 0 16px; 92 | } 93 | -------------------------------------------------------------------------------- /model/satellite-superframe-allocator.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2019 CNES 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Joaquin Muguerza 19 | */ 20 | 21 | #include "satellite-superframe-allocator.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatSuperframeAllocator"); 29 | 30 | namespace ns3 31 | { 32 | 33 | NS_OBJECT_ENSURE_REGISTERED(SatSuperframeAllocator); 34 | 35 | TypeId 36 | SatSuperframeAllocator::GetTypeId(void) 37 | { 38 | static TypeId tid = TypeId("ns3::SatSuperframeAllocator").SetParent(); 39 | return tid; 40 | } 41 | 42 | TypeId 43 | SatSuperframeAllocator::GetInstanceTypeId(void) const 44 | { 45 | NS_LOG_FUNCTION(this); 46 | 47 | return GetTypeId(); 48 | } 49 | 50 | SatSuperframeAllocator::SatSuperframeAllocator(Ptr superFrameConf) 51 | : m_superframeConf(superFrameConf) 52 | { 53 | NS_LOG_FUNCTION(this); 54 | } 55 | 56 | SatSuperframeAllocator::~SatSuperframeAllocator() 57 | { 58 | NS_LOG_FUNCTION(this); 59 | } 60 | 61 | } // namespace ns3 62 | -------------------------------------------------------------------------------- /ext-utils/run-sim.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2014 Magister Solutions Ltd 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License version 2 as 7 | # published by the Free Software Foundation; 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | # 18 | # Author: Jani Puttonen 19 | # 20 | 21 | #################################################### 22 | # Example simulation script for pushing simulations 23 | # to grid engine. Run the script in the NS-3 root. 24 | #################################################### 25 | 26 | # $1: Number of UTs 27 | # $2: Simulation length in seconds 28 | run_sim() 29 | { 30 | name="uts$1-simTime$2" 31 | echo "./waf --run \"sat-training-example \ 32 | --utsPerBeam=$1 \ 33 | --simDurationInSeconds=$2 \ 34 | --ns3::SatStatsHelperContainer::Name=$name\"" \ 35 | > "run-$name.sh" 36 | chmod +x "run-$name.sh" 37 | 38 | qsub -m eas -M $USER@magister.fi -j yes -b yes -cwd /bin/bash "run-$name.sh" 39 | } 40 | 41 | main() 42 | { 43 | uts="10 20" 44 | simTime="10 20" 45 | for i in $uts 46 | do 47 | for j in $simTime 48 | do 49 | # uts simTime 50 | run_sim $i $j 51 | run_sim $i $j 52 | done 53 | done 54 | } 55 | 56 | main $* 57 | 58 | 59 | -------------------------------------------------------------------------------- /model/satellite-sgp4io.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------- 2 | * 3 | * sgp4io.h; 4 | * 5 | * this file contains a function to read two line element sets. while 6 | * not formerly part of the sgp4 mathematical theory, it is 7 | * required for practical implemenation. 8 | * 9 | * companion code for 10 | * fundamentals of astrodynamics and applications 11 | * 2007 12 | * by david vallado 13 | * 14 | * (w) 719-573-2600, email dvallado@agi.com 15 | * 16 | * current : 17 | * 3 sep 07 david vallado 18 | * add operationmode for afspc (a) or improved (i) 19 | * changes : 20 | * 20 apr 07 david vallado 21 | * misc updates for manual operation 22 | * 14 aug 06 david vallado 23 | * original baseline 24 | * 25 | * code from https://gitlab.inesctec.pt/pmms/ns3-satellite 26 | * ---------------------------------------------------------------- */ 27 | 28 | #ifndef SAT_SGP4IO_H 29 | #define SAT_SGP4IO_H 30 | 31 | #include "satellite-sgp4ext.h" // for several misc routines 32 | #include "satellite-sgp4unit.h" // for sgp4init and getgravconst 33 | 34 | #include 35 | #include 36 | 37 | // ------------------------- function declarations ------------------------- 38 | 39 | void twoline2rv(char longstr1[130], 40 | char longstr2[130], 41 | char typerun, 42 | char typeinput, 43 | char opsmode, 44 | gravconsttype whichconst, 45 | double& startmfe, 46 | double& stopmfe, 47 | double& deltamin, 48 | elsetrec& satrec); 49 | 50 | #endif // SAT_SGP4IO_H 51 | -------------------------------------------------------------------------------- /model/satellite-node-info.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-node-info.h" 22 | 23 | #include 24 | 25 | NS_LOG_COMPONENT_DEFINE("SatNodeInfo"); 26 | 27 | namespace ns3 28 | { 29 | 30 | SatNodeInfo::SatNodeInfo() 31 | : m_nodeId(0), 32 | m_nodeType(SatEnums::NT_UNDEFINED), 33 | m_macAddress() 34 | { 35 | } 36 | 37 | SatNodeInfo::SatNodeInfo(SatEnums::SatNodeType_t nodeType, uint32_t nodeId, Mac48Address macAddress) 38 | : m_nodeId(nodeId), 39 | m_nodeType(nodeType), 40 | m_macAddress(macAddress) 41 | { 42 | } 43 | 44 | SatNodeInfo::~SatNodeInfo() 45 | { 46 | } 47 | 48 | uint32_t 49 | SatNodeInfo::GetNodeId() const 50 | { 51 | NS_LOG_FUNCTION(this); 52 | return m_nodeId; 53 | } 54 | 55 | SatEnums::SatNodeType_t 56 | SatNodeInfo::GetNodeType() const 57 | { 58 | NS_LOG_FUNCTION(this); 59 | return m_nodeType; 60 | } 61 | 62 | Mac48Address 63 | SatNodeInfo::GetMacAddress() const 64 | { 65 | NS_LOG_FUNCTION(this); 66 | return m_macAddress; 67 | } 68 | 69 | } // namespace ns3 70 | -------------------------------------------------------------------------------- /model/satellite-arp-cache.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-arp-cache.h" 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatArpCache"); 29 | 30 | namespace ns3 31 | { 32 | 33 | NS_OBJECT_ENSURE_REGISTERED(SatArpCache); 34 | 35 | TypeId 36 | SatArpCache::GetTypeId(void) 37 | { 38 | static TypeId tid = TypeId("ns3::SatArpCache").SetParent(); 39 | return tid; 40 | } 41 | 42 | SatArpCache::SatArpCache() 43 | : ArpCache() 44 | { 45 | NS_LOG_FUNCTION(this); 46 | } 47 | 48 | SatArpCache::~SatArpCache() 49 | { 50 | NS_LOG_FUNCTION(this); 51 | } 52 | 53 | ArpCache::Entry* 54 | SatArpCache::Add(Ipv4Address to, Address macAddress) 55 | { 56 | NS_LOG_FUNCTION(this << to << macAddress); 57 | 58 | // Add a new entry 59 | ArpCache::Entry* entry = ArpCache::Add(to); 60 | entry->SetMacAddress(macAddress); 61 | entry->MarkPermanent(); 62 | 63 | NS_LOG_INFO("IP: " << to << ", MAC: " << macAddress); 64 | 65 | return entry; 66 | } 67 | 68 | } // namespace ns3 69 | -------------------------------------------------------------------------------- /model/lorawan-ground-mac-gateway.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORAWAN_GROUND_MAC_GATEWAY_H 24 | #define LORAWAN_GROUND_MAC_GATEWAY_H 25 | 26 | #include "lora-tag.h" 27 | #include "lorawan-mac-gateway.h" 28 | #include "lorawan-mac.h" 29 | #include "satellite-bbframe-container.h" 30 | 31 | #include 32 | 33 | namespace ns3 34 | { 35 | 36 | class LorawanGroundMacGateway : public LorawanMacGateway 37 | { 38 | public: 39 | static TypeId GetTypeId(void); 40 | 41 | LorawanGroundMacGateway(); 42 | LorawanGroundMacGateway(uint32_t satId, uint32_t beamId); 43 | virtual ~LorawanGroundMacGateway(); 44 | 45 | // Implementation of the LorawanMac interface 46 | virtual void Send(Ptr packet); 47 | 48 | // Implementation of the LorawanMac interface 49 | // virtual void Receive (Ptr packet); 50 | virtual void Receive(SatPhy::PacketContainer_t packets, Ptr /*rxParams*/); 51 | 52 | private: 53 | // BB Frame configuration. 54 | protected: 55 | }; 56 | 57 | } /* namespace ns3 */ 58 | 59 | #endif /* LORAWAN_GROUND_MAC_GATEWAY_H */ 60 | -------------------------------------------------------------------------------- /model/lorawan-orbiter-mac-gateway.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORAWAN_ORBITER_MAC_GATEWAY_H 24 | #define LORAWAN_ORBITER_MAC_GATEWAY_H 25 | 26 | #include "lora-tag.h" 27 | #include "lorawan-mac-gateway.h" 28 | #include "lorawan-mac.h" 29 | #include "satellite-bbframe-container.h" 30 | 31 | #include 32 | 33 | namespace ns3 34 | { 35 | 36 | class LorawanOrbiterMacGateway : public LorawanMacGateway 37 | { 38 | public: 39 | static TypeId GetTypeId(void); 40 | 41 | LorawanOrbiterMacGateway(); 42 | LorawanOrbiterMacGateway(uint32_t satId, uint32_t beamId); 43 | virtual ~LorawanOrbiterMacGateway(); 44 | 45 | // Implementation of the LorawanMac interface 46 | virtual void Send(Ptr packet); 47 | 48 | // Implementation of the LorawanMac interface 49 | // virtual void Receive (Ptr packet); 50 | virtual void Receive(SatPhy::PacketContainer_t packets, Ptr /*rxParams*/); 51 | 52 | private: 53 | // BB Frame configuration. 54 | protected: 55 | }; 56 | 57 | } /* namespace ns3 */ 58 | 59 | #endif /* LORAWAN_ORBITER_MAC_GATEWAY_H */ 60 | -------------------------------------------------------------------------------- /stats/satellite-stats-backlogged-request-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_STATS_BACKLOGGED_REQUEST_HELPER_H 23 | #define SATELLITE_STATS_BACKLOGGED_REQUEST_HELPER_H 24 | 25 | #include "satellite-stats-helper.h" 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | class SatHelper; 33 | class DataCollectionObject; 34 | 35 | /** 36 | * \ingroup satstats 37 | * \brief 38 | */ 39 | class SatStatsBackloggedRequestHelper : public SatStatsHelper 40 | { 41 | public: 42 | // inherited from SatStatsHelper base class 43 | SatStatsBackloggedRequestHelper(Ptr satHelper); 44 | 45 | /** 46 | * / Destructor. 47 | */ 48 | virtual ~SatStatsBackloggedRequestHelper(); 49 | 50 | /** 51 | * inherited from ObjectBase base class 52 | */ 53 | static TypeId GetTypeId(); 54 | 55 | protected: 56 | // inherited from SatStatsHelper base class 57 | void DoInstall(); 58 | 59 | private: 60 | /// The aggregator created by this helper. 61 | Ptr m_aggregator; 62 | 63 | }; // end of class SatStatsBackloggedRequestHelper 64 | 65 | } // end of namespace ns3 66 | 67 | #endif /* SATELLITE_STATS_BACKLOGGED_REQUEST_HELPER_H */ 68 | -------------------------------------------------------------------------------- /model/iers-data.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2016 INESC TEC 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Pedro Silva 19 | * 20 | */ 21 | 22 | #ifndef IERS_DATA_H 23 | #define IERS_DATA_H 24 | 25 | #include 26 | #include 27 | 28 | /* 29 | * IMPORTANT: This file was generated automatically. Do not change it! 30 | * Instead, update files 'tai-utc.dat', and 'finals.data' on 31 | * data/sgp4/ folder using the latest files 32 | * provided at: 33 | * http://www.usno.navy.mil/USNO/earth-orientation/eo-info/general/bullc 34 | * and 35 | * http://www.usno.navy.mil/USNO/earth-orientation/eo-products/weekly or 36 | * http://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html 37 | */ 38 | namespace ns3 39 | { 40 | 41 | class IersData 42 | { 43 | public: 44 | struct EopParameters 45 | { 46 | // radians, radians, seconds, milliseconds 47 | double xp, yp, dut1, lod; 48 | }; 49 | 50 | static const std::vector EopValues; 51 | static const uint32_t BaseLeapSeconds; 52 | static const uint32_t CurLeapSeconds; 53 | static const std::vector LeapSeconds; 54 | 55 | protected: 56 | static const EopParameters __eop_params[]; 57 | static const uint32_t __leap_secs[]; 58 | }; 59 | 60 | } // namespace ns3 61 | 62 | #endif // IERS_DATA_H 63 | -------------------------------------------------------------------------------- /model/satellite-arp-cache.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_ARP_CACHE_H 22 | #define SATELLITE_ARP_CACHE_H 23 | 24 | #include 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * \brief An ARP cache interface for satellite module. In satellite module, 32 | * the ARP cache entries are pre-filled by the helpers and n "infinite" 33 | * timeout is set for all ARP cache entries. Thus, ARP is enabled but the 34 | * ARP messages do not need to be actively sent. 35 | */ 36 | class SatArpCache : public ArpCache 37 | { 38 | public: 39 | /** 40 | * \brief Get the type ID 41 | * \return the object TypeId 42 | */ 43 | static TypeId GetTypeId(void); 44 | 45 | /** 46 | * Default constructor. 47 | */ 48 | SatArpCache(); 49 | 50 | /** 51 | * Destructor for SatArpCache 52 | */ 53 | ~SatArpCache(); 54 | 55 | /** 56 | * \brief Add an Ipv4Address - MAC address entry to this ARP cache 57 | * \param to IP address 58 | * \param macAddress MAC address 59 | * \return ArpCache entry 60 | */ 61 | ArpCache::Entry* Add(Ipv4Address to, Address macAddress); 62 | }; 63 | 64 | } // namespace ns3 65 | 66 | #endif /* SATELLITE_ARP_CACHE_H */ 67 | -------------------------------------------------------------------------------- /model/satellite-lora-phy-tx.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | */ 20 | 21 | #include "satellite-lora-phy-tx.h" 22 | 23 | #include 24 | 25 | namespace ns3 26 | { 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatLoraPhyTx"); 29 | 30 | NS_OBJECT_ENSURE_REGISTERED(SatLoraPhyTx); 31 | 32 | TypeId 33 | SatLoraPhyTx::GetTypeId(void) 34 | { 35 | static TypeId tid = TypeId("ns3::SatLoraPhyTx").SetParent(); 36 | return tid; 37 | } 38 | 39 | SatLoraPhyTx::SatLoraPhyTx() 40 | : m_isTransmitting(false) 41 | { 42 | } 43 | 44 | SatLoraPhyTx::~SatLoraPhyTx() 45 | { 46 | } 47 | 48 | void 49 | SatLoraPhyTx::SetTxFinishedCallback(TxFinishedCallback callback) 50 | { 51 | m_txFinishedCallback = callback; 52 | } 53 | 54 | void 55 | SatLoraPhyTx::StartTx(Ptr txParams) 56 | { 57 | NS_LOG_FUNCTION(this << txParams); 58 | 59 | m_isTransmitting = true; 60 | 61 | SatPhyTx::StartTx(txParams); 62 | } 63 | 64 | void 65 | SatLoraPhyTx::EndTx() 66 | { 67 | NS_LOG_FUNCTION(this); 68 | 69 | m_isTransmitting = false; 70 | 71 | m_txFinishedCallback(); 72 | 73 | SatPhyTx::EndTx(); 74 | } 75 | 76 | bool 77 | SatLoraPhyTx::IsTransmitting() 78 | { 79 | NS_LOG_FUNCTION(this); 80 | 81 | return m_isTransmitting && SatPhyTx::IsTransmitting(); 82 | } 83 | 84 | } // namespace ns3 85 | -------------------------------------------------------------------------------- /model/satellite-fwd-carrier-conf.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #include "satellite-fwd-carrier-conf.h" 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatFwdCarrierConf"); 29 | 30 | namespace ns3 31 | { 32 | 33 | // Forward Link Carrier conf 34 | 35 | SatFwdCarrierConf::SatFwdCarrierConf() 36 | : m_allocatedBandwidthInHz(0.0), 37 | m_occupiedBandwidthInHz(0.0), 38 | m_effectiveBandwidthInHz(0.0) 39 | { 40 | // default constructor should not be used 41 | NS_ASSERT(false); 42 | } 43 | 44 | SatFwdCarrierConf::SatFwdCarrierConf(double bandwidthInHz, double rollOff, double spacing) 45 | : m_allocatedBandwidthInHz(bandwidthInHz) 46 | { 47 | NS_LOG_FUNCTION(this << bandwidthInHz << rollOff << spacing); 48 | 49 | if ((spacing < 0.00) || (spacing > 1.00) || (rollOff < 0.00) || (rollOff > 1.00)) 50 | { 51 | NS_FATAL_ERROR("Unvalid carrier spacing and/or roll-off parameters!"); 52 | } 53 | 54 | m_occupiedBandwidthInHz = m_allocatedBandwidthInHz / (rollOff + 1.00); 55 | m_effectiveBandwidthInHz = m_allocatedBandwidthInHz / ((spacing + 1.00) * (rollOff + 1.00)); 56 | } 57 | 58 | SatFwdCarrierConf::~SatFwdCarrierConf() 59 | { 60 | NS_LOG_FUNCTION(this); 61 | } 62 | 63 | } // namespace ns3 64 | -------------------------------------------------------------------------------- /model/lora-beam-tag.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien Tauran 19 | */ 20 | 21 | #include "lora-beam-tag.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("LoraBeamTag"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(LoraBeamTag); 33 | 34 | TypeId 35 | LoraBeamTag::GetTypeId(void) 36 | { 37 | static TypeId tid = TypeId("ns3::LoraBeamTag").SetParent().AddConstructor(); 38 | return tid; 39 | } 40 | 41 | TypeId 42 | LoraBeamTag::GetInstanceTypeId(void) const 43 | { 44 | return GetTypeId(); 45 | } 46 | 47 | LoraBeamTag::LoraBeamTag(uint8_t beamId) 48 | : m_beamId(beamId) 49 | { 50 | } 51 | 52 | LoraBeamTag::~LoraBeamTag() 53 | { 54 | } 55 | 56 | uint32_t 57 | LoraBeamTag::GetSerializedSize(void) const 58 | { 59 | return 1; 60 | } 61 | 62 | void 63 | LoraBeamTag::Serialize(TagBuffer i) const 64 | { 65 | i.WriteU8(m_beamId); 66 | } 67 | 68 | void 69 | LoraBeamTag::Deserialize(TagBuffer i) 70 | { 71 | m_beamId = i.ReadU8(); 72 | } 73 | 74 | void 75 | LoraBeamTag::Print(std::ostream& os) const 76 | { 77 | os << m_beamId; 78 | } 79 | 80 | uint8_t 81 | LoraBeamTag::GetBeamId() const 82 | { 83 | return m_beamId; 84 | } 85 | 86 | void 87 | LoraBeamTag::SetBeamId(uint8_t beamId) 88 | { 89 | m_beamId = beamId; 90 | } 91 | 92 | } // namespace ns3 93 | -------------------------------------------------------------------------------- /model/satellite-constant-position-mobility-model.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #ifndef SATELLITE_CONSTANT_POSITION_MOBILITY_MODEL_H 22 | #define SATELLITE_CONSTANT_POSITION_MOBILITY_MODEL_H 23 | 24 | #include "satellite-mobility-model.h" 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * 32 | * \brief Satellite mobility model for which the current position does not change 33 | * once it has been set and until it is set again explicitly to a new value. 34 | */ 35 | class SatConstantPositionMobilityModel : public SatMobilityModel 36 | { 37 | public: 38 | /** 39 | * \brief Get the type ID 40 | * \return the object TypeId 41 | */ 42 | static TypeId GetTypeId(void); 43 | /** 44 | * Create a position located at coordinates (0, 0, 0) 45 | */ 46 | SatConstantPositionMobilityModel(); 47 | 48 | /** 49 | * Destructor for SatConstantPositionMobilityModel 50 | */ 51 | virtual ~SatConstantPositionMobilityModel(); 52 | 53 | private: 54 | Vector DoGetVelocity(void) const; 55 | 56 | virtual GeoCoordinate DoGetGeoPosition(void) const; 57 | virtual void DoSetGeoPosition(const GeoCoordinate& position); 58 | 59 | mutable GeoCoordinate m_geoPosition; 60 | }; 61 | 62 | } // namespace ns3 63 | 64 | #endif /* SATELLITE_CONSTANT_POSITION_MOBILITY_MODEL_H */ 65 | -------------------------------------------------------------------------------- /utils/satellite-input-fstream-wrapper.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-input-fstream-wrapper.h" 22 | 23 | #include "ns3/abort.h" 24 | #include "ns3/log.h" 25 | 26 | #include 27 | #include 28 | 29 | NS_LOG_COMPONENT_DEFINE("SatInputFileStreamWrapper"); 30 | 31 | namespace ns3 32 | { 33 | 34 | SatInputFileStreamWrapper::SatInputFileStreamWrapper(std::string filename, 35 | std::ios::openmode filemode) 36 | : m_destroyable(true) 37 | { 38 | NS_LOG_FUNCTION(this << filename << filemode); 39 | 40 | std::ifstream* ifs = new std::ifstream(filename.c_str(), filemode); 41 | 42 | NS_ABORT_MSG_UNLESS(ifs->is_open(), 43 | "SatInputFileStreamWrapper::SatInputFileStreamWrapper(): " 44 | << "Unable to Open " << filename << " for mode " << filemode); 45 | 46 | m_ifstream = ifs; 47 | } 48 | 49 | SatInputFileStreamWrapper::~SatInputFileStreamWrapper() 50 | { 51 | NS_LOG_FUNCTION(this); 52 | 53 | if (m_destroyable) 54 | { 55 | delete m_ifstream; 56 | m_ifstream = 0; 57 | } 58 | m_destroyable = false; 59 | } 60 | 61 | std::ifstream* 62 | SatInputFileStreamWrapper::GetStream(void) 63 | { 64 | NS_LOG_FUNCTION(this); 65 | 66 | return m_ifstream; 67 | } 68 | 69 | } // namespace ns3 70 | -------------------------------------------------------------------------------- /model/satellite-isl-arbiter.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * Copyright (c) 2018 CNES 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation; 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Inspired and adapted from Hypatia: https://github.com/snkas/hypatia 20 | * 21 | * Author: Bastien Tauran 22 | */ 23 | 24 | #include "satellite-isl-arbiter.h" 25 | 26 | #include "satellite-id-mapper.h" 27 | #include "satellite-topology.h" 28 | 29 | #include 30 | 31 | NS_LOG_COMPONENT_DEFINE("SatIslArbiter"); 32 | 33 | namespace ns3 34 | { 35 | 36 | NS_OBJECT_ENSURE_REGISTERED(SatIslArbiter); 37 | 38 | TypeId 39 | SatIslArbiter::GetTypeId(void) 40 | { 41 | static TypeId tid = TypeId("ns3::SatIslArbiter").SetParent(); 42 | return tid; 43 | } 44 | 45 | SatIslArbiter::SatIslArbiter() 46 | { 47 | NS_LOG_FUNCTION(this); 48 | 49 | NS_FATAL_ERROR("Default constructor not in use"); 50 | } 51 | 52 | SatIslArbiter::SatIslArbiter(Ptr node) 53 | { 54 | NS_LOG_FUNCTION(this << node); 55 | 56 | m_nodeId = node->GetId(); 57 | } 58 | 59 | int32_t 60 | SatIslArbiter::BaseDecide(Ptr pkt, Mac48Address destination) 61 | { 62 | NS_LOG_FUNCTION(this << pkt << destination); 63 | 64 | int32_t targetId = Singleton::Get()->GetSatIdWithMacIsl(destination); 65 | 66 | if (targetId == -1) 67 | { 68 | NS_FATAL_ERROR("Cannot resolve target node ID"); 69 | } 70 | 71 | return Decide(m_nodeId, targetId, pkt); 72 | } 73 | 74 | } // namespace ns3 75 | -------------------------------------------------------------------------------- /model/satellite-sgp4ext.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------- 2 | * 3 | * sgp4ext.h 4 | * 5 | * this file contains extra routines needed for the main test program for sgp4. 6 | * these routines are derived from the astro libraries. 7 | * 8 | * companion code for 9 | * fundamentals of astrodynamics and applications 10 | * 2007 11 | * by david vallado 12 | * 13 | * (w) 719-573-2600, email dvallado@agi.com 14 | * 15 | * current : 16 | * 20 apr 07 david vallado 17 | * misc documentation updates 18 | * changes : 19 | * 14 aug 06 david vallado 20 | * original baseline 21 | * 22 | * code from https://gitlab.inesctec.pt/pmms/ns3-satellite 23 | * ---------------------------------------------------------------- */ 24 | 25 | #ifndef SAT_SGP4EXT_H 26 | #define SAT_SGP4EXT_H 27 | 28 | #include "satellite-sgp4unit.h" 29 | 30 | #include 31 | #include 32 | 33 | double sgn(double x); 34 | 35 | double mag(double x[3]); 36 | 37 | void cross(double vec1[3], double vec2[3], double outvec[3]); 38 | 39 | double dot(double x[3], double y[3]); 40 | 41 | double angle(double vec1[3], double vec2[3]); 42 | 43 | void newtonnu(double ecc, double nu, double& e0, double& m); 44 | 45 | // double asinh (double xval); 46 | 47 | void rv2coe(double r[3], 48 | double v[3], 49 | double mu, 50 | double& p, 51 | double& a, 52 | double& ecc, 53 | double& incl, 54 | double& omega, 55 | double& argp, 56 | double& nu, 57 | double& m, 58 | double& arglat, 59 | double& truelon, 60 | double& lonper); 61 | 62 | void jday(int year, int mon, int day, int hr, int minute, double sec, double& jd); 63 | 64 | void days2mdhms(int year, double days, int& mon, int& day, int& hr, int& minute, double& sec); 65 | 66 | void invjday(double jd, int& year, int& mon, int& day, int& hr, int& minute, double& sec); 67 | 68 | #endif // SAT_SGP4EXT_H 69 | -------------------------------------------------------------------------------- /model/satellite-base-fader-conf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | #ifndef SATELLITE_BASE_FADER_CONF_H 21 | #define SATELLITE_BASE_FADER_CONF_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | namespace ns3 31 | { 32 | 33 | /** 34 | * \ingroup satellite 35 | * 36 | * \brief Base class for fader configuration classes. This class 37 | * defines the functions which all the inherited fader 38 | * configuration classes must implement for the Markov-fading 39 | * model faders. This base class itself is abstract and will not 40 | * implement any real functionality. 41 | */ 42 | class SatBaseFaderConf : public Object 43 | { 44 | public: 45 | /** 46 | * \brief Constructor 47 | */ 48 | SatBaseFaderConf(); 49 | 50 | /** 51 | * \brief Destructor 52 | */ 53 | virtual ~SatBaseFaderConf(); 54 | 55 | /** 56 | * \brief NS-3 type id function 57 | * \return type id 58 | */ 59 | static TypeId GetTypeId(void); 60 | 61 | /** 62 | * \brief Function for getting the fading value 63 | * \param set parameter set 64 | * \return fading value 65 | */ 66 | virtual std::vector> GetParameters(uint32_t set) = 0; 67 | 68 | private: 69 | }; 70 | 71 | } // namespace ns3 72 | 73 | #endif /* SATELLITE_BASE_FADER_CONF_H */ 74 | -------------------------------------------------------------------------------- /model/satellite-arq-buffer-context.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_ARQ_BUFFER_CONTEXT_H_ 22 | #define SATELLITE_ARQ_BUFFER_CONTEXT_H_ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace ns3 31 | { 32 | 33 | /** 34 | * \ingroup satellite 35 | * \brief ARQ buffer context is holding information related to the ARQ transmission 36 | * or reception depending on whether packet(s) are being transmitted or received. 37 | * The SatArqBufferContext is used only when ARQ is enabled, i.e. encapsulator is 38 | * of type SatReturnLinkEncapsulatorArq or SatGenericStreamEncapsulatorArq. 39 | */ 40 | class SatArqBufferContext : public Object 41 | { 42 | public: 43 | /** 44 | * Default constructor. 45 | */ 46 | SatArqBufferContext(); 47 | 48 | ~SatArqBufferContext() 49 | { 50 | } 51 | 52 | /** 53 | * \brief Get the type ID 54 | * \return the object TypeId 55 | */ 56 | static TypeId GetTypeId(); 57 | 58 | /** 59 | * Dispose of this class instance 60 | */ 61 | virtual void DoDispose(); 62 | 63 | public: 64 | Ptr m_pdu; 65 | uint32_t m_seqNo; 66 | uint32_t m_retransmissionCount; 67 | EventId m_waitingTimer; 68 | bool m_rxStatus; 69 | }; 70 | 71 | } // namespace ns3 72 | 73 | #endif /* SATELLITE_ARQ_BUFFER_CONTEXT_H_ */ 74 | -------------------------------------------------------------------------------- /helper/satellite-point-to-point-isl-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2008 INRIA 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mathieu Lacage 19 | * (based on point-to-point helper) 20 | * Author: Andre Aguas March 2020 21 | * Simon 2020 22 | * Adapted to SNS-3 by: Bastien Tauran 23 | * 24 | */ 25 | 26 | #ifndef POINT_TO_POINT_ISL_HELPER_H 27 | #define POINT_TO_POINT_ISL_HELPER_H 28 | 29 | #include "ns3/data-rate.h" 30 | #include "ns3/net-device-container.h" 31 | #include "ns3/object-factory.h" 32 | 33 | #include 34 | 35 | namespace ns3 36 | { 37 | 38 | class NetDevice; 39 | class Node; 40 | 41 | class PointToPointIslHelper : public Object 42 | { 43 | public: 44 | /** 45 | * \brief Get the type ID 46 | * \return the object TypeId 47 | */ 48 | static TypeId GetTypeId(void); 49 | 50 | // Constructors 51 | PointToPointIslHelper(); 52 | 53 | // Installers 54 | NetDeviceContainer Install(Ptr a, Ptr b); 55 | 56 | private: 57 | ObjectFactory m_queueFactory; //!< Queue Factory 58 | ObjectFactory m_channelFactory; //!< Channel Factory 59 | ObjectFactory m_deviceFactory; //!< Device Factory 60 | 61 | DataRate m_dataRate; //!< Data rate of ISL link 62 | uint32_t m_maxPackets; //!< The maximum number of packets accepted by ISL queues 63 | uint32_t m_maxBytes; //!< The maximum number of bytes accepted by ISL queues 64 | }; 65 | 66 | } // namespace ns3 67 | 68 | #endif /* POINT_TO_POINT_ISL_HELPER_H */ 69 | -------------------------------------------------------------------------------- /model/lora-beam-tag.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien Tauran 19 | */ 20 | 21 | #ifndef LORA_BEAM_TAG_H 22 | #define LORA_BEAM_TAG_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * Tag used to save various data about a packet, like its Spreading Factor and 34 | * data about interference. 35 | */ 36 | class LoraBeamTag : public Tag 37 | { 38 | public: 39 | static TypeId GetTypeId(void); 40 | virtual TypeId GetInstanceTypeId(void) const; 41 | 42 | /** 43 | * Create a LoraBeamTag with a given beam ID. 44 | * 45 | * \param beamId The beam ID associated to this packet 46 | */ 47 | LoraBeamTag(uint8_t beamId = 0); 48 | 49 | virtual ~LoraBeamTag(); 50 | 51 | virtual void Serialize(TagBuffer i) const; 52 | virtual void Deserialize(TagBuffer i); 53 | virtual uint32_t GetSerializedSize() const; 54 | virtual void Print(std::ostream& os) const; 55 | 56 | /** 57 | * Read which beam ID this packet was transmitted with. 58 | * 59 | * \return This tag's packet's beam ID. 60 | */ 61 | uint8_t GetBeamId() const; 62 | 63 | /** 64 | * Set which beamId this packet was transmitted with. 65 | * 66 | * \param beamId The beam ID. 67 | */ 68 | void SetBeamId(uint8_t beamId); 69 | 70 | private: 71 | uint8_t m_beamId; //!< The beam ID used by the packet. 72 | }; 73 | } // namespace ns3 74 | 75 | #endif // LORA_BEAM_TAG_H 76 | -------------------------------------------------------------------------------- /utils/satellite-output-fstream-wrapper.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-output-fstream-wrapper.h" 22 | 23 | #include "ns3/abort.h" 24 | #include "ns3/fatal-impl.h" 25 | #include "ns3/log.h" 26 | 27 | #include 28 | #include 29 | 30 | NS_LOG_COMPONENT_DEFINE("SatOutputFileStreamWrapper"); 31 | 32 | namespace ns3 33 | { 34 | 35 | SatOutputFileStreamWrapper::SatOutputFileStreamWrapper(std::string filename, 36 | std::ios::openmode filemode) 37 | : m_destroyable(true) 38 | { 39 | NS_LOG_FUNCTION(this << filename << filemode); 40 | 41 | m_ofstream = new std::ofstream(filename.c_str(), filemode); 42 | 43 | NS_ABORT_MSG_UNLESS(m_ofstream->is_open(), 44 | "SatOutputFileStreamWrapper::SatOutputFileStreamWrapper(): " 45 | << "Unable to Open " << filename << " for mode " << filemode); 46 | 47 | FatalImpl::RegisterStream(m_ofstream); 48 | } 49 | 50 | SatOutputFileStreamWrapper::~SatOutputFileStreamWrapper() 51 | { 52 | NS_LOG_FUNCTION(this); 53 | 54 | FatalImpl::UnregisterStream(m_ofstream); 55 | 56 | if (m_destroyable) 57 | { 58 | delete m_ofstream; 59 | m_ofstream = 0; 60 | } 61 | m_destroyable = false; 62 | } 63 | 64 | std::ofstream* 65 | SatOutputFileStreamWrapper::GetStream(void) 66 | { 67 | NS_LOG_FUNCTION(this); 68 | 69 | return m_ofstream; 70 | } 71 | 72 | } // namespace ns3 73 | -------------------------------------------------------------------------------- /model/satellite-fading-input-trace.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-fading-input-trace.h" 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatFadingInputTrace"); 29 | 30 | namespace ns3 31 | { 32 | 33 | NS_OBJECT_ENSURE_REGISTERED(SatFadingInputTrace); 34 | 35 | TypeId 36 | SatFadingInputTrace::GetTypeId(void) 37 | { 38 | static TypeId tid = TypeId("ns3::SatFadingInputTrace") 39 | .SetParent() 40 | .AddConstructor(); 41 | return tid; 42 | } 43 | 44 | SatFadingInputTrace::SatFadingInputTrace( 45 | Ptr satFadingInputTraceContainer) 46 | : m_satFadingInputTraceContainer(satFadingInputTraceContainer) 47 | { 48 | NS_LOG_FUNCTION(this); 49 | } 50 | 51 | SatFadingInputTrace::SatFadingInputTrace() 52 | : m_satFadingInputTraceContainer() 53 | { 54 | NS_LOG_FUNCTION(this); 55 | 56 | NS_FATAL_ERROR("SatFadingInputTrace::SatFadingInputTrace - Constructor not in use."); 57 | } 58 | 59 | SatFadingInputTrace::~SatFadingInputTrace() 60 | { 61 | NS_LOG_FUNCTION(this); 62 | } 63 | 64 | double 65 | SatFadingInputTrace::DoGetFading(Address macAddress, SatEnums::ChannelType_t channelType) 66 | { 67 | NS_LOG_FUNCTION(this); 68 | 69 | return m_satFadingInputTraceContainer->GetFadingValue(std::make_pair(macAddress, channelType)); 70 | } 71 | 72 | } // namespace ns3 73 | -------------------------------------------------------------------------------- /helper/satellite-isl-arbiter-unicast-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * Copyright (c) 2018 CNES 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation; 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Inspired and adapted from Hypatia: https://github.com/snkas/hypatia 20 | * 21 | * Author: Bastien Tauran 22 | */ 23 | 24 | #ifndef SATELLITE_ISL_ARBITER_UNICAST_HELPER_H 25 | #define SATELLITE_ISL_ARBITER_UNICAST_HELPER_H 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace ns3 36 | { 37 | 38 | class SatIslArbiterUnicastHelper : public Object 39 | { 40 | public: 41 | static TypeId GetTypeId(void); 42 | 43 | /** 44 | * Default constructor. Must not be used 45 | */ 46 | SatIslArbiterUnicastHelper(); 47 | 48 | /** 49 | * Constructor 50 | * 51 | * \param isls List of all ISLs 52 | */ 53 | SatIslArbiterUnicastHelper(std::vector> isls); 54 | 55 | /** 56 | * Install arbiter on all satellite nodes 57 | */ 58 | void InstallArbiters(); 59 | 60 | /** 61 | * Update arbiter on all satellite nodes 62 | */ 63 | void UpdateArbiters(); 64 | 65 | private: 66 | /** 67 | * Compute routing tables for all satellite nodes 68 | */ 69 | std::vector> CalculateGlobalState(); 70 | 71 | std::vector> m_isls; // List of all ISLs 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SATELLITE_ISL_ARBITER_UNICAST_HELPER_H */ 77 | -------------------------------------------------------------------------------- /model/satellite-constant-position-mobility-model.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #include "satellite-constant-position-mobility-model.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatConstMobilityModel"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatConstantPositionMobilityModel); 33 | 34 | TypeId 35 | SatConstantPositionMobilityModel::GetTypeId(void) 36 | { 37 | static TypeId tid = TypeId("ns3::SatConstantPositionMobilityModel") 38 | .SetParent() 39 | .AddConstructor(); 40 | return tid; 41 | } 42 | 43 | SatConstantPositionMobilityModel::SatConstantPositionMobilityModel() 44 | { 45 | NS_LOG_FUNCTION(this); 46 | } 47 | 48 | SatConstantPositionMobilityModel::~SatConstantPositionMobilityModel() 49 | { 50 | NS_LOG_FUNCTION(this); 51 | } 52 | 53 | GeoCoordinate 54 | SatConstantPositionMobilityModel::DoGetGeoPosition(void) const 55 | { 56 | NS_LOG_FUNCTION(this); 57 | 58 | return m_geoPosition; 59 | } 60 | 61 | void 62 | SatConstantPositionMobilityModel::DoSetGeoPosition(const GeoCoordinate& position) 63 | { 64 | NS_LOG_FUNCTION(this << position); 65 | 66 | m_geoPosition = position; 67 | NotifyGeoCourseChange(); 68 | } 69 | 70 | Vector 71 | SatConstantPositionMobilityModel::DoGetVelocity(void) const 72 | { 73 | NS_LOG_FUNCTION(this); 74 | 75 | return Vector(0.0, 0.0, 0.0); 76 | } 77 | 78 | } // namespace ns3 79 | -------------------------------------------------------------------------------- /helper/satellite-lora-conf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien Tauran 19 | */ 20 | 21 | #ifndef SAT_LORA_CONF_H 22 | #define SAT_LORA_CONF_H 23 | 24 | #include "satellite-conf.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \brief A configuration class for the satellite reference system 34 | * 35 | */ 36 | class SatLoraConf : public Object 37 | { 38 | public: 39 | typedef enum 40 | { 41 | SATELLITE, //!< For Satellite 42 | EU863_870, //!< EU863-870 43 | } PhyLayerStandard_t; 44 | 45 | /** 46 | * Default constructor. 47 | */ 48 | SatLoraConf(); 49 | 50 | virtual ~SatLoraConf() 51 | { 52 | } 53 | 54 | /** 55 | * \brief Get the type ID 56 | * \return the object TypeId 57 | */ 58 | static TypeId GetTypeId(void); 59 | TypeId GetInstanceTypeId(void) const; 60 | 61 | void SetConf(Ptr gatewayMac); 62 | void SetConf(Ptr endDeviceMac); 63 | 64 | void setSatConfAttributes(Ptr satConf); 65 | 66 | private: 67 | void SetEu863_870Conf(Ptr gatewayMac); 68 | void SetEu863_870Conf(Ptr endDeviceMac); 69 | 70 | void SetSatelliteConf(Ptr gatewayMac); 71 | void SetSatelliteConf(Ptr endDeviceMac); 72 | 73 | PhyLayerStandard_t m_phyLayerStandard; 74 | }; 75 | 76 | } // namespace ns3 77 | 78 | #endif /* SAT_LORA_CONF_H */ 79 | -------------------------------------------------------------------------------- /stats/satellite-stats-capacity-request-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_STATS_CAPACITY_REQUEST_HELPER_H 23 | #define SATELLITE_STATS_CAPACITY_REQUEST_HELPER_H 24 | 25 | #include "satellite-stats-helper.h" 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | class SatHelper; 33 | class DataCollectionObject; 34 | 35 | /** 36 | * \ingroup satstats 37 | * \brief Produce capacity request statistics of Random Access Slotted ALOHA 38 | * from a satellite module simulation. 39 | * 40 | * Statistics logs every capacity request made in a simulation. 41 | * Statistics consists of tuples: time, node id, rc id, type (RBDC/VBDC), 42 | * kbps (RBDC) / bytes (VBDC), queued bytes. 43 | */ 44 | class SatStatsCapacityRequestHelper : public SatStatsHelper 45 | { 46 | public: 47 | // inherited from SatStatsHelper base class 48 | SatStatsCapacityRequestHelper(Ptr satHelper); 49 | 50 | /** 51 | * / Destructor. 52 | */ 53 | virtual ~SatStatsCapacityRequestHelper(); 54 | 55 | /** 56 | * inherited from ObjectBase base class 57 | */ 58 | static TypeId GetTypeId(); 59 | 60 | protected: 61 | // inherited from SatStatsHelper base class 62 | void DoInstall(); 63 | 64 | private: 65 | /// The aggregator created by this helper. 66 | Ptr m_aggregator; 67 | 68 | }; // end of class SatStatsCapacityRequestHelper 69 | 70 | } // end of namespace ns3 71 | 72 | #endif /* SATELLITE_STATS_CAPACITY_REQUEST_HELPER_H */ 73 | -------------------------------------------------------------------------------- /examples/sat-generic-launcher.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2018 CNES 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mathias Ettinger 19 | * 20 | */ 21 | 22 | #include "ns3/config-store-module.h" 23 | #include "ns3/core-module.h" 24 | #include "ns3/internet-module.h" 25 | #include "ns3/network-module.h" 26 | #include "ns3/satellite-module.h" 27 | #include "ns3/traffic-module.h" 28 | 29 | #include 30 | 31 | using namespace ns3; 32 | 33 | /** 34 | * \file sat-generic-launcher.cc 35 | * \ingroup satellite 36 | * 37 | * \brief Simulation script to run example simulation results with 38 | * a high degree of customization through XML file. 39 | * 40 | * execute command -> ./waf --run "sat-generic-launcher --PrintHelp" 41 | */ 42 | 43 | NS_LOG_COMPONENT_DEFINE("sat-generic-launcher"); 44 | 45 | int 46 | main(int argc, char* argv[]) 47 | { 48 | std::string inputFileNameWithPath = 49 | Singleton::Get()->LocateDirectory("contrib/satellite/examples") + 50 | "/generic-input-attributes.xml"; 51 | 52 | Ptr simulationHelper = CreateObject("generic-launcher"); 53 | simulationHelper->DisableAllCapacityAssignmentCategories(); 54 | simulationHelper->EnableCrdsa(); 55 | 56 | simulationHelper->LoadScenario("geo-33E"); 57 | 58 | CommandLine cmd; 59 | simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath); 60 | cmd.Parse(argc, argv); 61 | 62 | simulationHelper->ConfigureAttributesFromFile(inputFileNameWithPath); 63 | simulationHelper->StoreAttributesToFile("parametersUsed.xml"); 64 | simulationHelper->RunSimulation(); 65 | } 66 | -------------------------------------------------------------------------------- /model/vector-extensions.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2016 INESC TEC 4 | * Copyright (c) 2021 CNES 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation; 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Code from https://gitlab.inesctec.pt/pmms/ns3-satellite 20 | * 21 | * Author: Pedro Silva 22 | * Author: Bastien Tauran 23 | */ 24 | 25 | #include "vector-extensions.h" 26 | 27 | #include 28 | #include 29 | 30 | namespace ns3 31 | { 32 | 33 | Vector3D 34 | operator+(const Vector3D& v1, const Vector3D& v2) 35 | { 36 | return Vector3D(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); 37 | } 38 | 39 | Vector3D 40 | operator-(const Vector3D& v1, const Vector3D& v2) 41 | { 42 | return Vector3D(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); 43 | } 44 | 45 | Vector3D 46 | operator*(const Vector3D& vector, double scalar) 47 | { 48 | return Vector3D(vector.x * scalar, vector.y * scalar, vector.z * scalar); 49 | } 50 | 51 | Vector3D 52 | operator*(double scalar, const Vector3D& vector) 53 | { 54 | return vector * scalar; 55 | } 56 | 57 | Vector3D 58 | CrossProduct(const Vector3D& v1, const Vector3D& v2) 59 | { 60 | return Vector3D(v1.y * v2.z - v1.z * v2.y, 61 | v1.z * v2.x - v1.x * v2.z, 62 | v1.x * v2.y - v1.y * v2.x); 63 | } 64 | 65 | double 66 | DotProduct(const Vector3D& v1, const Vector3D& v2) 67 | { 68 | return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z); 69 | } 70 | 71 | double 72 | Magnitude(const Vector3D& vector) 73 | { 74 | return std::sqrt(DotProduct(vector, vector)); 75 | } 76 | 77 | double 78 | MagnitudeSquared(const Vector3D& vector) 79 | { 80 | return DotProduct(vector, vector); 81 | } 82 | 83 | } // namespace ns3 84 | -------------------------------------------------------------------------------- /utils/satellite-input-fstream-wrapper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #ifndef SAT_INPUT_FSTREAM_WRAPPER_H 22 | #define SAT_INPUT_FSTREAM_WRAPPER_H 23 | 24 | #include "ns3/object.h" 25 | #include "ns3/simple-ref-count.h" 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \brief A class encapsulating an STL input stream. 34 | * 35 | * This class wraps a pointer to a C++ std::ifstream and provides 36 | * reference counting of the object. 37 | * 38 | * This class uses a basic ns-3 reference counting base class but is not 39 | * an ns3::Object with attributes, TypeId, or aggregation. 40 | */ 41 | class SatInputFileStreamWrapper : public SimpleRefCount 42 | { 43 | public: 44 | /** 45 | * \brief Constructor 46 | * \param filename file name 47 | * \param filemode file mode 48 | */ 49 | SatInputFileStreamWrapper(std::string filename, std::ios::openmode filemode); 50 | 51 | /** 52 | * \brief Destructor 53 | */ 54 | ~SatInputFileStreamWrapper(); 55 | 56 | /** 57 | * \brief Return a pointer to an ifstream previously set in the wrapper. 58 | * \return a pointer to the encapsulated std::ifstream 59 | */ 60 | std::ifstream* GetStream(void); 61 | 62 | private: 63 | /** 64 | * \brief Input file stream 65 | */ 66 | std::ifstream* m_ifstream; 67 | 68 | /** 69 | * \brief Is the stream destroyable 70 | */ 71 | bool m_destroyable; 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SAT_INPUT_FSTREAM_WRAPPER_H */ 77 | -------------------------------------------------------------------------------- /ext-utils/uncrustify.cfg: -------------------------------------------------------------------------------- 1 | sp_func_proto_paren=Add 2 | sp_func_def_paren=Add 3 | sp_func_call_paren=Add 4 | sp_after_semi_for=Ignore 5 | sp_before_sparen=Ignore 6 | sp_type_func=Ignore 7 | sp_after_type=Ignore 8 | nl_class_leave_one_liners=True 9 | nl_enum_leave_one_liners=True 10 | nl_func_leave_one_liners=True 11 | nl_assign_leave_one_liners=True 12 | #nl_collapse_empty_body=False 13 | nl_getset_leave_one_liners=True 14 | nl_if_leave_one_liners=True 15 | nl_fdef_brace=Ignore 16 | # finally, indentation configuration 17 | indent_with_tabs=0 18 | indent_namespace=false 19 | indent_columns=2 20 | indent_brace=2 21 | indent_case_brace=2 22 | indent_class=true 23 | indent_class_colon=True 24 | # alignment 25 | indent_align_assign=False 26 | align_left_shift=True 27 | # comment reformating disabled 28 | cmt_reflow_mode=1 # do not touch comments at all 29 | cmt_indent_multi=False # really, do not touch them 30 | # extra spaces here and there 31 | sp_brace_typedef=Add 32 | sp_enum_assign=Add 33 | sp_before_sparen=Add 34 | sp_after_semi_for=Add 35 | sp_arith=Add 36 | sp_assign=Add 37 | sp_compare=Add 38 | sp_func_class_paren=Add 39 | sp_after_type=Add 40 | sp_type_func=Add 41 | sp_angle_paren=Add 42 | nl_collapse_empty_body=False 43 | nl_if_brace=Add 44 | nl_brace_else=Add 45 | nl_elseif_brace=Add 46 | nl_else_brace=Add 47 | nl_while_brace=Add 48 | nl_do_brace=Add 49 | nl_for_brace=Add 50 | nl_brace_while=Add 51 | nl_switch_brace=Add 52 | nl_after_case=True 53 | nl_namespace_brace=Remove 54 | nl_after_brace_open=True 55 | nl_class_leave_one_liners=False 56 | nl_enum_leave_one_liners=False 57 | nl_func_leave_one_liners=False 58 | nl_if_leave_one_liners=False 59 | nl_class_colon=Ignore 60 | nl_after_access_spec=1 61 | nl_after_semicolon=True 62 | pos_class_colon=Lead 63 | pos_class_comma=Trail 64 | pos_bool=Lead 65 | nl_class_init_args=Add 66 | nl_template_class=Add 67 | nl_class_brace=Add 68 | # does not work very well 69 | nl_func_type_name=Ignore 70 | nl_func_scope_name=Ignore 71 | nl_func_type_name_class=Ignore 72 | nl_func_proto_type_name=Ignore 73 | # function\\n( 74 | nl_func_paren=Remove 75 | nl_fdef_brace=Add 76 | nl_struct_brace=Add 77 | nl_enum_brace=Add 78 | nl_union_brace=Add 79 | mod_full_brace_do=Add 80 | mod_full_brace_for=Add 81 | mod_full_brace_if=Add 82 | mod_full_brace_while=Add 83 | mod_full_brace_for=Add 84 | mod_remove_extra_semicolon=True 85 | # max code width 86 | #code_width=128 87 | #ls_for_split_full=True 88 | #ls_func_split_full=True 89 | -------------------------------------------------------------------------------- /model/satellite-fading-input-trace.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | #ifndef SATELLITE_FADING_INPUT_TRACE_H 21 | #define SATELLITE_FADING_INPUT_TRACE_H 22 | 23 | #include "satellite-base-fading.h" 24 | #include "satellite-fading-input-trace-container.h" 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * 32 | * \brief Class for fading input trace. The class implements the fading 33 | * interface and provides access to the container of input fading files. 34 | */ 35 | class SatFadingInputTrace : public SatBaseFading 36 | { 37 | public: 38 | /** 39 | * \brief Constructor 40 | */ 41 | SatFadingInputTrace(); 42 | 43 | /** 44 | * \brief Constructor 45 | */ 46 | SatFadingInputTrace(Ptr satFadingInputTraceContainer); 47 | 48 | /** 49 | * \brief Destructor 50 | */ 51 | ~SatFadingInputTrace(); 52 | 53 | /** 54 | * \brief NS-3 type id function 55 | * \return type id 56 | */ 57 | static TypeId GetTypeId(void); 58 | 59 | /** 60 | * \brief Function for getting the fading value 61 | * \param macAddress MAC address 62 | * \param channelType channel type 63 | * \return fading value 64 | */ 65 | double DoGetFading(Address macAddress, SatEnums::ChannelType_t channelType); 66 | 67 | private: 68 | /** 69 | * \brief Pointer to input trace container 70 | */ 71 | Ptr m_satFadingInputTraceContainer; 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SATELLITE_FADING_INPUT_TRACE_H */ 77 | -------------------------------------------------------------------------------- /utils/satellite-output-fstream-wrapper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #ifndef SAT_OUTPUT_FSTREAM_WRAPPER_H 22 | #define SAT_OUTPUT_FSTREAM_WRAPPER_H 23 | 24 | #include "ns3/object.h" 25 | #include "ns3/simple-ref-count.h" 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \brief A class encapsulating an STL output stream. 34 | * 35 | * This class wraps a pointer to a C++ std::ofstream and provides 36 | * reference counting of the object. 37 | * 38 | * This class uses a basic ns-3 reference counting base class but is not 39 | * an ns3::Object with attributes, TypeId, or aggregation. 40 | */ 41 | class SatOutputFileStreamWrapper : public SimpleRefCount 42 | { 43 | public: 44 | /** 45 | * \brief Constructor 46 | * \param filename file name 47 | * \param filemode file mode 48 | */ 49 | SatOutputFileStreamWrapper(std::string filename, std::ios::openmode filemode); 50 | 51 | /** 52 | * \brief Destructor 53 | */ 54 | ~SatOutputFileStreamWrapper(); 55 | 56 | /** 57 | * \brief Return a pointer to an ofstream previously set in the wrapper. 58 | * \return a pointer to the encapsulated std::ofstream 59 | */ 60 | std::ofstream* GetStream(void); 61 | 62 | private: 63 | /** 64 | * \brief Output file stream 65 | */ 66 | std::ofstream* m_ofstream; 67 | 68 | /** 69 | * \brief Is the stream destroyable 70 | */ 71 | bool m_destroyable; 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SAT_OUTPUT_FSTREAM_WRAPPER_H */ 77 | -------------------------------------------------------------------------------- /model/satellite-free-space-loss.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #include "satellite-free-space-loss.h" 22 | 23 | #include "satellite-const-variables.h" 24 | #include "satellite-mobility-model.h" 25 | #include "satellite-utils.h" 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | NS_LOG_COMPONENT_DEFINE("SatFreeSpaceLoss"); 35 | 36 | namespace ns3 37 | { 38 | 39 | NS_OBJECT_ENSURE_REGISTERED(SatFreeSpaceLoss); 40 | 41 | TypeId 42 | SatFreeSpaceLoss::GetTypeId(void) 43 | { 44 | static TypeId tid = 45 | TypeId("ns3::SatFreeSpaceLoss").SetParent().AddConstructor(); 46 | return tid; 47 | } 48 | 49 | SatFreeSpaceLoss::SatFreeSpaceLoss() 50 | { 51 | } 52 | 53 | double 54 | SatFreeSpaceLoss::GetFsldB(Ptr a, Ptr b, double frequencyHz) const 55 | { 56 | NS_LOG_FUNCTION(this << frequencyHz); 57 | 58 | double fsl_dB; 59 | 60 | fsl_dB = SatUtils::LinearToDb(GetFsl(a, b, frequencyHz)); 61 | 62 | return fsl_dB; 63 | } 64 | 65 | double 66 | SatFreeSpaceLoss::GetFsl(Ptr a, Ptr b, double frequencyHz) const 67 | { 68 | NS_LOG_FUNCTION(this << frequencyHz); 69 | 70 | double fsl; 71 | double distance = 72 | DynamicCast(a)->GetDistanceFrom(DynamicCast(b)); 73 | 74 | fsl = 75 | std::pow(((4.0 * M_PI * distance * frequencyHz) / SatConstVariables::SPEED_OF_LIGHT), 2.0); 76 | 77 | return fsl; 78 | } 79 | 80 | } // namespace ns3 81 | -------------------------------------------------------------------------------- /model/satellite-free-space-loss.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | #ifndef SATELLITE_FREE_SPACE_LOSS_H 21 | #define SATELLITE_FREE_SPACE_LOSS_H 22 | 23 | #include 24 | #include 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * 32 | * \brief This class is responsible of calculating the free space loss (FSL) 33 | * based on two given node positions and used (center) frequency. 34 | */ 35 | class SatFreeSpaceLoss : public Object 36 | { 37 | public: 38 | /** 39 | * \brief Get the type ID 40 | * \return the object TypeId 41 | */ 42 | static TypeId GetTypeId(void); 43 | 44 | /** 45 | * Default constructor. 46 | */ 47 | SatFreeSpaceLoss(); 48 | 49 | ~SatFreeSpaceLoss() 50 | { 51 | } 52 | 53 | /** 54 | * \brief Calculate the free-space loss in linear format 55 | * \param a Mobility model of node a 56 | * \param b Mobility model of node b 57 | * \param frequencyHz Frequency in Hertz 58 | * \return the free space loss as ratio. 59 | */ 60 | virtual double GetFsl(Ptr a, Ptr b, double frequencyHz) const; 61 | 62 | /** 63 | * \brief Calculate the free-space loss in dB 64 | * \param a Mobility model of node a 65 | * \param b Mobility model of node b 66 | * \param frequencyHz Frequency in Hertz 67 | * \return the free space loss as dBs. 68 | */ 69 | virtual double GetFsldB(Ptr a, Ptr b, double frequencyHz) const; 70 | }; 71 | 72 | } // namespace ns3 73 | 74 | #endif /* SATELLITE_FREE_SPACE_LOSS_H */ 75 | -------------------------------------------------------------------------------- /model/lorawan-mac-gateway.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORAWAN_MAC_GATEWAY_H 24 | #define LORAWAN_MAC_GATEWAY_H 25 | 26 | #include "lora-tag.h" 27 | #include "lorawan-mac.h" 28 | #include "satellite-bbframe-container.h" 29 | 30 | #include 31 | 32 | namespace ns3 33 | { 34 | 35 | class LorawanMacGateway : public LorawanMac 36 | { 37 | public: 38 | static TypeId GetTypeId(void); 39 | 40 | LorawanMacGateway(); 41 | LorawanMacGateway(uint32_t satId, uint32_t beamId); 42 | virtual ~LorawanMacGateway(); 43 | 44 | // Implementation of the LorawanMac interface 45 | virtual void Send(Ptr packet) = 0; 46 | 47 | // Implementation of the LorawanMac interface 48 | bool IsTransmitting(void); 49 | 50 | // Implementation of the LorawanMac interface 51 | // virtual void Receive (Ptr packet); 52 | virtual void Receive(SatPhy::PacketContainer_t packets, 53 | Ptr /*rxParams*/) = 0; 54 | 55 | // Implementation of the LorawanMac interface 56 | virtual void FailedReception(Ptr packet); 57 | 58 | // Implementation of the LorawanMac interface 59 | virtual void TxFinished(); 60 | 61 | /** 62 | * Return the next time at which we will be able to transmit. 63 | * 64 | * \return The next transmission time. 65 | */ 66 | Time GetWaitingTime(double frequency); 67 | 68 | private: 69 | // BB Frame configuration. 70 | protected: 71 | }; 72 | 73 | } /* namespace ns3 */ 74 | 75 | #endif /* LORAWAN_MAC_GATEWAY_H */ 76 | -------------------------------------------------------------------------------- /model/satellite-orbiter-user-llc.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien TAURAN 19 | */ 20 | 21 | #ifndef SATELLITE_ORBITER_USER_LLC_H 22 | #define SATELLITE_ORBITER_USER_LLC_H 23 | 24 | #include "satellite-orbiter-llc.h" 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * \brief SatOrbiterUserLlc holds the orbiter user implementation of LLC layer. SatOrbiterUserLlc is 32 | * inherited from SatOrbiterLlc base class and implements the needed changes from the base class 33 | * related to SAT user LLC packet transmissions and receptions. 34 | */ 35 | class SatOrbiterUserLlc : public SatOrbiterLlc 36 | { 37 | public: 38 | /** 39 | * Derived from Object 40 | */ 41 | static TypeId GetTypeId(void); 42 | 43 | /** 44 | * Construct a SatOrbiterUserLlc 45 | */ 46 | SatOrbiterUserLlc(); 47 | 48 | /** 49 | * Destroy a SatOrbiterUserLlc 50 | * 51 | * This is the destructor for the SatOrbiterUserLlc. 52 | */ 53 | virtual ~SatOrbiterUserLlc(); 54 | 55 | protected: 56 | /** 57 | * Dispose of this class instance 58 | */ 59 | virtual void DoDispose(); 60 | 61 | /** 62 | * \brief Virtual method to create a new encapsulator 'on-a-need-basis' dynamically. 63 | * \param key Encapsulator key class 64 | */ 65 | virtual void CreateEncap(Ptr key); 66 | 67 | /** 68 | * \brief Virtual method to create a new decapsulator 'on-a-need-basis' dynamically. 69 | * \param key Encapsulator key class 70 | */ 71 | virtual void CreateDecap(Ptr key); 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SATELLITE_ORBITER_USER_LLC_H */ 77 | -------------------------------------------------------------------------------- /model/satellite-base-fader.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | #ifndef SATELLITE_BASE_FADER_H 21 | #define SATELLITE_BASE_FADER_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \ingroup satellite 34 | * 35 | * \brief Base class for faders such as the Rayleigh fader. 36 | * This class defines the functions which all the inherited 37 | * faders must implement for the Markov-fading model. This 38 | * base class itself is abstract and will not implement 39 | * any real functionality. 40 | */ 41 | class SatBaseFader : public Object 42 | { 43 | public: 44 | /** 45 | * \brief Constructor 46 | */ 47 | SatBaseFader(); 48 | 49 | /** 50 | * \brief Destructor 51 | */ 52 | virtual ~SatBaseFader(); 53 | 54 | /** 55 | * \brief NS-3 type id function 56 | * \return type id 57 | */ 58 | static TypeId GetTypeId(void); 59 | 60 | /** 61 | * \brief Returns channel gain in dB 62 | * \return channel gain in dB 63 | */ 64 | virtual double GetChannelGainDb(void) = 0; 65 | 66 | /** 67 | * \brief Returns channel gain 68 | * \return channel gain 69 | */ 70 | virtual double GetChannelGain(void) = 0; 71 | 72 | /** 73 | * \brief Function for updating the fader angle set and state 74 | * \param newSet new angle set 75 | * \param newState new state 76 | */ 77 | virtual void UpdateParameters(uint32_t newSet, uint32_t newState) = 0; 78 | 79 | private: 80 | }; 81 | 82 | } // namespace ns3 83 | 84 | #endif /* SATELLITE_BASE_FADER_H */ 85 | -------------------------------------------------------------------------------- /model/satellite-orbiter-feeder-llc.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien TAURAN 19 | */ 20 | 21 | #ifndef SATELLITE_ORBITER_FEEDER_LLC_H 22 | #define SATELLITE_ORBITER_FEEDER_LLC_H 23 | 24 | #include "satellite-orbiter-llc.h" 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * \brief SatOrbiterFeederLlc holds the orbiter feeder implementation of LLC layer. 32 | * SatOrbiterFeederLlc is inherited from SatOrbiterLlc base class and implements the needed changes 33 | * from the base class related to SAT feeder LLC packet transmissions and receptions. 34 | */ 35 | class SatOrbiterFeederLlc : public SatOrbiterLlc 36 | { 37 | public: 38 | /** 39 | * Derived from Object 40 | */ 41 | static TypeId GetTypeId(void); 42 | 43 | /** 44 | * Construct a SatOrbiterFeederLlc 45 | */ 46 | SatOrbiterFeederLlc(); 47 | 48 | /** 49 | * Destroy a SatOrbiterFeederLlc 50 | * 51 | * This is the destructor for the SatOrbiterFeederLlc. 52 | */ 53 | virtual ~SatOrbiterFeederLlc(); 54 | 55 | protected: 56 | /** 57 | * Dispose of this class instance 58 | */ 59 | virtual void DoDispose(); 60 | 61 | /** 62 | * \brief Method to create a new encapsulator 'on-a-need-basis' dynamically. 63 | * \param key Encapsulator key class 64 | */ 65 | virtual void CreateEncap(Ptr key); 66 | 67 | /** 68 | * \brief Virtual method to create a new decapsulator 'on-a-need-basis' dynamically. 69 | * \param key Encapsulator key class 70 | */ 71 | virtual void CreateDecap(Ptr key); 72 | }; 73 | 74 | } // namespace ns3 75 | 76 | #endif /* SATELLITE_ORBITER_FEEDER_LLC_H */ 77 | -------------------------------------------------------------------------------- /model/satellite-propagation-delay-model.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_PROPAGATION_DELAY_MODEL_H 22 | #define SATELLITE_PROPAGATION_DELAY_MODEL_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \ingroup satellite 34 | * 35 | * \brief The propagation delay is constant in time. 36 | */ 37 | class SatConstantPropagationDelayModel : public PropagationDelayModel 38 | { 39 | public: 40 | /** 41 | * \brief Get the type ID 42 | * \return the object TypeId 43 | */ 44 | static TypeId GetTypeId(void); 45 | 46 | /** 47 | * Default constructor. 48 | */ 49 | SatConstantPropagationDelayModel(); 50 | 51 | /** 52 | * \brief Get the propagation delay in Time 53 | * \param a the source 54 | * \param b the destination 55 | * \returns Propagation delay. 56 | */ 57 | virtual Time GetDelay(Ptr a, Ptr b) const; 58 | 59 | /** 60 | * \brief Get the propagation delay in Time 61 | * \returns Propagation delay. 62 | */ 63 | virtual Time GetDelay(void) const; 64 | 65 | /** 66 | * Set constant propagation delay. 67 | * \param delay Delay in Time. 68 | */ 69 | void SetDelay(Time delay); 70 | 71 | /** 72 | * DoAssignStreams need to be implemented due to inheritance from 73 | * PropagationDelayModel 74 | */ 75 | int64_t DoAssignStreams(int64_t s); 76 | 77 | private: 78 | Time m_delay; 79 | }; 80 | 81 | } // namespace ns3 82 | 83 | #endif /* SATELLITE_PROPAGATION_DELAY_MODEL_H */ 84 | -------------------------------------------------------------------------------- /ext-utils/runSatTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #!/bin/bash 4 | 5 | # Copyright (c) 2016 Magister Solutions Ltd 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License version 2 as 9 | # published by the Free Software Foundation; 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | # 20 | # Author: Jani Puttonen 21 | # 22 | 23 | # A script to easily run only the satellite module tests 24 | # 25 | 26 | cd ../../../; 27 | 28 | ./test.py -s sat-antenna-gain-pattern-test --fullness=TAKES_FOREVER 29 | ./test.py -s sat-arq-seqno-test --fullness=TAKES_FOREVER 30 | ./test.py -s sat-arq-test --fullness=TAKES_FOREVER 31 | ./test.py -s sat-channel-estimation-error-test --fullness=TAKES_FOREVER 32 | ./test.py -s sat-cno-estimator-unit-test --fullness=TAKES_FOREVER 33 | ./test.py -s sat-cra-test --fullness=TAKES_FOREVER 34 | ./test.py -s sat-ctrl-msg-container-unit-test --fullness=TAKES_FOREVER 35 | ./test.py -s sat-fading-external-input-trace-test --fullness=TAKES_FOREVER 36 | ./test.py -s sat-frame-allocator-test --fullness=TAKES_FOREVER 37 | ./test.py -s sat-fsl-test --fullness=TAKES_FOREVER 38 | ./test.py -s geo-coordinate-test --fullness=TAKES_FOREVER 39 | ./test.py -s sat-gse-test --fullness=TAKES_FOREVER 40 | ./test.py -s sat-if-unit-test --fullness=TAKES_FOREVER 41 | ./test.py -s sat-link-results-test --fullness=TAKES_FOREVER 42 | ./test.py -s sat-mobility-observer-test --fullness=TAKES_FOREVER 43 | ./test.py -s sat-perf-mem --fullness=TAKES_FOREVER 44 | ./test.py -s sat-periodic-control-message-test --fullness=TAKES_FOREVER 45 | ./test.py -s sat-per-packet-if-test --fullness=TAKES_FOREVER 46 | ./test.py -s sat-random-access-test --fullness=TAKES_FOREVER 47 | ./test.py -s sat-mobility-test --fullness=TAKES_FOREVER 48 | ./test.py -s sat-rle-test --fullness=TAKES_FOREVER 49 | ./test.py -s sat-rm-test --fullness=TAKES_FOREVER 50 | ./test.py -s sat-waveform-conf-test --fullness=TAKES_FOREVER 51 | ./test.py -s sat-scenario-creation --fullness=TAKES_FOREVER 52 | ./test.py -s sat-simple-unicast --fullness=TAKES_FOREVER 53 | 54 | -------------------------------------------------------------------------------- /model/satellite-encap-pdu-status-tag.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-encap-pdu-status-tag.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatEncapPduStatusTag"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatEncapPduStatusTag); 33 | 34 | SatEncapPduStatusTag::SatEncapPduStatusTag() 35 | : m_pduStatus(FULL_PDU) 36 | { 37 | } 38 | 39 | void 40 | SatEncapPduStatusTag::SetStatus(uint8_t status) 41 | { 42 | NS_LOG_FUNCTION(this << (uint32_t)status); 43 | m_pduStatus = status; 44 | } 45 | 46 | uint8_t 47 | SatEncapPduStatusTag::GetStatus() const 48 | { 49 | NS_LOG_FUNCTION(this); 50 | return m_pduStatus; 51 | } 52 | 53 | TypeId 54 | SatEncapPduStatusTag::GetTypeId() 55 | { 56 | static TypeId tid = 57 | TypeId("ns3::SatEncapPduStatusTag").SetParent().AddConstructor(); 58 | return tid; 59 | } 60 | 61 | TypeId 62 | SatEncapPduStatusTag::GetInstanceTypeId() const 63 | { 64 | return GetTypeId(); 65 | } 66 | 67 | uint32_t 68 | SatEncapPduStatusTag::GetSerializedSize() const 69 | { 70 | NS_LOG_FUNCTION(this); 71 | return 1; 72 | } 73 | 74 | void 75 | SatEncapPduStatusTag::Serialize(TagBuffer i) const 76 | { 77 | NS_LOG_FUNCTION(this); 78 | i.WriteU8(m_pduStatus); 79 | } 80 | 81 | void 82 | SatEncapPduStatusTag::Deserialize(TagBuffer i) 83 | { 84 | NS_LOG_FUNCTION(this); 85 | m_pduStatus = i.ReadU8(); 86 | } 87 | 88 | void 89 | SatEncapPduStatusTag::Print(std::ostream& os) const 90 | { 91 | NS_LOG_FUNCTION(this); 92 | os << "PPDU Status=" << (uint32_t)m_pduStatus; 93 | } 94 | 95 | } // namespace ns3 96 | -------------------------------------------------------------------------------- /examples/sat-rayleigh-example.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | * 20 | */ 21 | 22 | #include "ns3/core-module.h" 23 | #include "ns3/satellite-module.h" 24 | 25 | using namespace ns3; 26 | 27 | /** 28 | * \file sat-rayleigh-example.cc 29 | * \ingroup satellite 30 | * 31 | * \brief Example for Rayleigh fader class. Demonstrates the functionality 32 | * of the Rayleigh fader used by the Markov-fading. The example creates 33 | * a single Rayleigh fader and outputs the fading values in time. 34 | */ 35 | 36 | NS_LOG_COMPONENT_DEFINE("sat-rayleigh-example"); 37 | 38 | int 39 | main(int argc, char* argv[]) 40 | { 41 | /// Enable info logs 42 | LogComponentEnable("sat-rayleigh-example", LOG_LEVEL_INFO); 43 | LogComponentEnable("SatRayleighModel", LOG_LEVEL_INFO); 44 | 45 | /// Set simulation output details 46 | Config::SetDefault("ns3::SatEnvVariables::SimulationCampaignName", 47 | StringValue("example-rayleigh")); 48 | Config::SetDefault("ns3::SatEnvVariables::SimulationTag", StringValue("")); 49 | Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true)); 50 | 51 | /// Create fader 52 | Ptr rayleighConf = CreateObject(); 53 | Ptr rayleighFader = CreateObject(rayleighConf, 0, 0); 54 | 55 | /// Run simulation 56 | for (uint32_t i = 0; i < 1000; i++) 57 | { 58 | Simulator::Schedule(Time(500000 + i * 500000), 59 | &SatRayleighModel::GetChannelGainDb, 60 | rayleighFader); 61 | } 62 | 63 | Simulator::Run(); 64 | Simulator::Destroy(); 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /model/lora-device-address-generator.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #include "lora-device-address-generator.h" 24 | 25 | #include 26 | 27 | namespace ns3 28 | { 29 | 30 | NS_LOG_COMPONENT_DEFINE("LoraDeviceAddressGenerator"); 31 | 32 | TypeId 33 | LoraDeviceAddressGenerator::GetTypeId(void) 34 | { 35 | static TypeId tid = TypeId("ns3::LoraDeviceAddressGenerator") 36 | .SetParent() 37 | .AddConstructor(); 38 | return tid; 39 | } 40 | 41 | LoraDeviceAddressGenerator::LoraDeviceAddressGenerator(const uint8_t nwkId, const uint32_t nwkAddr) 42 | { 43 | NS_LOG_FUNCTION(this << unsigned(nwkId) << nwkAddr); 44 | 45 | m_currentNwkId.Set(nwkId); 46 | m_currentNwkAddr.Set(nwkAddr); 47 | } 48 | 49 | LoraDeviceAddress 50 | LoraDeviceAddressGenerator::NextNetwork(void) 51 | { 52 | NS_LOG_FUNCTION_NOARGS(); 53 | 54 | m_currentNwkId.Set(m_currentNwkId.Get() + 1); 55 | m_currentNwkAddr.Set(0); 56 | 57 | return LoraDeviceAddress(m_currentNwkId, m_currentNwkAddr); 58 | } 59 | 60 | LoraDeviceAddress 61 | LoraDeviceAddressGenerator::NextAddress(void) 62 | { 63 | NS_LOG_FUNCTION_NOARGS(); 64 | 65 | NwkAddr oldNwkAddr = m_currentNwkAddr; 66 | m_currentNwkAddr.Set(m_currentNwkAddr.Get() + 1); 67 | 68 | return LoraDeviceAddress(m_currentNwkId, oldNwkAddr); 69 | } 70 | 71 | LoraDeviceAddress 72 | LoraDeviceAddressGenerator::GetNextAddress(void) 73 | { 74 | NS_LOG_FUNCTION_NOARGS(); 75 | 76 | return LoraDeviceAddress(m_currentNwkId.Get(), m_currentNwkAddr.Get() + 1); 77 | } 78 | } // namespace ns3 79 | -------------------------------------------------------------------------------- /helper/satellite-on-off-helper.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #include "satellite-on-off-helper.h" 22 | 23 | #include "ns3/string.h" 24 | #include "ns3/uinteger.h" 25 | 26 | #include 27 | 28 | namespace ns3 29 | { 30 | 31 | SatOnOffHelper::SatOnOffHelper(std::string protocol, Address address) 32 | { 33 | m_factory.SetTypeId("ns3::SatOnOffApplication"); 34 | m_factory.Set("Protocol", StringValue(protocol)); 35 | m_factory.Set("Remote", AddressValue(address)); 36 | } 37 | 38 | void 39 | SatOnOffHelper::SetAttribute(std::string name, const AttributeValue& value) 40 | { 41 | m_factory.Set(name, value); 42 | } 43 | 44 | ApplicationContainer 45 | SatOnOffHelper::Install(Ptr node) const 46 | { 47 | return ApplicationContainer(InstallPriv(node)); 48 | } 49 | 50 | ApplicationContainer 51 | SatOnOffHelper::Install(NodeContainer c) const 52 | { 53 | ApplicationContainer apps; 54 | for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i) 55 | { 56 | apps.Add(InstallPriv(*i)); 57 | } 58 | 59 | return apps; 60 | } 61 | 62 | Ptr 63 | SatOnOffHelper::InstallPriv(Ptr node) const 64 | { 65 | Ptr app = m_factory.Create(); 66 | node->AddApplication(app); 67 | 68 | return app; 69 | } 70 | 71 | void 72 | SatOnOffHelper::SetConstantRate(DataRate dataRate, uint32_t packetSize) 73 | { 74 | m_factory.Set("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1000]")); 75 | m_factory.Set("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]")); 76 | m_factory.Set("DataRate", DataRateValue(dataRate)); 77 | m_factory.Set("PacketSize", UintegerValue(packetSize)); 78 | } 79 | 80 | } // namespace ns3 81 | -------------------------------------------------------------------------------- /stats/satellite-stats-waveform-usage-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_STATS_WAVEFORM_HELPER_H 23 | #define SATELLITE_STATS_WAVEFORM_HELPER_H 24 | 25 | #include "satellite-stats-helper.h" 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | namespace ns3 34 | { 35 | 36 | class SatHelper; 37 | class DataCollectionObject; 38 | 39 | /** 40 | * \ingroup satstats 41 | * \brief 42 | */ 43 | class SatStatsWaveformUsageHelper : public SatStatsHelper 44 | { 45 | public: 46 | // inherited from SatStatsHelper base class 47 | SatStatsWaveformUsageHelper(Ptr satHelper); 48 | 49 | /** 50 | * / Destructor. 51 | */ 52 | virtual ~SatStatsWaveformUsageHelper(); 53 | 54 | /** 55 | * inherited from ObjectBase base class 56 | */ 57 | static TypeId GetTypeId(); 58 | 59 | protected: 60 | // inherited from SatStatsHelper base class 61 | void DoInstall(); 62 | std::string GetIdentifierHeading(std::string dataLabel) const; 63 | 64 | private: 65 | /** 66 | * \param context 67 | * \param waveformId 68 | */ 69 | void WaveformUsageCallback(std::string context, uint32_t waveformId); 70 | 71 | /** 72 | * \brief Two-dimensional map of collectors, indexed by the waveform ID and 73 | * then by the identifier. 74 | */ 75 | std::map m_collectors; 76 | 77 | /// The aggregator created by this helper. 78 | Ptr m_aggregator; 79 | 80 | }; // end of class SatStatsWaveformUsageHelper 81 | 82 | } // end of namespace ns3 83 | 84 | #endif /* SATELLITE_STATS_WAVEFORM_HELPER_H */ 85 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(base_examples 2 | sat-arq-fwd-example 3 | sat-arq-rtn-example 4 | sat-beam-position-tracer 5 | sat-cbr-example 6 | sat-cbr-full-example 7 | sat-cbr-stats-example 8 | sat-cbr-user-defined-example 9 | sat-dama-http-sim-tn9 10 | sat-dama-onoff-sim-tn9 11 | sat-dama-sim-tn9 12 | sat-dama-verification-sim 13 | sat-dynamic-frequency-plan-example 14 | sat-environmental-variables-example 15 | sat-essa-example 16 | sat-fwd-link-beam-hopping-example 17 | sat-fwd-system-test-example 18 | sat-generic-launcher 19 | sat-group-example 20 | sat-gw-handover-example 21 | sat-handover-example 22 | sat-http-example 23 | sat-iot-example 24 | sat-link-budget-example 25 | sat-link-results-plot 26 | sat-list-position-ext-fading-example 27 | sat-log-example 28 | sat-logon-example 29 | sat-loo-example 30 | sat-lora-constellation-example 31 | sat-lora-example 32 | sat-lora-handover-example 33 | sat-lora-regenerative-example 34 | sat-markov-fading-trace-example 35 | sat-markov-logic-example 36 | sat-mobility-beam-tracer 37 | sat-mobility-example 38 | sat-mobility-position-generator 39 | sat-multi-application-fwd-example 40 | sat-multi-application-rtn-example 41 | sat-multicast-example 42 | sat-ncr-example 43 | sat-nrtv-example 44 | sat-onoff-example 45 | sat-per-packet-if-sim-tn9 46 | sat-profiling-sim 47 | sat-profiling-sim-tn8 48 | sat-random-access-crdsa-collision-example 49 | sat-random-access-crdsa-example 50 | sat-random-access-dynamic-load-control-example 51 | sat-random-access-example 52 | sat-random-access-slotted-aloha-collision-example 53 | sat-random-access-slotted-aloha-example 54 | sat-ra-sim-tn9 55 | sat-ra-sim-tn9-comparison 56 | sat-rayleigh-example 57 | sat-regeneration-collisions-example 58 | sat-regeneration-example 59 | sat-constellation-example 60 | sat-rtn-link-da-example 61 | sat-rtn-link-ra-example 62 | sat-rtn-system-test-example 63 | sat-trace-input-external-fading-example 64 | sat-trace-input-fading-example 65 | sat-trace-input-interference-example 66 | sat-trace-input-rx-power-example 67 | sat-trace-output-example 68 | sat-training-example 69 | sat-tutorial-example 70 | sat-vhts-example 71 | ) 72 | 73 | foreach( 74 | example 75 | ${base_examples} 76 | ) 77 | build_lib_example( 78 | NAME ${example} 79 | SOURCE_FILES ${example}.cc 80 | LIBRARIES_TO_LINK 81 | ${libsatellite} 82 | ) 83 | endforeach() 84 | -------------------------------------------------------------------------------- /model/satellite-propagation-delay-model.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-propagation-delay-model.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | NS_LOG_COMPONENT_DEFINE("SatConstantPropagationDelayModel"); 29 | 30 | namespace ns3 31 | { 32 | 33 | NS_OBJECT_ENSURE_REGISTERED(SatConstantPropagationDelayModel); 34 | 35 | TypeId 36 | SatConstantPropagationDelayModel::GetTypeId(void) 37 | { 38 | static TypeId tid = 39 | TypeId("ns3::SatConstantPropagationDelayModel") 40 | .SetParent() 41 | .AddConstructor() 42 | .AddAttribute("Delay", 43 | "The delay", 44 | TimeValue(Seconds(0.13)), 45 | MakeTimeAccessor(&SatConstantPropagationDelayModel::m_delay), 46 | MakeTimeChecker()); 47 | return tid; 48 | } 49 | 50 | SatConstantPropagationDelayModel::SatConstantPropagationDelayModel() 51 | { 52 | } 53 | 54 | Time 55 | SatConstantPropagationDelayModel::GetDelay(Ptr a, Ptr b) const 56 | { 57 | NS_LOG_FUNCTION(this); 58 | return m_delay; 59 | } 60 | 61 | void 62 | SatConstantPropagationDelayModel::SetDelay(Time delay) 63 | { 64 | NS_LOG_FUNCTION(this << delay.GetSeconds()); 65 | m_delay = delay; 66 | } 67 | 68 | Time 69 | SatConstantPropagationDelayModel::GetDelay() const 70 | { 71 | NS_LOG_FUNCTION(this); 72 | return m_delay; 73 | } 74 | 75 | int64_t 76 | SatConstantPropagationDelayModel::DoAssignStreams(int64_t s) 77 | { 78 | NS_LOG_FUNCTION(this); 79 | return 0; 80 | } 81 | 82 | } // namespace ns3 83 | -------------------------------------------------------------------------------- /model/satellite-look-up-table.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_LOOK_UP_TABLE_H 23 | #define SATELLITE_LOOK_UP_TABLE_H 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ns3 32 | { 33 | 34 | /** 35 | * \ingroup satellite 36 | * 37 | * \brief Loads a link result file and provide query service for BLER. 38 | */ 39 | class SatLookUpTable : public Object 40 | { 41 | public: 42 | /** 43 | * Constructor with initialization parameters. 44 | * \param linkResultPath 45 | */ 46 | SatLookUpTable(std::string linkResultPath); 47 | 48 | /** 49 | * Destructor for SatLookUpTable 50 | */ 51 | virtual ~SatLookUpTable(); 52 | 53 | /** 54 | * \brief Get the type ID 55 | * \return the object TypeId 56 | */ 57 | static TypeId GetTypeId(); 58 | 59 | /** 60 | * \brief Get the BLER corresponding to a given SINR 61 | * \param sinrDb SINR in logarithmic scale 62 | * \return BLER 63 | */ 64 | double GetBler(double sinrDb) const; 65 | 66 | /** 67 | * \brief Get Es/No in dB for a given BLER target 68 | * \param blerTarget BLER target (0-1) 69 | * \return Es/No target in dB 70 | */ 71 | double GetEsNoDb(double blerTarget) const; 72 | 73 | private: 74 | virtual void DoDispose(); 75 | 76 | /** 77 | * \brief Load the link results 78 | * \param linkResultsPath Path to a link results file. 79 | */ 80 | void Load(std::string linkResultPath); 81 | 82 | std::vector m_esNoDb; 83 | std::vector m_bler; 84 | std::ifstream* m_ifs; 85 | }; 86 | 87 | } // end of namespace ns3 88 | 89 | #endif /* SATELLITE_LOOK_UP_TABLE_H */ 90 | -------------------------------------------------------------------------------- /model/satellite-arq-header.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-arq-header.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatArqHeader"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatArqHeader); 33 | 34 | SatArqHeader::SatArqHeader() 35 | : m_seqNo(0) 36 | { 37 | } 38 | 39 | SatArqHeader::~SatArqHeader() 40 | { 41 | } 42 | 43 | TypeId 44 | SatArqHeader::GetTypeId(void) 45 | { 46 | static TypeId tid = 47 | TypeId("ns3::SatArqHeader").SetParent
().AddConstructor(); 48 | return tid; 49 | } 50 | 51 | uint32_t 52 | SatArqHeader::GetSerializedSize(void) const 53 | { 54 | NS_LOG_FUNCTION(this); 55 | return 1; 56 | } 57 | 58 | void 59 | SatArqHeader::Serialize(Buffer::Iterator start) const 60 | { 61 | NS_LOG_FUNCTION(this); 62 | Buffer::Iterator i = start; 63 | i.WriteU8(m_seqNo); 64 | } 65 | 66 | uint32_t 67 | SatArqHeader::Deserialize(Buffer::Iterator start) 68 | { 69 | NS_LOG_FUNCTION(this); 70 | Buffer::Iterator i = start; 71 | 72 | m_seqNo = i.ReadU8(); 73 | return GetSerializedSize(); 74 | } 75 | 76 | void 77 | SatArqHeader::Print(std::ostream& os) const 78 | { 79 | os << m_seqNo; 80 | } 81 | 82 | TypeId 83 | SatArqHeader::GetInstanceTypeId(void) const 84 | { 85 | return GetTypeId(); 86 | } 87 | 88 | uint8_t 89 | SatArqHeader::GetSeqNo() const 90 | { 91 | NS_LOG_FUNCTION(this); 92 | return m_seqNo; 93 | } 94 | 95 | void 96 | SatArqHeader::SetSeqNo(uint8_t seqNo) 97 | { 98 | NS_LOG_FUNCTION(this << (uint32_t)seqNo); 99 | m_seqNo = seqNo; 100 | } 101 | 102 | } // namespace ns3 103 | -------------------------------------------------------------------------------- /model/satellite-const-variables.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd 4 | * Copyright (c) 2018 CNES 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation; 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Author: Jani Puttonen 20 | * Author: Mathias Ettinger 21 | */ 22 | 23 | #ifndef SATELLITE_CONST_VARIABLES_H 24 | #define SATELLITE_CONST_VARIABLES_H 25 | 26 | #include 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \ingroup satellite 34 | * 35 | * \brief SatConstVariables is used for const variable definitions in satellite module. 36 | */ 37 | namespace SatConstVariables 38 | { 39 | 40 | /** 41 | * \brief Constant definition for the speed of light in m/s 42 | */ 43 | constexpr double SPEED_OF_LIGHT = 299792458.0; 44 | 45 | /** 46 | * \brief Number of bits in a byte 47 | */ 48 | constexpr uint32_t BITS_PER_BYTE = 8; 49 | 50 | /** 51 | * \brief Number of bytes consisting a kilobyte 52 | */ 53 | constexpr uint32_t BYTES_IN_KBYTE = 1024; 54 | 55 | /** 56 | * \brief Number of bits consisting a kilobit 57 | */ 58 | constexpr uint32_t BITS_IN_KBIT = 1000; 59 | 60 | /** 61 | * \brief Boltzmann Constant 62 | */ 63 | constexpr double BOLTZMANN_CONSTANT = 1.3806488e-23; 64 | 65 | /** 66 | * \brief Used superframe sequence in the RTN link. 67 | */ 68 | constexpr uint8_t SUPERFRAME_SEQUENCE = 0; 69 | 70 | /** 71 | * \brief Maximum value for time slot ID as specified in ETSI EN 301 542-2, chapter 7.5.1.3. 72 | */ 73 | constexpr uint16_t MAXIMUM_TIME_SLOT_ID = 2047; 74 | 75 | /** 76 | * \brief Maximum number of beams per satellite 77 | */ 78 | constexpr uint32_t MAX_BEAMS_PER_SATELLITE = 1000; 79 | 80 | /** 81 | * \brief Maximum number of satellites in constellation 82 | */ 83 | constexpr uint32_t MAX_SATELLITES = 10000; 84 | 85 | } // namespace SatConstVariables 86 | 87 | } // namespace ns3 88 | 89 | #endif /* SATELLITE_CONST_VARIABLES_H */ 90 | -------------------------------------------------------------------------------- /model/satellite-node-info.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_NODE_INFO_H_ 22 | #define SATELLITE_NODE_INFO_H_ 23 | 24 | #include "satellite-enums.h" 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace ns3 32 | { 33 | 34 | /** 35 | * \ingroup satellite 36 | * 37 | * \brief The SatNodeInfo implements a container for all needed node related information. 38 | * It may be passed to all entities which need node specific information, e.g. LLC, 39 | * MAC and PHY layers. 40 | */ 41 | 42 | class SatNodeInfo : public SimpleRefCount 43 | { 44 | public: 45 | /** 46 | * Default constructor. 47 | */ 48 | SatNodeInfo(); 49 | 50 | /** 51 | * Constructor with initialization parameters. 52 | * \param nodeType 53 | * \param nodeId 54 | * \param macAddress 55 | */ 56 | SatNodeInfo(SatEnums::SatNodeType_t nodeType, uint32_t nodeId, Mac48Address macAddress); 57 | 58 | /** 59 | * Destructor for SatNodeInfo 60 | */ 61 | virtual ~SatNodeInfo(); 62 | 63 | /** 64 | * \brief Get node identifier 65 | * \return Node identifier 66 | */ 67 | uint32_t GetNodeId() const; 68 | 69 | /** 70 | * \brief Get Node type (UT, SAT, GW, NCC, TER) 71 | * \return Node type enum 72 | */ 73 | SatEnums::SatNodeType_t GetNodeType() const; 74 | 75 | /** 76 | * \brief Get MAC address 77 | * \return Node (SatNetDevice) MAC address 78 | */ 79 | Mac48Address GetMacAddress() const; 80 | 81 | private: 82 | uint32_t m_nodeId; 83 | SatEnums::SatNodeType_t m_nodeType; 84 | Mac48Address m_macAddress; 85 | }; 86 | 87 | } // namespace ns3 88 | 89 | #endif /* SATELLITE_NODE_INFO_H_ */ 90 | -------------------------------------------------------------------------------- /model/satellite-on-off-application.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | #ifndef SAT_ONOFF_APPLICATION_H 21 | #define SAT_ONOFF_APPLICATION_H 22 | 23 | #include 24 | 25 | namespace ns3 26 | { 27 | 28 | class Socket; 29 | 30 | /** 31 | * \ingroup satellite 32 | * 33 | * \brief This class implements Satellite specific OnOff application. 34 | * It subclasses ns-3 'native' OnOffApplication to provide needed support for statics. 35 | * Otherwise functionality of original OnOffApplication is not changed. 36 | * 37 | */ 38 | class SatOnOffApplication : public OnOffApplication 39 | { 40 | public: 41 | /** 42 | */ 43 | static TypeId GetTypeId(void); 44 | 45 | /** 46 | * Constructor for Satellite specific on-off application 47 | */ 48 | SatOnOffApplication(); 49 | 50 | /** 51 | * Destructor Satellite specific on-off application 52 | */ 53 | virtual ~SatOnOffApplication(); 54 | 55 | /** 56 | * Enable or disable statistic tags 57 | * 58 | * \param enableStatus Enable status for statistics 59 | */ 60 | void EnableStatisticTags(bool enableStatus); 61 | 62 | /** 63 | * Get enable status of statistic tags. 64 | * 65 | * \return true if statistics are enabled, false if statistics are disabled 66 | */ 67 | bool IsStatisticTagsEnabled() const; 68 | 69 | /** 70 | * Trace callback for on-off application Tx. 71 | * 72 | * \param packet Packet send by on-off application. 73 | */ 74 | void SendPacketTrace(Ptr packet); 75 | 76 | private: 77 | bool m_isStatisticsTagsEnabled; ///< `EnableStatisticsTags` attribute. 78 | bool m_isConnectedWithTraceSource; 79 | }; 80 | 81 | } // namespace ns3 82 | 83 | #endif /* SAT_ONOFF_APPLICATION_H */ 84 | -------------------------------------------------------------------------------- /model/lora-network-controller.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORA_NETWORK_CONTROLLER_H 24 | #define LORA_NETWORK_CONTROLLER_H 25 | 26 | #include "lora-network-controller-components.h" 27 | #include "lora-network-status.h" 28 | 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace ns3 35 | { 36 | 37 | class LoraNetworkStatus; 38 | class LoraNetworkControllerComponent; 39 | 40 | /** 41 | * This class collects a series of components that deal with various aspects 42 | * of managing the network, and queries them for action when a new packet is 43 | * received or other events occur in the network. 44 | */ 45 | class LoraNetworkController : public Object 46 | { 47 | public: 48 | static TypeId GetTypeId(void); 49 | 50 | LoraNetworkController(); 51 | LoraNetworkController(Ptr networkStatus); 52 | virtual ~LoraNetworkController(); 53 | 54 | /** 55 | * Add a new LoraNetworkControllerComponent 56 | */ 57 | void Install(Ptr component); 58 | 59 | /** 60 | * Method that is called by the NetworkServer when a new packet is received. 61 | * 62 | * \param packet The newly received packet. 63 | */ 64 | void OnNewPacket(Ptr packet); 65 | 66 | /** 67 | * Method that is called by the NetworkScheduler just before sending a reply 68 | * to a certain End Device. 69 | */ 70 | void BeforeSendingReply(Ptr endDeviceStatus); 71 | 72 | private: 73 | Ptr m_status; 74 | std::list> m_components; 75 | }; 76 | 77 | } /* namespace ns3 */ 78 | 79 | #endif /* LORA_NETWORK_CONTROLLER_H */ 80 | -------------------------------------------------------------------------------- /helper/lora-forwarder-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORA_FORWARDER_HELPER_H 24 | #define LORA_FORWARDER_HELPER_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | namespace ns3 38 | { 39 | 40 | /** 41 | * This class can be used to install LoraForwarder applications on a set of 42 | * gateways. 43 | */ 44 | class LoraForwarderHelper : public Object 45 | { 46 | public: 47 | /** 48 | * \brief Get the type ID 49 | * \return the object TypeId 50 | */ 51 | static TypeId GetTypeId(void); 52 | 53 | LoraForwarderHelper(); 54 | 55 | ~LoraForwarderHelper(); 56 | 57 | void SetAttribute(std::string name, const AttributeValue& value); 58 | 59 | ApplicationContainer Install(NodeContainer c) const; 60 | 61 | ApplicationContainer Install(Ptr node) const; 62 | 63 | private: 64 | /** 65 | * Install if ground GW is a Lora GW 66 | * 67 | * \param node GW node where the forwarder is installed 68 | * 69 | * \return LoraForwarder application 70 | */ 71 | Ptr InstallPrivGwLora(Ptr node) const; 72 | 73 | /** 74 | * Install if ground GW is a DVB GW. Lora GW is on a satellite 75 | * 76 | * \param node Ground GW node where the forwarder is installed 77 | * 78 | * \return LoraForwarder application 79 | */ 80 | Ptr InstallPrivGwDvb(Ptr node) const; 81 | 82 | ObjectFactory m_factory; 83 | }; 84 | 85 | } // namespace ns3 86 | 87 | #endif /* LORA_FORWARDER_HELPER_H */ 88 | -------------------------------------------------------------------------------- /model/satellite-address-tag.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | */ 20 | 21 | #include "satellite-address-tag.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatAddressTag"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatAddressTag); 33 | 34 | SatAddressTag::SatAddressTag() 35 | : Tag() 36 | { 37 | NS_LOG_FUNCTION(this); 38 | } 39 | 40 | SatAddressTag::SatAddressTag(Address addr) 41 | : Tag(), 42 | m_sourceAddress(addr) 43 | { 44 | NS_LOG_FUNCTION(this); 45 | } 46 | 47 | TypeId 48 | SatAddressTag::GetTypeId(void) 49 | { 50 | static TypeId tid = 51 | TypeId("ns3::SatAddressTag").SetParent().AddConstructor(); 52 | return tid; 53 | } 54 | 55 | TypeId 56 | SatAddressTag::GetInstanceTypeId() const 57 | { 58 | return GetTypeId(); 59 | } 60 | 61 | uint32_t 62 | SatAddressTag::GetSerializedSize() const 63 | { 64 | return m_sourceAddress.GetSerializedSize(); 65 | } 66 | 67 | void 68 | SatAddressTag::Serialize(TagBuffer i) const 69 | { 70 | NS_LOG_FUNCTION(this << &i); 71 | 72 | m_sourceAddress.Serialize(i); 73 | } 74 | 75 | void 76 | SatAddressTag::Deserialize(TagBuffer i) 77 | { 78 | NS_LOG_FUNCTION(this << &i); 79 | 80 | m_sourceAddress.Deserialize(i); 81 | } 82 | 83 | void 84 | SatAddressTag::Print(std::ostream& os) const 85 | { 86 | NS_LOG_FUNCTION(this << &os); 87 | os << "(SourceAddress=" << m_sourceAddress << ")"; 88 | } 89 | 90 | void 91 | SatAddressTag::SetSourceAddress(Address addr) 92 | { 93 | NS_LOG_FUNCTION(this << addr); 94 | m_sourceAddress = addr; 95 | } 96 | 97 | Address 98 | SatAddressTag::GetSourceAddress() const 99 | { 100 | return m_sourceAddress; 101 | } 102 | 103 | } // namespace ns3 104 | -------------------------------------------------------------------------------- /stats/satellite-stats-beam-service-time-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Lauri Sormunen 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_STATS_BEAM_SERVICE_TIME_HELPER_H 23 | #define SATELLITE_STATS_BEAM_SERVICE_TIME_HELPER_H 24 | 25 | #include "satellite-stats-helper.h" 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace ns3 35 | { 36 | 37 | class SatHelper; 38 | class DataCollectionObject; 39 | 40 | /** 41 | * \ingroup satstats 42 | * \brief 43 | */ 44 | class SatStatsBeamServiceTimeHelper : public SatStatsHelper 45 | { 46 | public: 47 | /** 48 | * Constructor. 49 | * \param satHelper Satellite helper instance 50 | */ 51 | SatStatsBeamServiceTimeHelper(Ptr satHelper); 52 | 53 | /** 54 | * / Destructor. 55 | */ 56 | virtual ~SatStatsBeamServiceTimeHelper(); 57 | 58 | /** 59 | * inherited from ObjectBase base class 60 | * \return Type ID of the helper 61 | */ 62 | static TypeId GetTypeId(); 63 | 64 | protected: 65 | // inherited from SatStatsHelper base class 66 | void DoInstall(); 67 | 68 | private: 69 | /** 70 | * \param context Beam ID, GW ID or global ID (0) as string 71 | * \param time The time beam was enabled 72 | */ 73 | void BeamServiceCallback(std::string context, Time time); 74 | 75 | /** 76 | * \brief Two-dimensional map of collectors, indexed first by the 77 | * the frame type identifier and second by the global/gw/beam identifier. 78 | */ 79 | CollectorMap m_collectorMap; 80 | 81 | /// The aggregator created by this helper. 82 | Ptr m_aggregator; 83 | 84 | }; // end of class SatStatsBeamServiceTimeHelper 85 | 86 | } // end of namespace ns3 87 | 88 | #endif /* SATELLITE_STATS_BEAM_SERVICE_TIME_HELPER_H */ 89 | -------------------------------------------------------------------------------- /ext-utils/writeExtFadingIndexFile.m: -------------------------------------------------------------------------------- 1 | % Copyright (c) 2014 Magister Solutions Ltd 2 | % 3 | % This program is free software; you can redistribute it and/or modify 4 | % it under the terms of the GNU General Public License version 2 as 5 | % published by the Free Software Foundation; 6 | % 7 | % This program is distributed in the hope that it will be useful, 8 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | % GNU General Public License for more details. 11 | % 12 | % You should have received a copy of the GNU General Public License 13 | % along with this program; if not, write to the Free Software 14 | % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | % 16 | % Author: Jani Puttonen 17 | % 18 | 19 | clear all; 20 | close all; 21 | 22 | % --------------------------------------------------------- 23 | % This script can be used to create a external fading index 24 | % files with UT positions from the .mat file located under 25 | % satellite/data/ext-fadingfiles/input folders. Each fading 26 | % file comes with a position, which can be enforced by the 27 | % simulator with list position allocator and external fading 28 | % files in POSITION_MODE. Remember to change the folders to 29 | % the ones you are interested. 30 | % --------------------------------------------------------- 31 | 32 | beamId = 39; 33 | 34 | dir = '$NS3_ROOT/contrib/satellite/data/ext-fadingtraces/input/'; 35 | subDir = ['BeamId-' int2str(beamId) '_256_Terminals/']; 36 | locFileName = ['terminal_locations_beamId_' int2str(beamId) '.mat']; 37 | 38 | outputFwdDwnFileName = ['BeamId-' int2str(beamId) '_256_UT_fading_fwddwn_trace_index.txt']; 39 | outputRtnUpFileName = ['BeamId-' int2str(beamId) '_256_UT_fading_rtnup_trace_index.txt']; 40 | outputPosFileName = ['BeamId-' int2str(beamId) '_256_UT_Positions.txt']; 41 | 42 | loc = load([dir subDir locFileName]); 43 | terminals = length(loc.terminals.pos.lat); 44 | 45 | earthRadius = 6378137; 46 | 47 | lat = loc.terminals.pos.lat .* 180/pi; 48 | lon = loc.terminals.pos.lon .* 180/pi; 49 | alt = (loc.terminals.pos.r .- earthRadius); 50 | 51 | fwdDwnId = fopen(outputFwdDwnFileName, 'w'); 52 | rtnUpId = fopen(outputRtnUpFileName, 'w'); 53 | posId = fopen(outputPosFileName, 'w'); 54 | 55 | for i = 1:terminals; 56 | pos = [num2str(lat(i)) ' ' num2str(lon(i)) ' ' num2str(alt(i))]; 57 | ind_fwddwn_row = [int2str(i) ' ' subDir 'term_ID' int2str(i) '_fading_fwddwn.dat ' pos]; 58 | ind_rtnup_row = [int2str(i) ' ' subDir 'term_ID' int2str(i) '_fading_rtnup.dat ' pos]; 59 | 60 | fprintf(fwdDwnId, '%s\n', ind_fwddwn_row); 61 | fprintf(rtnUpId, '%s\n', ind_rtnup_row); 62 | fprintf(posId, '%s\n', pos); 63 | end 64 | 65 | fclose('all'); 66 | -------------------------------------------------------------------------------- /model/satellite-packet-classifier.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_PACKET_CLASSIFIER_H_ 22 | #define SATELLITE_PACKET_CLASSIFIER_H_ 23 | 24 | #include "satellite-control-message.h" 25 | #include "satellite-enums.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace ns3 32 | { 33 | 34 | class Packet; 35 | 36 | /** 37 | * \ingroup satellite 38 | * 39 | * SatPacketClassifier is responsible of classifying packets into certain 40 | * flow identifier. Classification is done based on IP header DSCP field 41 | * value. 42 | * Control -> flow index 0 (Note, that this is not using IP header DSCP field) 43 | * Default (0) -> flow index 3 44 | * Assured forwarding -> flow index 2 45 | * Expedited forwarding -> flow index 1 46 | */ 47 | 48 | class SatPacketClassifier : public SimpleRefCount 49 | { 50 | public: 51 | /** 52 | * Default constructor. 53 | */ 54 | SatPacketClassifier(); 55 | 56 | /** 57 | * Destructor for SatPacketClassifier 58 | */ 59 | virtual ~SatPacketClassifier(); 60 | 61 | /** 62 | * \brief Classify control message 63 | * \param type Control msg type 64 | * \param dest Destination address 65 | * \return uint8_t Flow identifier 66 | */ 67 | uint8_t Classify(SatControlMsgTag::SatControlMsgType_t type, const Address& dest) const; 68 | 69 | /** 70 | * \brief Classify a packet based on IP header DSCP to a lower layer 71 | * flow id. 72 | * \param packet Packet to be classified 73 | * \param dest Destination address 74 | * \param protocolNumber Protocol number 75 | * \return uint8_t Flow identifier 76 | */ 77 | uint8_t Classify(const Ptr packet, const Address& dest, uint16_t protocolNumber) const; 78 | 79 | private: 80 | }; 81 | 82 | } // namespace ns3 83 | 84 | #endif /* SATELLITE_PACKET_CLASSIFIER_H_ */ 85 | -------------------------------------------------------------------------------- /model/satellite-loo-conf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #ifndef SAT_LOO_CONF_H 22 | #define SAT_LOO_CONF_H 23 | 24 | #include "satellite-base-fader-conf.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \ingroup satellite 34 | * 35 | * \brief A configuration class for Loo's model fader. The class provides 36 | * configuration parameters for Loo's fader used with Markov-based 37 | * fading model. 38 | */ 39 | class SatLooConf : public SatBaseFaderConf 40 | { 41 | public: 42 | /** 43 | * \brief Default Loo parameter count 44 | */ 45 | static const uint32_t DEFAULT_LOO_PARAMETER_COUNT = 7; 46 | 47 | /** 48 | * \brief NS-3 function for type id 49 | * \return 50 | */ 51 | static TypeId GetTypeId(void); 52 | 53 | /** 54 | * \brief Constructor 55 | */ 56 | SatLooConf(); 57 | 58 | /** 59 | * \brief Destructor 60 | */ 61 | ~SatLooConf(); 62 | 63 | /** 64 | * \brief Function for getting the Loo parameters 65 | * \param set parameter set 66 | * \return Loo parameter values 67 | */ 68 | std::vector> GetParameters(uint32_t set); 69 | 70 | /** 71 | * \brief Do needed dispose actions 72 | */ 73 | void DoDispose(); 74 | 75 | private: 76 | /** 77 | * \brief Number of parameters sets 78 | */ 79 | uint32_t m_elevationCount; 80 | 81 | /** 82 | * \brief Number of states 83 | */ 84 | uint32_t m_stateCount; 85 | 86 | /** 87 | * \brief Loo's model parameters 88 | */ 89 | std::vector>> m_looParameters; 90 | 91 | /** 92 | * \brief Clear used variables 93 | */ 94 | void Reset(); 95 | }; 96 | 97 | } // namespace ns3 98 | 99 | #endif /* SAT_LOO_CONF_H */ 100 | -------------------------------------------------------------------------------- /ext-utils/get_beam_center.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Author: Aurelien DELRIEU / 4 | 5 | """ 6 | get_beam_center.py - Get the GPS location of beam center 7 | """ 8 | 9 | import os 10 | import math 11 | import operator 12 | import argparse 13 | from contextlib import suppress 14 | 15 | 16 | def command_line_parser(): 17 | """Define a parser for command line arguments""" 18 | 19 | parser = argparse.ArgumentParser( 20 | description='Get the center of beam (based on max antenna gain)', 21 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, 22 | ) 23 | 24 | parser.add_argument( 25 | 'beams_dir', 26 | type=str, 27 | help='the directory containing the antenna gain for each beam', 28 | ) 29 | 30 | return parser 31 | 32 | 33 | def parse_file(filepath): 34 | """ 35 | Parse an antenna gains file. 36 | 37 | Args: 38 | filepath: the antenna gains file 39 | 40 | Yields: 41 | latitude, longitude and gain of entries in the file 42 | """ 43 | with open(filepath) as antenna_gain_pattern: 44 | for line in antenna_gain_pattern: 45 | with suppress(ValueError): 46 | lat, lon, gain = map(float, line.split()) 47 | yield lat, lon, gain 48 | 49 | 50 | def get_max_antenna_gain_location(filepath): 51 | """ 52 | Get max antenna gains. 53 | 54 | Args: 55 | filepath: the antenna gains file 56 | 57 | Returns: 58 | location of the max gain, and gain 59 | """ 60 | return max( 61 | (item for item in parse_file(filepath) if not math.isnan(item[2])), 62 | key=operator.itemgetter(2) 63 | ) 64 | 65 | 66 | def get_beam_id(filepath): 67 | """ 68 | Get the beam id from the antenna gain file name. 69 | 70 | Args: 71 | filepath: the antenna gain file path 72 | 73 | Returns: 74 | the beam id 75 | """ 76 | return int(filepath[filepath.index('_') + 1:filepath.index('.txt')]) 77 | 78 | 79 | def main(beam_directory): 80 | """Print the position and gain of the center of each beam in beam_directory""" 81 | 82 | # List beam files indexed by their beam ID 83 | beam_files = { 84 | get_beam_id(filename): filename 85 | for filename in os.listdir(beam_directory) 86 | } 87 | 88 | # Parse each beam and check each GPS positions 89 | print('beam,lat,lon,gain') 90 | for beam_id in sorted(beam_files): 91 | beam_path = os.path.join(beam_directory, beam_files[beam_id]) 92 | center = get_max_antenna_gain_location(beam_path) 93 | print(beam_id, *center, sep=',') 94 | 95 | 96 | if __name__ == "__main__": 97 | args = command_line_parser().parse_args() 98 | main(args.beams_dir) 99 | -------------------------------------------------------------------------------- /helper/lora-network-server-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORA_NETWORK_SERVER_HELPER_H 24 | #define LORA_NETWORK_SERVER_HELPER_H 25 | 26 | #include "ns3/address.h" 27 | #include "ns3/application-container.h" 28 | #include "ns3/attribute.h" 29 | #include "ns3/lora-network-server.h" 30 | #include "ns3/net-device.h" 31 | #include "ns3/node-container.h" 32 | #include "ns3/object-factory.h" 33 | #include "ns3/point-to-point-helper.h" 34 | 35 | #include 36 | #include 37 | 38 | namespace ns3 39 | { 40 | 41 | /** 42 | * This class can install Network Server applications on multiple nodes at once. 43 | */ 44 | class LoraNetworkServerHelper : public Object 45 | { 46 | public: 47 | /** 48 | * \brief Get the type ID 49 | * \return the object TypeId 50 | */ 51 | static TypeId GetTypeId(void); 52 | 53 | LoraNetworkServerHelper(); 54 | 55 | ~LoraNetworkServerHelper(); 56 | 57 | void SetAttribute(std::string name, const AttributeValue& value); 58 | 59 | ApplicationContainer Install(NodeContainer c); 60 | 61 | ApplicationContainer Install(Ptr node); 62 | 63 | /** 64 | * Enable (true) or disable (false) the ADR component in the Network 65 | * Server created by this helper. 66 | */ 67 | void EnableAdr(bool enableAdr); 68 | 69 | /** 70 | * Set the ADR implementation to use in the Network Server created 71 | * by this helper. 72 | */ 73 | void SetAdr(std::string type); 74 | 75 | private: 76 | void InstallComponents(Ptr netServer); 77 | Ptr InstallPriv(Ptr node); 78 | 79 | ObjectFactory m_factory; 80 | 81 | PointToPointHelper p2pHelper; //!< Helper to create PointToPoint links 82 | 83 | bool m_adrEnabled; 84 | 85 | ObjectFactory m_adrSupportFactory; 86 | }; 87 | 88 | } // namespace ns3 89 | 90 | #endif /* LORA_NETWORK_SERVER_HELPER_H */ 91 | -------------------------------------------------------------------------------- /model/satellite-rayleigh-conf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #ifndef SAT_RAYLEIGH_CONF_H 22 | #define SAT_RAYLEIGH_CONF_H 23 | 24 | #include "satellite-base-fader-conf.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace ns3 30 | { 31 | 32 | /** 33 | * \ingroup satellite 34 | * 35 | * \brief A configuration class for Rayleigh model fader. The class provides 36 | * configuration parameters for Rayleigh fader used with Markov-based 37 | * fading model. 38 | */ 39 | class SatRayleighConf : public SatBaseFaderConf 40 | { 41 | public: 42 | /** 43 | * \brief Default Rayleigh parameter count 44 | */ 45 | static const uint32_t DEFAULT_RAYLEIGH_PARAMETER_COUNT = 2; 46 | 47 | /** 48 | * \brief NS-3 function for type id 49 | * \return 50 | */ 51 | static TypeId GetTypeId(void); 52 | 53 | /** 54 | * \brief Constructor 55 | */ 56 | SatRayleighConf(); 57 | 58 | /** 59 | * \brief Destructor 60 | */ 61 | ~SatRayleighConf(); 62 | 63 | /** 64 | * \brief Function for getting the Rayleigh parameters 65 | * \param set parameter set 66 | * \return Rayleigh parameter values 67 | */ 68 | std::vector> GetParameters(uint32_t set); 69 | 70 | /** 71 | * \brief Do needed dispose actions 72 | */ 73 | void DoDispose(); 74 | 75 | private: 76 | /** 77 | * \brief Clear used variables 78 | */ 79 | void Reset(); 80 | 81 | /** 82 | * \brief Number of parameters sets 83 | */ 84 | uint32_t m_elevationCount; 85 | 86 | /** 87 | * \brief Number of states 88 | */ 89 | uint32_t m_stateCount; 90 | 91 | /** 92 | * \brief Rayleigh model parameters 93 | */ 94 | std::vector>> m_rayleighParameters; 95 | }; 96 | 97 | } // namespace ns3 98 | 99 | #endif /* SAT_RAYLEIGH_CONF_H */ 100 | -------------------------------------------------------------------------------- /model/satellite-base-trace-container.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | 21 | #include "satellite-base-trace-container.h" 22 | 23 | #include 24 | 25 | NS_LOG_COMPONENT_DEFINE("SatBaseTraceContainer"); 26 | 27 | namespace ns3 28 | { 29 | 30 | NS_OBJECT_ENSURE_REGISTERED(SatBaseTraceContainer); 31 | 32 | const uint32_t SatBaseTraceContainer::RX_POWER_TRACE_DEFAULT_RX_POWER_DENSITY_INDEX; 33 | const uint32_t SatBaseTraceContainer::RX_POWER_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 34 | const uint32_t SatBaseTraceContainer::RX_CNO_TRACE_DEFAULT_RX_POWER_DENSITY_INDEX; 35 | const uint32_t SatBaseTraceContainer::RX_CNO_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 36 | const uint32_t SatBaseTraceContainer::INTF_TRACE_DEFAULT_INTF_DENSITY_INDEX; 37 | const uint32_t SatBaseTraceContainer::INTF_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 38 | const uint32_t SatBaseTraceContainer::FADING_TRACE_DEFAULT_FADING_VALUE_INDEX; 39 | const uint32_t SatBaseTraceContainer::FADING_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 40 | const uint32_t SatBaseTraceContainer::CSINR_TRACE_DEFAULT_FADING_VALUE_INDEX; 41 | const uint32_t SatBaseTraceContainer::CSINR_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 42 | const uint32_t SatBaseTraceContainer::POSITION_TRACE_DEFAULT_LATITUDE_INDEX; 43 | const uint32_t SatBaseTraceContainer::POSITION_TRACE_DEFAULT_LONGITUDE_INDEX; 44 | const uint32_t SatBaseTraceContainer::POSITION_TRACE_DEFAULT_ALTITUDE_INDEX; 45 | const uint32_t SatBaseTraceContainer::POSITION_TRACE_DEFAULT_NUMBER_OF_COLUMNS; 46 | 47 | TypeId 48 | SatBaseTraceContainer::GetTypeId(void) 49 | { 50 | static TypeId tid = TypeId("ns3::SatBaseTraceContainer").SetParent(); 51 | return tid; 52 | } 53 | 54 | TypeId 55 | SatBaseTraceContainer::GetInstanceTypeId(void) const 56 | { 57 | NS_LOG_FUNCTION(this); 58 | 59 | return GetTypeId(); 60 | } 61 | 62 | SatBaseTraceContainer::SatBaseTraceContainer() 63 | { 64 | NS_LOG_FUNCTION(this); 65 | } 66 | 67 | SatBaseTraceContainer::~SatBaseTraceContainer() 68 | { 69 | NS_LOG_FUNCTION(this); 70 | } 71 | 72 | } // namespace ns3 73 | -------------------------------------------------------------------------------- /stats/satellite-stats-resources-granted-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Budiarto Herman 19 | * 20 | */ 21 | 22 | #ifndef SATELLITE_STATS_RESOURCES_GRANTED_HELPER_H 23 | #define SATELLITE_STATS_RESOURCES_GRANTED_HELPER_H 24 | 25 | #include "satellite-stats-helper.h" 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace ns3 35 | { 36 | 37 | class SatHelper; 38 | class DataCollectionObject; 39 | 40 | /** 41 | * \ingroup satstats 42 | * \brief 43 | */ 44 | class SatStatsResourcesGrantedHelper : public SatStatsHelper 45 | { 46 | public: 47 | // inherited from SatStatsHelper base class 48 | SatStatsResourcesGrantedHelper(Ptr satHelper); 49 | 50 | /** 51 | * / Destructor. 52 | */ 53 | virtual ~SatStatsResourcesGrantedHelper(); 54 | 55 | /** 56 | * inherited from ObjectBase base class 57 | */ 58 | static TypeId GetTypeId(); 59 | 60 | /** 61 | * Change identifier used on probes, when handovers occur. 62 | */ 63 | template 64 | void UpdateIdentifierOnProbes(); 65 | 66 | protected: 67 | // inherited from SatStatsHelper base class 68 | void DoInstall(); 69 | 70 | private: 71 | /** 72 | * \param utNode 73 | * \param collectorTraceSink 74 | */ 75 | template 76 | void InstallProbe(Ptr utNode, R (C::*collectorTraceSink)(P, P)); 77 | 78 | /// Maintains a list of probes created by this helper. 79 | std::map, std::pair, uint32_t>> m_probes; 80 | 81 | /// Maintains a list of collectors created by this helper. 82 | CollectorMap m_terminalCollectors; 83 | 84 | /// The aggregator created by this helper. 85 | Ptr m_aggregator; 86 | 87 | }; // end of class SatStatsResourcesGrantedHelper 88 | 89 | } // end of namespace ns3 90 | 91 | #endif /* SATELLITE_STATS_RESOURCES_GRANTED_HELPER_H */ 92 | -------------------------------------------------------------------------------- /helper/satellite-beam-user-info.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #include "satellite-beam-user-info.h" 22 | 23 | #include "ns3/assert.h" 24 | #include "ns3/log.h" 25 | 26 | #include 27 | #include 28 | 29 | NS_LOG_COMPONENT_DEFINE("SatBeamUserInfo"); 30 | 31 | namespace ns3 32 | { 33 | 34 | SatBeamUserInfo::SatBeamUserInfo() 35 | { 36 | NS_LOG_FUNCTION(this); 37 | } 38 | 39 | SatBeamUserInfo::SatBeamUserInfo(uint32_t utCount, uint32_t userCountPerUt) 40 | { 41 | NS_LOG_FUNCTION(this << utCount << userCountPerUt); 42 | 43 | NS_ASSERT(utCount > 0); 44 | NS_ASSERT(userCountPerUt > 0); 45 | 46 | for (uint32_t i = 0; i < utCount; i++) 47 | { 48 | m_userCount.push_back(userCountPerUt); 49 | } 50 | } 51 | 52 | uint32_t 53 | SatBeamUserInfo::GetUtCount() const 54 | { 55 | NS_LOG_FUNCTION(this); 56 | 57 | return m_userCount.size(); 58 | } 59 | 60 | uint32_t 61 | SatBeamUserInfo::GetUtUserCount(uint32_t utIndex) const 62 | { 63 | NS_LOG_FUNCTION(this << utIndex); 64 | 65 | NS_ASSERT(utIndex < m_userCount.size()); 66 | 67 | return m_userCount[utIndex]; 68 | } 69 | 70 | void 71 | SatBeamUserInfo::SetUtUserCount(uint32_t utIndex, uint32_t userCount) 72 | { 73 | NS_LOG_FUNCTION(this << utIndex << userCount); 74 | 75 | NS_ASSERT(utIndex < m_userCount.size()); 76 | 77 | m_userCount[utIndex] = userCount; 78 | } 79 | 80 | void 81 | SatBeamUserInfo::AppendUt(uint32_t userCount) 82 | { 83 | NS_LOG_FUNCTION(this << userCount); 84 | 85 | NS_ASSERT(userCount > 0); 86 | 87 | m_userCount.push_back(userCount); 88 | } 89 | 90 | void 91 | SatBeamUserInfo::SetPositions(std::vector> positions) 92 | { 93 | m_positions = positions; 94 | } 95 | 96 | std::vector> 97 | SatBeamUserInfo::GetPositions() 98 | { 99 | return m_positions; 100 | } 101 | 102 | } // namespace ns3 103 | -------------------------------------------------------------------------------- /model/satellite-base-fading.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | */ 20 | #ifndef SATELLITE_BASE_FADING_H 21 | #define SATELLITE_BASE_FADING_H 22 | 23 | #include "satellite-enums.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace ns3 31 | { 32 | 33 | /** 34 | * \ingroup satellite 35 | * 36 | * \brief Base class for fading models such as Markov-based fading 37 | * or fading trace. This class defines the functions which all the 38 | * different fading models must implement for the fading 39 | * interface. This base class itself is abstract and will not 40 | * implement any real functionality. 41 | */ 42 | class SatBaseFading : public Object 43 | { 44 | public: 45 | /** 46 | * \brief Gets elevation angle in degrees 47 | */ 48 | typedef Callback ElevationCallback; 49 | 50 | /** 51 | * \brief Gets velocity in m/s 52 | */ 53 | typedef Callback VelocityCallback; 54 | 55 | /** 56 | * \brief Constructor 57 | */ 58 | SatBaseFading(); 59 | 60 | /** 61 | * \brief Destructor 62 | */ 63 | virtual ~SatBaseFading(); 64 | 65 | /** 66 | * \brief NS-3 type id function 67 | * \return type id 68 | */ 69 | static TypeId GetTypeId(void); 70 | 71 | /** 72 | * \brief Function for getting the fading value. 73 | * \param macAddress 74 | * \param channelType channel type 75 | * \return fading value 76 | */ 77 | double GetFading(Address macAddress, SatEnums::ChannelType_t channelType); 78 | 79 | /** 80 | * \brief Function for getting the fading value. This is an abstract method, 81 | * thus it is implemented in the inherited fading classes. 82 | * \param macAddress 83 | * \param channelType channel type 84 | * \return fading value 85 | */ 86 | virtual double DoGetFading(Address macAddress, SatEnums::ChannelType_t channelType) = 0; 87 | 88 | private: 89 | }; 90 | 91 | } // namespace ns3 92 | 93 | #endif /* SATELLITE_BASE_FADING_H */ 94 | -------------------------------------------------------------------------------- /model/satellite-scheduling-object.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #include "satellite-scheduling-object.h" 22 | 23 | #include 24 | #include 25 | 26 | NS_LOG_COMPONENT_DEFINE("SatSchedulingObject"); 27 | 28 | namespace ns3 29 | { 30 | 31 | SatSchedulingObject::SatSchedulingObject() 32 | : m_macAddress(), 33 | m_bufferedBytes(0), 34 | m_minTxOpportunity(0), 35 | m_holDelay(Seconds(0.0)), 36 | m_flowId() 37 | { 38 | NS_LOG_FUNCTION(this); 39 | NS_ASSERT(false); 40 | 41 | /** 42 | * Default constructor is not meant to be used! 43 | */ 44 | } 45 | 46 | SatSchedulingObject::SatSchedulingObject(Mac48Address addr, 47 | uint32_t bytes, 48 | uint32_t minTxOpportunity, 49 | Time holDelay, 50 | uint8_t flowId) 51 | : m_macAddress(addr), 52 | m_bufferedBytes(bytes), 53 | m_minTxOpportunity(minTxOpportunity), 54 | m_holDelay(holDelay), 55 | m_flowId(flowId) 56 | { 57 | NS_LOG_FUNCTION(this << addr << bytes << holDelay << (uint32_t)flowId); 58 | } 59 | 60 | SatSchedulingObject::~SatSchedulingObject() 61 | { 62 | } 63 | 64 | Mac48Address 65 | SatSchedulingObject::GetMacAddress() const 66 | { 67 | NS_LOG_FUNCTION(this); 68 | return m_macAddress; 69 | } 70 | 71 | uint32_t 72 | SatSchedulingObject::GetBufferedBytes() const 73 | { 74 | NS_LOG_FUNCTION(this); 75 | return m_bufferedBytes; 76 | } 77 | 78 | uint32_t 79 | SatSchedulingObject::GetMinTxOpportunityInBytes() const 80 | { 81 | NS_LOG_FUNCTION(this); 82 | return m_minTxOpportunity; 83 | } 84 | 85 | uint8_t 86 | SatSchedulingObject::GetFlowId() const 87 | { 88 | NS_LOG_FUNCTION(this); 89 | return m_flowId; 90 | } 91 | 92 | Time 93 | SatSchedulingObject::GetHolDelay() const 94 | { 95 | NS_LOG_FUNCTION(this); 96 | return m_holDelay; 97 | } 98 | 99 | } // namespace ns3 100 | -------------------------------------------------------------------------------- /model/satellite-fwd-carrier-conf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | 21 | #ifndef SATELLITE_FWD_CARRIER_CONF_H 22 | #define SATELLITE_FWD_CARRIER_CONF_H 23 | 24 | #include 25 | 26 | namespace ns3 27 | { 28 | 29 | /** 30 | * \ingroup satellite 31 | * \brief This class implements configuration for forward link carrier . 32 | */ 33 | 34 | class SatFwdCarrierConf : public SimpleRefCount 35 | { 36 | public: 37 | /** 38 | * Default constructor for SatFwdCarrierConf 39 | */ 40 | SatFwdCarrierConf(); 41 | 42 | /** 43 | * Constructor for SatFwdCarrierConf 44 | * 45 | * \param bandwidthInHz Allocated bandwidth of Forward Link Carrier in hertz 46 | * \param rollOff Roll-off factor 47 | * \param spacing Spacing factor 48 | */ 49 | SatFwdCarrierConf(double bandwidthInHz, double rollOff, double spacing); 50 | 51 | /** 52 | * Destructor for SatFwdCarrierConf 53 | */ 54 | ~SatFwdCarrierConf(); 55 | 56 | /** 57 | * Get bandwidth of Forward Link Carrier. 58 | * 59 | * \return The bandwidth of Forward Link Carrier in hertz. 60 | */ 61 | inline double GetAllocatedBandwidthInHz() const 62 | { 63 | return m_allocatedBandwidthInHz; 64 | } 65 | 66 | /** 67 | * Get occupied bandwidth of Forward Link Carrier. 68 | * 69 | * \return The occupied bandwidth of Forward Link Carrier in hertz. 70 | */ 71 | inline double GetOccupiedBandwidthInHz() const 72 | { 73 | return m_occupiedBandwidthInHz; 74 | } 75 | 76 | /** 77 | * Get occupied bandwidth of Forward Link Carrier. 78 | * 79 | * \return The occupied bandwidth of Forward Link Carrier in hertz. 80 | */ 81 | inline double GetEffectiveBandwidthInHz() const 82 | { 83 | return m_effectiveBandwidthInHz; 84 | } 85 | 86 | private: 87 | double m_allocatedBandwidthInHz; 88 | double m_occupiedBandwidthInHz; 89 | double m_effectiveBandwidthInHz; 90 | }; 91 | 92 | } // namespace ns3 93 | 94 | #endif // SATELLITE_FWD_CARRIER_CONF_H 95 | -------------------------------------------------------------------------------- /model/satellite-isl-arbiter.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd 4 | * Copyright (c) 2018 CNES 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation; 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Inspired and adapted from Hypatia: https://github.com/snkas/hypatia 20 | * 21 | * Author: Bastien Tauran 22 | */ 23 | 24 | #ifndef SATELLITE_ISL_ARBITER_H 25 | #define SATELLITE_ISL_ARBITER_H 26 | 27 | #include "satellite-orbiter-net-device.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | namespace ns3 37 | { 38 | 39 | class SatIslArbiter : public Object 40 | { 41 | public: 42 | static TypeId GetTypeId(void); 43 | 44 | /** 45 | * Default constructor. 46 | */ 47 | SatIslArbiter(); 48 | 49 | /** 50 | * Constructor. 51 | * \param node The satellite node this arbiter is attached 52 | */ 53 | SatIslArbiter(Ptr node); 54 | 55 | /** 56 | * Base decide how to forward 57 | * 58 | * \param pkt Packet 59 | * \param destination IP header of the packet 60 | * 61 | * \return ISL interface index, or -1 if routing failed 62 | */ 63 | int32_t BaseDecide(Ptr pkt, Mac48Address destination); 64 | 65 | /** 66 | * Decide how to forward. Implemented in subclasses 67 | * 68 | * \param sourceSatId Satellite ID where the packet originated from 69 | * \param targetSatId Satellite ID where the packet has to go to 70 | * \param pkt Packet 71 | * 72 | * \return ISL interface index, or -1 if routing failed 73 | */ 74 | virtual int32_t Decide(int32_t sourceSatId, int32_t targetSatId, Ptr pkt) = 0; 75 | 76 | /** 77 | * Convert the forwarding state (i.e., routing table) to a string representation. 78 | * 79 | * @return String representation 80 | */ 81 | virtual std::string StringReprOfForwardingState() = 0; 82 | 83 | protected: 84 | uint32_t m_nodeId; // ID of node where this arbiter is installed. 85 | }; 86 | 87 | } // namespace ns3 88 | 89 | #endif // SATELLITE_ISL_ARBITER_H 90 | -------------------------------------------------------------------------------- /model/lora-network-controller.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #include "lora-network-controller.h" 24 | 25 | #include 26 | 27 | namespace ns3 28 | { 29 | 30 | NS_LOG_COMPONENT_DEFINE("LoraNetworkController"); 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(LoraNetworkController); 33 | 34 | TypeId 35 | LoraNetworkController::GetTypeId(void) 36 | { 37 | static TypeId tid = 38 | TypeId("ns3::LoraNetworkController").AddConstructor(); 39 | return tid; 40 | } 41 | 42 | LoraNetworkController::LoraNetworkController() 43 | { 44 | NS_LOG_FUNCTION_NOARGS(); 45 | } 46 | 47 | LoraNetworkController::LoraNetworkController(Ptr networkStatus) 48 | : m_status(networkStatus) 49 | { 50 | NS_LOG_FUNCTION_NOARGS(); 51 | } 52 | 53 | LoraNetworkController::~LoraNetworkController() 54 | { 55 | NS_LOG_FUNCTION_NOARGS(); 56 | } 57 | 58 | void 59 | LoraNetworkController::Install(Ptr component) 60 | { 61 | NS_LOG_FUNCTION(this); 62 | m_components.push_back(component); 63 | } 64 | 65 | void 66 | LoraNetworkController::OnNewPacket(Ptr packet) 67 | { 68 | NS_LOG_FUNCTION(this << packet); 69 | 70 | // NOTE As a future optimization, we can allow components to register their 71 | // callbacks and only be called in case a certain MAC command is contained. 72 | // For now, we call all components. 73 | 74 | // Inform each component about the new packet 75 | for (auto it = m_components.begin(); it != m_components.end(); ++it) 76 | { 77 | (*it)->OnReceivedPacket(packet, m_status->GetEndDeviceStatus(packet), m_status); 78 | } 79 | } 80 | 81 | void 82 | LoraNetworkController::BeforeSendingReply(Ptr endDeviceStatus) 83 | { 84 | NS_LOG_FUNCTION(this); 85 | 86 | // Inform each component about the imminent reply 87 | for (auto it = m_components.begin(); it != m_components.end(); ++it) 88 | { 89 | (*it)->BeforeSendingReply(endDeviceStatus, m_status); 90 | } 91 | } 92 | 93 | } // namespace ns3 94 | -------------------------------------------------------------------------------- /model/lora-network-scheduler.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORA_NETWORK_SCHEDULER_H 24 | #define LORA_NETWORK_SCHEDULER_H 25 | 26 | #include "lora-device-address.h" 27 | #include "lora-frame-header.h" 28 | #include "lora-network-controller.h" 29 | #include "lora-network-status.h" 30 | #include "lorawan-mac-header.h" 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | namespace ns3 37 | { 38 | 39 | class LoraNetworkStatus; // Forward declaration 40 | class LoraNetworkController; // Forward declaration 41 | 42 | class LoraNetworkScheduler : public Object 43 | { 44 | public: 45 | static TypeId GetTypeId(void); 46 | 47 | TypeId GetInstanceTypeId(void) const; 48 | 49 | LoraNetworkScheduler(); 50 | LoraNetworkScheduler(Ptr status, Ptr controller); 51 | virtual ~LoraNetworkScheduler(); 52 | 53 | /** 54 | * Method called by NetworkServer to inform the Scheduler of a newly arrived 55 | * uplink packet. This function schedules the OnReceiveWindowOpportunity 56 | * events 1 and 2 seconds later. 57 | */ 58 | void OnReceivedPacket(Ptr packet); 59 | 60 | /** 61 | * Method that is scheduled after packet arrivals in order to act on 62 | * receive windows 1 and 2 seconds later receptions. 63 | */ 64 | void OnReceiveWindowOpportunity(LoraDeviceAddress deviceAddress, int window); 65 | 66 | private: 67 | TracedCallback> m_receiveWindowOpened; 68 | Ptr m_status; 69 | Ptr m_controller; 70 | 71 | /** 72 | * Delay to wait between end of reception of paquet and sending of anwser, to be in first window 73 | * opportunity 74 | */ 75 | Time m_firstWindowAnswerDelay; 76 | 77 | /** 78 | * Delay to wait between end of reception of paquet and sending of anwser, to be in second 79 | * window opportunity 80 | */ 81 | Time m_secondWindowAnswerDelay; 82 | }; 83 | 84 | } /* namespace ns3 */ 85 | 86 | #endif /* LORA_NETWORK_SCHEDULER_H */ 87 | -------------------------------------------------------------------------------- /model/satellite-simple-channel.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Sami Rantanen 19 | */ 20 | #ifndef SATELLITE_SIMPLE_CHANNEL_H 21 | #define SATELLITE_SIMPLE_CHANNEL_H 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace ns3 31 | { 32 | 33 | class SatSimpleNetDevice; 34 | class Packet; 35 | 36 | /** 37 | * \ingroup satellite 38 | * \brief The satellite simple channel, for satellite public and backbone networks. 39 | * Based on ns-3 SimpleChannel (implementation is identically same than in SimpleChannel, 40 | * but needed to re-implemented in order to use by SatSimpleNetDevice) 41 | */ 42 | class SatSimpleChannel : public Channel 43 | { 44 | public: 45 | /** 46 | * \brief Get the type ID 47 | * \return the object TypeId 48 | */ 49 | static TypeId GetTypeId(void); 50 | 51 | /** 52 | * Default constructor. 53 | */ 54 | SatSimpleChannel(); 55 | 56 | /** 57 | * A packet is sent by a net device. A receive event will be 58 | * scheduled for all net device connected to the channel other 59 | * than the net device who sent the packet 60 | * 61 | * \param p packet to be sent 62 | * \param protocol protocol number 63 | * \param to address to send packet to 64 | * \param from address the packet is coming from 65 | * \param sender net device who sent the packet 66 | * 67 | */ 68 | virtual void Send(Ptr p, 69 | uint16_t protocol, 70 | Mac48Address to, 71 | Mac48Address from, 72 | Ptr sender); 73 | 74 | /** 75 | * Attached a net device to the channel. 76 | * 77 | * \param device the device to attach to the channel 78 | */ 79 | virtual void Add(Ptr device); 80 | 81 | // inherited from ns3::Channel 82 | virtual std::size_t GetNDevices(void) const; 83 | virtual Ptr GetDevice(std::size_t i) const; 84 | 85 | private: 86 | std::vector> m_devices; 87 | }; 88 | 89 | } // namespace ns3 90 | 91 | #endif /* SATELLITE_SIMPLE_CHANNEL_H */ 92 | -------------------------------------------------------------------------------- /examples/sat-loo-example.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2014 Magister Solutions 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Frans Laakso 19 | * 20 | */ 21 | 22 | #include "ns3/core-module.h" 23 | #include "ns3/satellite-module.h" 24 | 25 | using namespace ns3; 26 | 27 | /** 28 | * \file sat-loo-example.cc 29 | * \ingroup satellite 30 | * 31 | * \brief Example for Loo's model fader class. Demonstrates the functionality 32 | * of the Loo's model fader used by the Markov-fading. The example creates 33 | * three faders with different parameters, switches the faders in time and 34 | * outputs the fading values. 35 | */ 36 | 37 | NS_LOG_COMPONENT_DEFINE("sat-loo-example"); 38 | 39 | int 40 | main(int argc, char* argv[]) 41 | { 42 | /// Enable info logs 43 | LogComponentEnable("sat-loo-example", LOG_LEVEL_INFO); 44 | LogComponentEnable("SatLooModel", LOG_LEVEL_INFO); 45 | 46 | /// Set simulation output details 47 | Config::SetDefault("ns3::SatEnvVariables::SimulationCampaignName", StringValue("example-loo")); 48 | Config::SetDefault("ns3::SatEnvVariables::SimulationTag", StringValue("")); 49 | Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true)); 50 | 51 | /// Load default configuration 52 | Ptr looConf = CreateObject(); 53 | 54 | /// Create faders 55 | Ptr looFaderLineOfSight = CreateObject(looConf, 3, 0, 0); 56 | Ptr looFaderLightShadowing = CreateObject(looConf, 3, 0, 1); 57 | Ptr looFaderHeavyShadowing = CreateObject(looConf, 3, 0, 2); 58 | 59 | /// Run simulation 60 | for (uint32_t i = 0; i < 1000; i++) 61 | { 62 | Simulator::Schedule(Time(300000 + i * 500000), 63 | &SatLooModel::GetChannelGainDb, 64 | looFaderLineOfSight); 65 | Simulator::Schedule(Time(500000 + i * 500000), 66 | &SatLooModel::GetChannelGainDb, 67 | looFaderLightShadowing); 68 | Simulator::Schedule(Time(700000 + i * 500000), 69 | &SatLooModel::GetChannelGainDb, 70 | looFaderHeavyShadowing); 71 | } 72 | 73 | Simulator::Run(); 74 | Simulator::Destroy(); 75 | 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /examples/sat-mobility-position-generator.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2018 CNES 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Mathias Ettinger 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | using namespace ns3; 31 | 32 | /** 33 | * \file sat-mobility-position-generator.cc 34 | * \ingroup satellite 35 | * 36 | * \brief Simulation script to run example simulation results with 37 | * a high degree of customization through XML file. 38 | * 39 | * execute command -> ./waf --run "sat-mobility-position-generator --PrintHelp" 40 | */ 41 | 42 | NS_LOG_COMPONENT_DEFINE("sat-mobility-position-generator"); 43 | 44 | int 45 | main(int argc, char* argv[]) 46 | { 47 | std::string inputFileNameWithPath = 48 | Singleton::Get()->LocateDirectory("contrib/satellite/examples") + 49 | "/generic-input-attributes.xml"; 50 | uint32_t posCount = 1; 51 | 52 | Ptr simulationHelper = 53 | CreateObject("sat-mobility-position-generator"); 54 | simulationHelper->DisableAllCapacityAssignmentCategories(); 55 | simulationHelper->EnableCrdsa(); 56 | 57 | simulationHelper->LoadScenario("geo-33E"); 58 | 59 | // Parse command-line and XML file 60 | CommandLine cmd; 61 | cmd.AddValue("PosCount", "Amount of positions to generate per beam", posCount); 62 | simulationHelper->AddDefaultUiArguments(cmd, inputFileNameWithPath); 63 | cmd.Parse(argc, argv); 64 | simulationHelper->ConfigureAttributesFromFile(inputFileNameWithPath); 65 | 66 | Ptr satHelper = simulationHelper->GetSatelliteHelper(); 67 | for (uint32_t beamId : simulationHelper->GetBeamSet()) 68 | { 69 | for (uint32_t posId = 0; posId < posCount; ++posId) 70 | { 71 | Ptr positions = satHelper->GetBeamAllocator(beamId); 72 | GeoCoordinate coords = positions->GetNextGeoPosition(0); 73 | std::cout << "[" << beamId << "] " << coords << std::endl; 74 | } 75 | } 76 | 77 | simulationHelper->SetSimulationTime(0.1); 78 | simulationHelper->RunSimulation(); 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /model/satellite-ground-station-address-tag.cc: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien TAURAN 19 | */ 20 | 21 | #include "satellite-ground-station-address-tag.h" 22 | 23 | #include 24 | 25 | #include 26 | 27 | NS_LOG_COMPONENT_DEFINE("SatGroundStationAddressTag"); 28 | 29 | namespace ns3 30 | { 31 | 32 | NS_OBJECT_ENSURE_REGISTERED(SatGroundStationAddressTag); 33 | 34 | SatGroundStationAddressTag::SatGroundStationAddressTag() 35 | { 36 | // Nothing to do here 37 | } 38 | 39 | SatGroundStationAddressTag::SatGroundStationAddressTag(Mac48Address groundStationAddress) 40 | : m_groundStationAddress(groundStationAddress) 41 | { 42 | // Nothing to do here 43 | } 44 | 45 | TypeId 46 | SatGroundStationAddressTag::GetTypeId(void) 47 | { 48 | static TypeId tid = TypeId("ns3::SatGroundStationAddressTag") 49 | .SetParent() 50 | .AddConstructor(); 51 | return tid; 52 | } 53 | 54 | TypeId 55 | SatGroundStationAddressTag::GetInstanceTypeId(void) const 56 | { 57 | return GetTypeId(); 58 | } 59 | 60 | uint32_t 61 | SatGroundStationAddressTag::GetSerializedSize(void) const 62 | { 63 | return ADDRESS_LENGHT; 64 | } 65 | 66 | void 67 | SatGroundStationAddressTag::Serialize(TagBuffer i) const 68 | { 69 | NS_LOG_FUNCTION(this << &i); 70 | 71 | uint8_t buff[ADDRESS_LENGHT]; 72 | 73 | m_groundStationAddress.CopyTo(buff); 74 | i.Write(buff, ADDRESS_LENGHT); 75 | } 76 | 77 | void 78 | SatGroundStationAddressTag::Deserialize(TagBuffer i) 79 | { 80 | NS_LOG_FUNCTION(this << &i); 81 | 82 | uint8_t buff[ADDRESS_LENGHT]; 83 | 84 | i.Read(buff, ADDRESS_LENGHT); 85 | m_groundStationAddress.CopyFrom(buff); 86 | } 87 | 88 | void 89 | SatGroundStationAddressTag::Print(std::ostream& os) const 90 | { 91 | os << m_groundStationAddress; 92 | } 93 | 94 | Mac48Address 95 | SatGroundStationAddressTag::GetGroundStationAddress(void) const 96 | { 97 | return m_groundStationAddress; 98 | } 99 | 100 | void 101 | SatGroundStationAddressTag::SetGroundStationAddress(Mac48Address groundStationAddress) 102 | { 103 | m_groundStationAddress = groundStationAddress; 104 | } 105 | 106 | } // namespace ns3 107 | -------------------------------------------------------------------------------- /model/lora-device-address-generator.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2017 University of Padova 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Davide Magrin 19 | * 20 | * Modified by: Bastien Tauran 21 | */ 22 | 23 | #ifndef LORA_DEVICE_ADDRESS_GENERATOR_H 24 | #define LORA_DEVICE_ADDRESS_GENERATOR_H 25 | 26 | #include "lora-device-address.h" 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace ns3 33 | { 34 | 35 | /** 36 | * This class generates sequential LoraDeviceAddress instances. 37 | */ 38 | class LoraDeviceAddressGenerator : public Object 39 | { 40 | public: 41 | static TypeId GetTypeId(void); 42 | 43 | /** 44 | * Initialise the base NwkID and the first NwkAddr to be used by the 45 | * generator. 46 | * 47 | * The first call to NextAddress() or GetAddress() will return these values. 48 | * 49 | * \param nwkId The first network id. 50 | * \param nwkAddr The first address. 51 | */ 52 | LoraDeviceAddressGenerator(const uint8_t nwkId = 0, const uint32_t nwkAddr = 0); 53 | 54 | /** 55 | * Get the first address from the next network. 56 | * 57 | * This resets the address to the base address that was used for 58 | * initialization. 59 | * 60 | * \return the LoraDeviceAddress address of the next network 61 | */ 62 | LoraDeviceAddress NextNetwork(void); 63 | 64 | /** 65 | * Allocate the next LoraDeviceAddress. 66 | * 67 | * This operation is a post-increment, meaning that the first address 68 | * allocated will be the one that was initially configured. 69 | * 70 | * This keeps the nwkId constant, only incrementing nwkAddr. 71 | * 72 | * \return the LoraDeviceAddress address 73 | */ 74 | LoraDeviceAddress NextAddress(void); 75 | 76 | /** 77 | * Get the LoraDeviceAddress that will be allocated upon a call to 78 | * NextAddress. 79 | * 80 | * Does not change the internal state; is just used to peek at the next 81 | * address that will be allocated upon a call to NextAddress 82 | * 83 | * \return the LoraDeviceAddress 84 | */ 85 | LoraDeviceAddress GetNextAddress(void); 86 | 87 | private: 88 | NwkID m_currentNwkId; //!< The current Network Id value 89 | NwkAddr m_currentNwkAddr; //!< The current Network Address value 90 | }; 91 | } // namespace ns3 92 | #endif 93 | -------------------------------------------------------------------------------- /stats/satellite-stats-packet-drop-rate-helper.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2018 CNES 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Bastien Tauran 19 | */ 20 | 21 | #ifndef SATELLITE_STATS_PACKET_DROP_RATE_HELPER_H 22 | #define SATELLITE_STATS_PACKET_DROP_RATE_HELPER_H 23 | 24 | #include "satellite-stats-helper.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | namespace ns3 34 | { 35 | 36 | class SatHelper; 37 | class Node; 38 | class Time; 39 | class DataCollectionObject; 40 | class DistributionCollector; 41 | 42 | /** 43 | * \ingroup satstats 44 | * \brief Base class for antenna gain statistics helpers. 45 | */ 46 | class SatStatsPacketDropRateHelper : public SatStatsHelper 47 | { 48 | public: 49 | // inherited from SatStatsHelper base class 50 | SatStatsPacketDropRateHelper(Ptr satHelper); 51 | 52 | /** 53 | * / Destructor. 54 | */ 55 | virtual ~SatStatsPacketDropRateHelper(); 56 | 57 | /** 58 | * inherited from ObjectBase base class 59 | */ 60 | static TypeId GetTypeId(); 61 | 62 | /** 63 | * \brief Set up several probes or other means of listeners 64 | * and connect them to the collectors. 65 | */ 66 | void InstallProbes(); 67 | 68 | /** 69 | * \brief Receive inputs from trace sources and determine the right collector 70 | * to forward the inputs to. 71 | * \param nPackets number of packets in the received packet burst. 72 | * \param satSrc Satellite src 73 | * \param satDst Satellite dst 74 | * \param isError whether a PHY error has occurred. 75 | * 76 | * Used only in return link. 77 | */ 78 | void PacketDropRateCallback(uint32_t nPackets, 79 | Ptr satSrc, 80 | Ptr satDst, 81 | bool isError); 82 | 83 | protected: 84 | // inherited from SatStatsHelper base class 85 | void DoInstall(); 86 | 87 | /// Maintains a list of collectors created by this helper. 88 | CollectorMap m_terminalCollectors; 89 | 90 | /// The aggregator created by this helper. 91 | Ptr m_aggregator; 92 | 93 | }; // end of class SatStatsPacketDropRateHelper 94 | 95 | } // namespace ns3 96 | 97 | #endif /* SATELLITE_STATS_PACKET_DROP_RATE_HELPER_H */ 98 | -------------------------------------------------------------------------------- /model/satellite-arq-sequence-number.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 | /* 3 | * Copyright (c) 2013 Magister Solutions Ltd. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 as 7 | * published by the Free Software Foundation; 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | * Author: Jani Puttonen 19 | */ 20 | 21 | #ifndef SATELLITE_ARQ_SEQUENCE_NUMBER_H_ 22 | #define SATELLITE_ARQ_SEQUENCE_NUMBER_H_ 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | /** 30 | * \ingroup satellite 31 | * 32 | * \brief SatArqSequenceNumber is handling the sequence numbers for the 33 | * ARQ process. There may be a total of windowSize sequential sequence numbers 34 | * in use simultaneously. If all of them are booked, then no new sequence numbers 35 | * are available for new transmissions until some sequence numbers are released. 36 | * Releasing may happen due to maximum retransmissions reached or received ACK. 37 | * Sequence number is identified with one byte, thus it may range between 0 - 255. 38 | */ 39 | namespace ns3 40 | { 41 | 42 | class SatArqSequenceNumber : public SimpleRefCount 43 | { 44 | public: 45 | /** 46 | * Default constructor. 47 | */ 48 | SatArqSequenceNumber(); 49 | 50 | /** 51 | * Constructor with initialization parameters. 52 | * \param windowSize 53 | */ 54 | SatArqSequenceNumber(uint8_t windowSize); 55 | 56 | virtual ~SatArqSequenceNumber() 57 | { 58 | } 59 | 60 | /** 61 | * \brief Check whether there are free (released) sequence numbers. If a 62 | * sequence number is not available, ARQ may not send any new packets. 63 | * \return Boolean to indicate whether there are seq no available 64 | */ 65 | bool SeqNoAvailable() const; 66 | 67 | /** 68 | * \brief Returns the next free sequence number 69 | * \return Next free sequence number 70 | */ 71 | uint8_t NextSequenceNumber(); 72 | 73 | /** 74 | * \brief Release a sequence number if either ACK is received or 75 | * maximum retransmissions have been reached. 76 | * \param seqNo Sequence number to be released 77 | */ 78 | void Release(uint8_t seqNo); 79 | 80 | private: 81 | /** 82 | * \brief Clean ups the sequence number map 83 | */ 84 | void CleanUp(); 85 | 86 | std::map m_seqNoMap; 87 | int m_currSeqNo; 88 | uint32_t m_windowSize; 89 | uint32_t m_maxSn; 90 | }; 91 | 92 | } // namespace ns3 93 | 94 | #endif /* SATELLITE_ARQ_SEQUENCE_NUMBER_H_ */ 95 | --------------------------------------------------------------------------------