2

I implemented the finish method in my application but it is not being called at the end of the simulation.

I tried placing logs and using the debugger, but none of these methods gave me any indication that it was being called

Here is the header file:

class   LoadBalancer : public BaseWaveApplLayer {
public:
    virtual void initialize(int stage);
    virtual void finish();

This is the implementation

void LoadBalancer::finish(){
std::string scWork = "Load Balancer : "+std::to_string(id)+" work finished";
recordScalar(scWork.c_str(),workFinished);
std::string scTask = "Load Balancer : "+std::to_string(id)+" task finished";
recordScalar(scTask.c_str(),taskCompleted);
EV << "Load balancer : " <<id<<" finished a total work of: "<<workFinished<<" and completed "<<taskCompleted<<" task"<<endl;

}

I would have hoped any of the logs in the finish method be called or any scalar file to have been created but that was not the case.

jmantica
  • 41
  • 2
  • 1
    Could you post your code? – thardes2 Feb 11 '19 at 07:25
  • Just like the method initialize, finish is called by omnet++ at a certain point of the simulation. Below is a citation from the omnet simulation manual. " cComponent has the following member functions meant for redefining in subclasses: -initialize(). This method is invoked after OMNeT++ has set up the network (i.e. created modules and connected them according to the definitions), and provides a place for initialization code; -finish() is called when the simulation has terminated successfully, and its recommended use is the recording of summary statistics" – jmantica Feb 12 '19 at 15:33
  • 1
    Could you please post your Veins, SUMO and OMNeT++ versions? – thardes2 Feb 15 '19 at 13:59
  • Its SUMO 3.0, OMNeT++ 5.1.1 and Veins 4.6 – jmantica Feb 18 '19 at 19:10
  • Also finished seems to be called in Cmdenv but not in Qtenv – jmantica Feb 18 '19 at 19:11

0 Answers0