#include <ns3/log.h>
#include <ns3/core-module.h>
#include <ns3/simulator.h>
#include <iostream>
using namespace ns3;
int TEST = 0; // sample global variable
void simCheck(){
TEST = (int)rand()%10;
std::cout<<"Test "<<TEST<<"\n";
}
/* I want the if(TEST>5) condition to pass.
Is there any way i can do this
I've tried a few variations but the Simulator::Now().GetSeconds()
goes out of bounds and simulation stops.
*/
int main(int argc, char const *argv[]) {
int mtime = 0;
while(mtime < 10 ){
Simulator::Schedule(Seconds(Simulator::Now().GetSeconds() + mtime),&simCheck);
if(TEST > 5){
Simulator::Schedule(Seconds (Simulator::Now().GetSeconds() + mtime ),&simCheck);
std::cout<<"If condition passed"<<"\n";
}
mtime+= 1;
}
Simulator::Run();
Simulator::Destroy ();
return 0;
}