Generating output in future OMNeT++ versions (5b2+)

67 views
Skip to first unread message

Rens van der Heijden

unread,
Aug 27, 2015, 9:01:41 AM8/27/15
to OMNeT++ Users
This post is mostly reporting a documentation issue (at least, I think it is..) for the beta release of OMNeT++.

I'm trying to compile veins against the recent OMNeT++ beta release (mostly to ensure forward compatibility). One of the problems I'm currently stuck at is the fact that, as written in the release notes:

 - The "simulation" and "ev" macros have been removed, to reduce pollution
   of the global namespace. You can use the newly introduced getSimulation()
   and getEnvir() functions instead.

 However, replacing "ev" with getEnvir() doesn't work in all cases; in particular, it doesn't work in code where it is used to generate output, like so: ev << "My Output"

I checked the user manual at this point, and saw that the hello world example there still generates output this way, as well as most other places I could find. This should probably be updated, because I tried grepping through all the examples in the /samples directory of the omnetpp code, but none of those seem to write output with ev <<. After realizing that the tictoc tutorial must also use this output method, I found that it uses:
        EV << "Sending initial message\n";
Which, as it turns out, seems to compile (at least, there are other compilation problems now). I checked the api doc; this definition comes from "Logging to the default category" (/doc/api//group__LoggingDefault.html), and this seems to be global. I'm not sure what the correct fix is -- should everything use EV for output, or should getEnvir() be used in some way?

Varga, András

unread,
Aug 28, 2015, 10:46:02 AM8/28/15
to omn...@googlegroups.com
Hello,

Documentation in the beta release hasn't been updated yet. We'll catch up latest for the final release.
Otherwise, your investigation was successful, the replacement for "ev" is indeed "EV".

Regards
Andras


--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Rens van der Heijden

unread,
Aug 28, 2015, 12:00:37 PM8/28/15
to OMNeT++ Users
Excellent! That clarifies a lot.
I've noticed, however, that the EV macro evaluates to something that eventually requires that the code is executed in a subclass of cComponent (or at least, somewhere in the OMNeT++ class hierarchy). Veins uses a nested class (to be precise, Mac1609_4::EDCA) to model some queuing stuff, and it turns out that because that class isn't in the OMNeT++ hierarchy, it can't use the EV macro (which used to work in the past). Have you already encountered this issue during other testing/are there any suggested solutions, or should I simply update the models such that debug output is emitted from Mac1609_4 only?

I'm currently preparing some patches for the VEINS devs, which I hope to publish later today; I'll post some links to that code for more details once I do.

Regards,
Rens

Varga, András

unread,
Sep 1, 2015, 12:25:47 PM9/1/15
to omn...@googlegroups.com
Just add EV_STATICCONTEXT at the top of the function, and you should be able to use the new EV from non-cObject classes too.

Cheers,
Andras
Reply all
Reply to author
Forward
0 new messages