11

I am currently looking for a discrete event simulator written for C++. I did not find much on the web written specifically in OO-style; there are some, but outdated. Some others, such as Opnet, Omnet and ns3 are way too complicated for what I need to do. And besides, I need to simulate agent-based algorithms capable of simulating systems of thousands of nodes.

Does anybody know anything suitable for my needs?

jweyrich
  • 31,198
  • 5
  • 66
  • 97
Bob
  • 10,741
  • 27
  • 89
  • 143
  • If you're comfortable with Python, you can try GarlicSim, which will let you do agent-based simulations. (I never tried it for thousands, but I don't think there will be a problem with it.) – Ram Rachum Oct 22 '10 at 20:58

6 Answers6

4

Others have good direct answers, but I'm going to suggest an alternative. If I understand you right, you want a system in C++ or such where you can post events that fire in the future, and code is run when those events fire.

I had a project to do like this, and I started out trying to write such an event system in C++ and then quickly realized I had a better solution.

Have you considered writing your program in behavioral Verilog? That may seem strange to write software in a hardware description language, but a Verilog simulator is an event-based system underneath, and behavioral Verilog is a very convenient way to express events, timing, triggers, etc. There is a free Verilog simulator (which is what I used) called Icarus Verilog. If you're not using Ubuntu or some Linux distro with Icarus already in a package, building from source is straightforward.

Timothy Miller
  • 1,527
  • 4
  • 28
  • 48
  • please consider posting a link to an example of Verilog performing a simple DES example. Thank you – gatorback Mar 30 '17 at 04:31
  • @gatorback I'm not sure I've ever seem anyone else do this. I'm sure they have, but the only example I know of is the aforementioned project I did, and I have no idea where I put that code. – Timothy Miller Mar 31 '17 at 13:48
4

I would recommend having a second look to OmNet++. At first sight it may look quite complex, but if you look it into more detail you will find that most of the complexity is in the network add-on (the INET Framework). Unless you are going to do a detailed network simulation you do not need the INET.

Using OmNet++ core is not specially difficult and it may be simpler than other similar tools.

You may want to have a look to an intro.

One of the things that makes OmNet++ attractive to me is its scalability. Is possible to run large simulations in a desktop. Besides, it is possible to scale the same simulation to a cluster without rewriting the code.

skovorodkin
  • 9,394
  • 1
  • 39
  • 30
3

You should consider SystemC, although I'd also recommend taking a second look at OmNet++.

jupp0r
  • 4,502
  • 1
  • 27
  • 34
2

We use SIMLIB at my school. It is very fast, easy to understand, object oriented, discrete and continuous simulator. It might look outdated but it is still maintained.

Strix
  • 1,094
  • 1
  • 10
  • 18
1

There is CSIM from Mesquite Software which supports developing models in C, C++ and Java. However, it is paid-commercial, AFAIK.

mvarshney
  • 364
  • 1
  • 8
0

Take a look at GBL library. It's written in modern C++ and even supports C++0x features like move semantics and lambda functions. It offers several modeling mechanisms: synchronous and asynchronous event handlers, preemptive threads, and fibers. You can create purely behavioral, cycle accurate, and real-time models, or any mixture of those.

Gene Bushuyev
  • 5,512
  • 20
  • 19