boulis / Castalia

An OMNeT-based simulator for low-power wireless networks such as Wireless Sensor Networks and Body Area Networks
80 stars 51 forks source link

Adapt the code to new omnet versions #12

Open aarizaq opened 6 years ago

aarizaq commented 6 years ago

I have modified the code to compile with omnet 5.2/5.3 this file has the modifications. You only need to import the project in the IDE. I haven't tested if the examples run, only that the code compiles without errors.

Castalia-master.zip

boulis commented 6 years ago

Mouhamadi has also created a port for OMNeT 5.2 and also conducted some tests to find deviations from Castalia runnig on OMNeT 4.6. His patches, report, and resulting discussion can be found here: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/castalia-simulator/5LU_xkfNqL8/KYAfHZTuAgAJ

It's worth noting that Mouhamadi's port includes patch files. I find this a more elegant solution for distributing changes to code. It would be good to study the differences and similarities between the two port efforts.

aarizaq commented 6 years ago

Castalia.zip This is the port for 5.3,

And yes, my aproach is a bit less elegant, for example instead of include the route to the headers files in the ocde I have used a makefrag file to define the default header route. And my skills with scripts files is a bit lacking, this is the reasion why i prefer to use the whole project.

For omnet 5.3 it is necesary to include some aditional modifications.

boulis commented 6 years ago

Could we merge the two ports into one? (keeping the advantages of each one) I do not have the time to look into this, but whoever is willing, it could be a valuable service to the Castalia community.

aarizaq commented 6 years ago

Most of the modification cover the problem witht he headers, omnet 5.2 and 5.3 need the route in the header #include "use/xxx/xxx.h", I have tries to modified the code the less possible and I have opted by a makefrag file where the include path variable is defined with the route to the diferent directories. I suppose that this modification is easier for the people that are used to the oldest versions of omnet. The rest of the modifications are basically the same, the change of some methods that have disappeared to the new (for example 'opp_error', not must be 'throw cRuntimeError'). A modification that I have included is the package castalia, this force the changes in the ned files routes to castalia.xxx.xx and in the c++ code when you use the class cTopology, now the nodes use this “castalia.node.Node” instead of “node.Node”. Other change that I have included that it is necessary for 5.3 is if read a configuration paramater in the c++ code, for example ‘int foo = par(“foo”);’, foo must be declared in the ned file like integer, if the types doesn’t coincide the simulator will raise an error. I have force casting in the code in some parts to avoid this problem for example ‘double foo = (int)par(“foo”);’.

I have also PD : I have solved a couple of errors that are raised by the compiler clang.

In the file Basic802154.cc, the code has if (seqNum > 255) seqNum == 0; This doesn’t have sense, I have replaced to if (seqNum > 255) seqNum = 0;

Have modified packet BypassRoutingPacket extends RoutingPacket { string source; string destination; } to packet BypassRoutingPacket extends RoutingPacket { }

