heal-research / SimSharp

Sim# is a .NET port of SimPy, process-based discrete event simulation framework
MIT License
126 stars 30 forks source link

Implement a standard library for modeling processes #6

Open abeham opened 5 years ago

abeham commented 5 years ago

Many processes can be standardized and a library of atomic processes can be created. In process models one creates a set of agents or entities and models their flow through a network of processes. The network features several streams. Each stream starts at "Create" and ends at "Finalize". Multiple streams may synchronized, they may be created also a result of one stream through "Clone" or merged to one stream using "Merge".

  1. Create - creates new entities (0:1)
  2. Finalize - finalizes the entities (1:0)
  3. Queue - puts entities into a queue (1:1)
  4. Delay - delays entities for some time (1:1)
  5. Attach - request resources and attach them (1:1)
  6. Detach - free resource requests and detach them (1:1)
  7. Collect - combine multiple entities into one collection entity (1:1)
  8. Dispense - dispenses the collection entity (1:1)
  9. Clone - creates one or multiple copies of an entity (1:n)
    1. Merge - creates a new entity based on a number (n:1)
    2. Distribute - select the next process based on some strategies (round-robin, custom) (1:1)
    3. Sync - uses n streams of entities and synchronizes them (n:n)

Collect and dispense are 1:1 because entity collection would also be a sub-type of entity. The resources in Sim# are not subclasses of one common class. Some abstraction must be created that hides the used resource type.

The processes should feature event handlers such as OnEnter, OnExit to allow collecting statistics or perform other manipulation to the entity instance.

sean-reed commented 2 years ago

There is a DES library for the R language, called simmer, based around this very concept. They call the streams that entities flow through 'trajectories' and there is a nice paper about it that you be interested in reading.

abeham commented 2 years ago

@sean-reed, thanks that looks interesting.