|Problems using cEnvirBase||FIV||10/5/12 3:50 AM|
I'm trying to carry out something similar to the "embedding2" example but using "cEnvirBase" instead of "cNullEnvir" as environment (I need the implemented methods to run INET libraries). Do you know if there is any example to have a look (apart from "cmdenv", it's too complicated for me)? So far, it always gets frozen when it sets up the network: "sim->setupNetwork(networkType);". Is there some documentation about the "steps to use cEnvirBase" or at least the methods that INET libraries necessarily demand?
Thanks in advance.
|Re: Problems using cEnvirBase||Rudolf Hornig||10/5/12 5:30 AM|
This problem is completely independent of INET. You can use also the queueinglib example for testing. I don't understand fully what you want to achieve and why you want to create a new environment instead of using the existing ones? (The reason for a new environment would be if you want: read your parameters from somewhere else than an INI file (i.e. from a database), or to implement a new user interface.
If you just want to have your own main() function, then you don't have to do this... Take a look at main.cc:
extern "C" ENVIR_API int evMain(int argc, char *argv);
int main(int argc, char *argv)
// call the main function and start the simulation
return evMain(argc, argv);
i.e. you just have to call evMain() (and obviously you have to link with all the omnet libraries + the inet library)
|Re: Problems using cEnvirBase||FIV||10/5/12 6:26 AM|
Ok. What I want to obtain in the end is some kind of functional mock-up unit for co-simulation.
I have a master C++ project which calls, synchronises and manages different simulation models (Omnet, Matlab, Modellica, etc.) using functions like Set(), Get(), TimeStep(), EventStep(). A possible scenario is a model ruled by continuous dynamics running in Matlab that also requires communication networks. Due to Matlab's lacks to face that, this part is implemented by Omnet. Therefore Matlab triggers communication events and waits for results whereas it tackles continuous dynamics process in parallel (obviously, times are synchronized).
(You have an example of something similar here: http://www.nvc.vt.edu/lmili/docs/ISGT2011_final.pdf).
So far, I have been able to successfully do that following the "embedding2" example for a simple Omnet model (e.g. TicToc). Now I want to add TCP/IP communication, but it's being freaking complicated.
So, you are right, I want to set and get parameters from somewhere else, and also to control the evolution of the simulation and make changes in the middle.
I tried with "CNullEnvir" developing all the methods that have to do with XML, but it gets frozen when executes "sim->doOneEvent(mod);". On the other hand, I don't think I know how to correctly use "cEnvirBase", it gets frozen setting up the network or calling the run method.
Thanks for your help.
Am Freitag, 5. Oktober 2012 14:30:47 UTC+2 schrieb Rudolf Hornig:
|Re: Problems using cEnvirBase||Rudolf Hornig||10/7/12 11:47 PM|
Hmm, you will have a BIG task if you want to implement the environment based on cNullEnvir as you have to provide ALL the parameters required by INET (i.e. any modules inside an INET host) via that module. It really depends of how much non-defautl values you have in your simulation).
As for the "freezing " problem... You have to debug the program and step into the methods until you find where it goes into an infinite loop. If it "freezes" in doOneEvent, then restart the simulation and next time step into that method...
|Re: Problems using cEnvirBase||FIV||10/8/12 12:55 AM|
Thanks, that's more or less what I'm doing at the moment. Provided that I have to implement some methods and I don't exactly know which ones, as you previously told me, I was also trying to do it using cEnvirBase, but no way. I would need an example, something else that just: http://www.omnetpp.org/doc/omnetpp/manual/usman.html#sec472.
Am Montag, 8. Oktober 2012 08:47:22 UTC+2 schrieb Rudolf Hornig:
|Re: Problems using cEnvirBase||FIV||10/8/12 2:07 AM|
By the way, it gets frozen in "ccoroutine.cc" when calls "SwitchToFiber(cor->lpFiber);" Any idea?
Am Montag, 8. Oktober 2012 09:55:13 UTC+2 schrieb FIV:
|Re: Problems using cEnvirBase||FIV||10/8/12 2:25 AM|
Ok. It's solved. Txs :)
Am Freitag, 5. Oktober 2012 12:50:32 UTC+2 schrieb FIV: