salabim 24.0.4.post0__tar.gz → 24.0.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. {salabim-24.0.4.post0 → salabim-24.0.5}/PKG-INFO +28 -15
  2. {salabim-24.0.4.post0 → salabim-24.0.5}/README.md +27 -14
  3. {salabim-24.0.4.post0 → salabim-24.0.5}/pyproject.toml +2 -2
  4. salabim-24.0.5/salabim/__init__.py +2 -0
  5. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim/salabim.py +22 -14
  6. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim.egg-info/PKG-INFO +28 -15
  7. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim.egg-info/SOURCES.txt +2 -2
  8. salabim-24.0.5/tests/test salabim.py +12 -0
  9. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_monitor.py +7 -7
  10. salabim-24.0.4.post0/salabim/changelog.txt +0 -7198
  11. salabim-24.0.4.post0/tests/test_salabim.py +0 -5
  12. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim/DejaVuSansMono.ttf +0 -0
  13. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim/LICENSE.txt +0 -0
  14. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim/calibri.ttf +0 -0
  15. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim/mplus-1m-regular.ttf +0 -0
  16. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim.egg-info/dependency_links.txt +0 -0
  17. {salabim-24.0.4.post0 → salabim-24.0.5}/salabim.egg-info/top_level.txt +0 -0
  18. {salabim-24.0.4.post0 → salabim-24.0.5}/setup.cfg +0 -0
  19. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_cap_now.py +0 -0
  20. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_componentgenerator.py +0 -0
  21. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_datetime.py +0 -0
  22. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_distributions.py +0 -0
  23. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_misc.py +0 -0
  24. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_process.py +0 -0
  25. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_queue.py +0 -0
  26. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_state.py +0 -0
  27. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_store.py +0 -0
  28. {salabim-24.0.4.post0 → salabim-24.0.5}/tests/test_timeunit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: salabim
3
- Version: 24.0.4.post0
3
+ Version: 24.0.5
4
4
  Summary: salabim - discrete event simulation in Python
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://salabim.org
@@ -11,13 +11,11 @@ Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
 
14
- <img src="https://www.salabim.org/salabim_logo_payoff.png" />
15
-
16
- </br>
14
+ <img src="https://www.salabim.org/salabim_logo_payoff.png" width=400 />
17
15
 
18
16
  Salabim is a Python library for object-oriented discrete event simulation (DES) and animation.
19
17
 
20
- ## Introduction
18
+ ### Introduction
21
19
 
22
20
  Discrete event simulation (DES) finds applications in various logistical domains including production facilities, warehousing, airports, hospitals, mining, materials handling, steel mills, and computer network analysis.
23
21
 
@@ -29,36 +27,51 @@ Salabim follows a well-proven and intuitive process description method similar t
29
27
  - Stores
30
28
  - States
31
29
  - Monitors for data collection and presentation
32
- - 2D and 3D animation (including video production)
30
+ - 2D and 3D animation (including video production) (see below)
33
31
  - Tracing facilities
34
32
  - Advanced statistical sampling
35
33
 
36
34
  In contrast to some other Python DES packages, salabim does not require the use of yield statements for process control, making it more straightforward to use. Salabim has minimal requirements, especially when animation is disabled.
37
35
 
38
- ## Features and documentation
36
+
37
+
38
+ ### Some salabim animations
39
+
40
+ <img src="https://www.salabim.org/cymulation3d.gif" width=700 />
41
+
42
+ <img src="https://www.salabim.org/elevator.gif" width=700 />
43
+
44
+ <img src="https://www.salabim.org/lights-3d.gif" width=700 />
45
+
46
+ ### Features and documentation
39
47
 
40
48
  - Cross-platform support: salabim runs on Windows, macOS, Linux, iOS/iPadOS (Pythonista), and can even be used with "Python In Excel".
41
49
  - Comprehensive documentation: Visit [www.salabim.org/manual](www.salabim.org/manual) for detailed documentation.
42
50
 
43
- ## Contributing and Reporting Issues
51
+ ### Resources
52
+
53
+ The salabim package can be found on GitHub: www.github.com/salabim/salabim
54
+
55
+ And on PyPI: https://pypi.org/project/salabim/
56
+
57
+ ### Contributing and Reporting Issues
44
58
 
