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

Modification of ADR algorithm #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions src/LoRaApp/SimpleLoRaApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,22 @@ void SimpleLoRaApp::sendJoinRequest()
if(ADR_ACK_CNT >= ADR_ACK_LIMIT + ADR_ACK_DELAY)
{
ADR_ACK_CNT = 0;
increaseSFIfPossible();
increaseTPOrSFIfPossible();
}
}
emit(LoRa_AppPacketSent, loRaSF);
}

void SimpleLoRaApp::increaseSFIfPossible()
void SimpleLoRaApp::increaseTPOrSFIfPossible()
{
if(loRaSF < 12) loRaSF++;
if(loRaTP < 14)
{
loRaTP += 3; // at the beginning increase the Transmission Power
}
else if(loRaSF < 12)
{
loRaSF++; // secondly increase Spreading Factor
}
}

} //end namespace inet
2 changes: 1 addition & 1 deletion src/LoRaApp/SimpleLoRaApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class INET_API SimpleLoRaApp : public cSimpleModule, public ILifecycle
int ADR_ACK_LIMIT = 64; //64;
int ADR_ACK_DELAY = 32; //32;
bool sendNextPacketWithADRACKReq = false;
void increaseSFIfPossible();
void increaseTPOrSFIfPossible();

public:
SimpleLoRaApp() {}
Expand Down