Place/transition net (petri net) simulator that uses asyncio utilities as its backend
Project description
SoyutNet
SoyutNet is a place/transition net (PT net, Petri net) simulator that uses Python's asyncio task and synchronization utilities as its backend. (Soyut means abstract in Turkish.)
Its documentation can be found at https://soyutnet.readthedocs.io
Building
python3 -m venv venv
source venv/bin/activate
pip install -e '.[dev]'
pytest
Installing
python3 -m venv venv
source venv/bin/activate
pip install soyutnet
An example
This example simulates the PT net given in the diagram below.
import asyncio
import soyutnet
from soyutnet.pt_common import PTRegistry
from soyutnet.place import Place
from soyutnet.transition import Transition
from soyutnet.common import GENERIC_LABEL, GENERIC_ID
def main():
p1 = Place("p1", initial_tokens={ GENERIC_LABEL: [GENERIC_ID] })
p2 = Place("p2")
t1 = Transition("t1")
"""Define places and transitions (PTs)"""
p1.connect(t1).connect(p2)
"""Create connections"""
reg = PTRegistry()
reg.register(p1)
reg.register(p2)
reg.register(t1)
"""Save to a list of PTs"""
asyncio.run(soyutnet.main(reg))
"""Run the simulation"""
if __name__ == "__main__":
main()
Credits
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
soyutnet-0.1.0.tar.gz
(108.5 kB
view hashes)
Built Distribution
soyutnet-0.1.0-py3-none-any.whl
(15.6 kB
view hashes)