45
59
  Contributions to salabim are highly appreciated! You can contribute by issuing a pull request or submitting an issue on [GitHub](https://github.com/salabim/salabim). Alternatively, you can use the [salabim Google user group](https://groups.google.com/g/salabim) for discussions and reporting issues.
46
60
 
47
- ## License
61
+ ### License
48
62
 
49
63
  Salabim is licensed under the MIT License. For details, please refer to the [LICENSE](LICENSE) file.
50
64
 
51
- ## Support
65
+ ### Support
52
66
 
53
- Ruud van der Ham is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
67
+ Ruud van der Ham, the core developer, is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
54
68
 
55
- ## Getting Started
69
+ ### Getting Started
56
70
 
57
71
  To start using salabim, visit [www.salabim.org](www.salabim.org) for installation instructions and further details.
58
72
 
59
- ## Badges
73
+ ### Badges
60
74
 
61
75
  ![PyPI](https://img.shields.io/pypi/v/salabim) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/salabim) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/salabim)
62
-
63
76
  ![PyPI - License](https://img.shields.io/pypi/l/salabim) ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
64
- ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
77
+ ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
@@ -1,10 +1,8 @@
1
- <img src="https://www.salabim.org/salabim_logo_payoff.png" />
2
-
3
- </br>
1
+ <img src="https://www.salabim.org/salabim_logo_payoff.png" width=400 />
4
2
 
5
3
  Salabim is a Python library for object-oriented discrete event simulation (DES) and animation.
6
4
 
7
- ## Introduction
5
+ ### Introduction
8
6
 
9
7
  Discrete event simulation (DES) finds applications in various logistical domains including production facilities, warehousing, airports, hospitals, mining, materials handling, steel mills, and computer network analysis.
10
8
 
@@ -16,36 +14,51 @@ Salabim follows a well-proven and intuitive process description method similar t
16
14
  - Stores
17
15
  - States
18
16
  - Monitors for data collection and presentation
19
- - 2D and 3D animation (including video production)
17
+ - 2D and 3D animation (including video production) (see below)
20
18
  - Tracing facilities
21
19
  - Advanced statistical sampling
22
20
 
23
21
  In contrast to some other Python DES packages, salabim does not require the use of yield statements for process control, making it more straightforward to use. Salabim has minimal requirements, especially when animation is disabled.
24
22
 
25
- ## Features and documentation
23
+
24
+
25
+ ### Some salabim animations
26
+
27
+ <img src="https://www.salabim.org/cymulation3d.gif" width=700 />
28
+
29
+ <img src="https://www.salabim.org/elevator.gif" width=700 />
30
+
31
+ <img src="https://www.salabim.org/lights-3d.gif" width=700 />
32
+
33
+ ### Features and documentation
26
34
 
27
35
  - Cross-platform support: salabim runs on Windows, macOS, Linux, iOS/iPadOS (Pythonista), and can even be used with "Python In Excel".
28
36
  - Comprehensive documentation: Visit [www.salabim.org/manual](www.salabim.org/manual) for detailed documentation.
29
37
 
30
- ## Contributing and Reporting Issues
38
+ ### Resources
39
+
40
+ The salabim package can be found on GitHub: www.github.com/salabim/salabim
41
+
42
+ And on PyPI: https://pypi.org/project/salabim/
43
+
44
+ ### Contributing and Reporting Issues
31
45
 
32
46
  Contributions to salabim are highly appreciated! You can contribute by issuing a pull request or submitting an issue on [GitHub](https://github.com/salabim/salabim). Alternatively, you can use the [salabim Google user group](https://groups.google.com/g/salabim) for discussions and reporting issues.
33
47
 
34
- ## License
48
+ ### License
35
49
 
36
50
  Salabim is licensed under the MIT License. For details, please refer to the [LICENSE](LICENSE) file.
37
51
 
38
- ## Support
52
+ ### Support
39
53
 
40
- Ruud van der Ham is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
54
+ Ruud van der Ham, the core developer, is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
41
55
 
42
- ## Getting Started
56
+ ### Getting Started
43
57
 
44
58
  To start using salabim, visit [www.salabim.org](www.salabim.org) for installation instructions and further details.
45
59
 
46
- ## Badges
60
+ ### Badges
47
61
 
48
62
  ![PyPI](https://img.shields.io/pypi/v/salabim) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/salabim) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/salabim)
49
-
50
63
  ![PyPI - License](https://img.shields.io/pypi/l/salabim) ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
51
- ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
64
+ ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
@@ -8,7 +8,7 @@ authors = [
8
8
  {name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com"}
9
9
  ]
10
10
  description = "salabim - discrete event simulation in Python"
11
- version = "24.0.4-0"
11
+ version = "24.0.5"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.7"
14
14
  dependencies = [
@@ -27,4 +27,4 @@ Repository = "https://github.com/salabim/salabim"
27
27
  packages = ["salabim"]
28
28
 
29
29
  [tool.setuptools.package-data]
30
- "*" = ["*.ttf", "*.txt"]
30
+ "*" = ["*.ttf", "*.txt"]
@@ -0,0 +1,2 @@
1
+ from .salabim import *
2
+ from .salabim import __version__
@@ -1,13 +1,13 @@
1
- # _ _ _ ____ _ _ ___ _ _
2
- # ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ | || |
3
- # / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | | || |_
4
- # \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ |__ _|
5
- # |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_) |_|
1
+ # _ _ _ ____ _ _ ___ ____
2
+ # ___ __ _ | | __ _ | |__ (_) _ __ ___ |___ \ | || | / _ \ | ___|
3
+ # / __| / _` || | / _` || '_ \ | || '_ ` _ \ __) || || |_ | | | | |___ \
4
+ # \__ \| (_| || || (_| || |_) || || | | | | | / __/ |__ _| _ | |_| | _ ___) |
5
+ # |___/ \__,_||_| \__,_||_.__/ |_||_| |_| |_| |_____| |_| (_) \___/ (_)|____/
6
6
  # discrete event simulation
7
7
  #
8
8
  # see www.salabim.org for more information, the documentation and license information
9
9
 
10
- __version__ = "24.0.4"
10
+ __version__ = "24.0.5"
11
11
 
12
12
  import heapq
13
13
  import random
@@ -581,6 +581,7 @@ class Monitor:
581
581
  name = kwargs.pop("name", None)
582
582
  if kwargs:
583
583
  raise TypeError("merge() got an unexpected keyword argument '" + tuple(kwargs)[0] + "'")
584
+ new_xtype = self.xtype
584
585
 
585
586
  for m in monitors:
586
587
  m._block_stats_only()
@@ -589,9 +590,12 @@ class Monitor:
589
590
  if self._level != m._level:
590
591
  raise TypeError("not possible to mix level monitor with non level monitor")
591
592
  if self.xtype != m.xtype:
592
- raise TypeError("not possible to mix type '" + self.xtype + "' with type '" + m.xtype + "'")
593
+ new_xtype = "any"
593
594
  if self.env != m.env:
594
595
  raise TypeError("not possible to mix environments")
596
+ if m.xtype != new_xtype:
597
+ new_xtype = "any" # to allow mixed xtypes
598
+
595
599
  if name is None:
596
600
  if self.name().endswith(".merged"):
597
601
  # this to avoid multiple .merged (particularly when merging with the + operator)
@@ -599,7 +603,7 @@ class Monitor:
599
603
  else:
600
604
  name = self.name() + ".merged"
601
605
 
602
- new = _SystemMonitor(name=name, type=self.xtype, level=self._level, env=self.env)
606
+ new = _SystemMonitor(name=name, type=new_xtype, level=self._level, env=self.env)
603
607
 
604
608
  merge = [self] + list(monitors)
605
609
 
@@ -3156,7 +3160,9 @@ class Monitor:
3156
3160
  self.cached_xweight[(ex0, force_numeric)] = (t_extra, xweight)
3157
3161
  return xweight
3158
3162
 
3159
- def as_dataframe(self, include_t: bool = True, use_datetime0=False) -> "dataframe":
3163
+ def as_dataframe(
3164
+ self, include_t: bool = True, use_datetime0=False, ex0: bool = False, exoff=False, force_numeric: bool = True, add_now: bool = True
3165
+ ) -> "dataframe":
3160
3166
  """
3161
3167
  makes a pandas dataframe with the x-values and optionally the t-values of the monitors
3162
3168
 
@@ -3188,14 +3194,15 @@ class Monitor:
3188
3194
  import pandas as pd
3189
3195
  except ImportError:
3190
3196
  raise ImportError("Monitor.as_dataframe requires pandas")
3197
+ xs, ts = self.xt(ex0=ex0, exoff=exoff, force_numeric=force_numeric, add_now=add_now)
3191
3198
  if include_t:
3192
3199
  if use_datetime0:
3193
- df = pd.DataFrame({"t": [self.env.t_to_datetime(t) for t in self._t]})
3200
+ df = pd.DataFrame({"t": [self.env.t_to_datetime(t) for t in ts]})
3194
3201
  else:
3195
- df = pd.DataFrame({"t": self._t})
3202
+ df = pd.DataFrame({"t": ts})
3196
3203
  else:
3197
3204
  df = pd.DataFrame()
3198
- df[f"{self.name()}.x"] = self._x
3205
+ df[f"{self.name()}.x"] = xs
3199
3206
 
3200
3207
  return df
3201
3208
 
@@ -13642,7 +13649,7 @@ class Environment:
13642
13649
 
13643
13650
  lastwidth = 0
13644
13651
  for fontsize in range(1, 300):
13645
- f = getfont(font, fontsize)
13652
+ f, heightA = getfont(font, fontsize)
13646
13653
  thiswidth, thisheight = f.getbbox(text)[2:]
13647
13654
  if thiswidth > width:
13648
13655
  break
@@ -23428,7 +23435,7 @@ class Resource:
23428
23435
  else:
23429
23436
  q = quantity
23430
23437
 
23431
- self._claimed_quantity -= q_claimers
23438
+ self._claimed_quantity -= q
23432
23439
  if self._claimed_quantity < 1e-8:
23433
23440
  self._claimed_quantity = 0
23434
23441
  self.claimed_quantity.tally(self._claimed_quantity)
@@ -27086,6 +27093,7 @@ reset()
27086
27093
  set_environment_aliases()
27087
27094
 
27088
27095
  if __name__ == "__main__":
27096
+ sys.path.insert(0, str(Path.cwd() / "misc"))
27089
27097
  try:
27090
27098
  import salabim_exp
27091
27099
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: salabim
3
- Version: 24.0.4.post0
3
+ Version: 24.0.5
4
4
  Summary: salabim - discrete event simulation in Python
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://salabim.org
@@ -11,13 +11,11 @@ Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
 
14
- <img src="https://www.salabim.org/salabim_logo_payoff.png" />
15
-
16
- </br>
14
+ <img src="https://www.salabim.org/salabim_logo_payoff.png" width=400 />
17
15
 
18
16
  Salabim is a Python library for object-oriented discrete event simulation (DES) and animation.
19
17
 
20
- ## Introduction
18
+ ### Introduction
21
19
 
22
20
  Discrete event simulation (DES) finds applications in various logistical domains including production facilities, warehousing, airports, hospitals, mining, materials handling, steel mills, and computer network analysis.
23
21
 
@@ -29,36 +27,51 @@ Salabim follows a well-proven and intuitive process description method similar t
29
27
  - Stores
30
28
  - States
31
29
  - Monitors for data collection and presentation
32
- - 2D and 3D animation (including video production)
30
+ - 2D and 3D animation (including video production) (see below)
33
31
  - Tracing facilities
34
32
  - Advanced statistical sampling
35
33
 
36
34
  In contrast to some other Python DES packages, salabim does not require the use of yield statements for process control, making it more straightforward to use. Salabim has minimal requirements, especially when animation is disabled.
37
35
 
38
- ## Features and documentation
36
+
37
+
38
+ ### Some salabim animations
39
+
40
+ <img src="https://www.salabim.org/cymulation3d.gif" width=700 />
41
+
42
+ <img src="https://www.salabim.org/elevator.gif" width=700 />
43
+
44
+ <img src="https://www.salabim.org/lights-3d.gif" width=700 />
45
+
46
+ ### Features and documentation
39
47
 
40
48
  - Cross-platform support: salabim runs on Windows, macOS, Linux, iOS/iPadOS (Pythonista), and can even be used with "Python In Excel".
41
49
  - Comprehensive documentation: Visit [www.salabim.org/manual](www.salabim.org/manual) for detailed documentation.
42
50
 
43
- ## Contributing and Reporting Issues
51
+ ### Resources
52
+
53
+ The salabim package can be found on GitHub: www.github.com/salabim/salabim
54
+
55
+ And on PyPI: https://pypi.org/project/salabim/
56
+
57
+ ### Contributing and Reporting Issues
44
58
 
45
59
  Contributions to salabim are highly appreciated! You can contribute by issuing a pull request or submitting an issue on [GitHub](https://github.com/salabim/salabim). Alternatively, you can use the [salabim Google user group](https://groups.google.com/g/salabim) for discussions and reporting issues.
46
60
 
47
- ## License
61
+ ### License
48
62
 
49
63
  Salabim is licensed under the MIT License. For details, please refer to the [LICENSE](LICENSE) file.
50
64
 
51
- ## Support
65
+ ### Support
52
66
 
53
- Ruud van der Ham is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
67
+ Ruud van der Ham, the core developer, is available and willing to help users with issues related to the package and modeling in general. He also provides services such as code and model reviews, consultancy, and training.
54
68
 
55
- ## Getting Started
69
+ ### Getting Started
56
70
 
57
71
  To start using salabim, visit [www.salabim.org](www.salabim.org) for installation instructions and further details.
58
72
 
59
- ## Badges
73
+ ### Badges
60
74
 
61
75
  ![PyPI](https://img.shields.io/pypi/v/salabim) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/salabim) ![PyPI - Implementation](https://img.shields.io/pypi/implementation/salabim)
62
-
63
76
  ![PyPI - License](https://img.shields.io/pypi/l/salabim) ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
64
- ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
77
+ ![GitHub last commit](https://img.shields.io/github/last-commit/salabim/salabim)
@@ -2,14 +2,15 @@ README.md
2
2
  pyproject.toml
3
3
  salabim/DejaVuSansMono.ttf
4
4
  salabim/LICENSE.txt
5
+ salabim/__init__.py
5
6
  salabim/calibri.ttf
6
- salabim/changelog.txt
7
7
  salabim/mplus-1m-regular.ttf
8
8
  salabim/salabim.py
9
9
  salabim.egg-info/PKG-INFO
10
10
  salabim.egg-info/SOURCES.txt
11
11
  salabim.egg-info/dependency_links.txt
12
12
  salabim.egg-info/top_level.txt
13
+ tests/test salabim.py
13
14
  tests/test_cap_now.py
14
15
  tests/test_componentgenerator.py
15
16
  tests/test_datetime.py
@@ -18,7 +19,6 @@ tests/test_misc.py
18
19
  tests/test_monitor.py
19
20
  tests/test_process.py
20
21
  tests/test_queue.py
21
- tests/test_salabim.py
22
22
  tests/test_state.py
23
23
  tests/test_store.py
24
24
  tests/test_timeunit.py
@@ -0,0 +1,12 @@
1
+ import pytest
2
+ import os
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ if __name__ == "__main__":
7
+ file_folder = Path(__file__).parent
8
+ top_folder = (file_folder / "..").resolve()
9
+ sys.path.insert(0, str(top_folder))
10
+ os.chdir(file_folder)
11
+
12
+ pytest.main(["-vv", "-s"])
@@ -397,13 +397,13 @@ def test_level_values():
397
397
  class Interrupter(sim.Component):
398
398
  def process(self):
399
399
  self.hold(6)
400
- x0.interrupt()
401
- x1.interrupt()
402
- x2.interrupt()
400
+ for x in (x0,x1,x2):
401
+ if x.isscheduled():
402
+ x.interrupt()
403
403
  self.hold(4)
404
- x0.resume()
405
- x1.resume()
406
- x2.resume()
404
+ for x in (x0,x1,x2):
405
+ if x.isinterrupted():
406
+ x.resume()
407
407
 
408
408
  def status_map(status):
409
409
  return sim.statuses().index(status)
@@ -425,7 +425,7 @@ def test_level_values():
425
425
 
426
426
  env.run(till=50)
427
427
 
428
- assert x1.status.value_duration("requesting") == pytest.approx(10.1)
428
+ assert x1.status.value_duration("requesting") == pytest.approx(14.1)
429
429
 
430
430
  assert x0.mode.xt(force_numeric=None) == (["abc", "ghi", "jkl", "jkl"], array("d", [0.0, 4.3, 18.4, 50.0]))
431
431
  assert x0.status.xt(force_numeric=None) == (