Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satelite Link Implementation by paolo #550

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
83bb094
Added free-space channels
Sep 11, 2023
a0c62f5
Infrastructure is there but unrecognized module type
Sep 11, 2023
f86d178
WIP
Sep 22, 2023
6437b29
Code builds and runs now
Oct 25, 2023
328ba46
cleanup
Oct 25, 2023
5343463
output recording, test on faster machine
Nov 2, 2023
2307f71
Status on pc breakdown
Nov 25, 2023
b470a05
Moved BSMTimingNotification tampering from GQueue to RuleEngine
Nov 28, 2023
d200324
Intermittent link working
Nov 28, 2023
6dae834
Intermittent link working
Nov 28, 2023
7c45085
fixed conflicts
Nov 28, 2023
ecd95f1
Intermittent link works (fixed regression)
Nov 28, 2023
70d1d4c
WIP
Nov 28, 2023
edb3b1f
csv parsing WIP
Nov 30, 2023
b4b03e1
Runs with reduced distances, but gives weird results.
Dec 1, 2023
5bba7b4
Works but results too pessimistic, is it normal?
Dec 4, 2023
817fbb3
Corrected units in loss calculation
Dec 5, 2023
977f10b
WIP
Nov 28, 2023
0ed0dfc
csv parsing WIP
Nov 30, 2023
8647673
Runs with reduced distances, but gives weird results.
Dec 1, 2023
2fa4da8
Works but results too pessimistic, is it normal?
Dec 4, 2023
4657d68
Variable link working
Dec 6, 2023
0fd8035
Variable link works + fixed merge
Dec 6, 2023
ec5a9aa
Greatly reduced number of polling events via caching of VisOutcome
Dec 19, 2023
81aa80e
Variable delay works, but needs time compensation to be useful.
Dec 21, 2023
dc6a951
Variable timing works. Cleanup, write tests and merge
Dec 21, 2023
d336ccf
Added exceptions, Tests wip
Jan 17, 2024
8ef0196
reverted bugs introduced in Router_test
Jan 18, 2024
eda29f2
First attempt at PointingSystem tests
Jan 18, 2024
cb12eb0
Tests on Pointing System WIP
Jan 22, 2024
e8180e4
Tests WIP
Jan 25, 2024
2d7c6b2
merging with EPPS
Jan 25, 2024
ffe100c
SAT EPPS WIP
Jan 29, 2024
09e3bcb
Hacked EPPS to sync every once in a while
Feb 5, 2024
93ca924
PointingSystem tests ok
Feb 20, 2024
fbbbaee
first GQueue test working
Feb 21, 2024
6ecd2bd
All tests working. Cleanup and merge
Feb 23, 2024
deae543
Cleanup
Feb 23, 2024
ef775ff
Cleanup pt2
Feb 24, 2024
b4c8468
Always let OSPF packages through
Feb 24, 2024
50a896c
Merge branch 'master' of github.com:pfittipaldi/quisp
Feb 24, 2024
8a1ea6f
mute signals and merge
Feb 24, 2024
35382c5
removed superfluous debug signals
Feb 24, 2024
8c80817
linted code, ready for merge
Feb 24, 2024
13f680c
Merge branch 'sfc-aqua:master' into master
pfittipaldi Feb 26, 2024
1a5cb11
Removed old experiment
pfittipaldi Feb 26, 2024
67f0314
Delete quisp.tar.xz
pfittipaldi Feb 26, 2024
e47dc44
Added docs
pfittipaldi Feb 26, 2024
928fbce
Added Paolo to authors
pfittipaldi Feb 26, 2024
496dc7e
Fixed error, should be ready for merge now
Feb 27, 2024
b49386b
sync fork
Feb 27, 2024
714da83
Delete log.txt
pfittipaldi Feb 27, 2024
c2570a2
corrected CSVParser bug
Feb 29, 2024
e1798fa
Merge remote-tracking branch 'upstream/master' into satelite-msm
zigen Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Sara Metwalli
* Michal Hadjusek
* Makoto Nakai
* Paolo Fittipaldi

## Senior Advisors:

Expand Down
6 changes: 3 additions & 3 deletions quisp/.nedfolders
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.
./channels
./modules
./networks
channels
modules
networks
59 changes: 59 additions & 0 deletions quisp/channels/CSVParser.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/** \file CSVParser.cc
*
* \brief CSVParser
*
*
* Quick parser for CSVs, written for csv-based Free-space channels.
*/

#include "CSVParser.h"

CSVParser::CSVParser(const string filename) {
file.open(filename);
if (!file.is_open()) throw cRuntimeError("Couldn't find CSV file!");
string line;
double key = 0;
double val = 0;
char sep; // throwaway
while (file >> line) {
std::istringstream ss(line);
ss >> key >> sep >> val;
property.insert(std::pair<double, double>(key, val));
}
return;
}

double CSVParser::getPropertyAtTime(const double time) {
if (time < getLowestDatapoint()) return getLowestDatavalue();
if (time > getHighestDatapoint()) return getHighestDatavalue();

// These two first lines are there just to provide mathematically sound results.
// They should never be used in actual simulation, as they are NOT in any way
// guaranteed to be accurate.

if (time != last_polled_time) {
last_polled_time = time;
auto u_b = property.upper_bound(time);
if (u_b == property.end()) {
last_polled_value = (--u_b)->second;
} else if (u_b == property.begin()) {
last_polled_value = u_b->second;
} else {
auto l_b = u_b;
--l_b;
const double delta = (time - l_b->first) / (u_b->first - l_b->first);
last_polled_value = delta * u_b->second + (1 - delta) * l_b->second;
}
}
return last_polled_value;
}

