Package: casymda
BPMN-based creation of SimPy discrete event simulation modelsWouldn't it becoolto combine the block-based process modeling experience of commercial discrete event simulation packages with the amenities of proper IDE-based source-code editing?
(Think Arena / Anylogic / ExtendSim / Plant Simulation / ... but with simple integration of third-party libraries, industry-standard interfaces, unit- and integration testing, dockerization, serverless execution in the cloud of your choice... and even actually working auto-completion!:D)And all that not only for free, but using the worlds most popular language for data analytics and machine learning?Casymdaenables you to createSimPy3simulation models, with help of BPMN and the battle-testedCamunda-Modeler.Created BPMN process diagrams are parsed and converted to Python-code, combining visual oversight of model structure with code-based definition of model behavior.
Immediately executable, including a token-based process animation, allowing for space-discrete entity movements, and ready to be wrapped as a gym-environment to let a machine-learning algorithm find a control strategy.Further information and sample projects:https://fladdimir.github.io/post/(English)https://casymda.github.io/page/Webpage/Startpage.html(German)InstallationFromPyPI:pip install casymdaFeaturesconnectable blocks for processing of entitiesgraphical model description via camunda modelerprocess visualization browser-based or via tkinterspace-discrete tilemap-movements of entitiesgradually typed (checkoutpyrightfor vscode)Coming soon:automated model generation from process event-logs viaPM4PyExamplesBasic features are illustrated as part of the example models (which also serve as integration tests):basics:bpmn-based generation of a simple model filerun the generated modelprocess visualization via tkinterbrowser-based visualization (served withflask, animated withpixijs)resources:seize and release a resource via graphical modelingtilemap:entity movement along a shortest path defined by a csv-tilemap (built on networkx:https://networkx.github.io/)For setup just clone the repository and install casymda (virtual environmentrecommended). Seebasics-visual-run-tkinterfor an example of how to cope with python-path issues.DesignModel generation and executionBlocks and animationDevelopmentThis project trustsBlackfor formatting,Sonarqubefor static code analysis, andpytestfor unit & integration testing. Developed and tested on Linux (Ubuntu 20.04), Python 3.8.5.
Tests can be carried out inside a docker-container, optionally including an installation from pypi to verify a successful upload.Sonarqubesonarqube server (public docker image):docker-compose up sonarqubesonar-scanner (public docker image):docker-compose up analysis(run a docker-based unit-test first for coverage-reporting)(remember to share your drive via Docker-Desktop settings if necessary, to be re-applied after each password change)Testspytest --cov-report term --cov=src/casymda/ tests/integrations tests:python3 -m pytest examples(integration-tests require tkinter, which may be installed viasudo apt-get install python3-tk)For Docker-based tests seedocker-compose.ymldocker-compose run unit-test
docker-compose run examples-test
docker-compose run examples-test-pypiVirtual environment setuppython3 -m venv venvEditable installationpip install -e .Publish to pypipython setup.py sdist

twine upload dist/*pip install twine if necessary,remember to set the version insetup.pyandsrc/casymdaas requiredPyPy3Tested PyPy3 (7.3.1-final). Install pypy3 pypy3-dev pypy-tk.Runtime could be decreased by factor ~2 when using PyPy3 for longer simulations runs (e.g. from ~45s to ~25s for asimple example model testwith MAX_ENTITIES set to 40.000 on an i5 notebook).Contactfladdi.mir@gmx.defeedback / ideas / discussion / cheering / complaints welcomeMIT License2020