├── .cproject ├── .gitignore ├── .nedfolders ├── .oppbuildspec ├── .project ├── LICENSE ├── Makefile ├── README.md ├── configurator ├── OS3Configurator-src.tgz ├── OS3Configurator.jar └── run ├── data └── TablespecRain.csv ├── doc └── installation-guide.pdf ├── doxy.cfg ├── examples ├── SatSGP4 │ ├── SatSGP4.ned │ ├── SatSGP4Fisheye.ned │ ├── gps-ops.txt │ ├── omnetpp.ini │ ├── package.ned │ └── run-sim.sh ├── Validation │ ├── GPS.ned │ ├── Validate.ned │ ├── gps-ops.txt │ ├── omnetpp.ini │ ├── package.ned │ └── run-sim.sh ├── groundstations │ ├── GroundStations.ned │ ├── omnetpp.ini │ ├── package.ned │ └── run-sim.sh ├── run └── satellites │ ├── SatSGP4.ned │ ├── SatSGP4Fisheye.ned │ ├── gps-ops.txt │ ├── omnetpp.ini │ ├── package.ned │ └── run-sim.sh ├── images └── os3 │ ├── Erde.GIF │ ├── Erde.jpg │ ├── Erde1.gif │ ├── Galileo_Satellit_klein.gif │ ├── background_earth.png │ ├── background_earth_CospasSarsat.png │ ├── binocular.png │ ├── satellit_blue.gif │ ├── satellit_green.gif │ ├── satellit_l_rot.gif │ ├── satellit_orange.gif │ ├── satellit_yellow.gif │ ├── satellite_red.gif │ ├── sw.gif │ └── weatherIcons │ ├── wsymbol_0001_sunny.png │ ├── wsymbol_0002_sunny_intervals.png │ ├── wsymbol_0003_white_cloud.png │ ├── wsymbol_0004_black_low_cloud.png │ ├── wsymbol_0006_mist.png │ ├── wsymbol_0007_fog.png │ ├── wsymbol_0008_clear_sky_night.png │ ├── wsymbol_0009_light_rain_showers.png │ ├── wsymbol_0010_heavy_rain_showers.png │ ├── wsymbol_0011_light_snow_showers.png │ ├── wsymbol_0012_heavy_snow_showers.png │ ├── wsymbol_0013_sleet_showers.png │ ├── wsymbol_0016_thundery_showers.png │ ├── wsymbol_0017_cloudy_with_light_rain.png │ ├── wsymbol_0018_cloudy_with_heavy_rain.png │ ├── wsymbol_0019_cloudy_with_light_snow.png │ ├── wsymbol_0020_cloudy_with_heavy_snow.png │ ├── wsymbol_0021_cloudy_with_sleet.png │ ├── wsymbol_0024_thunderstorms.png │ ├── wsymbol_0025_light_rain_showers_night.png │ ├── wsymbol_0026_heavy_rain_showers_night.png │ ├── wsymbol_0027_light_snow_showers_night.png │ ├── wsymbol_0028_heavy_snow_showers_night.png │ ├── wsymbol_0029_sleet_showers_night.png │ ├── wsymbol_0032_thundery_showers_night.png │ ├── wsymbol_0033_cloudy_with_light_rain_night.png │ ├── wsymbol_0034_cloudy_with_heavy_rain_night.png │ ├── wsymbol_0035_cloudy_with_light_snow_night.png │ ├── wsymbol_0036_cloudy_with_heavy_snow_night.png │ ├── wsymbol_0037_cloudy_with_sleet_night.png │ └── wsymbol_0040_thunderstorms_night.png └── src ├── makefrag ├── os3 ├── base │ ├── CNI_OS3.ned │ ├── Calculation.cc │ ├── Calculation.h │ ├── Calculation.ned │ ├── MissionControlCenter.ned │ ├── Observer.cc │ ├── Observer.h │ ├── Observer.ned │ ├── Satellite.ned │ ├── UserConfig.cc │ ├── UserConfig.h │ ├── UserConfig.ned │ ├── WeatherControl.cc │ ├── WeatherControl.h │ ├── WeatherControl.ned │ ├── WebServiceControl.cc │ ├── WebServiceControl.h │ └── WebServiceControl.ned ├── libnorad │ ├── cEci.cc │ ├── cEci.h │ ├── cJulian.cc │ ├── cJulian.h │ ├── cNoradBase.cc │ ├── cNoradBase.h │ ├── cNoradSDP4.cc │ ├── cNoradSDP4.h │ ├── cNoradSGP4.cc │ ├── cNoradSGP4.h │ ├── cOrbit.cc │ ├── cOrbit.h │ ├── cSite.cc │ ├── cSite.h │ ├── cTLE.cc │ ├── cTLE.h │ ├── cVector.cc │ ├── cVector.h │ ├── ccoord.cc │ ├── ccoord.h │ ├── globals.cc │ ├── globals.h │ └── libnorad.h ├── mobility │ ├── LUTMotionMobility.cc │ ├── LUTMotionMobility.h │ ├── LUTMotionMobility.ned │ ├── Norad.cc │ ├── Norad.h │ ├── Norad.ned │ ├── SatSGP4FisheyeMobility.cc │ ├── SatSGP4FisheyeMobility.h │ ├── SatSGP4FisheyeMobility.ned │ ├── SatSGP4Mobility.cc │ ├── SatSGP4Mobility.h │ └── SatSGP4Mobility.ned └── package.ned └── run_os3 /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore generated files 2 | .cmdenv-log 3 | *_m.h 4 | *_m.cc 5 | *_sm.h 6 | *_sm.cc 7 | src/Makefile 8 | src/Makefile.vc 9 | /doc/doxy/ 10 | /doc/neddoc/ 11 | /examples/*/results/ 12 | /examples/*/*/results/ 13 | /examples/*/*/*/results/ 14 | /tests/*/work/ 15 | *.pyc 16 | *.pcap 17 | *.sca 18 | *.vec 19 | # ignore binary files 20 | out/ 21 | *.so 22 | *.dylib 23 | *.dll 24 | *.a 25 | *.lib 26 | *.exe 27 | *.o 28 | *.obj 29 | *.pdb 30 | *.idb 31 | *.manifest 32 | .tkenvrc 33 | .tkenvlog 34 | .cmdenv-log 35 | netanim-trace.txt 36 | *.out 37 | gcc-debug 38 | 39 | # ignore backup and temp files 40 | *.bak 41 | backups 42 | *~ 43 | xxx 44 | /3rdparty 45 | /tmp/ 46 | .settings/ 47 | 48 | -------------------------------------------------------------------------------- /.nedfolders: -------------------------------------------------------------------------------- 1 | examples/SatSGP4 2 | examples/Validation 3 | examples/groundstations 4 | examples/satellites 5 | src/os3 6 | -------------------------------------------------------------------------------- /.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | os3 4 | 5 | 6 | inet 7 | 8 | 9 | 10 | org.omnetpp.cdt.MakefileBuilder 11 | 12 | 13 | 14 | 15 | org.omnetpp.scave.builder.vectorfileindexer 16 | 17 | 18 | 19 | 20 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 21 | clean,full,incremental, 22 | 23 | 24 | ?name? 25 | 26 | 27 | 28 | org.eclipse.cdt.make.core.append_environment 29 | true 30 | 31 | 32 | org.eclipse.cdt.make.core.autoBuildTarget 33 | all 34 | 35 | 36 | org.eclipse.cdt.make.core.buildArguments 37 | MODE=debug CONFIGNAME=${ConfigName} 38 | 39 | 40 | org.eclipse.cdt.make.core.buildCommand 41 | make 42 | 43 | 44 | org.eclipse.cdt.make.core.buildLocation 45 | ${ProjDirPath} 46 | 47 | 48 | org.eclipse.cdt.make.core.cleanBuildTarget 49 | clean 50 | 51 | 52 | org.eclipse.cdt.make.core.contents 53 | org.eclipse.cdt.make.core.activeConfigSettings 54 | 55 | 56 | org.eclipse.cdt.make.core.enableAutoBuild 57 | false 58 | 59 | 60 | org.eclipse.cdt.make.core.enableCleanBuild 61 | true 62 | 63 | 64 | org.eclipse.cdt.make.core.enableFullBuild 65 | true 66 | 67 | 68 | org.eclipse.cdt.make.core.fullBuildTarget 69 | all 70 | 71 | 72 | org.eclipse.cdt.make.core.stopOnError 73 | true 74 | 75 | 76 | org.eclipse.cdt.make.core.useDefaultBuildCmd 77 | true 78 | 79 | 80 | 81 | 82 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 83 | full,incremental, 84 | 85 | 86 | 87 | 88 | 89 | org.eclipse.cdt.core.cnature 90 | org.eclipse.cdt.core.ccnature 91 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 92 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 93 | org.omnetpp.main.omnetppnature 94 | 95 | 96 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | INET_PROJECT_DIR=../../inet 2 | 3 | all: checkmakefiles 4 | cd src && $(MAKE) 5 | 6 | clean: checkmakefiles 7 | cd src && $(MAKE) clean 8 | 9 | cleanall: checkmakefiles 10 | cd src && $(MAKE) MODE=release clean 11 | cd src && $(MAKE) MODE=debug clean 12 | rm -f src/Makefile 13 | rm -rf out/ 14 | 15 | makefiles: 16 | cd src && opp_makemake -f --deep --make-so -o cni-os3 -O out -I$$\(INET_PROJ\)/src/world/radio -I$$\(INET_PROJ\)/src/mobility/models -I$$\(INET_PROJ\)/src/mobility -I$$\(INET_PROJ\)/src/util -I$$\(INET_PROJ\)/src/base -L/usr/local/lib -L$$\(INET_PROJ\)/out/$$\(CONFIGNAME\)/src -linet -lcurl -DINET_IMPORT -KINET_PROJ=$(INET_PROJECT_DIR) 17 | 18 | checkmakefiles: 19 | @if [ ! -f src/Makefile ]; then \ 20 | echo; \ 21 | echo '======================================================================='; \ 22 | echo 'src/Makefile does not exist. Please use "make makefiles" to generate it!'; \ 23 | echo '======================================================================='; \ 24 | echo; \ 25 | exit 1; \ 26 | fi 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OS3 Satellite tracking library for OMNeT++/INET-Framework 2 | ------------------------------------------------------------- 3 | 4 | This project provides mobility modules that can be used during satellite 5 | communication modeling. 6 | 7 | Requirements: OMNeT++ 4.6, INET-Framework 2.5, libcurl4-dev 8 | 9 | Read the Installation Guide to configure extra dependencies and web service 10 | access for live weather data. 11 | 12 | 13 | -------------------------------------------------------------------------------- /configurator/OS3Configurator-src.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/configurator/OS3Configurator-src.tgz -------------------------------------------------------------------------------- /configurator/OS3Configurator.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/configurator/OS3Configurator.jar -------------------------------------------------------------------------------- /configurator/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd `dirname $0` 3 | java -jar OS3Configurator.jar 4 | -------------------------------------------------------------------------------- /data/TablespecRain.csv: -------------------------------------------------------------------------------- 1 | #Frequency [GHz];a (LPL);a (LPH);a (MP);a (J-T);a (J-D);b (LPL);b (LPH);b (MP);b (J-T);b (J-D) 2 | 1.0;0.0000641;0.0000526;0.0000860;0.0000471;0.0000863;0.8910;0.9470;0.8530;0.8990;0.8430 3 | 1.5;0.0001450;0.0001140;0.0001930;0.0000931;0.0001950;0.9080;0.9760;0.8700;0.9670;0.8470 4 | 2.0;0.0002610;0.0001960;0.0003450;0.0001360;0.0003470;0.9300;1.0120;0.8910;1.0690;0.8510 5 | 2.5;0.0004160;0.0002960;0.0005460;0.0001630;0.0005480;0.9550;1.0540;0.9170;1.2020;0.8570 6 | 3.0;0.0006150;0.0004120;0.0007990;0.0002090;0.0008010;0.9840;1.1000;0.9470;1.3030;0.8640 7 | 3.5;0.0008610;0.0005420;0.0011100;0.0003080;0.0011100;1.0150;1.1500;0.9810;1.3510;0.8710 8 | 4.0;0.0011600;0.0006840;0.0014700;0.0005080;0.0014800;1.0490;1.2020;1.0160;1.3500;0.8790 9 | 5.0;0.0019400;0.0011200;0.0024100;0.0013800;0.0024000;1.1130;1.2740;1.0790;1.2880;0.8960 10 | 6.0;0.0030500;0.0019900;0.0037100;0.0030600;0.0035900;1.1580;1.2850;1.1240;1.2210;0.9130 11 | 7.0;0.0045500;0.0033600;0.0054400;0.0055700;0.0050700;1.1800;1.2700;1.1470;1.1670;0.9290 12 | 8.0;0.0064900;0.0053500;0.0076500;0.0090700;0.0068600;1.1870;1.2450;1.1560;1.1180;0.9430 13 | 9.0;0.0088800;0.0080300;0.0104000;0.0129000;0.0089600;1.1850;1.2160;1.1550;1.0910;0.9570 14 | 10.0;0.0117000;0.0114000;0.0136000;0.0169000;0.0114000;1.1780;1.1890;1.1500;1.0760;0.9680 15 | 11.0;0.0150000;0.0152000;0.0173000;0.0212000;0.0141000;1.1710;1.1670;1.1430;1.0650;0.9770 16 | 12.0;0.0186000;0.0196000;0.0215000;0.0262000;0.0172000;1.1620;1.1500;1.1360;1.0520;0.9850 17 | 15.0;0.0321000;0.0347000;0.0368000;0.0466000;0.0282000;1.1420;1.1190;1.1180;1.0100;1.0030 18 | 20.0;0.0626000;0.0709000;0.0719000;0.0938000;0.0530000;1.1190;1.0830;1.0970;0.9460;1.0200 19 | 25.0;0.1050000;0.1320000;0.1210000;0.1730000;0.0861000;1.0940;1.0290;1.0740;0.8840;1.0330 20 | 30.0;0.1620000;0.2260000;0.1860000;0.2740000;0.1280000;1.0610;0.9640;1.0430;0.8230;1.0440 21 | 35.0;0.2320000;0.3450000;0.2680000;0.3720000;0.1800000;1.0220;0.9070;1.0070;0.7810;1.0530 22 | 40.0;0.3130000;0.4670000;0.3620000;0.4510000;0.2410000;0.9810;0.8640;0.9720;0.7600;1.0580 -------------------------------------------------------------------------------- /doc/installation-guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/doc/installation-guide.pdf -------------------------------------------------------------------------------- /examples/SatSGP4/SatSGP4.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.SatSGP4; 3 | 4 | import os3.base.Satellite; 5 | import os3.base.MissionControlCenter; 6 | import inet.world.radio.ChannelControl; 7 | import os3.base.CNI_OS3; 8 | // 9 | // Network SatSGP4 enables satellite movement on worldmap 10 | // 11 | network SatSGP4 12 | { 13 | parameters: 14 | int numOfSats; // Number of satellites 15 | int numOfMCCs; // Number of Mission Control Centers 16 | 17 | @display("bgi=background_earth;bgb=2160,1080"); 18 | 19 | submodules: 20 | satellite[numOfSats]: Satellite { 21 | parameters: 22 | @display("p=80,150;r=10,,#707070;i=device/satellite_l"); 23 | } 24 | MCC[numOfMCCs]: MissionControlCenter { 25 | parameters: 26 | @display("p=240,150;i=misc/building;r=10,,black"); 27 | } 28 | channelcontrol: ChannelControl { 29 | parameters: 30 | numChannels = 2; 31 | @display("p=240,70;i=misc/sun"); 32 | } 33 | cni_os3: CNI_OS3 { 34 | @display("p=80,70,i;i=old/bluebox"); 35 | } 36 | connections allowunconnected: 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /examples/SatSGP4/SatSGP4Fisheye.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.SatSGP4; 3 | 4 | import os3.base.Satellite; 5 | import inet.world.radio.ChannelControl; 6 | import os3.base.CNI_OS3; 7 | 8 | // 9 | // Network SatSGP4Fisheye enables satellite movement in fisheye view 10 | // 11 | network SatSGP4Fisheye 12 | { 13 | parameters: 14 | int numOfSats; // Number of satellites 15 | 16 | @display("bgi=binocular,c;bgb=980,980"); 17 | 18 | submodules: 19 | satellite[numOfSats]: Satellite { 20 | parameters: 21 | @display("p=70,180;r=10,,#707070;i=device/satellite_l"); 22 | } 23 | 24 | channelcontrol: ChannelControl { 25 | parameters: 26 | numChannels = 2; 27 | @display("p=180,70;i=misc/sun"); 28 | } 29 | cni_os3: CNI_OS3 { 30 | @display("p=50,70,i;i=old/bluebox"); 31 | } 32 | connections allowunconnected: 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/SatSGP4/gps-ops.txt: -------------------------------------------------------------------------------- 1 | GPS BIIA-10 (PRN 32) 2 | 1 20959U 90103A 15046.67351132 .00000041 00000-0 00000+0 0 9996 3 | 2 20959 54.2698 199.1668 0113185 0.0642 359.9021 2.00574874177407 4 | GPS BIIA-23 (PRN 04) 5 | 1 22877U 93068A 15047.10222014 -.00000012 00000-0 00000+0 0 9994 6 | 2 22877 53.8274 133.6286 0108442 59.5746 302.9999 2.00556928156135 7 | GPS BIIA-26 (PRN 10) 8 | 1 23953U 96041A 15047.44909635 .00000027 00000-0 00000+0 0 9997 9 | 2 23953 53.9447 194.9431 0143843 52.1820 33.2059 2.00564053136218 10 | GPS BIIR-2 (PRN 13) 11 | 1 24876U 97035A 15047.50821044 .00000063 00000-0 00000+0 0 9990 12 | 2 24876 55.8667 260.6947 0051525 119.2954 255.6926 2.00561986128754 13 | GPS BIIA-28 (PRN 08) 14 | 1 25030U 97067A 15047.15781539 -.00000046 00000-0 00000+0 0 9995 15 | 2 25030 56.9993 321.8632 0145160 206.6773 47.8221 2.00576804126641 16 | GPS BIIR-3 (PRN 11) 17 | 1 25933U 99055A 15046.60076136 -.00000012 00000-0 10000-3 0 9993 18 | 2 25933 51.1305 115.1208 0154083 79.3593 282.4268 2.00556713112559 19 | GPS BIIR-4 (PRN 20) 20 | 1 26360U 00025A 15047.38107291 .00000020 00000-0 00000+0 0 9993 21 | 2 26360 53.0819 190.3990 0055907 69.7752 351.2609 2.00318257108258 22 | GPS BIIR-5 (PRN 28) 23 | 1 26407U 00040A 15047.36199160 -.00000044 00000-0 00000+0 0 9993 24 | 2 26407 56.6365 18.3403 0199115 264.1928 312.0758 2.00561997106933 25 | GPS BIIR-6 (PRN 14) 26 | 1 26605U 00071A 15047.30210666 .00000065 00000-0 00000+0 0 9998 27 | 2 26605 55.4372 258.7592 0079540 247.4707 212.4712 2.00549981104520 28 | GPS BIIR-7 (PRN 18) 29 | 1 26690U 01004A 15047.47352072 .00000023 00000-0 00000+0 0 9999 30 | 2 26690 53.0152 193.4142 0159691 246.2007 72.0726 2.00552508102933 31 | GPS BIIR-8 (PRN 16) 32 | 1 27663U 03005A 15047.22658583 -.00000044 00000-0 00000+0 0 9996 33 | 2 27663 56.7173 18.0322 0080644 12.2320 223.2494 2.00554730 88281 34 | GPS BIIR-9 (PRN 21) 35 | 1 27704U 03010A 15047.43188862 -.00000011 00000-0 00000+0 0 9993 36 | 2 27704 53.4832 133.6130 0224605 248.7136 100.3884 2.00570585 87094 37 | GPS BIIR-10 (PRN 22) 38 | 1 28129U 03058A 15047.05864374 .00000026 00000-0 00000+0 0 9999 39 | 2 28129 52.8894 193.5098 0077266 242.1503 104.8680 2.00559611 81780 40 | GPS BIIR-11 (PRN 19) 41 | 1 28190U 04009A 15046.64607954 .00000014 00000-0 00000+0 0 9994 42 | 2 28190 55.4900 79.8172 0108778 28.3566 64.7570 2.00560737 79959 43 | GPS BIIR-12 (PRN 23) 44 | 1 28361U 04023A 15047.31049847 .00000065 00000-0 00000+0 0 9992 45 | 2 28361 54.3929 254.7421 0098811 205.5990 156.7305 2.00564964 78059 46 | GPS BIIR-13 (PRN 02) 47 | 1 28474U 04045A 15047.40354787 -.00000010 00000-0 00000+0 0 9994 48 | 2 28474 53.8825 132.7341 0145612 227.7890 204.0219 2.00551506 75412 49 | GPS BIIRM-1 (PRN 17) 50 | 1 28874U 05038A 15046.36445850 .00000013 00000-0 00000+0 0 9999 51 | 2 28874 55.6574 76.9670 0102806 244.0189 265.5879 2.00558188 68792 52 | GPS BIIRM-2 (PRN 31) 53 | 1 29486U 06042A 15047.16323734 -.00000039 00000-0 00000+0 0 9999 54 | 2 29486 55.9294 316.2522 0084016 327.1610 319.6110 2.00556605 61529 55 | GPS BIIRM-3 (PRN 12) 56 | 1 29601U 06052A 15047.45200142 -.00000046 00000-0 00000+0 0 9996 57 | 2 29601 56.6855 16.9549 0052209 27.2480 148.7658 2.00557368 60449 58 | GPS BIIRM-4 (PRN 15) 59 | 1 32260U 07047A 15046.95848635 .00000067 00000-0 00000+0 0 9997 60 | 2 32260 53.5260 251.8522 0070092 19.7883 290.1150 2.00571793 53825 61 | GPS BIIRM-5 (PRN 29) 62 | 1 32384U 07062A 15047.43163481 .00000017 00000-0 00000+0 0 9999 63 | 2 32384 55.7049 77.4557 0015036 306.0380 125.2273 2.00577989 52569 64 | GPS BIIRM-6 (PRN 07) 65 | 1 32711U 08012A 15046.93145336 -.00000039 00000-0 00000+0 0 9997 66 | 2 32711 55.6498 315.8432 0080879 204.1918 155.4716 2.00556407 50751 67 | GPS BIIRM-8 (PRN 05) 68 | 1 35752U 09043A 15047.44814862 .00000026 00000-0 00000+0 0 9999 69 | 2 35752 54.2431 194.0447 0039430 20.7457 14.7022 2.00550938 40345 70 | GPS BIIF-1 (PRN 25) 71 | 1 36585U 10022A 15047.54932178 -.00000051 00000-0 00000+0 0 9994 72 | 2 36585 56.0302 14.3463 0041055 35.2343 179.3794 2.00558558 34590 73 | GPS BIIF-2 (PRN 01) 74 | 1 37753U 11036A 15047.11171088 -.00000011 00000-0 00000+0 0 9992 75 | 2 37753 55.1084 134.7726 0038050 19.7772 323.8239 2.00563803 26251 76 | GPS BIIF-3 (PRN 24) 77 | 1 38833U 12053A 15047.12312602 -.00000036 00000-0 00000+0 0 9999 78 | 2 38833 54.6883 313.5919 0030255 12.6446 347.4781 2.00562215 17331 79 | GPS BIIF-4 (PRN 27) 80 | 1 39166U 13023A 15045.47973794 .00000008 00000-0 10000-3 0 9991 81 | 2 39166 55.3617 74.3025 0018773 1.1836 358.8884 2.00562271 12822 82 | GPS BIIF-5 (PRN 30) 83 | 1 39533U 14008A 15046.47254806 -.00000046 00000-0 00000+0 0 9998 84 | 2 39533 54.8302 318.7691 0010016 180.4798 179.5583 2.00552304 7216 85 | GPS BIIF-6 (PRN 06) 86 | 1 39741U 14026A 15046.25679885 -.00000014 00000-0 00000+0 0 9998 87 | 2 39741 55.1038 134.3181 0002893 186.1620 173.8598 2.00561863 5495 88 | GPS BIIF-7 (PRN 09) 89 | 1 40105U 14045A 15046.84651821 .00000070 00000-0 00000+0 0 9991 90 | 2 40105 54.9036 254.2170 0002057 184.4326 175.6238 2.00564726 3953 91 | GPS BIIF-8 (PRN 03) 92 | 1 40294U 14068A 15045.22400116 .00000050 00000-0 00000+0 0 9993 93 | 2 40294 54.9727 194.4616 0010457 202.4626 157.4706 2.00553484 2143 94 | -------------------------------------------------------------------------------- /examples/SatSGP4/omnetpp.ini: -------------------------------------------------------------------------------- 1 | 2 | [Config SatSGP4] 3 | network = SatSGP4 4 | 5 | SatSGP4.satellite[*].mobilityType = "SatSGP4Mobility" 6 | 7 | **.constraintAreaMinX = 0m 8 | **.constraintAreaMaxX = 2160m 9 | 10 | **.constraintAreaMinY = 0m 11 | **.constraintAreaMaxY = 1080m 12 | 13 | **.constraintAreaMinZ = 0m 14 | **.constraintAreaMaxZ = 0m 15 | 16 | [Config SatSGP4Fisheye] 17 | network = SatSGP4Fisheye 18 | 19 | SatSGP4Fisheye.satellite[*].mobilityType = "SatSGP4FisheyeMobility" 20 | 21 | **.constraintAreaMinX = 0m 22 | **.constraintAreaMaxX = 980m 23 | 24 | **.constraintAreaMinY = 0m 25 | **.constraintAreaMaxY = 980m 26 | 27 | **.constraintAreaMinZ = 0m 28 | **.constraintAreaMaxZ = 0m 29 | 30 | SatSGP4Fisheye.satellite[*].mobility.refCenterAltitude = 100 # Variable position of observer 31 | SatSGP4Fisheye.satellite[*].mobility.refCenterLatitude = 47.53849 # Can be changed with user specific 32 | SatSGP4Fisheye.satellite[*].mobility.refCenterLongitude = 19.03839 # position values 33 | 34 | [General] 35 | # location of NED files 36 | ned-path = ../../../inet/src;../../src/os3;.; 37 | # location of images for GUI 38 | tkenv-image-path = ../../images/os3 39 | # 40 | sim-time-limit = 48h 41 | 42 | # Network parameters 43 | **.updateInterval = 20s # Interval to update the satellite positions on the map 44 | **.numOfSats = 1 # Number of satellites used in simulation. ATTENTION! Must be smaller or equal to number of satellites in choosen TLEfile 45 | 46 | # Parameters for UserConfig 47 | **.userConfig.frequency = 1e9Hz 48 | **.userConfig.min_snr = 0dBHz 49 | 50 | # 51 | # Parameters for WebServiceControl 52 | # 53 | # Insert you own API Key. You can register at http://www.worldweatheronline.com/free-weather-feed.aspx 54 | **.webServiceControl.apiKeyWeather = "" 55 | # Insert your own username from http://www.geonames.org/login 56 | **.webServiceControl.usernameAltitude = "" 57 | # (default = 100) Maximum number of saved altitude values. Be careful when changing! 58 | **.webServiceControl.altitudeCacheThreshold = 100 59 | # (default = 10) Maximum number of saved TLE data strings. Be careful when changing! 60 | **.webServiceControl.tleCacheThreshold = 10 61 | # (default = 10) Maximum number of saved weather data strings. Be careful when changing! 62 | **.webServiceControl.weatherCacheThreshold = 10 63 | 64 | # 65 | # Parameters for WeatherControl 66 | # 67 | # (default = -1 means using live weather data) Precip per hour (unit mm/(m²*h)) 68 | **.weatherControl.defaultPrecipPerHour = -1 69 | 70 | # 71 | # Parameters for Norad 72 | # 73 | # Provide the filename of the TLEs. Used by Webservice if GUI not used, 74 | # must fit the names from http://celestrak.com/NORAD/elements/xxx.txt 75 | *.satellite[*].NoradModule.TLEfile = "gps-ops.txt" 76 | 77 | # 78 | # Parameters for Calculation 79 | # 80 | # Provide the name of the Table for the Rain parameters. DO NOT CHANGE! 81 | **.calculation.rainTableFile = "../../data/TablespecRain.csv" 82 | 83 | # 84 | # Parameters for Satellite 85 | # 86 | # (default = 7dBW) Transmit power of satellites (Can be choosen individually for each satellite, see MCCs for example) 87 | *.satellite[*].transmitPower = 10dBW 88 | # default = "", satelliteName is only used if a specific satellite from a TLE file should be used instead of the first numOfSats. 89 | #*.satellite[0].satelliteName = "GPS BIIA-10 (PRN 32)" 90 | 91 | # 92 | # Parameters for Channelcontrol (INET module) 93 | # 94 | # Variable. Maximum transmit Power of a Base Station found in Germany (Usingen). 95 | # Default(20mW) Maximum sending power used for this network (in mW) 96 | *.channelcontrol.pMax = 100000W 97 | 98 | #---------------------------------------------------- 99 | # Mission Control Centers all over the world 100 | #---------------------------------------------------- 101 | 102 | **.numOfMCCs = 44 103 | 104 | # Algier 105 | SatSGP4.MCC[0].mobility.latitude = 36.46 106 | SatSGP4.MCC[0].mobility.longitude = 3.03 107 | SatSGP4.MCC[0].cityName = "Algier" 108 | 109 | # Ourgla 110 | SatSGP4.MCC[1].mobility.latitude = 31.57 111 | SatSGP4.MCC[1].mobility.longitude = 5.20 112 | SatSGP4.MCC[1].cityName = "Ourgla" 113 | 114 | # Parana, Argentinia 115 | SatSGP4.MCC[2].mobility.latitude = -31.43 116 | SatSGP4.MCC[2].mobility.longitude = -60.30 117 | SatSGP4.MCC[2].cityName = "Parana" 118 | 119 | # Rio Grande 120 | SatSGP4.MCC[3].mobility.latitude = -53.47 121 | SatSGP4.MCC[3].mobility.longitude = -67.42 122 | SatSGP4.MCC[3].cityName = "Rio Grande" 123 | 124 | # Albany 125 | SatSGP4.MCC[4].mobility.latitude = -35.01 126 | SatSGP4.MCC[4].mobility.longitude = 117.53 127 | SatSGP4.MCC[4].cityName = "Albany" 128 | 129 | # Bundaberg 130 | SatSGP4.MCC[5].mobility.latitude = -24.51 131 | SatSGP4.MCC[5].mobility.longitude = 152.2 132 | SatSGP4.MCC[5].cityName = "Bundaberg" 133 | 134 | # Brasilia 135 | SatSGP4.MCC[6].mobility.latitude = -15.47 136 | SatSGP4.MCC[6].mobility.longitude = -47.55 137 | SatSGP4.MCC[6].cityName = "Brasilia" 138 | 139 | # Manaus 140 | SatSGP4.MCC[7].mobility.latitude = -3.09 141 | SatSGP4.MCC[7].mobility.longitude = -59.58 142 | SatSGP4.MCC[7].cityName = "Manaus" 143 | 144 | # Recife 145 | SatSGP4.MCC[8].mobility.latitude = -8.01 146 | SatSGP4.MCC[8].mobility.longitude = -34.55 147 | SatSGP4.MCC[8].cityName = "Recife" 148 | 149 | # Churchill 150 | SatSGP4.MCC[9].mobility.latitude = 58.47 151 | SatSGP4.MCC[9].mobility.longitude = -94.1236 152 | SatSGP4.MCC[9].cityName = "Churchill" 153 | 154 | # Edmonton 155 | SatSGP4.MCC[10].mobility.latitude = 53.32 156 | SatSGP4.MCC[10].mobility.longitude = -113.33 157 | SatSGP4.MCC[10].cityName = "Edmonton" 158 | 159 | # Goose Bay 160 | SatSGP4.MCC[11].mobility.latitude = 53.18 161 | SatSGP4.MCC[11].mobility.longitude = -60.17 162 | SatSGP4.MCC[11].cityName = "Goose Bay" 163 | 164 | # Easter Island 165 | SatSGP4.MCC[12].mobility.latitude = -27.09 166 | SatSGP4.MCC[12].mobility.longitude = -109.23 167 | SatSGP4.MCC[12].cityName = "Easter Island" 168 | 169 | # Punta Arenas 170 | SatSGP4.MCC[13].mobility.latitude = -53.08 171 | SatSGP4.MCC[13].mobility.longitude = -70.55 172 | SatSGP4.MCC[13].cityName = "Punta Arenas" 173 | 174 | # Santiago 175 | SatSGP4.MCC[14].mobility.latitude = -33.29 176 | SatSGP4.MCC[14].mobility.longitude = -70.40 177 | SatSGP4.MCC[14].cityName = "Santiago" 178 | 179 | # Beijing 180 | SatSGP4.MCC[15].mobility.latitude = 40.15 181 | SatSGP4.MCC[15].mobility.longitude = 116.3 182 | SatSGP4.MCC[15].cityName = "Beijing" 183 | 184 | # Hong Kong 185 | SatSGP4.MCC[16].mobility.latitude = 22.30 186 | SatSGP4.MCC[16].mobility.longitude = 114.3 187 | SatSGP4.MCC[16].cityName = "Hong Kong" 188 | 189 | # Toulouse 190 | SatSGP4.MCC[17].mobility.latitude = 43.36 191 | SatSGP4.MCC[17].mobility.longitude = 1.27 192 | SatSGP4.MCC[17].cityName = "Toulouse" 193 | 194 | # Bangalore 195 | SatSGP4.MCC[18].mobility.latitude = 12.58 196 | SatSGP4.MCC[18].mobility.longitude = 77.35 197 | SatSGP4.MCC[18].cityName = "Bangalore" 198 | 199 | # Lucknow 200 | SatSGP4.MCC[19].mobility.latitude = 26.51 201 | SatSGP4.MCC[19].mobility.longitude = 80.55 202 | SatSGP4.MCC[19].cityName = "Lucknow" 203 | 204 | # Jakarta 205 | SatSGP4.MCC[20].mobility.latitude = -6.11 206 | SatSGP4.MCC[20].mobility.longitude = 106.48 207 | SatSGP4.MCC[20].cityName = "Jakarta" 208 | 209 | # Bari 210 | SatSGP4.MCC[21].mobility.latitude = 41.07 211 | SatSGP4.MCC[21].mobility.longitude = 16.52 212 | SatSGP4.MCC[21].cityName = "Bari" 213 | 214 | # Keelung 215 | SatSGP4.MCC[22].mobility.latitude = 25.07 216 | SatSGP4.MCC[22].mobility.longitude = 121.43 217 | SatSGP4.MCC[22].cityName = "Keelung" 218 | 219 | # Yokohama 220 | SatSGP4.MCC[23].mobility.latitude = 35.27 221 | SatSGP4.MCC[23].mobility.longitude = 139.35 222 | SatSGP4.MCC[23].cityName = "Yokohama" 223 | 224 | # Incheon 225 | SatSGP4.MCC[24].mobility.latitude = 37.26 226 | SatSGP4.MCC[24].mobility.longitude = 126.39 227 | SatSGP4.MCC[24].cityName = "Incheon" 228 | 229 | # Wellington 230 | SatSGP4.MCC[25].mobility.latitude = -41.17 231 | SatSGP4.MCC[25].mobility.longitude = 174.46 232 | SatSGP4.MCC[25].cityName = "Wellington" 233 | 234 | # Abuja 235 | SatSGP4.MCC[26].mobility.latitude = 9.04 236 | SatSGP4.MCC[26].mobility.longitude = 7.29 237 | SatSGP4.MCC[26].cityName = "Abuja" 238 | 239 | # Tromsoe 240 | SatSGP4.MCC[27].mobility.latitude = 69.39 241 | SatSGP4.MCC[27].mobility.longitude = 18.57 242 | SatSGP4.MCC[27].cityName = "Tromsoe" 243 | 244 | # Spitsbergen 245 | SatSGP4.MCC[28].mobility.latitude = 77.33 246 | SatSGP4.MCC[28].mobility.longitude = 23.48 247 | SatSGP4.MCC[28].cityName = "Spitsbergen" 248 | 249 | # Callao 250 | SatSGP4.MCC[29].mobility.latitude = -12.03 251 | SatSGP4.MCC[29].mobility.longitude = -77.09 252 | SatSGP4.MCC[29].cityName = "Callao" 253 | 254 | # Arkhangelsk 255 | SatSGP4.MCC[30].mobility.latitude = 64.32 256 | SatSGP4.MCC[30].mobility.longitude = 40.38 257 | SatSGP4.MCC[30].cityName = "Arkhangelsk" 258 | 259 | # Nakhodka 260 | SatSGP4.MCC[31].mobility.latitude = 42.48 261 | SatSGP4.MCC[31].mobility.longitude = 132.52 262 | SatSGP4.MCC[31].cityName = "Nakhodka" 263 | 264 | # Jeddah 265 | SatSGP4.MCC[32].mobility.latitude = 21.27 266 | SatSGP4.MCC[32].mobility.longitude = 39.11 267 | SatSGP4.MCC[32].cityName = "Jeddah" 268 | 269 | # Singapore 270 | SatSGP4.MCC[33].mobility.latitude = 1.20 271 | SatSGP4.MCC[33].mobility.longitude = 103.49 272 | SatSGP4.MCC[33].cityName = "Singapore" 273 | 274 | # Cape Town 275 | SatSGP4.MCC[34].mobility.latitude = -33.57 276 | SatSGP4.MCC[34].mobility.longitude = 18.25 277 | SatSGP4.MCC[34].cityName = "Cape Town" 278 | 279 | # Maspalomas 280 | SatSGP4.MCC[35].mobility.latitude = 27.45 281 | SatSGP4.MCC[35].mobility.longitude = -15.34 282 | SatSGP4.MCC[35].cityName = "Maspalomas" 283 | 284 | # Bangkok 285 | SatSGP4.MCC[36].mobility.latitude = 13.43 286 | SatSGP4.MCC[36].mobility.longitude = 100.31 287 | SatSGP4.MCC[36].cityName = "Bangkok" 288 | 289 | # Ankara 290 | SatSGP4.MCC[37].mobility.latitude = 39.42 291 | SatSGP4.MCC[37].mobility.longitude = 32.21 292 | SatSGP4.MCC[37].cityName = "Ankara" 293 | 294 | # Combe Martin 295 | SatSGP4.MCC[38].mobility.latitude = 51.11 296 | SatSGP4.MCC[38].mobility.longitude = -4.01 297 | SatSGP4.MCC[38].cityName = "Combe Martin" 298 | 299 | # Alaska 300 | SatSGP4.MCC[39].mobility.latitude = 64 301 | SatSGP4.MCC[39].mobility.longitude = -152.30 302 | SatSGP4.MCC[39].cityName = "Alaska" 303 | 304 | # Florida 305 | SatSGP4.MCC[40].mobility.latitude = 28.23 306 | SatSGP4.MCC[40].mobility.longitude = -80.36 307 | SatSGP4.MCC[40].cityName = "Florida" 308 | 309 | # Guam 310 | SatSGP4.MCC[41].mobility.latitude = 13.30 311 | SatSGP4.MCC[41].mobility.longitude = 144.30 312 | SatSGP4.MCC[41].cityName = "Guam" 313 | 314 | # Hawaii 315 | SatSGP4.MCC[42].mobility.latitude = 23.45 316 | SatSGP4.MCC[42].mobility.longitude = -166.18 317 | SatSGP4.MCC[42].cityName = "Hawaii" 318 | 319 | # Haiphong 320 | SatSGP4.MCC[43].mobility.latitude = 20.52 321 | SatSGP4.MCC[43].mobility.longitude = 106.41 322 | SatSGP4.MCC[43].cityName = "Haiphong" 323 | 324 | -------------------------------------------------------------------------------- /examples/SatSGP4/package.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.SatSGP4; 3 | 4 | -------------------------------------------------------------------------------- /examples/SatSGP4/run-sim.sh: -------------------------------------------------------------------------------- 1 | # 2 | # ../../src/run_os3 3 | # 4 | opp_run -l ../../src/os3 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/Validation/GPS.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.Validation; 3 | 4 | import os3.base.Satellite; 5 | import inet.world.radio.ChannelControl; 6 | import os3.base.CNI_OS3; 7 | import os3.base.Observer; 8 | 9 | network GPS 10 | { 11 | parameters: 12 | int numOfSats; 13 | 14 | @display("bgi=binocular,c;bgb=980,980"); 15 | 16 | submodules: 17 | satellite[numOfSats]: Satellite { 18 | parameters: 19 | @display("p=70,180;r=10,,#707070;i=device/satellite_l"); 20 | } 21 | channelcontrol: ChannelControl { 22 | parameters: 23 | numChannels = 2; 24 | @display("p=180,70;i=misc/sun"); 25 | } 26 | cni_os3: CNI_OS3 { 27 | @display("p=50,70,i;i=old/bluebox"); 28 | } 29 | observer: Observer { 30 | @display("p=490,490"); 31 | numgps = numOfSats; 32 | } 33 | connections allowunconnected: 34 | } 35 | 36 | -------------------------------------------------------------------------------- /examples/Validation/Validate.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.Validation; 3 | 4 | import os3.base.Satellite; 5 | import inet.world.radio.ChannelControl; 6 | import os3.base.CNI_OS3; 7 | import os3.base.Observer; 8 | 9 | // 10 | // Network Validate used to show Observer functionalities 11 | // 12 | network Validate 13 | { 14 | parameters: 15 | int numOfSats; 16 | 17 | @display("bgi=background_earth;bgb=2160,1080"); 18 | 19 | submodules: 20 | satellite[numOfSats]: Satellite { 21 | parameters: 22 | @display("p=80,200;r=10,,#707070;i=device/satellite_l"); 23 | } 24 | channelcontrol: ChannelControl { 25 | parameters: 26 | numChannels = 2; 27 | @display("p=220,70;i=misc/sun"); 28 | } 29 | cni_os3: CNI_OS3 { 30 | @display("p=80,70,i;i=old/bluebox"); 31 | } 32 | observer: Observer { 33 | numgps = 0; 34 | @display("p=220,200"); 35 | } 36 | connections allowunconnected: 37 | } 38 | -------------------------------------------------------------------------------- /examples/Validation/gps-ops.txt: -------------------------------------------------------------------------------- 1 | GPS BIIA-10 (PRN 32) 2 | 1 20959U 90103A 15046.67351132 .00000041 00000-0 00000+0 0 9996 3 | 2 20959 54.2698 199.1668 0113185 0.0642 359.9021 2.00574874177407 4 | GPS BIIA-23 (PRN 04) 5 | 1 22877U 93068A 15047.10222014 -.00000012 00000-0 00000+0 0 9994 6 | 2 22877 53.8274 133.6286 0108442 59.5746 302.9999 2.00556928156135 7 | GPS BIIA-26 (PRN 10) 8 | 1 23953U 96041A 15047.44909635 .00000027 00000-0 00000+0 0 9997 9 | 2 23953 53.9447 194.9431 0143843 52.1820 33.2059 2.00564053136218 10 | GPS BIIR-2 (PRN 13) 11 | 1 24876U 97035A 15047.50821044 .00000063 00000-0 00000+0 0 9990 12 | 2 24876 55.8667 260.6947 0051525 119.2954 255.6926 2.00561986128754 13 | GPS BIIA-28 (PRN 08) 14 | 1 25030U 97067A 15047.15781539 -.00000046 00000-0 00000+0 0 9995 15 | 2 25030 56.9993 321.8632 0145160 206.6773 47.8221 2.00576804126641 16 | GPS BIIR-3 (PRN 11) 17 | 1 25933U 99055A 15046.60076136 -.00000012 00000-0 10000-3 0 9993 18 | 2 25933 51.1305 115.1208 0154083 79.3593 282.4268 2.00556713112559 19 | GPS BIIR-4 (PRN 20) 20 | 1 26360U 00025A 15047.38107291 .00000020 00000-0 00000+0 0 9993 21 | 2 26360 53.0819 190.3990 0055907 69.7752 351.2609 2.00318257108258 22 | GPS BIIR-5 (PRN 28) 23 | 1 26407U 00040A 15047.36199160 -.00000044 00000-0 00000+0 0 9993 24 | 2 26407 56.6365 18.3403 0199115 264.1928 312.0758 2.00561997106933 25 | GPS BIIR-6 (PRN 14) 26 | 1 26605U 00071A 15047.30210666 .00000065 00000-0 00000+0 0 9998 27 | 2 26605 55.4372 258.7592 0079540 247.4707 212.4712 2.00549981104520 28 | GPS BIIR-7 (PRN 18) 29 | 1 26690U 01004A 15047.47352072 .00000023 00000-0 00000+0 0 9999 30 | 2 26690 53.0152 193.4142 0159691 246.2007 72.0726 2.00552508102933 31 | GPS BIIR-8 (PRN 16) 32 | 1 27663U 03005A 15047.22658583 -.00000044 00000-0 00000+0 0 9996 33 | 2 27663 56.7173 18.0322 0080644 12.2320 223.2494 2.00554730 88281 34 | GPS BIIR-9 (PRN 21) 35 | 1 27704U 03010A 15047.43188862 -.00000011 00000-0 00000+0 0 9993 36 | 2 27704 53.4832 133.6130 0224605 248.7136 100.3884 2.00570585 87094 37 | GPS BIIR-10 (PRN 22) 38 | 1 28129U 03058A 15047.05864374 .00000026 00000-0 00000+0 0 9999 39 | 2 28129 52.8894 193.5098 0077266 242.1503 104.8680 2.00559611 81780 40 | GPS BIIR-11 (PRN 19) 41 | 1 28190U 04009A 15046.64607954 .00000014 00000-0 00000+0 0 9994 42 | 2 28190 55.4900 79.8172 0108778 28.3566 64.7570 2.00560737 79959 43 | GPS BIIR-12 (PRN 23) 44 | 1 28361U 04023A 15047.31049847 .00000065 00000-0 00000+0 0 9992 45 | 2 28361 54.3929 254.7421 0098811 205.5990 156.7305 2.00564964 78059 46 | GPS BIIR-13 (PRN 02) 47 | 1 28474U 04045A 15047.40354787 -.00000010 00000-0 00000+0 0 9994 48 | 2 28474 53.8825 132.7341 0145612 227.7890 204.0219 2.00551506 75412 49 | GPS BIIRM-1 (PRN 17) 50 | 1 28874U 05038A 15046.36445850 .00000013 00000-0 00000+0 0 9999 51 | 2 28874 55.6574 76.9670 0102806 244.0189 265.5879 2.00558188 68792 52 | GPS BIIRM-2 (PRN 31) 53 | 1 29486U 06042A 15047.16323734 -.00000039 00000-0 00000+0 0 9999 54 | 2 29486 55.9294 316.2522 0084016 327.1610 319.6110 2.00556605 61529 55 | GPS BIIRM-3 (PRN 12) 56 | 1 29601U 06052A 15047.45200142 -.00000046 00000-0 00000+0 0 9996 57 | 2 29601 56.6855 16.9549 0052209 27.2480 148.7658 2.00557368 60449 58 | GPS BIIRM-4 (PRN 15) 59 | 1 32260U 07047A 15046.95848635 .00000067 00000-0 00000+0 0 9997 60 | 2 32260 53.5260 251.8522 0070092 19.7883 290.1150 2.00571793 53825 61 | GPS BIIRM-5 (PRN 29) 62 | 1 32384U 07062A 15047.43163481 .00000017 00000-0 00000+0 0 9999 63 | 2 32384 55.7049 77.4557 0015036 306.0380 125.2273 2.00577989 52569 64 | GPS BIIRM-6 (PRN 07) 65 | 1 32711U 08012A 15046.93145336 -.00000039 00000-0 00000+0 0 9997 66 | 2 32711 55.6498 315.8432 0080879 204.1918 155.4716 2.00556407 50751 67 | GPS BIIRM-8 (PRN 05) 68 | 1 35752U 09043A 15047.44814862 .00000026 00000-0 00000+0 0 9999 69 | 2 35752 54.2431 194.0447 0039430 20.7457 14.7022 2.00550938 40345 70 | GPS BIIF-1 (PRN 25) 71 | 1 36585U 10022A 15047.54932178 -.00000051 00000-0 00000+0 0 9994 72 | 2 36585 56.0302 14.3463 0041055 35.2343 179.3794 2.00558558 34590 73 | GPS BIIF-2 (PRN 01) 74 | 1 37753U 11036A 15047.11171088 -.00000011 00000-0 00000+0 0 9992 75 | 2 37753 55.1084 134.7726 0038050 19.7772 323.8239 2.00563803 26251 76 | GPS BIIF-3 (PRN 24) 77 | 1 38833U 12053A 15047.12312602 -.00000036 00000-0 00000+0 0 9999 78 | 2 38833 54.6883 313.5919 0030255 12.6446 347.4781 2.00562215 17331 79 | GPS BIIF-4 (PRN 27) 80 | 1 39166U 13023A 15045.47973794 .00000008 00000-0 10000-3 0 9991 81 | 2 39166 55.3617 74.3025 0018773 1.1836 358.8884 2.00562271 12822 82 | GPS BIIF-5 (PRN 30) 83 | 1 39533U 14008A 15046.47254806 -.00000046 00000-0 00000+0 0 9998 84 | 2 39533 54.8302 318.7691 0010016 180.4798 179.5583 2.00552304 7216 85 | GPS BIIF-6 (PRN 06) 86 | 1 39741U 14026A 15046.25679885 -.00000014 00000-0 00000+0 0 9998 87 | 2 39741 55.1038 134.3181 0002893 186.1620 173.8598 2.00561863 5495 88 | GPS BIIF-7 (PRN 09) 89 | 1 40105U 14045A 15046.84651821 .00000070 00000-0 00000+0 0 9991 90 | 2 40105 54.9036 254.2170 0002057 184.4326 175.6238 2.00564726 3953 91 | GPS BIIF-8 (PRN 03) 92 | 1 40294U 14068A 15045.22400116 .00000050 00000-0 00000+0 0 9993 93 | 2 40294 54.9727 194.4616 0010457 202.4626 157.4706 2.00553484 2143 94 | -------------------------------------------------------------------------------- /examples/Validation/omnetpp.ini: -------------------------------------------------------------------------------- 1 | 2 | [Config Validate_ISS] 3 | network = Validate 4 | 5 | Validate.satellite[*].mobilityType = "SatSGP4Mobility" 6 | 7 | # Number of satellites used in simulation. ATTENTION! Must be smaller or equal 8 | # to number of satellites in choosen TLEfile. Observer tracks only one satellite! 9 | **.numOfSats = 1 10 | 11 | # Parameters for Norad 12 | # Provide the filename of the TLEs. Used by Webservice if GUI not used, 13 | # must fit the names from http://celestrak.com/NORAD/elements/xxx.txt 14 | *.satellite[*].NoradModule.TLEfile = "gps-ops.txt" 15 | 16 | **.observer.gps = false 17 | 18 | [Config GPS_cn0] 19 | network = GPS 20 | 21 | GPS.satellite[*].mobilityType = "SatSGP4FisheyeMobility" 22 | 23 | GPS.satellite[*].mobility.refCenterAltitude = 0 # Variable position of observer 24 | GPS.satellite[*].mobility.refCenterLatitude = 51.4923 # Can be changed with user specific 25 | GPS.satellite[*].mobility.refCenterLongitude = 7.4121 # Position values 26 | **.numOfSats = 31 # Number of satellites used in simulation. ATTENTION! Must be smaller or equal to number of satellites in choosen TLEfile. Observer tracks only one satellite! 27 | # Parameters for Norad 28 | *.satellite[*].NoradModule.TLEfile = "gps-ops.txt" # Provide the filename of the TLEs. Used by Webservice if GUI not used, must fit the names from http://celestrak.com/NORAD/elements/xxx.txt 29 | 30 | **.observer.gps = true 31 | 32 | # Parameters for WeatherControl 33 | **.weatherControl.defaultPrecipPerHour = -1 # (default = -1 means using live weather data) Precip per hour (unit mm/(m²*h)) 34 | 35 | [General] 36 | # location of NED files 37 | ned-path = ../../../inet/src;../../src/os3;.; 38 | # location of images for GUI 39 | tkenv-image-path = ../../images/os3 40 | # 41 | sim-time-limit = 216h 42 | 43 | **.constraintAreaMinX = 0m 44 | **.constraintAreaMaxX = 2160m 45 | 46 | **.constraintAreaMinY = 0m 47 | **.constraintAreaMaxY = 1080m 48 | 49 | **.constraintAreaMinZ = 0m 50 | **.constraintAreaMaxZ = 0m 51 | 52 | # Network parameters 53 | **.updateInterval = 20s # Interval to update the satellite positions on the map 54 | 55 | # Parameters for Observer 56 | **.ObserverAltitude = 0 # Variable Position 57 | **.ObserverLatitude = 51.4923 # Of Observer 58 | **.ObserverLongitude = 7.4121 # Can be set individually 59 | **.TimerInterval = 20s # Update interval for Observer. Note: Make it at least as large as update interval for satellites! 60 | 61 | # Parameters for UserConfig 62 | **.userConfig.frequency = 1e9Hz 63 | **.userConfig.min_snr = 0dBHz 64 | 65 | # 66 | # Parameters for WebServiceControl 67 | # 68 | # Insert you own API Key. You can register at http://www.worldweatheronline.com/free-weather-feed.aspx 69 | #**.webServiceControl.apiKeyWeather = "" 70 | # Insert your own username from http://www.geonames.org/login 71 | #**.webServiceControl.usernameAltitude = "" 72 | 73 | # Parameters for testing SNR (you have to comment in the parts in observer.cc too, to test this 74 | #*.satellite[*].NoradModule.TLEfile = "geo.txt" 75 | #*.satellite[0].satelliteName = "ASTRA 1L" 76 | 77 | # Parameters for Calculation 78 | **.calculation.rainTableFile = "../../data/TablespecRain.csv" # Provide the name of the Table for the Rain parameters. DO NOT CHANGE! 79 | 80 | # Parameters for Channelcontrol (INET module) 81 | # Variable. Maximum transmit Power of a Base Station found in Germany (Usingen). 82 | # Default(20mW) Maximum sending power used for this network (in mW) 83 | *.channelcontrol.pMax = 100000W 84 | -------------------------------------------------------------------------------- /examples/Validation/package.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.Validation; 3 | 4 | -------------------------------------------------------------------------------- /examples/Validation/run-sim.sh: -------------------------------------------------------------------------------- 1 | # 2 | # ../../src/run_os3 3 | # 4 | opp_run -l ../../src/os3 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/groundstations/GroundStations.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.groundstations; 3 | 4 | import os3.base.MissionControlCenter; 5 | 6 | network GroundStations 7 | { 8 | parameters: 9 | int numOfMCCs; 10 | @display("bgi=background_earth;bgb=2160,1080"); 11 | 12 | submodules: 13 | mcc[numOfMCCs]: MissionControlCenter { 14 | parameters: 15 | @display("p=240,150;i=misc/building;r=10,,black"); 16 | } 17 | connections allowunconnected: 18 | } 19 | -------------------------------------------------------------------------------- /examples/groundstations/omnetpp.ini: -------------------------------------------------------------------------------- 1 | 2 | [General] 3 | # location of NED files 4 | ned-path = ../../../inet/src;../../src/os3;.; 5 | # location of images for GUI 6 | tkenv-image-path = ../../images/os3 7 | # 8 | sim-time-limit = 48h 9 | 10 | [Config GroundStations] 11 | network = GroundStations 12 | 13 | **.constraintAreaMinX = 0m 14 | **.constraintAreaMaxX = 2160m 15 | 16 | **.constraintAreaMinY = 0m 17 | **.constraintAreaMaxY = 1080m 18 | 19 | **.constraintAreaMinZ = 0m 20 | **.constraintAreaMaxZ = 0m 21 | 22 | #---------------------------------------------------- 23 | # Mission Control Centers all over the world 24 | #---------------------------------------------------- 25 | 26 | **.numOfMCCs = 44 27 | 28 | # Algier 29 | **.mcc[0].mobility.latitude = 36.46 30 | **.mcc[0].mobility.longitude = 3.03 31 | **.mcc[0].cityName = "Algier" 32 | 33 | # Ourgla 34 | **.mcc[1].mobility.latitude = 31.57 35 | **.mcc[1].mobility.longitude = 5.20 36 | **.mcc[1].cityName = "Ourgla" 37 | 38 | # Parana, Argentinia 39 | **.mcc[2].mobility.latitude = -31.43 40 | **.mcc[2].mobility.longitude = -60.30 41 | **.mcc[2].cityName = "Parana" 42 | 43 | # Rio Grande 44 | **.mcc[3].mobility.latitude = -53.47 45 | **.mcc[3].mobility.longitude = -67.42 46 | **.mcc[3].cityName = "Rio Grande" 47 | 48 | # Albany 49 | **.mcc[4].mobility.latitude = -35.01 50 | **.mcc[4].mobility.longitude = 117.53 51 | **.mcc[4].cityName = "Albany" 52 | 53 | # Bundaberg 54 | **.mcc[5].mobility.latitude = -24.51 55 | **.mcc[5].mobility.longitude = 152.2 56 | **.mcc[5].cityName = "Bundaberg" 57 | 58 | # Brasilia 59 | **.mcc[6].mobility.latitude = -15.47 60 | **.mcc[6].mobility.longitude = -47.55 61 | **.mcc[6].cityName = "Brasilia" 62 | 63 | # Manaus 64 | **.mcc[7].mobility.latitude = -3.09 65 | **.mcc[7].mobility.longitude = -59.58 66 | **.mcc[7].cityName = "Manaus" 67 | 68 | # Recife 69 | **.mcc[8].mobility.latitude = -8.01 70 | **.mcc[8].mobility.longitude = -34.55 71 | **.mcc[8].cityName = "Recife" 72 | 73 | # Churchill 74 | **.mcc[9].mobility.latitude = 58.47 75 | **.mcc[9].mobility.longitude = -94.1236 76 | **.mcc[9].cityName = "Churchill" 77 | 78 | # Edmonton 79 | **.mcc[10].mobility.latitude = 53.32 80 | **.mcc[10].mobility.longitude = -113.33 81 | **.mcc[10].cityName = "Edmonton" 82 | 83 | # Goose Bay 84 | **.mcc[11].mobility.latitude = 53.18 85 | **.mcc[11].mobility.longitude = -60.17 86 | **.mcc[11].cityName = "Goose Bay" 87 | 88 | # Easter Island 89 | **.mcc[12].mobility.latitude = -27.09 90 | **.mcc[12].mobility.longitude = -109.23 91 | **.mcc[12].cityName = "Easter Island" 92 | 93 | # Punta Arenas 94 | **.mcc[13].mobility.latitude = -53.08 95 | **.mcc[13].mobility.longitude = -70.55 96 | **.mcc[13].cityName = "Punta Arenas" 97 | 98 | # Santiago 99 | **.mcc[14].mobility.latitude = -33.29 100 | **.mcc[14].mobility.longitude = -70.40 101 | **.mcc[14].cityName = "Santiago" 102 | 103 | # Beijing 104 | **.mcc[15].mobility.latitude = 40.15 105 | **.mcc[15].mobility.longitude = 116.3 106 | **.mcc[15].cityName = "Beijing" 107 | 108 | # Hong Kong 109 | **.mcc[16].mobility.latitude = 22.30 110 | **.mcc[16].mobility.longitude = 114.3 111 | **.mcc[16].cityName = "Hong Kong" 112 | 113 | # Toulouse 114 | **.mcc[17].mobility.latitude = 43.36 115 | **.mcc[17].mobility.longitude = 1.27 116 | **.mcc[17].cityName = "Toulouse" 117 | 118 | # Bangalore 119 | **.mcc[18].mobility.latitude = 12.58 120 | **.mcc[18].mobility.longitude = 77.35 121 | **.mcc[18].cityName = "Bangalore" 122 | 123 | # Lucknow 124 | **.mcc[19].mobility.latitude = 26.51 125 | **.mcc[19].mobility.longitude = 80.55 126 | **.mcc[19].cityName = "Lucknow" 127 | 128 | # Jakarta 129 | **.mcc[20].mobility.latitude = -6.11 130 | **.mcc[20].mobility.longitude = 106.48 131 | **.mcc[20].cityName = "Jakarta" 132 | 133 | # Bari 134 | **.mcc[21].mobility.latitude = 41.07 135 | **.mcc[21].mobility.longitude = 16.52 136 | **.mcc[21].cityName = "Bari" 137 | 138 | # Keelung 139 | **.mcc[22].mobility.latitude = 25.07 140 | **.mcc[22].mobility.longitude = 121.43 141 | **.mcc[22].cityName = "Keelung" 142 | 143 | # Yokohama 144 | **.mcc[23].mobility.latitude = 35.27 145 | **.mcc[23].mobility.longitude = 139.35 146 | **.mcc[23].cityName = "Yokohama" 147 | 148 | # Incheon 149 | **.mcc[24].mobility.latitude = 37.26 150 | **.mcc[24].mobility.longitude = 126.39 151 | **.mcc[24].cityName = "Incheon" 152 | 153 | # Wellington 154 | **.mcc[25].mobility.latitude = -41.17 155 | **.mcc[25].mobility.longitude = 174.46 156 | **.mcc[25].cityName = "Wellington" 157 | 158 | # Abuja 159 | **.mcc[26].mobility.latitude = 9.04 160 | **.mcc[26].mobility.longitude = 7.29 161 | **.mcc[26].cityName = "Abuja" 162 | 163 | # Tromsoe 164 | **.mcc[27].mobility.latitude = 69.39 165 | **.mcc[27].mobility.longitude = 18.57 166 | **.mcc[27].cityName = "Tromsoe" 167 | 168 | # Spitsbergen 169 | **.mcc[28].mobility.latitude = 77.33 170 | **.mcc[28].mobility.longitude = 23.48 171 | **.mcc[28].cityName = "Spitsbergen" 172 | 173 | # Callao 174 | **.mcc[29].mobility.latitude = -12.03 175 | **.mcc[29].mobility.longitude = -77.09 176 | **.mcc[29].cityName = "Callao" 177 | 178 | # Arkhangelsk 179 | **.mcc[30].mobility.latitude = 64.32 180 | **.mcc[30].mobility.longitude = 40.38 181 | **.mcc[30].cityName = "Arkhangelsk" 182 | 183 | # Nakhodka 184 | **.mcc[31].mobility.latitude = 42.48 185 | **.mcc[31].mobility.longitude = 132.52 186 | **.mcc[31].cityName = "Nakhodka" 187 | 188 | # Jeddah 189 | **.mcc[32].mobility.latitude = 21.27 190 | **.mcc[32].mobility.longitude = 39.11 191 | **.mcc[32].cityName = "Jeddah" 192 | 193 | # Singapore 194 | **.mcc[33].mobility.latitude = 1.20 195 | **.mcc[33].mobility.longitude = 103.49 196 | **.mcc[33].cityName = "Singapore" 197 | 198 | # Cape Town 199 | **.mcc[34].mobility.latitude = -33.57 200 | **.mcc[34].mobility.longitude = 18.25 201 | **.mcc[34].cityName = "Cape Town" 202 | 203 | # Maspalomas 204 | **.mcc[35].mobility.latitude = 27.45 205 | **.mcc[35].mobility.longitude = -15.34 206 | **.mcc[35].cityName = "Maspalomas" 207 | 208 | # Bangkok 209 | **.mcc[36].mobility.latitude = 13.43 210 | **.mcc[36].mobility.longitude = 100.31 211 | **.mcc[36].cityName = "Bangkok" 212 | 213 | # Ankara 214 | **.mcc[37].mobility.latitude = 39.42 215 | **.mcc[37].mobility.longitude = 32.21 216 | **.mcc[37].cityName = "Ankara" 217 | 218 | # Combe Martin 219 | **.mcc[38].mobility.latitude = 51.11 220 | **.mcc[38].mobility.longitude = -4.01 221 | **.mcc[38].cityName = "Combe Martin" 222 | 223 | # Alaska 224 | **.mcc[39].mobility.latitude = 64 225 | **.mcc[39].mobility.longitude = -152.30 226 | **.mcc[39].cityName = "Alaska" 227 | 228 | # Florida 229 | **.mcc[40].mobility.latitude = 28.23 230 | **.mcc[40].mobility.longitude = -80.36 231 | **.mcc[40].cityName = "Florida" 232 | 233 | # Guam 234 | **.mcc[41].mobility.latitude = 13.30 235 | **.mcc[41].mobility.longitude = 144.30 236 | **.mcc[41].cityName = "Guam" 237 | 238 | # Hawaii 239 | **.mcc[42].mobility.latitude = 23.45 240 | **.mcc[42].mobility.longitude = -166.18 241 | **.mcc[42].cityName = "Hawaii" 242 | 243 | # Haiphong 244 | **.mcc[43].mobility.latitude = 20.52 245 | **.mcc[43].mobility.longitude = 106.41 246 | **.mcc[43].cityName = "Haiphong" 247 | -------------------------------------------------------------------------------- /examples/groundstations/package.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.groundstations; 3 | 4 | -------------------------------------------------------------------------------- /examples/groundstations/run-sim.sh: -------------------------------------------------------------------------------- 1 | # 2 | # ../../src/run_os3 3 | # 4 | opp_run -l ../../src/os3 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd `dirname $0` 3 | # 4 | # executable 5 | #../src/os3 -n .:../src $* 6 | # shared lib 7 | opp_run -l ../src/os3 -n .:../src $* 8 | 9 | -------------------------------------------------------------------------------- /examples/satellites/SatSGP4.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.satellites; 3 | 4 | import os3.base.Satellite; 5 | import os3.base.MissionControlCenter; 6 | 7 | // 8 | // Network SatSGP4 enables satellite movement on worldmap 9 | // 10 | network SatSGP4 11 | { 12 | parameters: 13 | int numOfSats; // Number of satellites 14 | int numOfMCCs; // Number of Mission Control Centers 15 | 16 | @display("bgi=background_earth;bgb=2160,1080"); 17 | 18 | submodules: 19 | satellite[numOfSats]: Satellite { 20 | parameters: 21 | @display("p=96,92;r=10,,#707070;i=device/satellite_l"); 22 | } 23 | MCC[numOfMCCs]: MissionControlCenter { 24 | parameters: 25 | @display("p=232,92;i=misc/building;r=10,,black"); 26 | } 27 | connections allowunconnected: 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/satellites/SatSGP4Fisheye.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.satellites; 3 | 4 | import os3.base.Satellite; 5 | 6 | // 7 | // Network SatSGP4Fisheye enables satellite movement in fisheye view 8 | // 9 | network SatSGP4Fisheye 10 | { 11 | parameters: 12 | int numOfSats; // Number of satellites 13 | 14 | @display("bgi=binocular,c;bgb=980,980"); 15 | 16 | submodules: 17 | satellite[numOfSats]: Satellite { 18 | parameters: 19 | @display("p=73,74;r=10,,#707070;i=device/satellite_l"); 20 | } 21 | 22 | connections allowunconnected: 23 | } 24 | -------------------------------------------------------------------------------- /examples/satellites/gps-ops.txt: -------------------------------------------------------------------------------- 1 | GPS BIIA-10 (PRN 32) 2 | 1 20959U 90103A 15046.67351132 .00000041 00000-0 00000+0 0 9996 3 | 2 20959 54.2698 199.1668 0113185 0.0642 359.9021 2.00574874177407 4 | GPS BIIA-23 (PRN 04) 5 | 1 22877U 93068A 15047.10222014 -.00000012 00000-0 00000+0 0 9994 6 | 2 22877 53.8274 133.6286 0108442 59.5746 302.9999 2.00556928156135 7 | GPS BIIA-26 (PRN 10) 8 | 1 23953U 96041A 15047.44909635 .00000027 00000-0 00000+0 0 9997 9 | 2 23953 53.9447 194.9431 0143843 52.1820 33.2059 2.00564053136218 10 | GPS BIIR-2 (PRN 13) 11 | 1 24876U 97035A 15047.50821044 .00000063 00000-0 00000+0 0 9990 12 | 2 24876 55.8667 260.6947 0051525 119.2954 255.6926 2.00561986128754 13 | GPS BIIA-28 (PRN 08) 14 | 1 25030U 97067A 15047.15781539 -.00000046 00000-0 00000+0 0 9995 15 | 2 25030 56.9993 321.8632 0145160 206.6773 47.8221 2.00576804126641 16 | GPS BIIR-3 (PRN 11) 17 | 1 25933U 99055A 15046.60076136 -.00000012 00000-0 10000-3 0 9993 18 | 2 25933 51.1305 115.1208 0154083 79.3593 282.4268 2.00556713112559 19 | GPS BIIR-4 (PRN 20) 20 | 1 26360U 00025A 15047.38107291 .00000020 00000-0 00000+0 0 9993 21 | 2 26360 53.0819 190.3990 0055907 69.7752 351.2609 2.00318257108258 22 | GPS BIIR-5 (PRN 28) 23 | 1 26407U 00040A 15047.36199160 -.00000044 00000-0 00000+0 0 9993 24 | 2 26407 56.6365 18.3403 0199115 264.1928 312.0758 2.00561997106933 25 | GPS BIIR-6 (PRN 14) 26 | 1 26605U 00071A 15047.30210666 .00000065 00000-0 00000+0 0 9998 27 | 2 26605 55.4372 258.7592 0079540 247.4707 212.4712 2.00549981104520 28 | GPS BIIR-7 (PRN 18) 29 | 1 26690U 01004A 15047.47352072 .00000023 00000-0 00000+0 0 9999 30 | 2 26690 53.0152 193.4142 0159691 246.2007 72.0726 2.00552508102933 31 | GPS BIIR-8 (PRN 16) 32 | 1 27663U 03005A 15047.22658583 -.00000044 00000-0 00000+0 0 9996 33 | 2 27663 56.7173 18.0322 0080644 12.2320 223.2494 2.00554730 88281 34 | GPS BIIR-9 (PRN 21) 35 | 1 27704U 03010A 15047.43188862 -.00000011 00000-0 00000+0 0 9993 36 | 2 27704 53.4832 133.6130 0224605 248.7136 100.3884 2.00570585 87094 37 | GPS BIIR-10 (PRN 22) 38 | 1 28129U 03058A 15047.05864374 .00000026 00000-0 00000+0 0 9999 39 | 2 28129 52.8894 193.5098 0077266 242.1503 104.8680 2.00559611 81780 40 | GPS BIIR-11 (PRN 19) 41 | 1 28190U 04009A 15046.64607954 .00000014 00000-0 00000+0 0 9994 42 | 2 28190 55.4900 79.8172 0108778 28.3566 64.7570 2.00560737 79959 43 | GPS BIIR-12 (PRN 23) 44 | 1 28361U 04023A 15047.31049847 .00000065 00000-0 00000+0 0 9992 45 | 2 28361 54.3929 254.7421 0098811 205.5990 156.7305 2.00564964 78059 46 | GPS BIIR-13 (PRN 02) 47 | 1 28474U 04045A 15047.40354787 -.00000010 00000-0 00000+0 0 9994 48 | 2 28474 53.8825 132.7341 0145612 227.7890 204.0219 2.00551506 75412 49 | GPS BIIRM-1 (PRN 17) 50 | 1 28874U 05038A 15046.36445850 .00000013 00000-0 00000+0 0 9999 51 | 2 28874 55.6574 76.9670 0102806 244.0189 265.5879 2.00558188 68792 52 | GPS BIIRM-2 (PRN 31) 53 | 1 29486U 06042A 15047.16323734 -.00000039 00000-0 00000+0 0 9999 54 | 2 29486 55.9294 316.2522 0084016 327.1610 319.6110 2.00556605 61529 55 | GPS BIIRM-3 (PRN 12) 56 | 1 29601U 06052A 15047.45200142 -.00000046 00000-0 00000+0 0 9996 57 | 2 29601 56.6855 16.9549 0052209 27.2480 148.7658 2.00557368 60449 58 | GPS BIIRM-4 (PRN 15) 59 | 1 32260U 07047A 15046.95848635 .00000067 00000-0 00000+0 0 9997 60 | 2 32260 53.5260 251.8522 0070092 19.7883 290.1150 2.00571793 53825 61 | GPS BIIRM-5 (PRN 29) 62 | 1 32384U 07062A 15047.43163481 .00000017 00000-0 00000+0 0 9999 63 | 2 32384 55.7049 77.4557 0015036 306.0380 125.2273 2.00577989 52569 64 | GPS BIIRM-6 (PRN 07) 65 | 1 32711U 08012A 15046.93145336 -.00000039 00000-0 00000+0 0 9997 66 | 2 32711 55.6498 315.8432 0080879 204.1918 155.4716 2.00556407 50751 67 | GPS BIIRM-8 (PRN 05) 68 | 1 35752U 09043A 15047.44814862 .00000026 00000-0 00000+0 0 9999 69 | 2 35752 54.2431 194.0447 0039430 20.7457 14.7022 2.00550938 40345 70 | GPS BIIF-1 (PRN 25) 71 | 1 36585U 10022A 15047.54932178 -.00000051 00000-0 00000+0 0 9994 72 | 2 36585 56.0302 14.3463 0041055 35.2343 179.3794 2.00558558 34590 73 | GPS BIIF-2 (PRN 01) 74 | 1 37753U 11036A 15047.11171088 -.00000011 00000-0 00000+0 0 9992 75 | 2 37753 55.1084 134.7726 0038050 19.7772 323.8239 2.00563803 26251 76 | GPS BIIF-3 (PRN 24) 77 | 1 38833U 12053A 15047.12312602 -.00000036 00000-0 00000+0 0 9999 78 | 2 38833 54.6883 313.5919 0030255 12.6446 347.4781 2.00562215 17331 79 | GPS BIIF-4 (PRN 27) 80 | 1 39166U 13023A 15045.47973794 .00000008 00000-0 10000-3 0 9991 81 | 2 39166 55.3617 74.3025 0018773 1.1836 358.8884 2.00562271 12822 82 | GPS BIIF-5 (PRN 30) 83 | 1 39533U 14008A 15046.47254806 -.00000046 00000-0 00000+0 0 9998 84 | 2 39533 54.8302 318.7691 0010016 180.4798 179.5583 2.00552304 7216 85 | GPS BIIF-6 (PRN 06) 86 | 1 39741U 14026A 15046.25679885 -.00000014 00000-0 00000+0 0 9998 87 | 2 39741 55.1038 134.3181 0002893 186.1620 173.8598 2.00561863 5495 88 | GPS BIIF-7 (PRN 09) 89 | 1 40105U 14045A 15046.84651821 .00000070 00000-0 00000+0 0 9991 90 | 2 40105 54.9036 254.2170 0002057 184.4326 175.6238 2.00564726 3953 91 | GPS BIIF-8 (PRN 03) 92 | 1 40294U 14068A 15045.22400116 .00000050 00000-0 00000+0 0 9993 93 | 2 40294 54.9727 194.4616 0010457 202.4626 157.4706 2.00553484 2143 94 | -------------------------------------------------------------------------------- /examples/satellites/omnetpp.ini: -------------------------------------------------------------------------------- 1 | 2 | [Config SatSGP4] 3 | network = SatSGP4 4 | 5 | SatSGP4.satellite[*].mobilityType = "SatSGP4Mobility" 6 | 7 | **.constraintAreaMinX = 0m 8 | **.constraintAreaMaxX = 2160m 9 | 10 | **.constraintAreaMinY = 0m 11 | **.constraintAreaMaxY = 1080m 12 | 13 | **.constraintAreaMinZ = 0m 14 | **.constraintAreaMaxZ = 0m 15 | 16 | [Config SatSGP4Fisheye] 17 | network = SatSGP4Fisheye 18 | 19 | SatSGP4Fisheye.satellite[*].mobilityType = "SatSGP4FisheyeMobility" 20 | 21 | **.constraintAreaMinX = 0m 22 | **.constraintAreaMaxX = 980m 23 | 24 | **.constraintAreaMinY = 0m 25 | **.constraintAreaMaxY = 980m 26 | 27 | **.constraintAreaMinZ = 0m 28 | **.constraintAreaMaxZ = 0m 29 | 30 | SatSGP4Fisheye.satellite[*].mobility.refCenterAltitude = 100 # Variable position of observer 31 | SatSGP4Fisheye.satellite[*].mobility.refCenterLatitude = 47.53849 # Can be changed with user specific 32 | SatSGP4Fisheye.satellite[*].mobility.refCenterLongitude = 19.03839 # position values 33 | 34 | [General] 35 | # location of NED files 36 | ned-path = ../../../inet/src;../../src/os3;.; 37 | # location of images for GUI 38 | tkenv-image-path = ../../images/os3 39 | # 40 | sim-time-limit = 48h 41 | 42 | # Network parameters 43 | **.updateInterval = 20s # Interval to update the satellite positions on the map 44 | 45 | #---------------------------------------------------- 46 | # Satellite Info 47 | #---------------------------------------------------- 48 | **.numOfSats = 12 49 | 50 | # 51 | # default = "", satelliteName is only used if a specific satellite from a TLE file should be used 52 | # if not defined, the first numOfSats are used 53 | # 54 | #*.satellite[0].satelliteName = "GPS BIIA-10 (PRN 32)" 55 | 56 | # 57 | # Parameters for Norad 58 | # 59 | # Provide the filename of the TLEs. Used by Webservice if GUI not used, 60 | # must fit the names from http://celestrak.com/NORAD/elements/xxx.txt 61 | *.satellite[*].NoradModule.TLEfile = "gps-ops.txt" 62 | 63 | # 64 | # Parameters for Satellite 65 | # 66 | # (default = 7dBW) Transmit power of satellites (Can be choosen individually for each satellite, see MCCs for example) 67 | *.satellite[*].transmitPower = 10dBW 68 | 69 | 70 | #---------------------------------------------------- 71 | # Mission Control Centers all over the world 72 | #---------------------------------------------------- 73 | 74 | **.numOfMCCs = 9 75 | 76 | # Mission Control Centers all over the world 77 | # Algier 78 | SatSGP4.MCC[0].mobility.latitude = 36.46 79 | SatSGP4.MCC[0].mobility.longitude = 3.03 80 | SatSGP4.MCC[0].cityName = "Algier" 81 | 82 | # Ourgla 83 | SatSGP4.MCC[1].mobility.latitude = 31.57 84 | SatSGP4.MCC[1].mobility.longitude = 5.20 85 | SatSGP4.MCC[1].cityName = "Ourgla" 86 | 87 | # Parana, Argentinia 88 | SatSGP4.MCC[2].mobility.latitude = -31.43 89 | SatSGP4.MCC[2].mobility.longitude = -60.30 90 | SatSGP4.MCC[2].cityName = "Parana" 91 | 92 | # Rio Grande 93 | SatSGP4.MCC[3].mobility.latitude = -53.47 94 | SatSGP4.MCC[3].mobility.longitude = -67.42 95 | SatSGP4.MCC[3].cityName = "Rio Grande" 96 | 97 | # Albany 98 | SatSGP4.MCC[4].mobility.latitude = -35.01 99 | SatSGP4.MCC[4].mobility.longitude = 117.53 100 | SatSGP4.MCC[4].cityName = "Albany" 101 | 102 | # Bundaberg 103 | SatSGP4.MCC[5].mobility.latitude = -24.51 104 | SatSGP4.MCC[5].mobility.longitude = 152.2 105 | SatSGP4.MCC[5].cityName = "Bundaberg" 106 | 107 | # Brasilia 108 | SatSGP4.MCC[6].mobility.latitude = -15.47 109 | SatSGP4.MCC[6].mobility.longitude = -47.55 110 | SatSGP4.MCC[6].cityName = "Brasilia" 111 | 112 | # Manaus 113 | SatSGP4.MCC[7].mobility.latitude = -3.09 114 | SatSGP4.MCC[7].mobility.longitude = -59.58 115 | SatSGP4.MCC[7].cityName = "Manaus" 116 | 117 | # Recife 118 | SatSGP4.MCC[8].mobility.latitude = -8.01 119 | SatSGP4.MCC[8].mobility.longitude = -34.55 120 | SatSGP4.MCC[8].cityName = "Recife" 121 | 122 | -------------------------------------------------------------------------------- /examples/satellites/package.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.examples.satellites; 3 | 4 | -------------------------------------------------------------------------------- /examples/satellites/run-sim.sh: -------------------------------------------------------------------------------- 1 | # 2 | # ../../src/run_os3 3 | # 4 | opp_run -l ../../src/os3 5 | 6 | 7 | -------------------------------------------------------------------------------- /images/os3/Erde.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/Erde.GIF -------------------------------------------------------------------------------- /images/os3/Erde.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/Erde.jpg -------------------------------------------------------------------------------- /images/os3/Erde1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/Erde1.gif -------------------------------------------------------------------------------- /images/os3/Galileo_Satellit_klein.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/Galileo_Satellit_klein.gif -------------------------------------------------------------------------------- /images/os3/background_earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/background_earth.png -------------------------------------------------------------------------------- /images/os3/background_earth_CospasSarsat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/background_earth_CospasSarsat.png -------------------------------------------------------------------------------- /images/os3/binocular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/binocular.png -------------------------------------------------------------------------------- /images/os3/satellit_blue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellit_blue.gif -------------------------------------------------------------------------------- /images/os3/satellit_green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellit_green.gif -------------------------------------------------------------------------------- /images/os3/satellit_l_rot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellit_l_rot.gif -------------------------------------------------------------------------------- /images/os3/satellit_orange.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellit_orange.gif -------------------------------------------------------------------------------- /images/os3/satellit_yellow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellit_yellow.gif -------------------------------------------------------------------------------- /images/os3/satellite_red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/satellite_red.gif -------------------------------------------------------------------------------- /images/os3/sw.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/sw.gif -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0001_sunny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0001_sunny.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0002_sunny_intervals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0002_sunny_intervals.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0003_white_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0003_white_cloud.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0004_black_low_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0004_black_low_cloud.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0006_mist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0006_mist.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0007_fog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0007_fog.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0008_clear_sky_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0008_clear_sky_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0009_light_rain_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0009_light_rain_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0010_heavy_rain_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0010_heavy_rain_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0011_light_snow_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0011_light_snow_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0012_heavy_snow_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0012_heavy_snow_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0013_sleet_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0013_sleet_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0016_thundery_showers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0016_thundery_showers.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0017_cloudy_with_light_rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0017_cloudy_with_light_rain.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0018_cloudy_with_heavy_rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0018_cloudy_with_heavy_rain.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0019_cloudy_with_light_snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0019_cloudy_with_light_snow.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0020_cloudy_with_heavy_snow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0020_cloudy_with_heavy_snow.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0021_cloudy_with_sleet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0021_cloudy_with_sleet.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0024_thunderstorms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0024_thunderstorms.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0025_light_rain_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0025_light_rain_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0026_heavy_rain_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0026_heavy_rain_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0027_light_snow_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0027_light_snow_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0028_heavy_snow_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0028_heavy_snow_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0029_sleet_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0029_sleet_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0032_thundery_showers_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0032_thundery_showers_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0033_cloudy_with_light_rain_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0033_cloudy_with_light_rain_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0034_cloudy_with_heavy_rain_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0034_cloudy_with_heavy_rain_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0035_cloudy_with_light_snow_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0035_cloudy_with_light_snow_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0036_cloudy_with_heavy_snow_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0036_cloudy_with_heavy_snow_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0037_cloudy_with_sleet_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0037_cloudy_with_sleet_night.png -------------------------------------------------------------------------------- /images/os3/weatherIcons/wsymbol_0040_thunderstorms_night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inet-framework/os3/c965760177b52641904e052208145423faa54357/images/os3/weatherIcons/wsymbol_0040_thunderstorms_night.png -------------------------------------------------------------------------------- /src/makefrag: -------------------------------------------------------------------------------- 1 | # 2 | # additional flags 3 | # 4 | CFLAGS += -I/usr/local/include -g -Wall 5 | # 6 | # os3 includes 7 | # 8 | CFLAGS += -I. 9 | # 10 | # inet 2.5 includes (nasty! - fixed in inet 2.99) 11 | # 12 | CFLAGS += -I../../inet/src 13 | CFLAGS += -I../../inet/src/base 14 | CFLAGS += -I../../inet/src/util 15 | CFLAGS += -I../../inet/src/mobility/common 16 | CFLAGS += -I../../inet/src/mobility/contract 17 | # 18 | # curl library 19 | # 20 | LIBS += -lcurl -lm -L/usr/local/lib 21 | 22 | -------------------------------------------------------------------------------- /src/os3/base/CNI_OS3.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | import os3.base.UserConfig; 5 | import os3.base.WebServiceControl; 6 | import os3.base.WeatherControl; 7 | import os3.base.Calculation; 8 | 9 | // 10 | // Bundles the control modules for the OS³ satellite simulator. 11 | // ATTENTION: This version only works with INET version 20111118!!! Porting to INET 2.0 is scheduled for November 2012. 12 | // 13 | module CNI_OS3 14 | { 15 | submodules: 16 | userConfig: UserConfig { // Module for user parameters 17 | @display("p=80,40"); 18 | } 19 | webServiceControl: WebServiceControl { 20 | @display("p=80,180"); 21 | } 22 | weatherControl: WeatherControl { // Module for fetching and handling of weather information 23 | @display("p=310,40"); 24 | } 25 | calculation: Calculation { // Module for calculation 26 | @display("p=310,180"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/os3/base/Calculation.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_Calculation_H__ 17 | #define __OS3_Calculation_H__ 18 | 19 | #include 20 | 21 | /** Source: 'The aR^b Relation in the Calculation of Rain Attenuation', Olsen and Rogers and Hodge 22 | * a and b are coefficients for different average dropsize distributions to calculate rain specific attenuation 23 | * LPl: Laws and Parsons Distribution - low rain rate 24 | * LPh: Laws and Parsons Distribution - high rain rate 25 | * MP: Marshall-Palmer Distribution 26 | * Jt: "Thunderstorm" Distribution 27 | * Jd: "Drizzle" Distribution 28 | */ 29 | struct rainCoefficients 30 | { 31 | double aLPl; 32 | double aLPh; 33 | double aMP; 34 | double aJt; 35 | double aJd; 36 | double bLPl; 37 | double bLPh; 38 | double bMP; 39 | double bJt; 40 | double bJd; 41 | }; 42 | 43 | class UserConfig; 44 | class WeatherControl; 45 | class WebServiceControl; 46 | 47 | //----------------------------------------------------- 48 | // Class: Calculation 49 | // Helper-class for calculating path loss, distances, etc. 50 | //----------------------------------------------------- 51 | class Calculation : public cSimpleModule 52 | { 53 | public: 54 | 55 | /** 56 | * @brief Convenience function 57 | * @param rad Angle in radiants 58 | * @return Angle in degrees 59 | */ 60 | static inline double rad2deg(const double& rad); 61 | 62 | /** 63 | * @brief Convenience function 64 | * @param deg Angle in degrees 65 | * @return Angle in radiants 66 | */ 67 | static inline double deg2rad(const double& deg); 68 | 69 | /** 70 | * Calculates the free space loss 71 | * @param satIndex Index of the satellite 72 | * @param lambda Wave length 73 | * @return Free space loss in dB 74 | */ 75 | double calcFSL(const int& satIndex, const double& lambda, const double& latitude, 76 | const double& longitude, const double& altitude = -9999); 77 | 78 | /** 79 | * Calculates the euclidean distance between two nodes (planar, i.e., without respect to altitude. E.g., sub-satellite point and base station) 80 | * @param latitude1 Latitude first node 81 | * @param longitude1 Longitude first node 82 | * @param latitude2 Latitude second node 83 | * @param longitude2 Longitude second node 84 | * @return Planar euclidean distance between the two given nodes 85 | */ 86 | double calcDistance(const double& latitude1, const double& longitude1, 87 | const double& latitude2, const double& longitude2); 88 | 89 | /** 90 | * Calculates the SNR for a transmission (in dBHz) 91 | * @param transmitterGain Gain of the transmitting antenna in dB 92 | * @param receiverGain Gain of the receiving antenna in dB 93 | * @param transmitterPower Transmit Power in dBW 94 | * @param lambda Wave length in m 95 | * @param satIndex Index of the satellite that is used 96 | * @param bandwidth Bandwidth of the used system in Hz 97 | * @param latitude Coordinate for the reference point 98 | * @param longitude Coordinate for the reference point 99 | * @param altitude Altitude of the reference point, default -9999 uses altitude data from webservice 100 | * @param dG Average ratio of antenna radiation from ground, default 0.1 101 | * @param tR Receiver noise temperature, default 150 K 102 | * @param dR Highest point of rain area in km, default 3 is average for mild climate 103 | * @return SNR in dB 104 | */ 105 | double calcSNR( 106 | const double& transmitterGain, // in dB 107 | const double& receiverGain, // in dB 108 | const double& transmitterPower, // in dbW 109 | const double& lambda, // in m 110 | const int& satIndex, 111 | const double& bandwidth, // in Hz 112 | const double& latitutde, 113 | const double& longitude, 114 | const double& altitude = -9999, 115 | const double& dG = 0.1, 116 | const double& tR = 150, 117 | const double& dR = 3); 118 | 119 | /** 120 | * Determines the best-in-reach satellite depending on calculated SNR in dBHz 121 | * @param latitude Latitude of base station 122 | * @param longitude Longitude of base station 123 | * @param transmitterGain Gain of the transmitting antenna in dB 124 | * @param receiverGain Gain of the receiving antenna in dB 125 | * @param transmitterPower Transmit Power in dBW 126 | * @param bandwidth Bandwidth of the used system in Hz 127 | * @param altitude Altitude of the reference point, default -9999 uses altitude data from webservice 128 | * @param dG Average ratio of antenna radiation from ground, default 0.1 129 | * @param tR Receiver noise temperature, default 150 K 130 | * @param dR Highest point of rain area in km, default 3 is average for mild climate 131 | * @return index of the best-in-reach satellite 132 | */ 133 | int getScoredSatfromSNR( 134 | const double& latitude, 135 | const double& longitude, 136 | const double& transmitterGain, // in dB 137 | const double& receiverGain, // in dB 138 | const double& transmitterPower, // in dbW 139 | const double& bandwidth, // in Hz 140 | const double& altitude = -9999, 141 | const double& dG = 0.1, 142 | const double& tR = 150, 143 | const double& dR = 3); 144 | 145 | protected: 146 | 147 | // initializes Calculation module and calls fillRainMap() 148 | virtual void initialize(); 149 | 150 | virtual void handleMessage(cMessage* msg); 151 | 152 | // fills the rainCoeffMap with the Values from CSV file (default: data/TablespecRain.csv) 153 | void fillRainMap(); 154 | 155 | // Maps the given frequency to an frequency existing in the table for RainCoefficients 156 | // frequency: frequency of used system 157 | // returns nearest frequency existing in rainCoeffMap 158 | double getMappedFrequency(const double& frequency); 159 | 160 | private: 161 | 162 | static const double C; // In m/s; 163 | static const double Boltzmann; // In dBWs/K 164 | static const double EarthRadius; // In km 165 | 166 | std::string rainTableFile; 167 | 168 | // Used for calculation of specific rain attenuation 169 | std::map< double, rainCoefficients > rainCoeffMap; 170 | 171 | UserConfig* userConfig; 172 | WeatherControl* weatherControl; 173 | WebServiceControl* webserviceControl; 174 | 175 | struct SAT { 176 | int satIndex; 177 | double snr; 178 | }; 179 | }; 180 | 181 | #endif 182 | 183 | -------------------------------------------------------------------------------- /src/os3/base/Calculation.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | // 5 | // Calculation of distances, attenuation and other channel characteristics 6 | // 7 | simple Calculation 8 | { 9 | parameters: 10 | @display("i=device/palm"); 11 | string rainTableFile; // Filename and path to the table containing the parameters for specific rain attenuation 12 | } 13 | -------------------------------------------------------------------------------- /src/os3/base/MissionControlCenter.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | import os3.mobility.LUTMotionMobility; 4 | import inet.base.NotificationBoard; 5 | 6 | // 7 | // Bundles the analyzation and notification modules for the OS³ missions. 8 | // 9 | module MissionControlCenter 10 | { 11 | parameters: 12 | string cityName = default(""); 13 | @display("t=$cityName"); 14 | @node; 15 | 16 | gates: 17 | input radioIn; // Input gate 18 | output radioOut; // Output gate 19 | 20 | submodules: 21 | mobility: LUTMotionMobility { // Module for mobility (LUTMotionMobility) 22 | parameters: 23 | @display("p=54,256;i=block/cogwheel_s"); 24 | } 25 | notificationBoard: NotificationBoard { // Module for Notfication on event occuring 26 | parameters: 27 | @display("p=182,248;i=block/control"); 28 | } 29 | connections allowunconnected: // Connections between compound gates and submodules 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/os3/base/Observer.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/base/Observer.h" 17 | 18 | Define_Module(Observer); 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "os3/base/Calculation.h" 26 | 27 | #include "os3/mobility/SatSGP4Mobility.h" 28 | #include "os3/mobility/SatSGP4FisheyeMobility.h" 29 | 30 | Observer::Observer() 31 | { 32 | Sat = nullptr; 33 | calculation = nullptr; 34 | timer = nullptr; 35 | longitude = 0.0; 36 | latitude = 0.0; 37 | altitude = 0.0; 38 | lastelv = 0.0; 39 | interval = 0.0; 40 | numgps = 0; 41 | gps = false; 42 | } 43 | 44 | void Observer::initialize() 45 | { 46 | longitude = par("ObserverLongitude"); 47 | latitude = par("ObserverLatitude"); 48 | altitude = par("ObserverAltitude"); 49 | interval = par("TimerInterval"); 50 | 51 | Sat = dynamic_cast(getParentModule()->getSubmodule("satellite", 0)->getSubmodule("mobility", 0)); 52 | if (Sat == nullptr) { 53 | error("Error in Observer::initialize(): Could not find Satellite module."); 54 | } else { 55 | std::cout << "Satellite module found!" << std::endl; 56 | } 57 | 58 | calculation = dynamic_cast(getParentModule()->getSubmodule("cni_os3", 0)->getSubmodule("calculation", 0)); 59 | if (calculation == nullptr) { 60 | error("Error in Observer::initialize(): Could not find Calculation module."); 61 | } else { 62 | std::cout << "Calculation module found!" << std::endl; 63 | } 64 | 65 | gps = par("gps"); 66 | numgps = par("numgps"); 67 | 68 | if (gps == true) { 69 | 70 | for (int i = 0; i < numgps; i++) { 71 | gpsSats[i] = dynamic_cast(getParentModule()->getSubmodule("satellite", i)->getSubmodule("mobility", 0)); 72 | if (Sat == nullptr) { 73 | error("Error in Observer::initialize(): Could not find Satellite module."); 74 | } else { 75 | std::cout << "Satellite module found!" << std::endl; 76 | } 77 | } 78 | 79 | // start timer to toggle C/N0 calculation (carrier to noise) 80 | timer = new cMessage("timer"); 81 | scheduleAt(simTime() + interval, timer); 82 | 83 | // generate outfile 84 | char text[100]; 85 | char* cstr = new char[100]; 86 | std::sprintf(text, "CN0forGPSsatellites_%f,%f.txt", latitude, longitude); 87 | std::strcpy(cstr, text); 88 | 89 | // open outfile 90 | outfile.open(cstr, std::ofstream::trunc); 91 | outfile << "Satellite\tC/N0\tElevation\tAzimuth" << std::endl; 92 | 93 | } else { 94 | 95 | timer = new cMessage("timer"); 96 | scheduleAt(simTime() + interval, timer); 97 | 98 | // generate outfile 99 | char text[100]; 100 | char* cstr = new char[51]; 101 | std::sprintf(text, "SatelliteMovementAt%f,%f.txt", latitude, longitude); 102 | std::strcpy(cstr, text); 103 | 104 | // open outfile 105 | outfile.open(cstr, std::ofstream::trunc); 106 | outfile << "Date\tTime\tElevation\tAzimuth" << std::endl; 107 | 108 | // initialize time and elevation 109 | timestamp = std::time(0); 110 | lastelv = 0; 111 | 112 | // set Position on map 113 | setPosition(latitude, longitude); 114 | } 115 | } 116 | 117 | void Observer::handleMessage(cMessage* msg) 118 | { 119 | if (msg->isSelfMessage()) { 120 | if (gps == true) { 121 | const double bandwidth = 2000000; // GPS bandwidth 122 | for (int i = 0; i < numgps; i++) { 123 | const double tempsnr = checksnr(i, bandwidth); 124 | const double tempcn0 = tempsnr + 10 * std::log10(bandwidth); 125 | 126 | outfile 127 | << i 128 | << "\t" 129 | << tempcn0 130 | << "\t" 131 | << gpsSats[i]->getElevation(latitude, longitude, 132 | altitude) << "\t" 133 | << gpsSats[i]->getAzimuth(latitude, longitude, altitude) 134 | << "\t" << std::endl; 135 | } 136 | 137 | } else { 138 | 139 | const double elevation = Sat->getElevation(latitude, longitude, altitude); 140 | 141 | if ((elevation > 10) | (lastelv > 10)) { // Satellite in view or just out of view 142 | 143 | const double azimuth = Sat->getAzimuth(latitude, longitude, altitude); 144 | 145 | std::time_t runtime = timestamp + simTime().dbl(); 146 | const std::tm* currentTime = std::localtime(&runtime); 147 | 148 | if ((elevation > 10) & (lastelv < 10)) // First time satellite is in view 149 | outfile << currentTime->tm_mday << "." 150 | << currentTime->tm_mon + 1 << "." 151 | << currentTime->tm_year + 1900 << "\t" 152 | << currentTime->tm_hour << ':' 153 | << currentTime->tm_min << ":" << currentTime->tm_sec 154 | << "\t" << elevation << "\t" << azimuth << std::endl; 155 | 156 | if ((elevation < 10) & (lastelv > 10)) { // Last time satellite is in view 157 | runtime = runtime - interval; // Get last time stamp back 158 | currentTime = std::localtime(&runtime); 159 | outfile << currentTime->tm_mday << "." 160 | << currentTime->tm_mon + 1 << "." 161 | << currentTime->tm_year + 1900 << "\t" 162 | << currentTime->tm_hour << ':' 163 | << currentTime->tm_min << ":" << currentTime->tm_sec 164 | << "\t" << lastelv << "\t" << azimuth << std::endl; 165 | } 166 | 167 | lastelv = elevation; 168 | 169 | } 170 | scheduleAt(simTime() + interval, timer); 171 | } 172 | } else { 173 | error("Observer should not receive Message other than self message"); 174 | } 175 | } 176 | 177 | void Observer::setPosition(double latitude, double longitude) 178 | { 179 | const double mapx = std::atoi(getParentModule()->getDisplayString().getTagArg("bgb", 0)); 180 | const double mapy = std::atoi(getParentModule()->getDisplayString().getTagArg("bgb", 1)); 181 | 182 | double posY = ((-mapy * latitude) / 180) + (mapy / 2); 183 | double posX = mapx * longitude / 360 + (mapx / 2); 184 | posX = static_cast(posX) % static_cast(mapx); 185 | 186 | getDisplayString().setTagArg("p", 0, static_cast(posX)); 187 | getDisplayString().setTagArg("p", 1, static_cast(posY)); 188 | } 189 | 190 | // GPS 191 | double Observer::checksnr(int satindex, double bandwidth) 192 | { 193 | const double transmitterGain = 13.0; // GPS transmitter gain 194 | const double receiverGain = 0.0; // Average GPS antenna 195 | const double transmitterPower = 14; // GPS transmitter power 196 | const double lambda = 0.1905; // wavelength of GPS signal in m (f = 1575,42 MHz) 197 | const double dG = 0.5; // Average ratio of antenna radiation from ground (omnidirectional gps antenna) 198 | const double tR = 150; // in K, Receiver noise temperature 199 | 200 | const double snr = calculation->calcSNR(transmitterGain, receiverGain, 201 | transmitterPower, lambda, satindex, bandwidth, latitude, longitude, -9999, dG, tR); 202 | return snr; 203 | } 204 | 205 | void Observer::finish() 206 | { 207 | outfile.close(); 208 | cancelAndDelete(timer); 209 | } 210 | -------------------------------------------------------------------------------- /src/os3/base/Observer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_Observer_H__ 17 | #define __OS3_Observer_H__ 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | class SatSGP4Mobility; 26 | class SatSGP4FisheyeMobility; 27 | class Calculation; 28 | 29 | //----------------------------------------------------- 30 | // Class: Observer 31 | // Base Station with example function to check when a satellite is in 32 | // view or to calculate the C/N0 (carrier to noise) for GPS satellites 33 | //----------------------------------------------------- 34 | class Observer : public cSimpleModule 35 | { 36 | public: 37 | Observer(); 38 | 39 | protected: 40 | 41 | // initializes Observer module and calls setPosition() 42 | virtual void initialize(); 43 | 44 | // checks every update interval if a certain satellite is in view and writes results to an output file 45 | virtual void handleMessage(cMessage* msg); 46 | 47 | virtual void finish(); 48 | 49 | // sets the position on the map 50 | void setPosition(double latitude, double longitude); 51 | 52 | // calculates SNR for given satellite 53 | // - satindex index of satellite 54 | // - bandwidth bandwidth of used channel 55 | double checksnr(int satindex, double bandwidth); 56 | 57 | private: 58 | SatSGP4Mobility* Sat; // Reference to observed satellite 59 | SatSGP4FisheyeMobility* gpsSats[31]; // GPS satellites for C/N0 validation 60 | Calculation* calculation; 61 | cMessage* timer; // Self message to trigger observation 62 | double longitude; // Longitude of Observer 63 | double latitude; // Latitude of Observer 64 | double altitude; // Altitude of Observer 65 | double lastelv; // Last observed elevation is saved 66 | double interval; // Update interval for timer 67 | std::ofstream outfile; // File where results are written/saved 68 | std::time_t timestamp; // Time stamp for starting simulation 69 | int numgps; // Number of GPS satellites for C/N0 validation 70 | bool gps; // bool to check whether gps or ISS validation should run 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /src/os3/base/Observer.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | // 5 | // Observer module 6 | // 7 | simple Observer 8 | { 9 | parameters: 10 | @display("i=block/user"); 11 | double ObserverLongitude; // Observer longitude 12 | double ObserverLatitude; // Observer latitude 13 | double ObserverAltitude; // Observer altitude 14 | double TimerInterval @unit(s); // Update interval for timer 15 | int numgps; // Number of GPS satellites used 16 | bool gps; // Check of GPS validation or ISS validation should run 17 | } 18 | -------------------------------------------------------------------------------- /src/os3/base/Satellite.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | import inet.base.NotificationBoard; 5 | 6 | import inet.mobility.contract.IMobility; 7 | import os3.mobility.Norad; 8 | import os3.mobility.SatSGP4Mobility; 9 | 10 | module Satellite 11 | { 12 | parameters: 13 | @nodes(); 14 | @node; //because of MobilityBase initialization 15 | string satelliteName = default(""); // Parameter for satellite name 16 | string mobilityType = default("SatSGP4Mobility"); // Define mobility module 17 | // Transmit Power of satellite (7dBW as example for CospasSarsat system) 18 | double transmitPower @unit(dBW) @display("i=device/satellite;bgb=324,226") = default(7dBW); // Symbol 19 | @display("t=$satelliteName"); 20 | gates: 21 | input radioIn; // Input gate 22 | output radioOut; // Output gate 23 | 24 | submodules: 25 | mobility: like IMobility { // Module for mobility (parent class -> BasicMobility), BasicMobility -> IMobility 26 | @display("p=96,94"); 27 | } 28 | //mobility : SatSGP4Mobility { 29 | // parameters: 30 | // @display("p=194,103"); 31 | //} 32 | notificationBoard: NotificationBoard { // Module for event notification 33 | parameters: 34 | @display("p=221,94"); 35 | } 36 | NoradModule: Norad { // Module for transformation between omnet and libNorad 37 | parameters: 38 | @display("p=98,35"); 39 | } 40 | connections allowunconnected: 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/os3/base/UserConfig.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/base/UserConfig.h" 17 | 18 | #include "os3/mobility/SatSGP4Mobility.h" 19 | #include "os3/mobility/SatSGP4FisheyeMobility.h" 20 | 21 | #include 22 | #include 23 | 24 | Define_Module(UserConfig); 25 | 26 | void UserConfig::initialize() 27 | { 28 | userParameters.numOfSats = par("numOfSats"); 29 | userParameters.frequency = par("frequency"); 30 | userParameters.min_snr = par("min_snr"); 31 | 32 | userParameters.mapX = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 0)); 33 | userParameters.mapY = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 1)); 34 | 35 | initializeSatMobility(); 36 | } 37 | 38 | void UserConfig::handleMessage(cMessage* msg) 39 | { 40 | error("Error in UserConfig::handleMessage(): This module is not able to handle messages"); 41 | } 42 | 43 | void UserConfig::initializeSatMobility() 44 | { 45 | // initialize satellite mobilities for view 46 | for (int i = 0; i < userParameters.numOfSats; i++) { 47 | char name[128]; 48 | std::sprintf(name, "satellite[%d].mobility", i); 49 | SatSGP4Mobility* mob = check_and_cast< SatSGP4Mobility* >(simulation.getModuleByPath(name)); 50 | 51 | if (mob != nullptr) 52 | satmoVector.push_back(mob); 53 | else { 54 | std::sprintf(name, "Error in UserConfig::initializeSatFisheyeMobility(): Could not find module \"%s\".", name); 55 | error(name); 56 | } 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/os3/base/UserConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_UserConfig_H__ 17 | #define __OS3_UserConfig_H__ 18 | 19 | #include 20 | 21 | class SatSGP4Mobility; 22 | 23 | struct parameters 24 | { 25 | int numOfSats; 26 | int mapX; 27 | int mapY; 28 | double min_snr; 29 | double frequency; 30 | }; 31 | 32 | //----------------------------------------------------- 33 | // Class: UserConfig 34 | // This class manages the interaction with the user parameters and the 35 | // omnet simulation. It also creates satellite mobility vectors. 36 | //----------------------------------------------------- 37 | class UserConfig : public cSimpleModule 38 | { 39 | public: 40 | /** 41 | * @brief returns the user settings 42 | * This method is just a dummy method. No action is taking place here. 43 | * @return object of type parameters which contains user-specific parameters set in omnetpp.ini 44 | */ 45 | const parameters& getParameters() const { return userParameters; }; 46 | 47 | /** 48 | * @brief Initializes the mobility for SatMobility 49 | * This method fills the mobility-module-vector (satmoGEO and satmoLEO Vectors) with satellite-mobilities (number of satellites set in omnetpp.ini). 50 | * @return a vector of type LineSegmentsMobilityBase (parent class of SatSGP4Mobilty and SatSGPFisheyeMobility). If an error occurs, the method returns an empty vector. 51 | */ 52 | const std::vector< SatSGP4Mobility* >& getSatMobility() const { return satmoVector; }; 53 | 54 | protected: 55 | // initializes an object of type UserConfig and saves the user variables given in omnetpp.ini 56 | virtual void initialize(); 57 | 58 | virtual void handleMessage(cMessage* msg); 59 | 60 | // fills the mobility-module-vector with satellite-mobilities (number of satellites set in omnetpp.ini). 61 | // These vectors are needed for the usage of SatSGP4Mobility and SatSGP4FisheyeMobility in other methods 62 | // (get the mobility of a specific satellite). 63 | void initializeSatMobility(); 64 | 65 | private: 66 | parameters userParameters; 67 | std::vector< SatSGP4Mobility* > satmoVector; 68 | }; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /src/os3/base/UserConfig.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | // 5 | // Interaction with user parameters set in omnetpp.ini and the omnet simulation. Also creates satellite mobility vectors. 6 | // 7 | simple UserConfig 8 | { 9 | parameters: 10 | @class(UserConfig); 11 | @display("i=block/user"); 12 | double min_snr @unit(dBHz); // minimal SNR to enable a transmission 13 | int numOfSats; // number of satellites 14 | double frequency @unit(Hz); // frequency of satellite communication antennas in Hertz 15 | } 16 | -------------------------------------------------------------------------------- /src/os3/base/WeatherControl.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/base/WeatherControl.h" 17 | 18 | #include "os3/base/WebServiceControl.h" 19 | 20 | Define_Module(WeatherControl); 21 | 22 | void WeatherControl::initialize() 23 | { 24 | // Create reference to WebServiceControl module 25 | webServiceControl = dynamic_cast< WebServiceControl* >(getParentModule()->getSubmodule("webServiceControl")); 26 | if (webServiceControl == nullptr) { 27 | error("Error in WeatherControl::initialize(): Could not find WebServiceControl module."); 28 | } 29 | 30 | // Initialize default precipPerHourValue (-1 = not set) 31 | defaultPrecipPerHour = par("defaultPrecipPerHour"); 32 | } 33 | 34 | void WeatherControl::handleMessage(cMessage* msg) 35 | { 36 | error("Error in WeatherControl::handleMessage(): This module is not able to handle messages."); 37 | } 38 | 39 | void WeatherControl::setWeatherGimmick(const double& latitude, const double& longitude) 40 | { 41 | // Fetch symbol fitting current weather situation 42 | std::string tmpString = webServiceControl->getWeatherData(latitude, longitude).weatherIconURL; 43 | 44 | // Modify weatherIconURl: Erase URL from string and add weaterIcons folder before file name 45 | if (tmpString.find("wsymbol") == tmpString.npos) { 46 | // very likely, the weather poll failed 47 | EV << "Warning in WeatherControl::setWeatherGimmick(): Could not resolve weatherData from webServiceControl. " 48 | "Current weather information will not be available! This is probably due to a loss of internet connection " 49 | "or the service is currently unavailable.\n"; 50 | return; 51 | } 52 | 53 | tmpString.erase(0, tmpString.find("wsymbol")); 54 | tmpString.erase(0, tmpString.find("/") + 1); 55 | tmpString.erase(tmpString.find(".png"), 4); 56 | 57 | std::string symbolString = "weatherIcons/"; 58 | symbolString += tmpString; 59 | 60 | // Set weather symbol to module 61 | getDisplayString().setTagArg("i", 0, symbolString.c_str()); 62 | 63 | // Set weather symbol in CNI-OS3 icon to display in map 64 | getParentModule()->getDisplayString().setTagArg("i", 0, symbolString.c_str()); 65 | 66 | return; 67 | } 68 | 69 | double WeatherControl::getPrecipPerHour(const double& latitude, const double& longitude) 70 | { 71 | // Check if default value is set. If this is the case => return value. Otherwise, fetch live data from WebService module 72 | if (defaultPrecipPerHour != -1) { 73 | return defaultPrecipPerHour; 74 | } 75 | 76 | // Get weather data 77 | WeatherData currentData = webServiceControl->getWeatherData(latitude, longitude); 78 | 79 | // Set weather icon 80 | setWeatherGimmick(latitude, longitude); 81 | 82 | return currentData.precipMM / 24; //transform precip per day to precip per hour 83 | } 84 | 85 | void WeatherControl::setDefaultPrecipPerHour(const double precipValue) 86 | { 87 | defaultPrecipPerHour = precipValue; 88 | } 89 | -------------------------------------------------------------------------------- /src/os3/base/WeatherControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_WeatherControl_H__ 17 | #define __OS3_WeatherControl_H__ 18 | 19 | #include 20 | 21 | class WebServiceControl; 22 | 23 | //----------------------------------------------------- 24 | // Class: WeatherControl 25 | // This class gets weather information from web service and integrates them in the simulation. 26 | //----------------------------------------------------- 27 | class WeatherControl : public cSimpleModule 28 | { 29 | public: 30 | /** 31 | * @brief Sets weather symbol depending on weather situation. 32 | * This method sets the weather symbol of the module. The symbol is fetched from the WebServiceControl module, which returns 33 | * an symbol filename fitting the current weather situation. 34 | * In former versions this method used an weather index describing the statistically developed weather situation 35 | * (1: rainy, 2: cloudy, 3: suncloudy, 4: sunny) 36 | * @param latitude coordinate for the reference point 37 | * @param longitude coordinate for the reference point 38 | */ 39 | void setWeatherGimmick(const double& latitude, const double& longitude); 40 | 41 | /** 42 | * @brief Gets the current (live!) precipation per hour 43 | * This method gets the current precipation (=rainfall) per hour value. 44 | * If a default value is NOT set (defaultPrecipPerHour = -1), it fetches live (!) weather data from the 45 | * Web service module. Does not update the weatherGimmick. 46 | * @param latitude Coordinate for the reference point 47 | * @param longitude Coordinate for the reference point 48 | * @return Current precipation in mm/(m²*h) 49 | */ 50 | double getPrecipPerHour(const double& latitude, const double& longitude); 51 | 52 | // This method sets the default precip (=rainfall) per hour value if live weather data should not be evaluated for a scenario. 53 | void setDefaultPrecipPerHour(const double precipValue); 54 | 55 | protected: 56 | /** 57 | * @brief Initialize reference to WebServiceControl module and set weather icon. 58 | * This method initializes a connection to the WebServiceControl module and predefines weather icon. 59 | */ 60 | virtual void initialize(); 61 | 62 | virtual void handleMessage(cMessage* msg); 63 | 64 | private: 65 | WebServiceControl* webServiceControl; 66 | double defaultPrecipPerHour; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/os3/base/WeatherControl.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | // 5 | // Gets weather information from WebService and integrates them in the simulation. 6 | // 7 | simple WeatherControl 8 | { 9 | parameters: 10 | @display("i=misc/sun"); // Symbol, depending on actual weather situation 11 | double defaultPrecipPerHour = default(-1); // Default precipitation (=rainfall) per hour value. If set to -1, then system is using live weather data. 12 | } 13 | -------------------------------------------------------------------------------- /src/os3/base/WebServiceControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_WebServiceControl_H__ 17 | #define __OS3_WebServiceControl_H__ 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | struct WeatherData 25 | { 26 | std::string date; 27 | double tempMaxC; 28 | double tempMaxF; 29 | double tempMinC; 30 | double tempMinF; 31 | double windSpeedMiles; 32 | double windSpeedKmph; 33 | double windDirDegree; 34 | double windDir16Point; 35 | double weatherCode; 36 | std::string weatherIconURL; 37 | std::string weatherDesc; 38 | double precipMM; 39 | }; 40 | 41 | struct TLEData 42 | { 43 | std::string tleName; 44 | std::string tleLine1; 45 | std::string tleLine2; 46 | }; 47 | 48 | 49 | //----------------------------------------------------- 50 | // Class: WebServiceControl 51 | // 52 | // Pulls data for live weather, TLE and altitude 53 | //----------------------------------------------------- 54 | class WebServiceControl : public cSimpleModule 55 | { 56 | public: 57 | // returns live weather data for initialized region 58 | WeatherData getWeatherData(const double& latitude, const double& longitude); 59 | 60 | // returns altitude data 61 | double getAltitudeData(const double& latitude, const double& longitude); 62 | 63 | // returns actual TLE data for requested satellite (characterized by specific satellite number) 64 | // - the data is taken from celestrak.com. The file name must be identical to the one which is located at the website 65 | // - (e.g. the ISS can be found in file "stations.txt" so the variable fileName has to be set to "stations.txt"). 66 | // - The method extracts the satellite number numSat (beginning from 0). So the satellite has to be present in celestrak's textfile. 67 | // fileName: file name of the TLE-File (corresponding to file located at www.clestrak.com/NORAD/elements/xxx.txt) 68 | // numSat: number of satellite for which TLE data is requested 69 | TLEData getTLEData(std::string fileName, unsigned int numSat); 70 | 71 | // Returns actual TLE data for requested satellite (characterized by specific satellite name) 72 | // - this method returns actual TLE data for a number of satellites which are contained in file with file name fileName. 73 | // - the data is taken from celestrak.com. The file name must be identical to the one which is located at the website 74 | // - (e.g. the ISS can be found in file "stations.txt" so the variable fileName has to be set to "stations.txt"). 75 | // - the method extracts the satellite data for the satellite named with satName. So the satellite has to be present in celestrak's textfile. 76 | // fileName: file name of the TLE-File (corresponding to file located at www.clestrak.com/NORAD/elements/xxx.txt) 77 | // satName: name of the satellite for which TLE data is requested 78 | TLEData getTLEData(std::string fileName, std::string satName); 79 | 80 | // checks if an url exists 81 | bool urlExist(std::string url); 82 | 83 | protected: 84 | virtual void initialize(); 85 | 86 | virtual void handleMessage(cMessage* msg); 87 | 88 | // creates the request string for the weatherData request 89 | std::string getRequestStringWeatherData(const double& latitude, const double& longitude); 90 | 91 | // creates the request string for the altitude data request 92 | std::string getRequestStringAltitudeData(const double& latitude, const double& longitude); 93 | 94 | // creates the request string for the TLE data request 95 | std::string getRequestStringTLEData(std::string fileName); 96 | 97 | // creates the request for the weatherData 98 | std::string requestWeatherData(const double& latitude, const double& longitude); 99 | 100 | // creates the request for the altitude data 101 | double requestAltitudeData(const double& latitude, const double& longitude); 102 | 103 | /** 104 | * Creation of request for TLE data 105 | * This method creates the request for the TLE data. If an entry for requested TLE file is saved in tleCache, the saved data string is returned instead of 106 | * another request to the website is taken. 107 | * If the datastring is not in cache, data is loaded from the website and saved in cache in order to reduce latency for further requests. 108 | * @param fileName file name of the TLE file located at www.celestrak.com/NORAD/elements/xxx.txt 109 | * @return String containing the data of the TLE file with actual TLE data taken from www.celestrak.com 110 | */ 111 | std::string requestTLEData(std::string fileName); 112 | 113 | /** 114 | * Evaluate weather data 115 | * This method evaluates the fetched weather data and parse them into a WeatherData struct. 116 | * @param dataString String containing the data of a .csv weather file from www.worldweatheronline.com 117 | * @return Weather data for requested region 118 | */ 119 | WeatherData evaluateWeatherInformation(std::string dataString); 120 | 121 | /** 122 | * Evaluate TLE data 123 | * This method evaluates the fetched TLE data and parse the TLE data of the numSat satellite into a TLEData struct. 124 | * @param dataString String containing the data of a TLE file from www.celestrak.com/NORAD/elements/xxx.txt 125 | * @return TLEData for requested satellite 126 | */ 127 | TLEData evaluateTLEData(std::string dataString, unsigned int numSat); 128 | 129 | /** 130 | * Evaluate TLE data 131 | * This method evaluates the fetched TLE data and parse the TLE data of the satellite with name satName into a TLEData struct. 132 | * @param dataString String containing the data of a TLE file from www.celestrak.com/NORAD/elements/xxx.txt 133 | * @return TLEData for requested satellite 134 | */ 135 | TLEData evaluateTLEData(std::string dataString, std::string satName); 136 | 137 | private: 138 | //Variables 139 | std::string weatherApiKey; 140 | std::string altitudeUsername; 141 | unsigned int altitudeCacheThreshold; 142 | unsigned int tleCacheThreshold; 143 | unsigned int weatherCacheThreshold; 144 | std::map< std::pair< double, double >, double > altitudeCache; 145 | std::map< std::string, std::string > tleCache; 146 | std::map< std::pair< double, double >, std::string > weatherCache; 147 | }; 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /src/os3/base/WebServiceControl.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.base; 3 | 4 | // 5 | // Gets information from a web service (e.g. for Weather Information, TLE Files) and returns them to requesting modules. 6 | // 7 | simple WebServiceControl 8 | { 9 | parameters: 10 | @display("i=misc/globe"); 11 | int altitudeCacheThreshold = default(100); // Maximum number of altitudes stored in the cache. Generally, it should always hold altitudeCacheThreshold >= number of base stations 12 | int tleCacheThreshold = default(10); // Maximum number of TLE data strings stored in cache. Generelly, it should always hold tleCacheThreshold >= number of TLE files used for simulation scenario 13 | int weatherCacheThreshold = default(10); // Maxmimum number of weather data strings stored in cache. Generally, it should always hold weatherCacheThreshold >= number of base stations 14 | string apiKeyWeather; // API key for connection with WorldWeatherOnline.com API interface. More infos can be found at www.worldweatheronline.com/free-weather-feed.aspx 15 | string usernameAltitude; // Username for connection with Geonames.org More infos can be found at www.geonames.org 16 | } 17 | -------------------------------------------------------------------------------- /src/os3/libnorad/cEci.cc: -------------------------------------------------------------------------------- 1 | // 2 | // cEci.cpp 3 | // 4 | // Copyright (c) 2002-2003 Michael F. Henry 5 | // 6 | 7 | #include "os3/libnorad/cEci.h" 8 | 9 | #include 10 | 11 | cEci::cEci(const cVector& pos, 12 | const cVector& vel, 13 | const cJulian& date, 14 | bool IsAeUnits /* = true */) 15 | { 16 | m_pos = pos; 17 | m_vel = vel; 18 | m_date = date; 19 | m_VecUnits = (IsAeUnits ? UNITS_AE : UNITS_NONE); 20 | } 21 | 22 | ////////////////////////////////////////////////////////////////////// 23 | // cEci(cCoordGeo&, cJulian&) 24 | // Calculate the ECI coordinates of the location "geo" at time "date". 25 | // Assumes geo coordinates are km-based. 26 | // Assumes the earth is an oblate spheroid as defined in WGS '72. 27 | // Reference: The 1992 Astronomical Almanac, page K11 28 | // Reference: www.celestrak.com (Dr. TS Kelso) 29 | cEci::cEci(const cCoordGeo& geo, const cJulian& date) 30 | { 31 | m_VecUnits = UNITS_KM; 32 | 33 | double mfactor = TWOPI * (OMEGA_E / SEC_PER_DAY); 34 | double lat = geo.m_Lat; 35 | double lon = geo.m_Lon; 36 | double alt = geo.m_Alt; 37 | 38 | // Calculate Local Mean Sidereal Time (theta) 39 | double theta = date.toLMST(lon); 40 | double c = 1.0 / std::sqrt(1.0 + F * (F - 2.0) * sqr(std::sin(lat))); 41 | double s = sqr(1.0 - F) * c; 42 | double achcp = (XKMPER_WGS72 * c + alt) * std::cos(lat); 43 | 44 | m_date = date; 45 | 46 | m_pos.m_x = achcp * std::cos(theta); // km 47 | m_pos.m_y = achcp * std::sin(theta); // km 48 | m_pos.m_z = (XKMPER_WGS72 * s + alt) * std::sin(lat); // km 49 | m_pos.m_w = std::sqrt(sqr(m_pos.m_x) + 50 | sqr(m_pos.m_y) + 51 | sqr(m_pos.m_z)); // range, km 52 | 53 | m_vel.m_x = -mfactor * m_pos.m_y; // km / sec 54 | m_vel.m_y = mfactor * m_pos.m_x; 55 | m_vel.m_z = 0.0; 56 | m_vel.m_w = std::sqrt(sqr(m_vel.m_x) + // range rate km/sec^2 57 | sqr(m_vel.m_y)); 58 | } 59 | 60 | ////////////////////////////////////////////////////////////////////////////// 61 | // toGeo() 62 | // Return the corresponding geodetic position (based on the current ECI 63 | // coordinates/Julian date). 64 | // Assumes the earth is an oblate spheroid as defined in WGS '72. 65 | // Side effects: Converts the position and velocity vectors to km-based units. 66 | // Reference: The 1992 Astronomical Almanac, page K12. 67 | // Reference: www.celestrak.com (Dr. TS Kelso) 68 | cCoordGeo cEci::toGeo() 69 | { 70 | ae2km(); // Vectors must be in kilometer-based units 71 | 72 | double theta = AcTan(m_pos.m_y, m_pos.m_x); 73 | double lon = std::fmod(theta - m_date.toGMST(), TWOPI); 74 | 75 | if (lon < 0.0) 76 | lon += TWOPI; // "wrap" negative modulo 77 | 78 | double r = std::sqrt(sqr(m_pos.m_x) + sqr(m_pos.m_y)); 79 | double e2 = F * (2.0 - F); 80 | double lat = AcTan(m_pos.m_z, r); 81 | 82 | const double delta = 1.0e-07; 83 | double phi; 84 | double c; 85 | 86 | do { 87 | phi = lat; 88 | c = 1.0 / std::sqrt(1.0 - e2 * sqr(std::sin(phi))); 89 | lat = AcTan(m_pos.m_z + XKMPER_WGS72 * c * e2 * std::sin(phi), r); 90 | } while (std::fabs(lat - phi) > delta); 91 | 92 | const double alt = r / std::cos(lat) - XKMPER_WGS72 * c; 93 | 94 | return cCoordGeo(lat, lon, alt); // radians, radians, kilometers 95 | } 96 | 97 | ////////////////////////////////////////////////////////////////////////////// 98 | // ae2km() 99 | // Convert the position and velocity vector units from AE-based units 100 | // to kilometer based units. 101 | void cEci::ae2km() 102 | { 103 | if (UnitsAreAe()) { 104 | MulPos(XKMPER_WGS72 / AE); // km 105 | MulVel((XKMPER_WGS72 / AE) * (MIN_PER_DAY / 86400)); // km/sec 106 | m_VecUnits = UNITS_KM; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/os3/libnorad/cEci.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cEci.h 3 | // 4 | // Copyright (c) 2003 Michael F. Henry 5 | //----------------------------------------------------- 6 | #ifndef __LIBNORAD_cEci_H__ 7 | #define __LIBNORAD_cEci_H__ 8 | 9 | #include "os3/libnorad/ccoord.h" 10 | #include "os3/libnorad/cVector.h" 11 | #include "os3/libnorad/cJulian.h" 12 | 13 | //----------------------------------------------------- 14 | // Class: cEci 15 | // Description: Encapsulates an Earth-Centered Inertial 16 | // position, velocity, and time. 17 | //----------------------------------------------------- 18 | class cEci 19 | { 20 | public: 21 | cEci() { m_VecUnits = UNITS_NONE; } 22 | cEci(const cCoordGeo& geo, const cJulian& cJulian); 23 | cEci(const cVector& pos, const cVector& vel, 24 | const cJulian& date, bool IsAeUnits = true); 25 | virtual ~cEci() {}; 26 | 27 | cCoordGeo toGeo(); 28 | 29 | cVector getPos() const { return m_pos; } 30 | cVector getVel() const { return m_vel; } 31 | cJulian getDate() const { return m_date; } 32 | 33 | void setUnitsAe() { m_VecUnits = UNITS_AE; } 34 | void setUnitsKm() { m_VecUnits = UNITS_KM; } 35 | bool UnitsAreAe() const { return m_VecUnits == UNITS_AE; } 36 | bool UnitsAreKm() const { return m_VecUnits == UNITS_KM; } 37 | void ae2km(); // Convert position, velocity vector units from AE to km 38 | 39 | protected: 40 | void MulPos(double factor) { m_pos.Mul(factor); } 41 | void MulVel(double factor) { m_vel.Mul(factor); } 42 | 43 | enum VecUnits 44 | { 45 | UNITS_NONE, // not initialized 46 | UNITS_AE, 47 | UNITS_KM, 48 | }; 49 | 50 | cVector m_pos; 51 | cVector m_vel; 52 | cJulian m_date; 53 | VecUnits m_VecUnits; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/os3/libnorad/cJulian.cc: -------------------------------------------------------------------------------- 1 | // 2 | // cJulian.cpp 3 | // 4 | // This class encapsulates Julian dates with the epoch of 12:00 noon (12:00 UT) 5 | // on January 1, 4713 B.C. Some epoch dates: 6 | // 01/01/1990 00:00 UTC - 2447892.5 7 | // 01/01/1990 12:00 UTC - 2447893.0 8 | // 01/01/2000 00:00 UTC - 2451544.5 9 | // 01/01/2001 00:00 UTC - 2451910.5 10 | // 11 | // Note the Julian day begins at noon, which allows astronomers to have all 12 | // the dates in a single observing session the same. 13 | // 14 | // References: 15 | // "Astronomical Formulae for Calculators", Jean Meeus 16 | // "Satellite Communications", Dennis Roddy, 2nd Edition, 1995. 17 | // 18 | // Copyright (c) 2003 Michael F. Henry 19 | // 20 | // mfh 12/24/2003 21 | // 22 | 23 | #include "os3/libnorad/cJulian.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | cJulian::cJulian() 31 | { 32 | initialize(2000, 1.0); 33 | } 34 | 35 | //----------------------------------------------------- 36 | // Create a Julian date object from a time_t object. time_t objects store the 37 | // number of seconds since midnight UTC January 1, 1970. 38 | //----------------------------------------------------- 39 | cJulian::cJulian(std::time_t time) 40 | { 41 | struct tm* ptm = gmtime(&time); 42 | assert(ptm); 43 | 44 | const int year = ptm->tm_year + 1900; 45 | const double day = ptm->tm_yday + 1 46 | + (ptm->tm_hour + ((ptm->tm_min + (ptm->tm_sec / 60.0)) / 60.0)) 47 | / 24.0; 48 | 49 | initialize(year, day); 50 | } 51 | 52 | //----------------------------------------------------- 53 | // Create a Julian date object from a year and day of year. 54 | // Example parameters: year = 2001, day = 1.5 (Jan 1 12h) 55 | //----------------------------------------------------- 56 | cJulian::cJulian(int year, double day) 57 | { 58 | initialize(year, day); 59 | } 60 | 61 | //----------------------------------------------------- 62 | // Create a Julian date obj A(47);ect. 63 | //----------------------------------------------------- 64 | cJulian::cJulian(int year, // i.e., 2004 65 | int mon, // 1..12 66 | int day, // 1..31 67 | int hour, // 0..23 68 | int min, // 0..59 69 | double sec /* = 0.0 */) // 0..(59.999999...) 70 | { 71 | // Calculate N, the day of the year (1..366) 72 | int N; 73 | const int F1 = static_cast((275.0 * mon) / 9.0); 74 | const int F2 = static_cast((mon + 9.0) / 12.0); 75 | 76 | if (IsLeapYear(year)) { 77 | // Leap year 78 | N = F1 - F2 + day - 30; 79 | } else { 80 | // Common year 81 | N = F1 - (2 * F2) + day - 30; 82 | } 83 | 84 | const double dblDay = N + (hour + (min + (sec / 60.0)) / 60.0) / 24.0; 85 | 86 | initialize(year, dblDay); 87 | } 88 | 89 | void cJulian::initialize(int year, double day) 90 | { 91 | // 1582 A.D.: 10 days removed from calendar 92 | // 3000 A.D.: Arbitrary error checking limit 93 | assert((year > 1582) && (year < 3000)); 94 | assert((day >= 0.0) && (day <= 366.5)); 95 | 96 | // Now calculate Julian date 97 | 98 | year--; 99 | 100 | // Centuries are not leap years unless they divide by 400 101 | const int A = (year / 100); 102 | const int B = 2 - A + (A / 4); 103 | 104 | // 1720994.5 = Oct 30, year -1 105 | const double NewYears = static_cast(365.25 * year) 106 | + static_cast(30.6001 * 14) + 1720994.5 + B; 107 | 108 | m_Date = NewYears + day; 109 | } 110 | 111 | //----------------------------------------------------- 112 | // getComponent() 113 | // Return requested components of date. 114 | // Year : Includes the century. 115 | // Month: 1..12 116 | // Day : 1..31 including fractional part 117 | //----------------------------------------------------- 118 | void cJulian::getComponent(int *pYear, int *pMon /* = NULL */, 119 | double *pDOM /* = NULL */) const 120 | { 121 | assert(pYear != NULL); 122 | 123 | const double jdAdj = getDate() + 0.5; 124 | const int Z = static_cast(jdAdj); // integer part 125 | const double F = static_cast(jdAdj - Z); // fractional part 126 | const double alpha = static_cast((Z - 1867216.25) / 36524.25); 127 | const double A = Z + 1 + alpha - static_cast(alpha / 4.0); 128 | const double B = A + 1524.0; 129 | const int C = static_cast((B - 122.1) / 365.25); 130 | const int D = static_cast(C * 365.25); 131 | const int E = static_cast((B - D) / 30.6001); 132 | 133 | const double DOM = B - D - static_cast(E * 30.6001) + F; 134 | const int month = (E < 13.5) ? (E - 1) : (E - 13); 135 | const int year = (month > 2.5) ? (C - 4716) : (C - 4715); 136 | 137 | *pYear = year; 138 | 139 | if (pMon != NULL) 140 | *pMon = month; 141 | 142 | if (pDOM != NULL) 143 | *pDOM = DOM; 144 | } 145 | 146 | //----------------------------------------------------- 147 | // toGMST() 148 | // Calculate Greenwich Mean Sidereal Time for the Julian date. The return value 149 | // is the angle, in radians, measuring eastward from the Vernal Equinox to the 150 | // prime meridian. This angle is also referred to as "ThetaG" (Theta GMST). 151 | // 152 | // References: 153 | // The 1992 Astronomical Almanac, page B6. 154 | // Explanatory Supplement to the Astronomical Almanac, page 50.protected: 155 | // Orbital Coordinate Systems, Part III, Dr. T.S. Kelso, Satellite Times, 156 | // Nov/Dec 1995 157 | //----------------------------------------------------- 158 | double cJulian::toGMST() const 159 | { 160 | const double UT = fmod(m_Date + 0.5, 1.0); 161 | const double TU = (FromJan1_12h_2000() - UT) / 36525.0; 162 | 163 | double GMST = 24110.54841 164 | + TU * (8640184.812866 + TU * (0.093104 - TU * 6.2e-06)); 165 | 166 | GMST = std::fmod(GMST + SEC_PER_DAY * OMEGA_E * UT, SEC_PER_DAY); 167 | 168 | if (GMST < 0.0) 169 | GMST += SEC_PER_DAY; // "wrap" negative modulo value 170 | 171 | return (TWOPI * (GMST / SEC_PER_DAY)); 172 | } 173 | 174 | //----------------------------------------------------- 175 | // toLMST() 176 | // Calculate Local Mean Sidereal Time for given longitude (for this date). 177 | // The longitude is assumed to be in radians measured west from Greenwich. 178 | // The return value is the angle, in radians, measuring eastward from the 179 | // Vernal Equinox to the given longitude. 180 | //----------------------------------------------------- 181 | double cJulian::toLMST(double lon) const 182 | { 183 | return std::fmod(toGMST() + lon, TWOPI); 184 | } 185 | 186 | //----------------------------------------------------- 187 | // toTime() 188 | // Convert to type time_t 189 | // Avoid using this function as it discards the fractional seconds of the 190 | // time component. 191 | //----------------------------------------------------- 192 | std::time_t cJulian::toTime() const 193 | { 194 | int nYear; 195 | int nMonth; 196 | double dblDay; 197 | 198 | getComponent(&nYear, &nMonth, &dblDay); 199 | 200 | // dblDay is the fractional Julian Day (i.e., 29.5577). 201 | // Save the whole number day in nDOM and convert dblDay to 202 | // the fractional portion of day. 203 | int nDOM = static_cast(dblDay); 204 | 205 | dblDay -= nDOM; 206 | 207 | const int SEC_PER_MIN = 60; 208 | const int SEC_PER_HR = 60 * SEC_PER_MIN; 209 | const int SEC_PER_DAY = 24 * SEC_PER_HR; 210 | 211 | const int secs = static_cast((dblDay * SEC_PER_DAY) + 0.5); 212 | 213 | // Create a "struct tm" type. 214 | // NOTE: 215 | // The "struct tm" type has a 1-second resolution. Any fractional 216 | // component of the "seconds" time value is discarded. 217 | struct tm tGMT; 218 | std::memset(&tGMT, 0, sizeof(tGMT)); 219 | 220 | tGMT.tm_year = nYear - 1900; // 2001 is 101 221 | tGMT.tm_mon = nMonth - 1; // January is 0 222 | tGMT.tm_mday = nDOM; // First day is 1 223 | tGMT.tm_hour = secs / SEC_PER_HR; 224 | tGMT.tm_min = (secs % SEC_PER_HR) / SEC_PER_MIN; 225 | tGMT.tm_sec = (secs % SEC_PER_HR) % SEC_PER_MIN; 226 | tGMT.tm_isdst = 0; // No conversion desired 227 | 228 | std::time_t tEpoch = std::mktime(&tGMT); 229 | 230 | if (tEpoch != -1) { 231 | // Valid time_t value returned from mktime(). 232 | // mktime() expects a local time which means that tEpoch now needs 233 | // to be adjusted by the difference between this time zone and GMT. 234 | #if defined(_WIN32) 235 | long _timezone = 0; 236 | tEpoch -= _timezone; 237 | #else 238 | tEpoch -= timezone; 239 | #endif 240 | } 241 | 242 | return tEpoch; 243 | } 244 | -------------------------------------------------------------------------------- /src/os3/libnorad/cJulian.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cJulian.h 3 | // 4 | // Copyright (c) 2003 Michael F. Henry 5 | //----------------------------------------------------- 6 | #ifndef __LIBNORAD_cJulian_H__ 7 | #define __LIBNORAD_cJulian_H__ 8 | 9 | #include 10 | 11 | #include "os3/libnorad/globals.h" 12 | 13 | //----------------------------------------------------- 14 | // See note in cJulian.cpp for information on this class and the epoch dates 15 | //----------------------------------------------------- 16 | const double EPOCH_JAN1_00H_1900 = 2415019.5; // Jan 1.0 1900 = Jan 1 1900 00h UTC 17 | const double EPOCH_JAN1_12H_1900 = 2415020.0; // Jan 1.5 1900 = Jan 1 1900 12h UTC 18 | const double EPOCH_JAN1_12H_2000 = 2451545.0; // Jan 1.5 2000 = Jan 1 2000 12h UTC 19 | 20 | class cJulian 21 | { 22 | public: 23 | cJulian(); 24 | explicit cJulian(std::time_t t); // Create from time_t 25 | explicit cJulian(int year, double day); // Create from year, day of year 26 | explicit cJulian(int year, // i.e., 2004 27 | int mon, // 1..12 28 | int day, // 1..31 29 | int hour, // 0..23 30 | int min, // 0..59 31 | double sec = 0.0); // 0..(59.999999...) 32 | ~cJulian() {} 33 | 34 | double toGMST() const; // Greenwich Mean Sidereal Time 35 | double toLMST(double lon) const; // Local Mean Sideral Time 36 | std::time_t toTime() const; // To time_t type - avoid using 37 | 38 | double FromJan1_00h_1900() const { return m_Date - EPOCH_JAN1_00H_1900; } 39 | double FromJan1_12h_1900() const { return m_Date - EPOCH_JAN1_12H_1900; } 40 | double FromJan1_12h_2000() const { return m_Date - EPOCH_JAN1_12H_2000; } 41 | 42 | void getComponent(int* pYear, int* pMon = NULL, double* pDOM = NULL) const; 43 | 44 | double getDate() const { return m_Date; } 45 | 46 | void addDay(double day) { m_Date += day; } 47 | void addHour(double hr) { m_Date += (hr / HR_PER_DAY); } 48 | void addMin(double min) { m_Date += (min / MIN_PER_DAY); } 49 | void addSec(double sec) { m_Date += (sec / SEC_PER_DAY); } 50 | 51 | double spanDay(const cJulian& b) const { return m_Date - b.m_Date; } 52 | double spanHour(const cJulian& b) const { return spanDay(b) * HR_PER_DAY; } 53 | double spanMin(const cJulian& b) const { return spanDay(b) * MIN_PER_DAY; } 54 | double spanSec(const cJulian& b) const { return spanDay(b) * SEC_PER_DAY; } 55 | 56 | static bool IsLeapYear(int y) { 57 | return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0); 58 | } 59 | protected: 60 | void initialize(int year, double day); 61 | 62 | double m_Date; // Julian date 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/os3/libnorad/cNoradBase.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cNoradBase.cpp 3 | // 4 | // Historical Note: 5 | // The equations used here (and in derived classes) to determine satellite 6 | // ECI coordinates/velocity come from the December, 1980 NORAD document 7 | // "Space Track Report No. 3". The report details 6 orbital models and 8 | // provides FORTRAN IV implementations of each. The classes here 9 | // implement only two of the orbital models: SGP4 and SDP4. These two models, 10 | // one for "near-earth" objects and one for "deep space" objects, are widely 11 | // used in satellite tracking software and can produce very accurate results 12 | // when used with current NORAD two-line element datum. 13 | // 14 | // The NORAD FORTRAN IV SGP4/SDP4 implementations were converted to Pascal by 15 | // Dr. TS Kelso in 1995. In 1996 these routines were ported in a straight- 16 | // forward manner to C++ by Varol Okan. The SGP4/SDP4 classes here were 17 | // written by Michael F. Henry in 2002-03 and are a modern C++ re-write of 18 | // the work done by Okan. In addition to introducing an object-oriented 19 | // architecture, the last residues of the original FORTRAN code (such as 20 | // labels and gotos) were eradicated. 21 | // 22 | // For excellent information on the underlying physics of orbits, visible 23 | // satellite observations, current NORAD TLE data, and other related material, 24 | // see http://www.celestrak.com which is maintained by Dr. TS Kelso. 25 | // 26 | // Copyright (c) 2003 Michael F. Henry 27 | // 28 | // mfh 12/07/2003 29 | //----------------------------------------------------- 30 | #include "os3/libnorad/cNoradBase.h" 31 | #include "os3/libnorad/cOrbit.h" 32 | #include "os3/libnorad/ccoord.h" 33 | #include "os3/libnorad/cEci.h" 34 | #include "os3/libnorad/cVector.h" 35 | #include "os3/libnorad/cJulian.h" 36 | 37 | #include 38 | 39 | cNoradBase::cNoradBase(const cOrbit& orbit) : 40 | m_Orbit(orbit) 41 | { 42 | Initialize(); 43 | } 44 | 45 | cNoradBase::~cNoradBase() 46 | {} 47 | 48 | cNoradBase& cNoradBase::operator=(const cNoradBase& b) 49 | { 50 | // m_Orbit is a "const" member var, so cast away its 51 | // "const-ness" in order to complete the assigment. 52 | *(const_cast(&m_Orbit)) = b.m_Orbit; 53 | 54 | return *this; 55 | } 56 | 57 | ////////////////////////////////////////////////////////////////////////////// 58 | // Initialize() 59 | // Perform the initialization of member variables, specifically the variables 60 | // used by derived-class objects to calculate ECI coordinates. 61 | void cNoradBase::Initialize() 62 | { 63 | // Initialize any variables which are time-independent when 64 | // calculating the ECI coordinates of the satellite. 65 | m_satInc = m_Orbit.Inclination(); 66 | m_satEcc = m_Orbit.Eccentricity(); 67 | 68 | m_cosio = std::cos(m_satInc); 69 | m_theta2 = m_cosio * m_cosio; 70 | m_x3thm1 = 3.0 * m_theta2 - 1.0; 71 | m_eosq = m_satEcc * m_satEcc; 72 | m_betao2 = 1.0 - m_eosq; 73 | m_betao = std::sqrt(m_betao2); 74 | 75 | // The "recovered" semi-minor axis and mean motion. 76 | m_aodp = m_Orbit.SemiMinor(); 77 | m_xnodp = m_Orbit.mnMotionRec(); 78 | 79 | // For perigee below 156 km, the values of S and QOMS2T are altered. 80 | m_perigee = XKMPER_WGS72 * (m_aodp * (1.0 - m_satEcc) - AE); 81 | 82 | m_s4 = S; 83 | m_qoms24 = QOMS2T; 84 | 85 | if (m_perigee < 156.0) { 86 | m_s4 = m_perigee - 78.0; 87 | 88 | if (m_perigee <= 98.0) { 89 | m_s4 = 20.0; 90 | } 91 | 92 | m_qoms24 = std::pow((120.0 - m_s4) * AE / XKMPER_WGS72, 4.0); 93 | m_s4 = m_s4 / XKMPER_WGS72 + AE; 94 | } 95 | 96 | const double pinvsq = 1.0 / (m_aodp * m_aodp * m_betao2 * m_betao2); 97 | 98 | m_tsi = 1.0 / (m_aodp - m_s4); 99 | m_eta = m_aodp * m_satEcc * m_tsi; 100 | m_etasq = m_eta * m_eta; 101 | m_eeta = m_satEcc * m_eta; 102 | 103 | const double psisq = std::fabs(1.0 - m_etasq); 104 | 105 | m_coef = m_qoms24 * std::pow(m_tsi,4.0); 106 | m_coef1 = m_coef / std::pow(psisq,3.5); 107 | 108 | const double c2 = m_coef1 * m_xnodp * 109 | (m_aodp * (1.0 + 1.5 * m_etasq + m_eeta * (4.0 + m_etasq)) + 110 | 0.75 * CK2 * m_tsi / psisq * m_x3thm1 * 111 | (8.0 + 3.0 * m_etasq * (8.0 + m_etasq))); 112 | 113 | m_c1 = m_Orbit.BStar() * c2; 114 | m_sinio = std::sin(m_satInc); 115 | 116 | const double a3ovk2 = -XJ3 / CK2 * std::pow(AE,3.0); 117 | 118 | m_c3 = m_coef * m_tsi * a3ovk2 * m_xnodp * AE * m_sinio / m_satEcc; 119 | m_x1mth2 = 1.0 - m_theta2; 120 | m_c4 = 2.0 * m_xnodp * m_coef1 * m_aodp * m_betao2 * 121 | (m_eta * (2.0 + 0.5 * m_etasq) + 122 | m_satEcc * (0.5 + 2.0 * m_etasq) - 123 | 2.0 * CK2 * m_tsi / (m_aodp * psisq) * 124 | (-3.0 * m_x3thm1 * (1.0 - 2.0 * m_eeta + m_etasq * (1.5 - 0.5 * m_eeta)) + 125 | 0.75 * m_x1mth2 * 126 | (2.0 * m_etasq - m_eeta * (1.0 + m_etasq)) * 127 | std::cos(2.0 * m_Orbit.ArgPerigee()))); 128 | 129 | const double theta4 = m_theta2 * m_theta2; 130 | const double temp1 = 3.0 * CK2 * pinvsq * m_xnodp; 131 | const double temp2 = temp1 * CK2 * pinvsq; 132 | const double temp3 = 1.25 * CK4 * pinvsq * pinvsq * m_xnodp; 133 | 134 | m_xmdot = m_xnodp + 0.5 * temp1 * m_betao * m_x3thm1 + 135 | 0.0625 * temp2 * m_betao * 136 | (13.0 - 78.0 * m_theta2 + 137.0 * theta4); 137 | 138 | const double x1m5th = 1.0 - 5.0 * m_theta2; 139 | 140 | m_omgdot = -0.5 * temp1 * x1m5th + 0.0625 * temp2 * 141 | (7.0 - 114.0 * m_theta2 + 395.0 * theta4) + 142 | temp3 * (3.0 - 36.0 * m_theta2 + 49.0 * theta4); 143 | 144 | const double xhdot1 = -temp1 * m_cosio; 145 | 146 | m_xnodot = xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * m_theta2) + 147 | 2.0 * temp3 * (3.0 - 7.0 * m_theta2)) * m_cosio; 148 | m_xnodcf = 3.5 * m_betao2 * xhdot1 * m_c1; 149 | m_t2cof = 1.5 * m_c1; 150 | m_xlcof = 0.125 * a3ovk2 * m_sinio * 151 | (3.0 + 5.0 * m_cosio) / (1.0 + m_cosio); 152 | m_aycof = 0.25 * a3ovk2 * m_sinio; 153 | m_x7thm1 = 7.0 * m_theta2 - 1.0; 154 | } 155 | 156 | bool cNoradBase::FinalPosition(double incl, double omega, 157 | double e, double a, 158 | double xl, double xnode, 159 | double xn, double tsince, 160 | cEci &eci) 161 | { 162 | if ((e * e) > 1.0) { 163 | // error in satellite data 164 | return false; 165 | } 166 | 167 | const double beta = std::sqrt(1.0 - e * e); 168 | 169 | // Long period periodics 170 | const double axn = e * std::cos(omega); 171 | double temp = 1.0 / (a * beta * beta); 172 | const double xll = temp * m_xlcof * axn; 173 | const double aynl = temp * m_aycof; 174 | const double xlt = xl + xll; 175 | const double ayn = e * std::sin(omega) + aynl; 176 | 177 | // Solve Kepler's Equation 178 | 179 | const double capu = Fmod2p(xlt - xnode); 180 | double temp2 = capu; 181 | double temp3 = 0.0; 182 | double temp4 = 0.0; 183 | double temp5 = 0.0; 184 | double temp6 = 0.0; 185 | double sinepw = 0.0; 186 | double cosepw = 0.0; 187 | bool fDone = false; 188 | 189 | for (int i = 1; (i <= 10) && !fDone; i++) { 190 | sinepw = std::sin(temp2); 191 | cosepw = std::cos(temp2); 192 | temp3 = axn * sinepw; 193 | temp4 = ayn * cosepw; 194 | temp5 = axn * cosepw; 195 | temp6 = ayn * sinepw; 196 | 197 | double epw = (capu - temp4 + temp3 - temp2) / 198 | (1.0 - temp5 - temp6) + temp2; 199 | 200 | if (std::fabs(epw - temp2) <= E6A) 201 | fDone = true; 202 | else 203 | temp2 = epw; 204 | } 205 | 206 | // Short period preliminary quantities 207 | const double ecose = temp5 + temp6; 208 | const double esine = temp3 - temp4; 209 | const double elsq = axn * axn + ayn * ayn; 210 | temp = 1.0 - elsq; 211 | const double pl = a * temp; 212 | const double r = a * (1.0 - ecose); 213 | double temp1 = 1.0 / r; 214 | const double rdot = XKE * std::sqrt(a) * esine * temp1; 215 | const double rfdot = XKE * std::sqrt(pl) * temp1; 216 | temp2 = a * temp1; 217 | const double betal = std::sqrt(temp); 218 | temp3 = 1.0 / (1.0 + betal); 219 | const double cosu = temp2 * (cosepw - axn + ayn * esine * temp3); 220 | const double sinu = temp2 * (sinepw - ayn - axn * esine * temp3); 221 | const double u = AcTan(sinu, cosu); 222 | const double sin2u = 2.0 * sinu * cosu; 223 | const double cos2u = 2.0 * cosu * cosu - 1.0; 224 | 225 | temp = 1.0 / pl; 226 | temp1 = CK2 * temp; 227 | temp2 = temp1 * temp; 228 | 229 | // Update for short periodics 230 | const double rk = r * (1.0 - 1.5 * temp2 * betal * m_x3thm1) + 231 | 0.5 * temp1 * m_x1mth2 * cos2u; 232 | const double uk = u - 0.25 * temp2 * m_x7thm1 * sin2u; 233 | const double xnodek = xnode + 1.5 * temp2 * m_cosio * sin2u; 234 | const double xinck = incl + 1.5 * temp2 * m_cosio * m_sinio * cos2u; 235 | const double rdotk = rdot - xn * temp1 * m_x1mth2 * sin2u; 236 | const double rfdotk = rfdot + xn * temp1 * (m_x1mth2 * cos2u + 1.5 * m_x3thm1); 237 | 238 | // Orientation vectors 239 | const double sinuk = std::sin(uk); 240 | const double cosuk = std::cos(uk); 241 | const double sinik = std::sin(xinck); 242 | const double cosik = std::cos(xinck); 243 | const double sinnok = std::sin(xnodek); 244 | const double cosnok = std::cos(xnodek); 245 | const double xmx = -sinnok * cosik; 246 | const double xmy = cosnok * cosik; 247 | const double ux = xmx * sinuk + cosnok * cosuk; 248 | const double uy = xmy * sinuk + sinnok * cosuk; 249 | const double uz = sinik * sinuk; 250 | const double vx = xmx * cosuk - cosnok * sinuk; 251 | const double vy = xmy * cosuk - sinnok * sinuk; 252 | const double vz = sinik * cosuk; 253 | 254 | // Position 255 | const double x = rk * ux; 256 | const double y = rk * uy; 257 | const double z = rk * uz; 258 | 259 | cVector vecPos(x, y, z); 260 | 261 | // Validate on altitude 262 | const double altKm = (vecPos.Magnitude() * (XKMPER_WGS72 / AE)); 263 | 264 | if ((altKm < XKMPER_WGS72) || (altKm > (2 * GEOSYNC_ALT))) 265 | return false; 266 | 267 | // Velocity 268 | const double xdot = rdotk * ux + rfdotk * vx; 269 | const double ydot = rdotk * uy + rfdotk * vy; 270 | const double zdot = rdotk * uz + rfdotk * vz; 271 | 272 | cVector vecVel(xdot, ydot, zdot); 273 | 274 | cJulian gmt = m_Orbit.Epoch(); 275 | gmt.addMin(tsince); 276 | 277 | eci = cEci(vecPos, vecVel, gmt); 278 | 279 | return true; 280 | } 281 | 282 | 283 | 284 | -------------------------------------------------------------------------------- /src/os3/libnorad/cNoradBase.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cNoradBase.h 3 | // 4 | // This class provides a base class for the NORAD SGP4/SDP4 5 | // orbit models. 6 | // 7 | // Copyright (c) 2003 Michael F. Henry 8 | //----------------------------------------------------- 9 | #ifndef __LIBNORAD_cNoradBase_H__ 10 | #define __LIBNORAD_cNoradBase_H__ 11 | 12 | class cEci; 13 | class cOrbit; 14 | 15 | class cNoradBase 16 | { 17 | public: 18 | cNoradBase(const cOrbit&); 19 | virtual ~cNoradBase(void); 20 | 21 | virtual bool getPosition(double tsince, cEci &eci) = 0; 22 | 23 | protected: 24 | cNoradBase& operator=(const cNoradBase&); 25 | 26 | void Initialize(); 27 | bool FinalPosition(double incl, double omega, double e, 28 | double a, double xl, double xnode, 29 | double xn, double tsince, cEci &eci); 30 | 31 | const cOrbit& m_Orbit; 32 | 33 | // Orbital parameter variables which need only be calculated one 34 | // time for a given orbit (ECI position time-independent). 35 | double m_satInc; // inclination 36 | double m_satEcc; // eccentricity 37 | 38 | double m_cosio; double m_theta2; double m_x3thm1; double m_eosq; 39 | double m_betao2; double m_betao; double m_aodp; double m_xnodp; 40 | double m_s4; double m_qoms24; double m_perigee; double m_tsi; 41 | double m_eta; double m_etasq; double m_eeta; double m_coef; 42 | double m_coef1; double m_c1; double m_c2; double m_c3; 43 | double m_c4; double m_sinio; double m_a3ovk2; double m_x1mth2; 44 | double m_xmdot; double m_omgdot; double m_xhdot1; double m_xnodot; 45 | double m_xnodcf; double m_t2cof; double m_xlcof; double m_aycof; 46 | double m_x7thm1; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/os3/libnorad/cNoradSDP4.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cNoradSDP4.h 3 | // 4 | // This class implements the NORAD Simple Deep Perturbation 4 orbit 5 | // model. This model provides the ECI coordinates/velocity of satellites 6 | // with periods >= 225 minutes. 7 | // 8 | // Copyright (c) 2003 Michael F. Henry 9 | //----------------------------------------------------- 10 | #ifndef __LIBNORAD_cNoradSDP4_H__ 11 | #define __LIBNORAD_cNoradSDP4_H__ 12 | 13 | #include "os3/libnorad/cNoradBase.h" 14 | 15 | class cOrbit; 16 | 17 | class cNoradSDP4 : public cNoradBase 18 | { 19 | public: 20 | cNoradSDP4(const cOrbit& orbit); 21 | virtual ~cNoradSDP4(); 22 | 23 | virtual bool getPosition(double tsince, cEci& eci); 24 | 25 | protected: 26 | bool DeepInit(double* eosq, double* sinio, double* cosio, double* m_betao, 27 | double* m_aodp, double* m_theta2, double* m_sing, double* m_cosg, 28 | double* m_betao2,double* xmdot, double* omgdot, double* xnodott); 29 | 30 | bool DeepSecular(double* xmdf, double* omgadf,double* xnode, double* emm, 31 | double* xincc, double* xnn, double* tsince); 32 | bool DeepCalcDotTerms (double* pxndot, double* pxnddt, double* pxldot); 33 | void DeepCalcIntegrator(double* pxndot, double* pxnddt, double* pxldot, 34 | const double& delt); 35 | bool DeepPeriodics(double* e, double* xincc, double* omgadf, 36 | double* xnode, double* xmam); 37 | double m_sing; 38 | double m_cosg; 39 | 40 | // Deep Initialization 41 | double eqsq; double siniq; double cosiq; double rteqsq; double ao; 42 | double cosq2; double sinomo; double cosomo; double bsq; double xlldot; 43 | double omgdt; double xnodot; 44 | 45 | // Deep Secular, Periodic 46 | double xll; double omgasm; double xnodes; double _em; 47 | double xinc; double xn; double t; 48 | 49 | // Variables shared by "Deep" routines 50 | double dp_e3; double dp_ee2; double dp_savtsn; double dp_se2; 51 | double dp_se3; double dp_sgh2; double dp_sgh3; double dp_sgh4; 52 | double dp_sghs; double dp_sh2; double dp_sh3; double dp_si2; 53 | double dp_si3; double dp_sl2; double dp_sl3; double dp_sl4; 54 | double dp_xgh2; double dp_xgh3; double dp_xgh4; double dp_xh2; 55 | double dp_xh3; double dp_xi2; double dp_xi3; double dp_xl2; 56 | double dp_xl3; double dp_xl4; double dp_xqncl; double dp_zmol; 57 | double dp_zmos; 58 | 59 | double dp_atime; double dp_d2201; double dp_d2211; double dp_d3210; 60 | double dp_d3222; double dp_d4410; double dp_d4422; double dp_d5220; 61 | double dp_d5232; double dp_d5421; double dp_d5433; double dp_del1; 62 | double dp_del2; double dp_del3; double dp_fasx2; double dp_fasx4; 63 | double dp_fasx6; double dp_omegaq; double dp_sse; double dp_ssg; 64 | double dp_ssh; double dp_ssi; double dp_ssl; double dp_step2; 65 | double dp_stepn; double dp_stepp; double dp_thgr; double dp_xfact; 66 | double dp_xlamo; double dp_xli; double dp_xni; 67 | 68 | bool dp_iresfl; 69 | bool dp_isynfl; 70 | 71 | // DeepInit vars that change with epoch 72 | double dpi_c; double dpi_ctem; double dpi_day; double dpi_gam; 73 | double dpi_stem; double dpi_xnodce; double dpi_zcosgl; double dpi_zcoshl; 74 | double dpi_zcosil; double dpi_zsingl; double dpi_zsinhl; double dpi_zsinil; 75 | double dpi_zx; double dpi_zy; 76 | 77 | }; 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /src/os3/libnorad/cNoradSGP4.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cNoradSGP4.cpp 3 | // 4 | // NORAD SGP4 implementation. See historical note in cNoradBase.cpp 5 | // Copyright (c) 2003 Michael F. Henry 6 | // 7 | // mfh 12/07/2003 8 | //----------------------------------------------------- 9 | 10 | #include "os3/libnorad/cNoradSGP4.h" 11 | 12 | #include 13 | 14 | #include "os3/libnorad/cJulian.h" 15 | #include "os3/libnorad/cOrbit.h" 16 | #include "os3/libnorad/cVector.h" 17 | #include "os3/libnorad/ccoord.h" 18 | 19 | cNoradSGP4::cNoradSGP4(const cOrbit& orbit) : 20 | cNoradBase(orbit) 21 | { 22 | m_c5 = 2.0 * m_coef1 * m_aodp * m_betao2 * 23 | (1.0 + 2.75 * (m_etasq + m_eeta) + m_eeta * m_etasq); 24 | m_omgcof = m_Orbit.BStar() * m_c3 * std::cos(m_Orbit.ArgPerigee()); 25 | m_xmcof = -TWOTHRD * m_coef * m_Orbit.BStar() * AE / m_eeta; 26 | m_delmo = std::pow(1.0 + m_eta * std::cos(m_Orbit.mnAnomaly()), 3.0); 27 | m_sinmo = std::sin(m_Orbit.mnAnomaly()); 28 | } 29 | 30 | cNoradSGP4::~cNoradSGP4() 31 | {} 32 | 33 | //----------------------------------------------------- 34 | // getPosition() 35 | // This procedure returns the ECI position and velocity for the satellite 36 | // in the orbit at the given number of minutes since the TLE epoch time 37 | // using the NORAD Simplified General Perturbation 4, near earth orbit 38 | // model. 39 | // 40 | // tsince - Time in minutes since the TLE epoch (GMT). 41 | // eci - ECI object to hold position information. 42 | // To convert the returned ECI position vector to km, 43 | // multiply each component by: 44 | // (XKMPER_WGS72 / AE). 45 | // To convert the returned ECI velocity vector to km/sec, 46 | // multiply each component by: 47 | // (XKMPER_WGS72 / AE) * (MIN_PER_DAY / 86400). 48 | //----------------------------------------------------- 49 | bool cNoradSGP4::getPosition(double tsince, cEci& eci) 50 | { 51 | // For m_perigee less than 220 kilometers, the isimp flag is set and 52 | // the equations are truncated to linear variation in sqrt a and 53 | // quadratic variation in mean anomaly. Also, the m_c3 term, the 54 | // delta omega term, and the delta m term are dropped. 55 | bool isimp = false; 56 | if ((m_aodp * (1.0 - m_satEcc) / AE) < (220.0 / XKMPER_WGS72 + AE)) { 57 | isimp = true; 58 | } 59 | 60 | double d2 = 0.0; 61 | double d3 = 0.0; 62 | double d4 = 0.0; 63 | 64 | double t3cof = 0.0; 65 | double t4cof = 0.0; 66 | double t5cof = 0.0; 67 | 68 | if (!isimp) { 69 | double c1sq = m_c1 * m_c1; 70 | 71 | d2 = 4.0 * m_aodp * m_tsi * c1sq; 72 | 73 | const double temp = d2 * m_tsi * m_c1 / 3.0; 74 | 75 | d3 = (17.0 * m_aodp + m_s4) * temp; 76 | d4 = 0.5 * temp * m_aodp * m_tsi * 77 | (221.0 * m_aodp + 31.0 * m_s4) * m_c1; 78 | t3cof = d2 + 2.0 * c1sq; 79 | t4cof = 0.25 * (3.0 * d3 + m_c1 * (12.0 * d2 + 10.0 * c1sq)); 80 | t5cof = 0.2 * (3.0 * d4 + 12.0 * m_c1 * d3 + 6.0 * 81 | d2 * d2 + 15.0 * c1sq * (2.0 * d2 + c1sq)); 82 | } 83 | 84 | // Update for secular gravity and atmospheric drag. 85 | const double xmdf = m_Orbit.mnAnomaly() + m_xmdot * tsince; 86 | const double omgadf = m_Orbit.ArgPerigee() + m_omgdot * tsince; 87 | const double xnoddf = m_Orbit.RAAN() + m_xnodot * tsince; 88 | double omega = omgadf; 89 | double xmp = xmdf; 90 | const double tsq = tsince * tsince; 91 | double xnode = xnoddf + m_xnodcf * tsq; 92 | double tempa = 1.0 - m_c1 * tsince; 93 | double tempe = m_Orbit.BStar() * m_c4 * tsince; 94 | double templ = m_t2cof * tsq; 95 | 96 | if (!isimp) { 97 | double delomg = m_omgcof * tsince; 98 | double delm = m_xmcof * (std::pow(1.0 + m_eta * std::cos(xmdf), 3.0) - m_delmo); 99 | double temp = delomg + delm; 100 | 101 | xmp = xmdf + temp; 102 | omega = omgadf - temp; 103 | 104 | double tcube = tsq * tsince; 105 | double tfour = tsince * tcube; 106 | 107 | tempa = tempa - d2 * tsq - d3 * tcube - d4 * tfour; 108 | tempe = tempe + m_Orbit.BStar() * m_c5 * (std::sin(xmp) - m_sinmo); 109 | templ = templ + t3cof * tcube + tfour * (t4cof + tsince * t5cof); 110 | } 111 | 112 | const double a = m_aodp * sqr(tempa); 113 | const double e = m_satEcc - tempe; 114 | 115 | 116 | const double xl = xmp + omega + xnode + m_xnodp * templ; 117 | const double xn = XKE / pow(a, 1.5); 118 | 119 | return FinalPosition(m_satInc, omgadf, e, a, xl, xnode, xn, tsince, eci); 120 | } 121 | 122 | -------------------------------------------------------------------------------- /src/os3/libnorad/cNoradSGP4.h: -------------------------------------------------------------------------------- 1 | // 2 | // cNoradSGP4.h 3 | // 4 | // This class implements the NORAD Simple General Perturbation 4 orbit 5 | // model. This model provides the ECI coordiantes/velocity of satellites 6 | // with orbit periods less than 225 minutes. 7 | // 8 | // Copyright (c) 2003 Michael F. Henry 9 | // 10 | #ifndef __LIBNORAD_cNoradSGP4_H__ 11 | #define __LIBNORAD_cNoradSGP4_H__ 12 | 13 | #include "os3/libnorad/cNoradBase.h" 14 | 15 | class cOrbit; 16 | 17 | class cNoradSGP4 : public cNoradBase 18 | { 19 | public: 20 | cNoradSGP4(const cOrbit& orbit); 21 | virtual ~cNoradSGP4(); 22 | 23 | virtual bool getPosition(double tsince, cEci& eci); 24 | 25 | protected: 26 | double m_c5; 27 | double m_omgcof; 28 | double m_xmcof; 29 | double m_delmo; 30 | double m_sinmo; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/os3/libnorad/cOrbit.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cOrbit.cpp 3 | // 4 | // Copyright (c) 2002-2003 Michael F. Henry 5 | // 6 | // mfh 11/15/2003 7 | //----------------------------------------------------- 8 | 9 | #include "os3/libnorad/cOrbit.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "os3/libnorad/cVector.h" 16 | #include "os3/libnorad/cEci.h" 17 | #include "os3/libnorad/ccoord.h" 18 | #include "os3/libnorad/cJulian.h" 19 | #include "os3/libnorad/cNoradSGP4.h" 20 | #include "os3/libnorad/cNoradSDP4.h" 21 | 22 | cOrbit::cOrbit(const cTle &tle) : 23 | m_tle(tle), 24 | m_pNoradModel(NULL) 25 | { 26 | m_tle.Initialize(); 27 | 28 | int epochYear = static_cast(m_tle.getField(cTle::FLD_EPOCHYEAR)); 29 | const double epochDay = m_tle.getField(cTle::FLD_EPOCHDAY ); 30 | 31 | if (epochYear < 57) 32 | epochYear += 2000; 33 | else 34 | epochYear += 1900; 35 | 36 | m_jdEpoch = cJulian(epochYear, epochDay); 37 | 38 | m_secPeriod = -1.0; 39 | 40 | // Recover the original mean motion and semimajor axis from the 41 | // input elements. 42 | const double mm = mnMotion(); 43 | const double rpmin = mm * 2 * PI / MIN_PER_DAY; // rads per minute 44 | 45 | const double a1 = std::pow(XKE / rpmin, TWOTHRD); 46 | const double e = Eccentricity(); 47 | const double i = Inclination(); 48 | const double temp = (1.5 * CK2 * (3.0 * sqr(cos(i)) - 1.0) / std::pow(1.0 - e * e, 1.5)); 49 | const double delta1 = temp / (a1 * a1); 50 | const double a0 = a1 * 51 | (1.0 - delta1 * 52 | ((1.0 / 3.0) + delta1 * 53 | (1.0 + 134.0 / 81.0 * delta1))); 54 | 55 | const double delta0 = temp / (a0 * a0); 56 | 57 | m_mnMotionRec = rpmin / (1.0 + delta0); 58 | m_aeAxisSemiMinorRec = a0 / (1.0 - delta0); 59 | m_aeAxisSemiMajorRec = m_aeAxisSemiMinorRec / sqrt(1.0 - (e * e)); 60 | m_kmPerigeeRec = XKMPER_WGS72 * (m_aeAxisSemiMajorRec * (1.0 - e) - AE); 61 | m_kmApogeeRec = XKMPER_WGS72 * (m_aeAxisSemiMajorRec * (1.0 + e) - AE); 62 | 63 | if (2.0 * PI / m_mnMotionRec >= 225.0) { 64 | // SDP4 - period >= 225 minutes. 65 | m_pNoradModel = new cNoradSDP4(*this); 66 | } else { 67 | // SGP4 - period < 225 minutes 68 | m_pNoradModel = new cNoradSGP4(*this); 69 | } 70 | } 71 | 72 | cOrbit::~cOrbit() 73 | { 74 | delete m_pNoradModel; 75 | } 76 | 77 | //----------------------------------------------------- 78 | // Return the period in seconds 79 | //----------------------------------------------------- 80 | double cOrbit::Period() const 81 | { 82 | if (m_secPeriod < 0.0) { 83 | // Calculate the period using the recovered mean motion. 84 | if (m_mnMotionRec == 0) 85 | m_secPeriod = 0.0; 86 | else 87 | m_secPeriod = (2 * PI) / m_mnMotionRec * 60.0; 88 | } 89 | return m_secPeriod; 90 | } 91 | 92 | //----------------------------------------------------- 93 | // Returns elapsed number of seconds from epoch to given time. 94 | // Note: "Predicted" TLEs can have epochs in the future. 95 | //----------------------------------------------------- 96 | double cOrbit::TPlusEpoch(const cJulian& gmt) const 97 | { 98 | return gmt.spanSec(Epoch()); 99 | } 100 | 101 | //----------------------------------------------------- 102 | // Returns the mean anomaly in radians at given GMT. 103 | // At epoch, the mean anomaly is given by the elements data. 104 | //----------------------------------------------------- 105 | double cOrbit::mnAnomaly(cJulian gmt) const 106 | { 107 | const double span = TPlusEpoch(gmt); 108 | const double P = Period(); 109 | 110 | assert(P != 0.0); 111 | 112 | return std::fmod(mnAnomaly() + (TWOPI * (span / P)), TWOPI); 113 | } 114 | 115 | //----------------------------------------------------- 116 | // getPosition() 117 | // This procedure returns the ECI position and velocity for the satellite 118 | // at "tsince" minutes from the (GMT) TLE epoch. The vectors returned in 119 | // the ECI object are kilometer-based. 120 | // tsince - Time in minutes since the TLE epoch (GMT). 121 | //----------------------------------------------------- 122 | bool cOrbit::getPosition(double tsince, cEci* pEci) const 123 | { 124 | const bool rc = m_pNoradModel->getPosition(tsince, *pEci); 125 | pEci->ae2km(); 126 | return rc; 127 | } 128 | 129 | //----------------------------------------------------- 130 | // SatName() 131 | // Return the name of the satellite. If requested, the NORAD number is 132 | // appended to the end of the name, i.e., "ISS (ZARYA) #25544". 133 | // The name of the satellite with the NORAD number appended is important 134 | // because many satellites, especially debris, have the same name and 135 | // would otherwise appear to be the same satellite in ouput data. 136 | //----------------------------------------------------- 137 | std::string cOrbit::SatName(bool fAppendId /* = false */) const 138 | { 139 | std::string str = m_tle.getName(); 140 | if (fAppendId) { 141 | std::string strId; 142 | m_tle.getField(cTle::FLD_NORADNUM, cTle::U_NATIVE, &strId); 143 | str = str + " #" + strId; 144 | } 145 | return str; 146 | } 147 | 148 | -------------------------------------------------------------------------------- /src/os3/libnorad/cOrbit.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cOrbit.h 3 | // 4 | // This is the header file for the class cOrbit. This class accepts a 5 | // single satellite's NORAD two-line element set and provides information 6 | // regarding the satellite's orbit such as period, axis length, 7 | // ECI coordinates/velocity, etc., using the SGP4/SDP4 orbital models. 8 | // 9 | // Copyright (c) 2002-2003 Michael F. Henry 10 | //----------------------------------------------------- 11 | 12 | #ifndef __LIBNORAD_cOrbit_H__ 13 | #define __LIBNORAD_cOrbit_H__ 14 | 15 | #include "os3/libnorad/cTLE.h" 16 | #include "os3/libnorad/cJulian.h" 17 | 18 | class cVector; 19 | class cGeoCoord; 20 | class cEci; 21 | class cNoradBase; 22 | 23 | class cOrbit 24 | { 25 | public: 26 | cOrbit(const cTle& tle); 27 | virtual ~cOrbit(); 28 | 29 | // Return satellite ECI data at given minutes since element's epoch. 30 | bool getPosition(double tsince, cEci* pEci) const; 31 | 32 | double Inclination() const { return radGet(cTle::FLD_I); } 33 | double Eccentricity() const { return m_tle.getField(cTle::FLD_E); } 34 | double RAAN() const { return radGet(cTle::FLD_RAAN); } 35 | double ArgPerigee() const { return radGet(cTle::FLD_ARGPER); } 36 | double BStar() const { return m_tle.getField(cTle::FLD_BSTAR) / AE;} 37 | double Drag() const { return m_tle.getField(cTle::FLD_MMOTIONDT); } 38 | double mnMotion() const { return m_tle.getField(cTle::FLD_MMOTION); } 39 | double mnAnomaly() const { return radGet(cTle::FLD_M); } 40 | double mnAnomaly(cJulian t) const; // mean anomaly (in radians) at time t 41 | 42 | cJulian Epoch() const { return m_jdEpoch; } 43 | 44 | double TPlusEpoch(const cJulian& t) const; // time span [t - epoch] in secs 45 | 46 | std::string SatName(bool fAppendId = false) const; 47 | 48 | // "Recovered" from the input elements 49 | double SemiMajor() const { return m_aeAxisSemiMajorRec; } 50 | double SemiMinor() const { return m_aeAxisSemiMinorRec; } 51 | double mnMotionRec() const { return m_mnMotionRec; } // mn motion, rads/min 52 | double Major() const { return 2.0 * SemiMajor(); } // major axis in AE 53 | double Minor() const { return 2.0 * SemiMinor(); } // minor axis in AE 54 | double Perigee() const { return m_kmPerigeeRec; } // perigee in km 55 | double Apogee() const { return m_kmApogeeRec; } // apogee in km 56 | double Period() const; // period in seconds 57 | 58 | protected: 59 | double radGet(cTle::eField fld) const 60 | { return m_tle.getField(fld, cTle::U_RAD); } 61 | 62 | double degGet(cTle::eField fld) const 63 | { return m_tle.getField(fld, cTle::U_DEG); } 64 | 65 | private: 66 | cTle m_tle; 67 | cJulian m_jdEpoch; 68 | cNoradBase* m_pNoradModel; 69 | 70 | // Caching variables; note units are not necessarily the same as tle units 71 | mutable double m_secPeriod; 72 | 73 | // Caching variables recovered from the input TLE elements 74 | double m_aeAxisSemiMinorRec; // semi-minor axis, in AE units 75 | double m_aeAxisSemiMajorRec; // semi-major axis, in AE units 76 | double m_mnMotionRec; // radians per minute 77 | double m_kmPerigeeRec; // perigee, in km 78 | double m_kmApogeeRec; // apogee, in km 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/os3/libnorad/cSite.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cSite.cpp 3 | // 4 | // Copyright (c) 2003 Michael F. Henry 5 | //----------------------------------------------------- 6 | 7 | #include "os3/libnorad/cSite.h" 8 | #include "os3/libnorad/globals.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | cSite::cSite(const cCoordGeo& geo) : m_geo(geo) 15 | {} 16 | 17 | //----------------------------------------------------- 18 | // c'tor accepting: 19 | // Latitude in degress (negative south) 20 | // Longitude in degress (negative west) 21 | // Altitude in km 22 | //----------------------------------------------------- 23 | cSite::cSite(double degLat, double degLon, double kmAlt) : 24 | m_geo(deg2rad(degLat), deg2rad(degLon), kmAlt) 25 | {} 26 | 27 | cSite::~cSite() 28 | {} 29 | 30 | //----------------------------------------------------- 31 | // setGeo() 32 | // Set a new geographic position 33 | //----------------------------------------------------- 34 | void cSite::setGeo(const cCoordGeo& geo) 35 | { 36 | m_geo = geo; 37 | } 38 | 39 | //----------------------------------------------------- 40 | // getPosition() 41 | // Return the ECI coordinate of the site at the given time. 42 | //----------------------------------------------------- 43 | cEci cSite::getPosition(const cJulian& date) const 44 | { 45 | return cEci(m_geo, date); 46 | } 47 | 48 | //----------------------------------------------------- 49 | // getLookAngle() 50 | // Return the topocentric (azimuth, elevation, etc.) coordinates for a target 51 | // object described by the input ECI coordinates. 52 | //----------------------------------------------------- 53 | cCoordTopo cSite::getLookAngle(const cEci& eci) const 54 | { 55 | // Calculate the ECI coordinates for this cSite object at the time 56 | // of interest. 57 | cJulian date = eci.getDate(); 58 | cEci eciSite(m_geo, date); 59 | 60 | // The Site ECI units are km-based; ensure target ECI units are same 61 | assert(eci.UnitsAreKm()); 62 | 63 | cVector vecRgRate(eci.getVel().m_x - eciSite.getVel().m_x, 64 | eci.getVel().m_y - eciSite.getVel().m_y, 65 | eci.getVel().m_z - eciSite.getVel().m_z); 66 | 67 | double x = eci.getPos().m_x - eciSite.getPos().m_x; 68 | double y = eci.getPos().m_y - eciSite.getPos().m_y; 69 | double z = eci.getPos().m_z - eciSite.getPos().m_z; 70 | double w = std::sqrt(sqr(x) + sqr(y) + sqr(z)); 71 | //cout << "Distance to satellite: "<< w ; 72 | 73 | cVector vecRange(x, y, z, w); 74 | 75 | // The site's Local Mean Sidereal Time at the time of interest. 76 | double theta = date.toLMST(getLon()); 77 | 78 | double sin_lat = std::sin(getLat()); 79 | double cos_lat = std::cos(getLat()); 80 | double sin_theta = std::sin(theta); 81 | double cos_theta = std::cos(theta); 82 | 83 | double top_s = sin_lat * cos_theta * vecRange.m_x + 84 | sin_lat * sin_theta * vecRange.m_y - 85 | cos_lat * vecRange.m_z; 86 | double top_e = -sin_theta * vecRange.m_x + 87 | cos_theta * vecRange.m_y; 88 | double top_z = cos_lat * cos_theta * vecRange.m_x + 89 | cos_lat * sin_theta * vecRange.m_y + 90 | sin_lat * vecRange.m_z; 91 | double az = std::atan(-top_e / top_s); 92 | 93 | if (top_s > 0.0) 94 | az += PI; 95 | 96 | if (az < 0.0) 97 | az += 2.0*PI; 98 | 99 | double el = std::asin(top_z / vecRange.m_w); 100 | double rate = (vecRange.m_x * vecRgRate.m_x + 101 | vecRange.m_y * vecRgRate.m_y + 102 | vecRange.m_z * vecRgRate.m_z) / vecRange.m_w; 103 | 104 | cCoordTopo topo(az, // azimuth, radians 105 | el, // elevation, radians 106 | vecRange.m_w, // range, km 107 | rate); // rate, km / sec 108 | 109 | #ifdef WANT_ATMOSPHERIC_CORRECTION 110 | // Elevation correction for atmospheric refraction. 111 | // Reference: Astronomical Algorithms by Jean Meeus, pp. 101-104 112 | // Note: Correction is meaningless when apparent elevation is below horizon 113 | topo.m_El += deg2rad((1.02 / 114 | std::tan(deg2rad(rad2deg(el) + 10.3 / 115 | (rad2deg(el) + 5.11)))) / 60.0); 116 | if (topo.m_El < 0.0) 117 | topo.m_El = el; // Reset to true elevation 118 | 119 | if (topo.m_El > (PI / 2)) 120 | topo.m_El = (PI / 2); 121 | #endif 122 | 123 | return topo; 124 | } 125 | 126 | //----------------------------------------------------- 127 | // toString() 128 | // 129 | // FIXME: String anstelle von char* 130 | //----------------------------------------------------- 131 | std::string cSite::toString() const 132 | { 133 | const int TEMP_SIZE = 128; 134 | char sz[TEMP_SIZE]; 135 | 136 | bool LatNorth = true; 137 | bool LonEast = true; 138 | 139 | if (m_geo.m_Lat < 0.0) { 140 | LatNorth = false; 141 | } 142 | 143 | if (m_geo.m_Lon < 0.0) { 144 | LonEast = false; 145 | } 146 | 147 | std::sprintf(sz,"%06.3f%c, ", std::fabs(rad2deg(m_geo.m_Lat)),(LatNorth ? 'N' : 'S')); 148 | 149 | std::string strLoc = sz; 150 | 151 | std::sprintf(sz, 152 | "%07.3f%c, ", 153 | std::fabs(rad2deg(m_geo.m_Lon)), 154 | (LonEast ? 'E' : 'W')); 155 | strLoc += sz; 156 | 157 | std::sprintf(sz, 158 | "%.1fm\n", 159 | (m_geo.m_Alt * 1000.0)); 160 | strLoc += sz; 161 | 162 | return strLoc; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /src/os3/libnorad/cSite.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cSite.h: interface for the cSite class. 3 | // 4 | // Copyright 2002-2003 Michael F. Henry 5 | // 6 | //----------------------------------------------------- 7 | #ifndef __LIBNORAD_cSite_H__ 8 | #define __LIBNORAD_cSite_H__ 9 | 10 | #include 11 | 12 | #include "os3/libnorad/ccoord.h" 13 | #include "os3/libnorad/cEci.h" 14 | 15 | //----------------------------------------------------- 16 | // Class: cSite 17 | // This class represents a location (ground site) on the earth. 18 | //----------------------------------------------------- 19 | class cSite 20 | { 21 | public: 22 | cSite(double degLat, double degLon, double kmAlt); 23 | cSite(const cCoordGeo& geo); 24 | virtual ~cSite(); 25 | 26 | void setGeo(const cCoordGeo& geo); // Set new coordinates 27 | cCoordGeo getGeo() const { return m_geo; } 28 | 29 | cEci getPosition(const cJulian&) const; // calc ECI of geo location. 30 | cCoordTopo getLookAngle(const cEci&) const; // calc topo coords to ECI object 31 | 32 | double getLat() const { return m_geo.m_Lat; } 33 | double getLon() const { return m_geo.m_Lon; } 34 | double getAlt() const { return m_geo.m_Alt; } 35 | 36 | std::string toString() const; 37 | 38 | protected: 39 | cCoordGeo m_geo; // lat, lon, alt of earth site 40 | 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/os3/libnorad/cTLE.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cTle.h 3 | // 4 | // This class will accept a single set of two-line elements and then allow 5 | // a client to request specific fields, such as epoch, mean motion, 6 | // etc., from the set. 7 | // 8 | // Copyright 1996-2003 Michael F. Henry 9 | //----------------------------------------------------- 10 | #ifndef __LIBNORAD_cTle_H__ 11 | #define __LIBNORAD_cTle_H__ 12 | 13 | #include 14 | #include 15 | 16 | #include "os3/libnorad/globals.h" 17 | 18 | class cTle 19 | { 20 | public: 21 | cTle(std::string&, std::string&, std::string&); 22 | cTle(const cTle& tle); 23 | ~cTle(); 24 | 25 | enum eTleLine 26 | { 27 | LINE_ZERO, 28 | LINE_ONE, 29 | LINE_TWO 30 | }; 31 | 32 | enum eField 33 | { 34 | FLD_FIRST, 35 | FLD_NORADNUM = FLD_FIRST, 36 | FLD_INTLDESC, 37 | FLD_SET, // TLE set number 38 | FLD_EPOCHYEAR, // Epoch: Last two digits of year 39 | FLD_EPOCHDAY, // Epoch: Fractional Julian Day of year 40 | FLD_ORBITNUM, // Orbit at epoch 41 | FLD_I, // Inclination 42 | FLD_RAAN, // R.A. ascending node 43 | FLD_E, // Eccentricity 44 | FLD_ARGPER, // Argument of perigee 45 | FLD_M, // Mean anomaly 46 | FLD_MMOTION, // Mean motion 47 | FLD_MMOTIONDT, // First time derivative of mean motion 48 | FLD_MMOTIONDT2,// Second time derivative of mean motion 49 | FLD_BSTAR, // BSTAR Drag 50 | FLD_LAST // MUST be last 51 | }; 52 | 53 | enum eUnits 54 | { 55 | U_FIRST, 56 | U_RAD = U_FIRST, // radians 57 | U_DEG, // degrees 58 | U_NATIVE, // TLE format native units (no conversion) 59 | U_LAST // MUST be last 60 | }; 61 | 62 | void Initialize(); 63 | 64 | static int CheckSum(const std::string&); 65 | static bool IsValidLine(std::string&, eTleLine); 66 | static std::string ExpToDecimal(const std::string&); 67 | 68 | static void TrimLeft(std::string&); 69 | static void TrimRight(std::string&); 70 | 71 | double getField(eField fld, // which field to retrieve 72 | eUnits unit = U_NATIVE, // return units in rad, deg etc. 73 | std::string *pstr = NULL, // return ptr for str value 74 | bool bStrUnits = false) // 'true': append units to str val 75 | const; 76 | std::string getName() const { return m_strName; } 77 | std::string getLine1() const { return m_strLine1;} 78 | std::string getLine2() const { return m_strLine2;} 79 | 80 | protected: 81 | static double ConvertUnits(double val, eField fld, eUnits units); 82 | 83 | private: 84 | std::string getUnits(eField) const; 85 | double getFieldNumeric(eField) const; 86 | 87 | // Satellite name and two data lines 88 | std::string m_strName; 89 | std::string m_strLine1; 90 | std::string m_strLine2; 91 | 92 | // Converted fields, in atof()-readable form 93 | std::string m_Field[FLD_LAST]; 94 | 95 | // Cache of field values in "double" format 96 | typedef int FldKey; 97 | FldKey Key(eUnits u, eField f) const { return (u * 100) + f; } 98 | mutable std::map m_mapCache; 99 | }; 100 | 101 | /////////////////////////////////////////////////////////////////////////// 102 | // 103 | // TLE data format 104 | // 105 | // [Reference: T.S. Kelso] 106 | // 107 | // Two line element data consists of three lines in the following format: 108 | // 109 | // AAAAAAAAAAAAAAAAAAAAAA 110 | // 1 NNNNNU NNNNNAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN 111 | // 2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNN 112 | // 113 | // Line 0 is a twenty-two-character name. 114 | // 115 | // Lines 1 and 2 are the standard Two-Line Orbital Element Set Format identical 116 | // to that used by NORAD and NASA. The format description is: 117 | // 118 | // Line 1 119 | // Column Description 120 | // 01-01 Line Number of Element Data 121 | // 03-07 Satellite Number 122 | // 10-11 International Designator (Last two digits of launch year) 123 | // 12-14 International Designator (Launch number of the year) 124 | // 15-17 International Designator (Piece of launch) 125 | // 19-20 Epoch Year (Last two digits of year) 126 | // 21-32 Epoch (Julian Day and fractional portion of the day) 127 | // 34-43 First Time Derivative of the Mean Motion 128 | // or Ballistic Coefficient (Depending on ephemeris type) 129 | // 45-52 Second Time Derivative of Mean Motion (decimal point assumed; 130 | // blank if N/A) 131 | // 54-61 BSTAR drag term if GP4 general perturbation theory was used. 132 | // Otherwise, radiation pressure coefficient. (Decimal point assumed) 133 | // 63-63 Ephemeris type 134 | // 65-68 Element number 135 | // 69-69 Check Sum (Modulo 10) 136 | // (Letters, blanks, periods, plus signs = 0; minus signs = 1) 137 | // 138 | // Line 2 139 | // Column Description 140 | // 01-01 Line Number of Element Data 141 | // 03-07 Satellite Number 142 | // 09-16 Inclination [Degrees] 143 | // 18-25 Right Ascension of the Ascending Node [Degrees] 144 | // 27-33 Eccentricity (decimal point assumed) 145 | // 35-42 Argument of Perigee [Degrees] 146 | // 44-51 Mean Anomaly [Degrees] 147 | // 53-63 Mean Motion [Revs per day] 148 | // 64-68 Revolution number at epoch [Revs] 149 | // 69-69 Check Sum (Modulo 10) 150 | // 151 | // All other columns are blank or fixed. 152 | // 153 | // Example: 154 | // 155 | // NOAA 6 156 | // 1 11416U 86 50.28438588 0.00000140 67960-4 0 5293 157 | // 2 11416 98.5105 69.3305 0012788 63.2828 296.9658 14.24899292346978 158 | 159 | #endif 160 | -------------------------------------------------------------------------------- /src/os3/libnorad/cVector.cc: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cVector.cpp 3 | // 4 | // Copyright (c) 2001-2003 Michael F. Henry 5 | //----------------------------------------------------- 6 | 7 | #include "os3/libnorad/cVector.h" 8 | 9 | #include 10 | 11 | //----------------------------------------------------- 12 | // Multiply each component in the vector by 'factor'. 13 | //----------------------------------------------------- 14 | void cVector::Mul(double factor) 15 | { 16 | m_x *= factor; 17 | m_y *= factor; 18 | m_z *= factor; 19 | m_w *= fabs(factor); 20 | } 21 | 22 | //----------------------------------------------------- 23 | // Subtract a vector from this one. 24 | //----------------------------------------------------- 25 | void cVector::Sub(const cVector& vec) 26 | { 27 | m_x -= vec.m_x; 28 | m_y -= vec.m_y; 29 | m_z -= vec.m_z; 30 | m_w -= vec.m_w; 31 | } 32 | 33 | //----------------------------------------------------- 34 | // Calculate the angle between this vector and another 35 | //----------------------------------------------------- 36 | double cVector::Angle(const cVector& vec) const 37 | { 38 | return std::acos(Dot(vec) / (Magnitude() * vec.Magnitude())); 39 | } 40 | 41 | double cVector::Magnitude() const 42 | { 43 | return std::sqrt((m_x * m_x) + (m_y * m_y) + (m_z * m_z)); 44 | } 45 | 46 | //----------------------------------------------------- 47 | // Return the dot product 48 | //----------------------------------------------------- 49 | double cVector::Dot(const cVector& vec) const 50 | { 51 | return (m_x * vec.m_x) + (m_y * vec.m_y) + (m_z * vec.m_z); 52 | } 53 | -------------------------------------------------------------------------------- /src/os3/libnorad/cVector.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // cVector.h: interface for the cVector class. 3 | // 4 | // Copyright 2003 (c) Michael F. Henry 5 | //----------------------------------------------------- 6 | #ifndef __LIBNORAD_cVector_H__ 7 | #define __LIBNORAD_cVector_H__ 8 | 9 | class cVector 10 | { 11 | public: 12 | cVector(double x = 0.0, double y = 0.0, double z = 0.0, double w = 0.0) : 13 | m_x(x), m_y(y), m_z(z), m_w(w) {} 14 | virtual ~cVector() {}; 15 | 16 | void Sub(const cVector&); // subtraction 17 | void Mul(double factor); // multiply each component by 'factor' 18 | 19 | double Angle(const cVector&) const; // angle between two vectors 20 | double Magnitude() const; // vector magnitude 21 | double Dot(const cVector& vec) const; // dot product 22 | 23 | double m_x; 24 | double m_y; 25 | double m_z; 26 | double m_w; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/os3/libnorad/ccoord.cc: -------------------------------------------------------------------------------- 1 | // 2 | // coord.cpp 3 | // 4 | // Copyright (c) 2003 Michael F. Henry 5 | // 6 | #include "os3/libnorad/ccoord.h" 7 | 8 | cCoordGeo::cCoordGeo() 9 | { 10 | m_Lat = 0.0; 11 | m_Lon = 0.0; 12 | m_Alt = 0.0; 13 | } 14 | 15 | cCoordTopo::cCoordTopo() 16 | { 17 | m_Az = 0.0; 18 | m_El = 0.0; 19 | m_Range = 0.0; 20 | m_RangeRate = 0.0; 21 | } 22 | -------------------------------------------------------------------------------- /src/os3/libnorad/ccoord.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // coord.h 3 | // 4 | // Copyright 2002-2003 Michael F. Henry 5 | //----------------------------------------------------- 6 | #ifndef __LIBNORAD_ccoord_H__ 7 | #define __LIBNORAD_ccoord_H__ 8 | 9 | #include "os3/libnorad/globals.h" 10 | 11 | //----------------------------------------------------- 12 | // Geocentric coordinates. 13 | //----------------------------------------------------- 14 | class cCoordGeo 15 | { 16 | public: 17 | cCoordGeo(); 18 | cCoordGeo(double lat, double lon, double alt) : 19 | m_Lat(lat), m_Lon(lon), m_Alt(alt) {} 20 | virtual ~cCoordGeo() {}; 21 | 22 | double m_Lat; // Latitude, radians (negative south) 23 | double m_Lon; // Longitude, radians (negative west) 24 | double m_Alt; // Altitude, km (above mean sea level) 25 | }; 26 | 27 | //----------------------------------------------------- 28 | // Topocentric-Horizon coordinates. 29 | //----------------------------------------------------- 30 | class cCoordTopo 31 | { 32 | public: 33 | cCoordTopo(); 34 | cCoordTopo(double az, double el, double rng, double rate) : 35 | m_Az(az), m_El(el), m_Range(rng), m_RangeRate(rate) {} 36 | virtual ~cCoordTopo() {}; 37 | 38 | double m_Az; // Azimuth, radians 39 | double m_El; // Elevation, radians 40 | double m_Range; // Range, kilometers 41 | double m_RangeRate; // Range rate of change, km/sec 42 | // Negative value means "towards observer" 43 | }; 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /src/os3/libnorad/globals.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "os3/libnorad/globals.h" 3 | 4 | #include 5 | 6 | double sqr(const double x) 7 | { 8 | return (x * x); 9 | } 10 | 11 | double Fmod2p(const double arg) 12 | { 13 | double modu = std::fmod(arg, TWOPI); 14 | 15 | if (modu < 0.0) 16 | modu += TWOPI; 17 | 18 | return modu; 19 | } 20 | 21 | //----------------------------------------------------- 22 | // AcTan() 23 | // ArcTangent of sin(x) / cos(x). The advantage of this function over arctan() 24 | // is that it returns the correct quadrant of the angle. 25 | //----------------------------------------------------- 26 | double AcTan(const double sinx, const double cosx) 27 | { 28 | double ret; 29 | 30 | if (cosx == 0.0) { 31 | if (sinx > 0.0) 32 | ret = PI / 2.0; 33 | else 34 | ret = 3.0 * PI / 2.0; 35 | } else { 36 | if (cosx > 0.0) 37 | ret = atan(sinx / cosx); 38 | else 39 | ret = PI + atan(sinx / cosx); 40 | } 41 | 42 | return ret; 43 | } 44 | 45 | double rad2deg(const double r) 46 | { 47 | const double DEG_PER_RAD = 180.0 / PI; 48 | return r * DEG_PER_RAD; 49 | } 50 | 51 | double deg2rad(const double d) 52 | { 53 | const double RAD_PER_DEG = PI / 180.0; 54 | return d * RAD_PER_DEG; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/os3/libnorad/globals.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------- 2 | // globals 3 | //----------------------------------------------------- 4 | #ifndef __LIBNORAD_Globals_H__ 5 | #define __LIBNORAD_Globals_H__ 6 | 7 | #include 8 | 9 | #ifndef PI 10 | #define PI 3.1415926535 11 | #endif //PI 12 | 13 | //const double PI = 3.141592653589793; 14 | const double TWOPI = 2.0 * PI; 15 | const double RADS_PER_DEG = PI / 180.0; 16 | 17 | const double GM = 398601.2; // Earth gravitational constant, km^3/sec^2 18 | const double GEOSYNC_ALT = 42241.892; // km 19 | const double EARTH_DIA = 12800.0; // km 20 | const double DAY_SIDERAL = (23 * 3600) + (56 * 60) + 4.09; // sec 21 | const double DAY_24HR = (24 * 3600); // sec 22 | 23 | const double AE = 1.0; 24 | const double AU = 149597870.0; // Astronomical unit (km) (IAU 76) 25 | const double SR = 696000.0; // Solar radius (km) (IAU 76) 26 | const double TWOTHRD = 2.0 / 3.0; 27 | const double XKMPER_WGS72 = 6378.135; // Earth equatorial radius - km (WGS '72) 28 | const double F = 1.0 / 298.26; // Earth flattening (WGS '72) 29 | const double GE = 398600.8; // Earth gravitational constant (WGS '72) 30 | const double J2 = 1.0826158E-3; // J2 harmonic (WGS '72) 31 | const double J3 = -2.53881E-6; // J3 harmonic (WGS '72) 32 | const double J4 = -1.65597E-6; // J4 harmonic (WGS '72) 33 | const double CK2 = J2 / 2.0; 34 | const double CK4 = -3.0 * J4 / 8.0; 35 | const double XJ3 = J3; 36 | const double E6A = 1.0e-06; 37 | const double QO = AE + 120.0 / XKMPER_WGS72; 38 | const double S = AE + 78.0 / XKMPER_WGS72; 39 | const double HR_PER_DAY = 24.0; // Hours per day (solar) 40 | const double MIN_PER_DAY = 1440.0; // Minutes per day (solar) 41 | const double SEC_PER_DAY = 86400.0; // Seconds per day (solar) 42 | const double OMEGA_E = 1.00273790934; // earth rotation per sideral day 43 | const double XKE = std::sqrt(3600.0 * GE / //sqrt(ge) ER^3/min^2 44 | (XKMPER_WGS72 * XKMPER_WGS72 * XKMPER_WGS72)); 45 | const double QOMS2T = std::pow((QO - S), 4); //(QO - S)^4 ER^4 46 | 47 | // Utility functions 48 | double sqr (const double x); 49 | double Fmod2p(const double arg); 50 | double AcTan (const double sinx, double cosx); 51 | 52 | double rad2deg(const double); 53 | double deg2rad(const double); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/os3/libnorad/libnorad.h: -------------------------------------------------------------------------------- 1 | /** 2 | * libnorad.h 3 | * 4 | * @date 2012/04/20 5 | * @author Marian Felder, Florian Schweikowski 6 | */ 7 | 8 | #ifndef __LIBNORAD_H__ 9 | #define __LIBNORAD_H__ 10 | 11 | #include "ccoord.h" 12 | #include "cEci.h" 13 | #include "cJulian.h" 14 | #include "cNoradBase.h" 15 | #include "cNoradSDP4.h" 16 | #include "cNoradSGP4.h" 17 | #include "cOrbit.h" 18 | #include "cSite.h" 19 | #include "cTLE.h" 20 | #include "globals.h" 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/os3/mobility/LUTMotionMobility.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/mobility/LUTMotionMobility.h" 17 | 18 | #include 19 | 20 | Define_Module(LUTMotionMobility); 21 | 22 | void LUTMotionMobility::initialize(int stage) 23 | { 24 | StationaryMobility::initialize(stage); 25 | EV << "initializing LUTMotionMobility stage " << stage << endl; 26 | WATCH(lastPosition); 27 | if (stage == 0) { 28 | mapx = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 0)); 29 | mapy = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 1)); 30 | latitude = par("latitude"); 31 | longitude = par("longitude"); 32 | } 33 | } 34 | 35 | double LUTMotionMobility::getLUTPositionX() 36 | { 37 | return longitude; 38 | } 39 | double LUTMotionMobility::getLUTPositionY() 40 | { 41 | return latitude; 42 | } 43 | 44 | Coord LUTMotionMobility::getCurrentPosition() 45 | { 46 | return Coord(longitude, latitude); 47 | } 48 | 49 | // 50 | // this mobility model does not deal with speed, but it must be implemented 51 | // because it is a pure virtual function declared in IMobility 52 | // 53 | Coord LUTMotionMobility::getCurrentSpeed() 54 | { 55 | return Coord(0,0,0); 56 | } 57 | 58 | void LUTMotionMobility::setInitialPosition() 59 | { 60 | lastPosition.y = ((-mapy * latitude) / 180) + (mapy / 2); 61 | lastPosition.x = mapx * longitude / 360 + (mapx / 2); 62 | lastPosition.x = static_cast(lastPosition.x) % static_cast(mapx); 63 | } 64 | -------------------------------------------------------------------------------- /src/os3/mobility/LUTMotionMobility.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_LUTMotionMobility_H__ 17 | #define __OS3_LUTMotionMobility_H__ 18 | 19 | #include 20 | 21 | #include "mobility/static/StationaryMobility.h" // inet 22 | 23 | //----------------------------------------------------- 24 | // Class: LUTMotionMobility 25 | // 26 | // Positions a ground station at a specific lat/long 27 | //----------------------------------------------------- 28 | class LUTMotionMobility : public StationaryMobility 29 | { 30 | public: 31 | // returns longitude 32 | double getLUTPositionX(); 33 | 34 | // returns latitude 35 | double getLUTPositionY(); 36 | 37 | virtual Coord getCurrentPosition(); 38 | virtual Coord getCurrentSpeed(); 39 | 40 | protected: 41 | virtual void initialize(int); 42 | 43 | virtual void setInitialPosition(); 44 | 45 | double latitude, longitude; // Geographic coordinates 46 | double mapx, mapy; // Coordinates on map 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/os3/mobility/LUTMotionMobility.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.mobility; 3 | 4 | import inet.mobility.common.MovingMobilityBase; 5 | import inet.mobility.contract.IMobility; 6 | 7 | // 8 | // Initializes the initial positions of Base Stations (LUT = Local User Terminal) 9 | // 10 | simple LUTMotionMobility extends MovingMobilityBase 11 | { 12 | parameters: 13 | double latitude; 14 | double longitude; 15 | //double updateInterval @unit(s); // Time interval to update the hosts position 16 | @class(LUTMotionMobility); 17 | } 18 | -------------------------------------------------------------------------------- /src/os3/mobility/Norad.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/mobility/Norad.h" 17 | 18 | #include 19 | #include 20 | 21 | #include "os3/libnorad/cTLE.h" 22 | #include "os3/libnorad/cOrbit.h" 23 | #include "os3/libnorad/cSite.h" 24 | 25 | Define_Module(Norad); 26 | 27 | Norad::Norad() 28 | { 29 | gap = 0.0; 30 | tle = nullptr; 31 | orbit = nullptr; 32 | } 33 | 34 | void Norad::finish() 35 | { 36 | delete orbit; 37 | delete tle; 38 | } 39 | 40 | void Norad::initializeMobility(const simtime_t& targetTime) 41 | { 42 | std::string filename = par("TLEfile").stringValue(); 43 | 44 | // read file with TLE data 45 | std::fstream tleFile; 46 | tleFile.open(filename.c_str()); 47 | 48 | // Length 100 should be enough since lines are usually 70+'\n' char long 49 | char line[100] = ""; 50 | char line1tmp[100] = ""; 51 | char line2tmp[100] = ""; 52 | 53 | std::string satelliteName = getParentModule()->par("satelliteName").stringValue(); 54 | std::string line_str; 55 | if (satelliteName == "") { 56 | int index = getParentModule()->getIndex(); 57 | int i = 0; 58 | do { 59 | tleFile.getline(line, 100); 60 | if (!tleFile.good()) { 61 | EV << "Error in Norad::initializeMobility(): Cannot read further satellites from TLE file!" << std::endl; 62 | endSimulation(); 63 | } 64 | } while (i++ < index * 3 && tleFile.good()); 65 | line_str.append(line); 66 | } else { 67 | do { 68 | line_str = ""; 69 | tleFile.getline(line, 100); 70 | line_str.append(line); 71 | } while (tleFile.good() 72 | && line_str.find(satelliteName.c_str()) == std::string::npos); 73 | } 74 | tleFile.getline(line1tmp, 100); 75 | tleFile.getline(line2tmp, 100); 76 | 77 | // Pretty up the satellites name 78 | line_str = line_str.substr(0, line_str.find(" ")); 79 | line0 = line_str; 80 | line1.append(line1tmp); 81 | line2.append(line2tmp); 82 | cTle tle(line0, line1, line2); 83 | orbit = new cOrbit(tle); 84 | 85 | // Gap is needed to eliminate different start times 86 | gap = orbit->TPlusEpoch(currentJulian); 87 | 88 | updateTime(targetTime); 89 | 90 | // Set name from TLE file for icon name 91 | line3 = orbit->SatName(false); 92 | /*if (line3.find(" (") != std::string::npos) { 93 | line3.at(line3.find(" (")) = '\n'; 94 | }*/ 95 | 96 | std::size_t found = line3.find("(PRN "); 97 | std::string satName = "PRN-"; 98 | satName.push_back(line3.at(found+5)); 99 | satName.push_back(line3.at(found+6)); 100 | satName += "\nsatellite"; 101 | getParentModule()->setName(satName.c_str()); 102 | } 103 | 104 | void Norad::updateTime(const simtime_t& targetTime) 105 | { 106 | orbit->getPosition((gap + targetTime.dbl()) / 60, &eci); 107 | geoCoord = eci.toGeo(); 108 | } 109 | 110 | double Norad::getLongitude() 111 | { 112 | return rad2deg(geoCoord.m_Lon); 113 | } 114 | 115 | double Norad::getLatitude() 116 | { 117 | return rad2deg(geoCoord.m_Lat); 118 | } 119 | 120 | double Norad::getElevation(const double& refLatitude, const double& refLongitude, const double& refAltitude) 121 | { 122 | cSite siteEquator(refLatitude, refLongitude, refAltitude); 123 | cCoordTopo topoLook = siteEquator.getLookAngle(eci); 124 | if (topoLook.m_El == 0.0) { 125 | error("Error in Norad::getElevation(): Corrupted database."); 126 | } 127 | return rad2deg(topoLook.m_El); 128 | } 129 | 130 | double Norad::getAzimuth(const double& refLatitude, const double& refLongitude, const double& refAltitude) 131 | { 132 | cSite siteEquator(refLatitude, refLongitude, refAltitude); 133 | cCoordTopo topoLook = siteEquator.getLookAngle(eci); 134 | if (topoLook.m_El == 0.0) { 135 | error("Error in Norad::getAzimuth(): Corrupted database."); 136 | } 137 | return rad2deg(topoLook.m_Az); 138 | } 139 | 140 | double Norad::getAltitude() 141 | { 142 | geoCoord = eci.toGeo(); 143 | return geoCoord.m_Alt; 144 | } 145 | 146 | double Norad::getDistance(const double& refLatitude, const double& refLongitude, const double& refAltitude) 147 | { 148 | cSite siteEquator(refLatitude, refLongitude, refAltitude); 149 | cCoordTopo topoLook = siteEquator.getLookAngle(eci); 150 | double distance = topoLook.m_Range; 151 | return distance; 152 | } 153 | 154 | void Norad::handleMessage(cMessage* msg) 155 | { 156 | error("Error in Norad::handleMessage(): This module is not able to handle messages."); 157 | } 158 | 159 | void Norad::setJulian(std::tm* currentTime) 160 | { 161 | currentJulian = cJulian(currentTime->tm_year + 1900, 162 | currentTime->tm_mon + 1, 163 | currentTime->tm_mday, 164 | currentTime->tm_hour, 165 | currentTime->tm_min, 0); 166 | } 167 | -------------------------------------------------------------------------------- /src/os3/mobility/Norad.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_Norad_H__ 17 | #define __OS3_Norad_H__ 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include "os3/libnorad/cEci.h" 25 | #include "os3/libnorad/cJulian.h" 26 | #include "os3/libnorad/ccoord.h" 27 | 28 | class cTle; 29 | class cOrbit; 30 | 31 | //----------------------------------------------------- 32 | // Class: Norad 33 | // 34 | // Provides the functionality for satellite positioning 35 | // this class provides the functionality needed to get the positions for satellites according 36 | // to current tables from web information by providing known data 37 | //----------------------------------------------------- 38 | class Norad : public cSimpleModule 39 | { 40 | public: 41 | Norad(); 42 | 43 | // sets the internal calendar by translating the current gregorian time 44 | // currentTime: time at which the simulation takes place 45 | void setJulian(std::tm* currentTime); 46 | 47 | // Updates the end time of current linear movement for calculation of current position 48 | // targetTime: End time of current linear movement 49 | void updateTime(const simtime_t& targetTime); 50 | 51 | // This method gets the current simulation time, cares for the file download (happens only once) 52 | // of the TLE files from the web and reads the values for the satellites according to the 53 | // omnet.ini-file. The information is provided by the respective mobility class. 54 | // targetTime: End time of current linear movement 55 | virtual void initializeMobility(const simtime_t& targetTime); 56 | 57 | // returns the longitude 58 | double getLongitude(); 59 | 60 | // returns the latitude 61 | double getLatitude(); 62 | 63 | // returns the elevation to a reference point 64 | double getElevation(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999); 65 | 66 | // returns the azimuth 67 | double getAzimuth(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999); 68 | 69 | // returns the altitude 70 | double getAltitude(); 71 | 72 | void finish(); 73 | 74 | // returns the distance to the satellite from a reference point (distance in km) 75 | double getDistance(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999); 76 | 77 | protected: 78 | virtual void handleMessage(cMessage* msg); 79 | 80 | private: 81 | cEci eci; 82 | cJulian currentJulian; 83 | double gap; 84 | 85 | cTle* tle; 86 | cOrbit* orbit; 87 | cCoordGeo geoCoord; 88 | std::string line0; 89 | std::string line1; 90 | std::string line2; 91 | std::string line3; 92 | }; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /src/os3/mobility/Norad.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.mobility; 3 | 4 | simple Norad 5 | { 6 | parameters: 7 | string TLEfile = default(""); // filename of TLE data file 8 | @display("i=msg/book"); 9 | } 10 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4FisheyeMobility.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/mobility/SatSGP4FisheyeMobility.h" 17 | 18 | #include 19 | 20 | #include "os3/mobility/Norad.h" 21 | 22 | Define_Module(SatSGP4FisheyeMobility); 23 | 24 | void SatSGP4FisheyeMobility::initialize(int stage) 25 | { 26 | SatSGP4Mobility::initialize(stage); 27 | 28 | // we have a round fisheye circle 29 | mapY = mapX; 30 | 31 | // additional parameters 32 | refCenterLongitude = par("refCenterLongitude"); 33 | refCenterLatitude = par("refCenterLatitude"); 34 | refCenterAltitude = par("refCenterAltitude"); 35 | transmitPower = getParentModule()->par("transmitPower"); 36 | } 37 | 38 | void SatSGP4FisheyeMobility::setTargetPosition() 39 | { 40 | nextChange += updateInterval.dbl(); 41 | noradModule->updateTime(nextChange); 42 | 43 | double radius = mapX / 2 - 1; 44 | const double elevation = noradModule->getElevation(refCenterLatitude, refCenterLongitude, refCenterAltitude); 45 | const double azimuth = noradModule->getAzimuth(refCenterLatitude, refCenterLongitude, refCenterAltitude); 46 | 47 | if (elevation > 0) { 48 | radius -= std::abs((elevation / 90.0) * mapX / 2); 49 | } 50 | 51 | lastPosition.x = -std::cos(deg2rad(azimuth + 90)) * radius + mapX / 2; 52 | lastPosition.y = -std::sin(deg2rad(azimuth + 90)) * radius + mapY / 2; 53 | 54 | if (lastPosition.x >= mapX) 55 | lastPosition.x = mapX - 1; 56 | if (lastPosition.y >= mapY) 57 | lastPosition.y = mapY - 1; 58 | 59 | targetPosition.x = lastPosition.x; 60 | targetPosition.y = lastPosition.y; 61 | } 62 | 63 | void SatSGP4FisheyeMobility::setRefCenterPoint(const double& latitude, const double& longitude, const double& altitude) 64 | { 65 | refCenterLatitude = latitude; 66 | refCenterLongitude = longitude; 67 | refCenterAltitude = altitude; 68 | 69 | // update satellite positions 70 | move(); 71 | } 72 | 73 | double SatSGP4FisheyeMobility::getRefCenterLatitude() 74 | { 75 | return refCenterLatitude; 76 | } 77 | 78 | double SatSGP4FisheyeMobility::getRefCenterLongitude() 79 | { 80 | return refCenterLongitude; 81 | } 82 | 83 | double SatSGP4FisheyeMobility::getRefCenterAltitude() 84 | { 85 | return refCenterAltitude; 86 | } 87 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4FisheyeMobility.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_SatSGP4FisheyeMobility_H__ 17 | #define __OS3_SatSGP4FisheyeMobility_H__ 18 | 19 | #include "os3/mobility/SatSGP4Mobility.h" 20 | 21 | //----------------------------------------------------- 22 | // Class: SatSGP4FisheyeMobility 23 | // 24 | // Realizes the SatSGP4Fisheye mobility module - provides methods to get and set 25 | // the position of a satellite module and resets the satellite position when 26 | // it gets outside the playground. 27 | //----------------------------------------------------- 28 | class SatSGP4FisheyeMobility : public SatSGP4Mobility 29 | { 30 | public: 31 | 32 | // sets a new reference point for the fisheye 33 | void setRefCenterPoint(const double& latitude, const double& longitude, const double& altitude); 34 | 35 | // returns the reference point's latitude 36 | double getRefCenterLatitude(); 37 | 38 | // returns the reference point's longitude 39 | double getRefCenterLongitude(); 40 | 41 | // returns the reference point's altitude 42 | double getRefCenterAltitude(); 43 | 44 | protected: 45 | 46 | // initialize Fisheye 47 | // - this method is same as SatSGP4Mobility::initialize() except that it satisfies 48 | // - mapX == mapY for a proper display. It also sets the center reference point. 49 | virtual void initialize(int stage); 50 | 51 | virtual void setTargetPosition(); 52 | 53 | private: 54 | // fisheye reference point 55 | double refCenterLatitude; 56 | double refCenterLongitude; 57 | double refCenterAltitude; 58 | 59 | double transmitPower; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4FisheyeMobility.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.mobility; 3 | 4 | import inet.mobility.contract.IMobility; 5 | import inet.mobility.common.MobilityBase; 6 | 7 | // 8 | // Manages the SatSGP4Fisheye Mobility 9 | // 10 | simple SatSGP4FisheyeMobility extends MobilityBase 11 | { 12 | parameters: 13 | @class(SatSGP4FisheyeMobility); 14 | @display("i=block/cogwheel_s"); 15 | double refCenterLatitude; // Coordinate for the center point 16 | double refCenterLongitude; // Coordinate for the center point 17 | double refCenterAltitude; // Coordinate for the center point 18 | double updateInterval @unit(s); // Time interval to update the hosts position 19 | } 20 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4Mobility.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "os3/mobility/SatSGP4Mobility.h" 17 | 18 | #include 19 | #include 20 | 21 | #include "os3/mobility/Norad.h" 22 | 23 | Define_Module(SatSGP4Mobility); 24 | 25 | SatSGP4Mobility::SatSGP4Mobility() 26 | { 27 | noradModule = nullptr; 28 | mapX = 0; 29 | mapY = 0; 30 | transmitPower = 0.0; 31 | } 32 | 33 | void SatSGP4Mobility::initialize(int stage) 34 | { 35 | // noradModule must be initialized before LineSegmentsMobilityBase calling setTargetPosition() in its initialization at stage 1 36 | if (stage == 1) { 37 | noradModule->initializeMobility(nextChange); 38 | } 39 | LineSegmentsMobilityBase::initialize(stage); 40 | 41 | noradModule = check_and_cast< Norad* >(getParentModule()->getSubmodule("NoradModule")); 42 | if (noradModule == nullptr) { 43 | error("Error in SatSGP4Mobility::initializeMobility(): Cannot find module Norad."); 44 | } 45 | 46 | std::time_t timestamp = std::time(nullptr); // get current time as an integral value holding the num of secs 47 | // since 00:00, Jan 1 1970 UTC 48 | std::tm* currentTime = std::gmtime(×tamp); // convert timestamp into structure holding a calendar date and time 49 | 50 | noradModule->setJulian(currentTime); 51 | 52 | mapX = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 0)); 53 | mapY = std::atoi(getParentModule()->getParentModule()->getDisplayString().getTagArg("bgb", 1)); 54 | 55 | transmitPower = getParentModule()->par("transmitPower"); 56 | 57 | ev << "initializing SatSGP4Mobility stage " << stage << endl; 58 | WATCH(lastPosition); 59 | 60 | updateVisualRepresentation(); 61 | } 62 | 63 | double SatSGP4Mobility::getAltitude() const 64 | { 65 | return noradModule->getAltitude(); 66 | } 67 | 68 | double SatSGP4Mobility::getElevation(const double& refLatitude, const double& refLongitude, 69 | const double& refAltitude) const 70 | { 71 | return noradModule->getElevation(refLatitude, refLongitude, refAltitude); 72 | } 73 | 74 | double SatSGP4Mobility::getAzimuth(const double& refLatitude, const double& refLongitude, 75 | const double& refAltitude) const 76 | { 77 | return noradModule->getAzimuth(refLatitude, refLongitude, refAltitude); 78 | } 79 | 80 | double SatSGP4Mobility::getDistance(const double& refLatitude, const double& refLongitude, 81 | const double& refAltitude) const 82 | { 83 | return noradModule->getDistance(refLatitude, refLongitude, refAltitude); 84 | } 85 | 86 | double SatSGP4Mobility::getLongitude() const 87 | { 88 | return noradModule->getLongitude(); 89 | } 90 | 91 | double SatSGP4Mobility::getLatitude() const 92 | { 93 | return noradModule->getLatitude(); 94 | } 95 | 96 | void SatSGP4Mobility::setTargetPosition() 97 | { 98 | nextChange += updateInterval.dbl(); 99 | noradModule->updateTime(nextChange); 100 | 101 | lastPosition.x = mapX * noradModule->getLongitude() / 360 + (mapX / 2); 102 | lastPosition.x = static_cast(lastPosition.x) % static_cast(mapX); 103 | lastPosition.y = ((-mapY * noradModule->getLatitude()) / 180) + (mapY / 2); 104 | 105 | targetPosition.x = lastPosition.x; 106 | targetPosition.y = lastPosition.y; 107 | } 108 | 109 | void SatSGP4Mobility::move() 110 | { 111 | LineSegmentsMobilityBase::move(); 112 | raiseErrorIfOutside(); 113 | } 114 | 115 | void SatSGP4Mobility::fixIfHostGetsOutside() 116 | { 117 | raiseErrorIfOutside(); 118 | } 119 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4Mobility.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 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 Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef __OS3_SatSGP4Mobility_H__ 17 | #define __OS3_SatSGP4Mobility_H__ 18 | 19 | #include "mobility/common/LineSegmentsMobilityBase.h" // inet 20 | 21 | class Norad; 22 | 23 | //----------------------------------------------------- 24 | // Class: SatSGP4Mobility 25 | // 26 | // Realizes the SatSGP4 mobility module - provides methods to get and set 27 | // the position of a satellite module and resets the satellite position when 28 | // it gets outside the playground. 29 | //----------------------------------------------------- 30 | class SatSGP4Mobility : public LineSegmentsMobilityBase 31 | { 32 | public: 33 | SatSGP4Mobility(); 34 | 35 | // returns x-position of satellite on playground (not longitude!) 36 | virtual double getPositionX() const { return lastPosition.x; }; 37 | 38 | // returns y-position of satellite on playground (not latitude!) 39 | virtual double getPositionY() const { return lastPosition.y; }; 40 | 41 | // returns the altitude of the satellite. 42 | virtual double getAltitude() const; 43 | 44 | // returns the elevation for the satellite in degrees 45 | virtual double getElevation(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999) const; 46 | 47 | // returns the azimuth from satellite to reference point in degrees 48 | virtual double getAzimuth(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999) const; 49 | 50 | // returns the Euclidean distance from satellite to reference point 51 | virtual double getDistance(const double& refLatitude, const double& refLongitude, const double& refAltitude = -9999) const; 52 | 53 | // returns satellite latitude 54 | virtual double getLatitude() const; 55 | 56 | // returns satellite longitude 57 | virtual double getLongitude() const; 58 | 59 | protected: 60 | Norad* noradModule; 61 | int mapX, mapY; 62 | double transmitPower; 63 | 64 | // initialize module 65 | // - creates a reference to the Norad moudule 66 | // - timestamps and initial position on playground are managed here. 67 | virtual void initialize(int stage); 68 | 69 | // sets the position of satellite 70 | // - sets the target position for the satellite 71 | // - the position is fetched from the Norad module with reference to the current timestamp 72 | virtual void setTargetPosition(); 73 | 74 | // resets the position of the satellite 75 | // - wraps around the position of the satellite if it reaches the end of the playground 76 | virtual void fixIfHostGetsOutside(); 77 | 78 | // implements basic satellite movement on map 79 | virtual void move(); 80 | }; 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/os3/mobility/SatSGP4Mobility.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3.mobility; 3 | 4 | import inet.mobility.common.MobilityBase; 5 | 6 | // 7 | // Manages the SatSGP4 Mobility 8 | // 9 | simple SatSGP4Mobility extends MobilityBase 10 | { 11 | parameters: 12 | @class(SatSGP4Mobility); 13 | @display("i=block/cogwheel_s"); 14 | double updateInterval @unit(s); // Time interval to update the hosts position 15 | } 16 | -------------------------------------------------------------------------------- /src/os3/package.ned: -------------------------------------------------------------------------------- 1 | 2 | package os3; 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/run_os3: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | DIR=`dirname $0` 3 | 4 | if [ -x $DIR/os3 -o -x $DIR/os3.exe ]; then 5 | $DIR/os3 -n $DIR/../examples:$DIR:$DIR/../../inet/src $* 6 | else 7 | opp_run -l $DIR/os3 -n $DIR/../examples:$DIR:$DIR/../../inet/src $* 8 | fi 9 | 10 | --------------------------------------------------------------------------------