int CSVParser::getLowestDatapoint() { return property.begin()->first; }

int CSVParser::getHighestDatapoint() { return property.rbegin()->first; }

double CSVParser::getLowestDatavalue() { return property.begin()->second; }

double CSVParser::getHighestDatavalue() { return property.rbegin()->second; }

CSVParser::~CSVParser() {}
41 changes: 41 additions & 0 deletions quisp/channels/CSVParser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* CSVParser.h
*
* Created on: Nov 28, 2023
* Author: paolo
*/

#ifndef CHANNELS_CSVPARSER_H_
#define CHANNELS_CSVPARSER_H_

#include <omnetpp.h>
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>

using namespace omnetpp;
using std::string;

class CSVParser {
public:
CSVParser();
CSVParser(const string filename);
virtual ~CSVParser();
double getPropertyAtTime(const double time);
int getLowestDatapoint();
int getHighestDatapoint();
double getLowestDatavalue();
double getHighestDatavalue();

char* getName;

private:
std::ifstream file;
char* name;
double last_polled_time = -1;
double last_polled_value = -1;
std::map<double, double> property;
};

#endif /* CHANNELS_CSVPARSER_H_ */
68 changes: 68 additions & 0 deletions quisp/channels/FSChannel.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/** \file FSChannel.cc
*
* \brief Freespace channel
*
*
*/

#include "FSChannel.h"

using namespace omnetpp;
namespace quisp::channels {

FSChannel::FSChannel(){};

Define_Channel(FSChannel);

void FSChannel::initialize() {
cDatarateChannel::initialize();
const char *filename = par("distance_CSV").stringValue();
dist_par = new CSVParser(filename);
op.orbit_period = par("orbital_period");
op.vis_start_time = dist_par->getLowestDatapoint();
op.vis_end_time = dist_par->getHighestDatapoint();
}

cChannel::Result FSChannel::processMessage(cMessage *msg, const SendOptions &options, simtime_t t) {
Result result;

if (!checkLOS() and !dynamic_cast<OspfPacket *>(msg)) {
result.discard = true;
} else {
recalculateChannelParameters();
result = cDatarateChannel::processMessage(msg, options, t);
}
return result;
}

bool FSChannel::checkLOS() {
Enter_Method("checkLOS()");
const SimTime currentTime = fmod(simTime(), op.orbit_period);
if (currentTime >= op.vis_start_time and currentTime <= op.vis_end_time) {
return true;
}
return false;
}

double FSChannel::getDistanceAtTime(const simtime_t time) {
recalculateChannelParameters();
return dist_par->getPropertyAtTime(time.dbl());
}

SimTime FSChannel::getNext_check_time() {
Enter_Method("next_check_time()");
const SimTime current_time = fmod(simTime(), op.orbit_period);
if (current_time >= op.vis_start_time and current_time <= op.vis_end_time) {
return 0;
}
if (current_time >= op.vis_end_time) { // Satellite already passed for this orbit
return op.vis_start_time + op.orbit_period - current_time;
}
return op.vis_start_time - current_time;
}

void FSChannel::recalculateChannelParameters() {
par("distance").setDoubleValue(dist_par->getPropertyAtTime(simTime().dbl()));
if (par("CSV_varies_delay").boolValue()) par("delay").setDoubleValue(par("distance").doubleValue() / par("speed_of_light_in_FS").doubleValue());
}
} // namespace quisp::channels
51 changes: 51 additions & 0 deletions quisp/channels/FSChannel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** \file FSChannel.h
*
* \brief Freespace channel
*
* Loss model from 10.1038/s42005-022-01123-7.
* Base class for Free-space communication: this channel handles variable length and delay using a CSVParser.
* LOS-related methods are directly callable from outside since the pointing system is expected to be able to directly check whether there is visibility or not.
*
*/

#ifndef CHANNELS_FSCHANNEL_H_
#define CHANNELS_FSCHANNEL_H_

#include <messages/ospf_messages_m.h>
#include <omnetpp.h>
#include <cmath>
#include <stdexcept>
#include "CSVParser.h"
#include "PhotonicQubit_m.h"
#include "omnetpp/cexception.h"

using namespace omnetpp;
using namespace quisp::messages;

struct ORBITAL_PARAMETERS {
SimTime orbit_period = SIMTIME_MAX;
SimTime vis_start_time = SIMTIME_ZERO;
SimTime vis_end_time = SIMTIME_MAX;
};

namespace quisp::channels {
class FSChannel : public cDatarateChannel {
public:
FSChannel();
virtual void initialize() override;
void set_orbit_parameters(double orb_period, double orb_vis_start_coeff, double orb_vis_end_coeff);
virtual void recalculateChannelParameters();
bool checkLOS();
double getDistanceAtTime(const simtime_t time);
virtual SimTime getNext_check_time();

private:
ORBITAL_PARAMETERS op;
CSVParser *dist_par;

protected:
cChannel::Result processMessage(cMessage *msg, const SendOptions &options, simtime_t t) override;
};
}; // namespace quisp::channels

#endif /* CHANNELS_FSCHANNEL_H_ */
Loading
Loading