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 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.2.0b1.tar.gz
(186.9 kB
view hashes)
Built Distribution
soyutnet-0.2.0b1-py3-none-any.whl
(17.3 kB
view hashes)
Close
Hashes for soyutnet-0.2.0b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbed4a4d8dfa2c0effd6a3c981b07abe239d700af060349f560fefda79991c23 |
|
MD5 | 72843f4ba2b974a5bedfbe23fc1db0fe |
|
BLAKE2b-256 | f34100db0d606550f6a87edaa378acef9a1b2bfc306e1a70b4c9a31a20ea4479 |