message RadioControlCommand { int radioControlCommandKind enum (RadioControlCommand_type); int state enum (BasicState_type) = RX; //to be used with SET_STATE double parameter = 0.0; //to be used with SET_TX_OUTPUT, SET_CARRIER_FREQ, SET_CCA_THRESHOLD string name = ""; //to be used with SET_MODE, SET_SLEEP_LEVEL and SET_ENCODING } To message RadioControlCommand { int radioControlCommandKind enum (RadioControlCommand_type); int state enum (BasicState_type) = RX; //to be used with SET_STATE double parameter = 0.0; //to be used with SET_TX_OUTPUT, SET_CARRIER_FREQ, SET_CCA_THRESHOLD }

The file includes the .project and .cproject files to import it directly in the omnet IDE, I suppose that to load the project directly in the IDE is simpler for the new user that to use the command line options.

aarizaq commented 6 years ago

Now the makemake also works (tested in windows 10). With this version you can use the scrips or to use the IDE, this simplify the debug. Castalia.zip

And sorry for the misspellings, I am ashamed when I have read that I have written

aarizaq commented 6 years ago

My latest modification, this include modifications in the Castalia.py that allows to run the srtipt in windows. The root Makefile has been completly rewrite and the makemake file is now a call to the Makefile. I can now run castalia from the command line or from the IDE in windows using omnet 5.3p3 Castalia.zip

xarokk commented 6 years ago

Thanks , very useful.

Hana33 commented 6 years ago

Is this solution functional on ubuntu too ? Would you please mention exactly which folder in the discussion is the one that I have to import into the IDE to adapt castalia with omnet 5.3 (on ubuntu) ? My questions sound maybe kind of clumsy , I am still a newbie Thank you for your help;

aarizaq commented 6 years ago

It should work in ubuntu also

Hana33 commented 6 years ago

I have compiled the modified version of Castalia on Omnet 5.3 and everything goes well; But when trying to run my first simulation using command line as in the manual /Castalia/Simulations/radioTest$ ../../bin/Castalia -c General I got this error: bash: ../../bin/Castalia : Permission denied

Have anyone tested if the examples run in this case ?

aarizaq commented 6 years ago

Linux or windows, if you are working in Linux you need to check if the file Castalia (case sensitive) exist and the permit (with ls –l). If you are working in omnet 5.3 is possible that you have created the program in debug mode and in this case the file is called Castalia_dbg. De: Hana33 [mailto:notifications@github.com] Enviado el: domingo, 22 de julio de 2018 21:28 Para: boulis/Castalia Castalia@noreply.github.com CC: Alfonso aarizaq_m@hotmail.com; Author author@noreply.github.com Asunto: Re: [boulis/Castalia] Adapt the code to new omnet versions (#12)

I have compiled the modified version of Castalia on Omnet 5.3 and everything goes well; But when trying to run my first simulation using command line as in the manual /Castalia/Simulations/radioTest$ ../../bin/Castalia -c General I got this error: bash: ../../bin/Castalia : Permission denied

Have anyone tested if the examples run in this case ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/boulis/Castalia/issues/12#issuecomment-406890501, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AADyd1ydOE8fmzB7pRsfbheX9uQzMeeXks5uJNJagaJpZM4Sq7-N.

Hana33 commented 6 years ago

I didn't get exactly what do you mean ? I am working on ubuntu 16.4 and there is no such file as Castalia_dbg. I even added the path to .bashrc and .profile export PATH=$PATH:/home/usr/../Castalia/bin but still got the same error Could you please explain me more

aarizaq commented 6 years ago

Check the route “/home/usr/../Castalia/bin” This search in the directory /home/Castalia

De: Hana33 [mailto:notifications@github.com] Enviado el: lunes, 23 de julio de 2018 10:44 Para: boulis/Castalia Castalia@noreply.github.com CC: Alfonso aarizaq_m@hotmail.com; Author author@noreply.github.com Asunto: Re: [boulis/Castalia] Adapt the code to new omnet versions (#12)

I didn't get exactly what do you mean ? I am working on ubuntu 16.4 and there is no such file as Castalia_dbg. I even added the path to .bashrc and .profile export PATH=$PATH:/home/usr/../Castalia/bin but still got the same error Could you please explain me more

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/boulis/Castalia/issues/12#issuecomment-406984411, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AADyd2Nf6TjJcETAxgT0zVf4wThUOMHeks5uJYzOgaJpZM4Sq7-N.

Hana33 commented 6 years ago

Checked, I have only these four files in the folder Castalia/bin (screen capture joint) Castalia CastaliaPlot CastaliaResults extractOmnetppINI

Le lun. 23 juil. 2018 à 11:07, Alfonso notifications@github.com a écrit :

Check the route “/home/usr/../Castalia/bin” This search in the directory /home/Castalia

De: Hana33 [mailto:notifications@github.com] Enviado el: lunes, 23 de julio de 2018 10:44 Para: boulis/Castalia Castalia@noreply.github.com CC: Alfonso aarizaq_m@hotmail.com; Author author@noreply.github.com Asunto: Re: [boulis/Castalia] Adapt the code to new omnet versions (#12)

I didn't get exactly what do you mean ? I am working on ubuntu 16.4 and there is no such file as Castalia_dbg. I even added the path to .bashrc and .profile export PATH=$PATH:/home/usr/../Castalia/bin but still got the same error Could you please explain me more

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/boulis/Castalia/issues/12#issuecomment-406984411>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AADyd2Nf6TjJcETAxgT0zVf4wThUOMHeks5uJYzOgaJpZM4Sq7-N>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/boulis/Castalia/issues/12#issuecomment-406990958, or mute the thread https://github.com/notifications/unsubscribe-auth/AmSaauXLz1nqG4ZIxtvrPoXiBqhix8T_ks5uJZJcgaJpZM4Sq7-N .

-- Hana RHIM *PhD Student in TIC *(Sup'Com) Xlim Laboratory Limoges

Hana33 commented 6 years ago

It is Okey, I have solved the problem.

I added the word python as : /Castalia/Simulations/radioTest$ python ../../bin/Castalia -c General and it works ! another radical solution is to allow all permissions to the file ../bin/Castalia by setting chmod 777 Castalia as a command line and then type the usual ../../bin/Castalia -c General

Hana33 commented 6 years ago

It is Okey, I have solved the problem.

I added the word python as : /Castalia/Simulations/radioTest$ python ../../bin/Castalia -c General and it works !

another radical solution is to allow all permissions to the file ../bin/Castalia by setting "chmod 777 Castalia" as a command line and then type the usual ../../bin/Castalia -c General

Le lun. 23 juil. 2018 à 11:17, hana rhim hana.rhim@gmail.com a écrit :

Checked, I have only these four files in the folder Castalia/bin (screen capture joint)

Le lun. 23 juil. 2018 à 11:07, Alfonso notifications@github.com a écrit :

Check the route “/home/usr/../Castalia/bin” This search in the directory /home/Castalia

De: Hana33 [mailto:notifications@github.com] Enviado el: lunes, 23 de julio de 2018 10:44 Para: boulis/Castalia Castalia@noreply.github.com CC: Alfonso aarizaq_m@hotmail.com; Author author@noreply.github.com Asunto: Re: [boulis/Castalia] Adapt the code to new omnet versions (#12)

I didn't get exactly what do you mean ? I am working on ubuntu 16.4 and there is no such file as Castalia_dbg. I even added the path to .bashrc and .profile export PATH=$PATH:/home/usr/../Castalia/bin but still got the same error Could you please explain me more

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/boulis/Castalia/issues/12#issuecomment-406984411>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AADyd2Nf6TjJcETAxgT0zVf4wThUOMHeks5uJYzOgaJpZM4Sq7-N>.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/boulis/Castalia/issues/12#issuecomment-406990958, or mute the thread https://github.com/notifications/unsubscribe-auth/AmSaauXLz1nqG4ZIxtvrPoXiBqhix8T_ks5uJZJcgaJpZM4Sq7-N .

-- Hana RHIM *PhD Student in TIC *(Sup'Com) Xlim Laboratory Limoges

-- Hana RHIM *PhD Student in TIC *(Sup'Com) Xlim Laboratory Limoges

ghost commented 6 years ago

I have compiled the modified version of Castalia on Omnet 5.4.1 and everything goes well, but still got the some errors.

OMNeT++ Discrete Event Simulation (C) 1992-2018 Andras Varga, OpenSim Ltd. Version: 5.4.1, build: 180629-5e28390, edition: Academic Public License -- NOT FOR COMMERCIAL USE See the license for distribution terms and warranty disclaimer

Setting up Qtenv...

Loading NED files from ../../../simulations: <!> Error: Could not load NED sources from '../../../simulations': Cannot temporarily change to directory '../../../simulations' (does it exist?)

End.

Hana33 commented 5 years ago

hello,

after doing all the steps and building the modified version of castalia 3.3 proposed here under omnet 5.3 , simulations can't take place because castaliaBin is not created after ./makemake . I got this error when running an example trough the terminal : ERROR: CastaliaBin not found (need to run make?) This is the capture of the makefile folder from the IDE capt

Need some help please !

rhornig commented 5 years ago

Hi all, I've made s a pull request #16 for OMNeT++ 5.4 and 6.0 pre compatibility. Also incorporated the python script changes from @aarizaq . Added IDE build support and rearranged the source tree to match the recommended layout for models.

boulis commented 5 years ago

Hi all, I've made s a pull request #16 for OMNeT++ 5.4 and 6.0 pre compatibility. Also incorporated the python script changes from @aarizaq . Added IDE build support and rearranged the source tree to match the recommended layout for models.

Thank you very much for your contribution!
I'll have to test the changes and pull them. I am not working with Castalia anymore and I have other priorities, so this might take time.

vandenbergborges commented 4 years ago

Hello everyone. I am in a PhD stage that I need to use a simulator for a sensor network communicating in a wifi interference environment, I opted for Castalia but I have been having difficulties installing, tried on Ubuntu and Windows 10. The first flaw is #include "CastaliaMessages.h" in "CastaliaModule.H". The second glitch I can not insert the "omnetpp.ini" or simulate. I ask for urgent help. image

image

image

vandenbergborges commented 4 years ago

I tried to install on various versions on windows and Ubuntu. In the recommended version (Omnet 4.6), it has an error and not complete, see print.

image

vandenbergborges commented 4 years ago

I tried to install on various versions on windows and Ubuntu. In the recommended version (Omnet 4.6), it has an error and not complete, see print.

image

aarizaq commented 4 years ago

The modifications are for omnet 5.4

foersben commented 3 years ago

One maybe stupid question - why did nobody fork the castalia project and provides an Omnet++ 5.x/6.x version this way? I just assume that it would be somewhat elegant and other experts could maybe contribute to the project in an easier way.

(Not that I am an expert, just got in touch with Castalia some days ago)

avarga commented 1 year ago

For everyone looking for a version that works with new OMNeT++ versions, see https://github.com/rhornig/Castalia/tree/topic/omnetpp54-compatibility (this is the source of the yet-unmerged pull request).

The reason why no one has updated Castalia in the recent years might be that INET Framework has recently accumulated features that have originally been only found in Castalia (such as clock skew), so there is less reason to use Castalia.

boulis commented 12 months ago

@foersben It's hard to know why something was NOT done, but certainly Castalia has not been an active project for more than 10 years, so people are naturally less inclined to contribute to a dead project. The reviving through a fork could be an option, but this takes a lot of dedication, and there might be other tools out there that now offer solutions, as @avarga points out.

Having said this, @rhornig did make a great effort in 2019 and has created PR #16 . Your interest and his effort give me the motivation to see this PR through and merge it in the main Castalia repo. But it takes time and I am not working at all in this area anymore. It will all have to come from my very limited personal time.

capoolebugchat commented 4 months ago

@boulis your project is not dead, it's living well in my machine, running sims all day. It's a good enough stepping stone to be something more capable. I got MAC 802.15.4e and RPL sims propped up and running thanks to the enormous work you done at the Radio layer.

boulis commented 4 months ago

@boulis your project is not dead, it's living well in my machine, running sims all day. It's a good enough stepping stone to be something more capable. I got MAC 802.15.4e and RPL sims propped up and running thanks to the enormous work you done at the Radio layer.

@capoolebugchat That's wonderful to hear! Sounds like you have done a lot of additional work implementing these protocols. Is this something you can eventually share? Which version of OMNeT++ are you using?

capoolebugchat commented 3 months ago

@boulis While eager to share the code base Im a bit reluctant. My coding is really, really convoluted and low-quality and hyper specific on what I wanted to simulate. But eventually, maybe at the end of this year I'll force myself to do many (much needed) waves of refactoring and throw this whole thing out to the world, cant stress how benefited I am for all of the OSS I found and molded to my own needs, I want to give back what I could. 5.4 is the stable-ish OMNET version for Castalia rnow. Anything newer than that breaks the thing (idk why, really). Gotta say your Wireless Channel was an impressive piece of code and I wanna match up to 50% of that quality (for the new features). Also, whats up with TMAC clock sync? Its been giving me hell with those random neg setTimer() ops. Did a quick debug and removed 80% of those cases but the 20% rest are still giving me headscratches.

rhornig commented 3 months ago

I just want to drop a bit of info here. opp_env can install castalia-3.3pr16 which contains my original pull request, so it works with a wide range of OMNeT++ version. from 5.3 - 5.7.1.

Still does not support OMNeT++ 6.x though :(