Skip to main content

A simple implement for discrete events simulation.

Project description

Akatosh

This is a light weighted disceret event simulation library. The name is from the Dragon God of Time in Elder Scroll. :)

Install

pip install --upgrade Akatosh

How to use

Import modules:

from Akatosh import Mundus, Actor

create actors, aka event:

There are serveral ways that you can create an event:

  1. Create an event with lambda expression

     Actor(action = lambda: print("All hail dragonborn!"))
    
  2. Create an event with defined functions:

     #funtion without arguments
     def hail():
         print("All hail dragonborn!")
     Actor(action = hail)
     
     #function with arguments
     def hail(message: str):
         print(message)
     Actor(action = hail, message = "All hail dragonborn!")
    
  3. Create an event by subclass:

      class Myevent(Actor):
    
         def action(self):
             print("All hail dragonborn!")
    
      Myevent()
    
  4. Create with decorator (new!)

     #directly create an event with a function:
     @event()
     def hail():
         print(f"{Mundus.now}:\tHail Akatosh!")       
    
     #create a on call event, that is the decorated function must be called to actually make the event
     @event(on_call=True)
     def dragon_shout(msg:str="Ros Fu Da!"):
         print(f"{Mundus.now}:\t{msg}")
    

To start the simulation,

    Mundus.simulate(till=inf)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Akatosh-1.6.95.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

Akatosh-1.6.95-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page