Salabim

Latest version: v24.0.2

Safety actively analyzes 613544 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 24

24.0.2

==========================
Added functionality (0)
-----------------------
Salabim now also supports rounded rectangles, which can result in more pleasing animations.

Therefore, the spec argument (tuple) of sim.AnimateRectangle now has an optional fifth item,
which is the radius of the corners of the rounded rectangle.

The same holds for the rectangle0 and rectangle1 (tuple) paramaters of sim.Animate.

Note that if the radius is too big, the radius will be adjusted.

Changed functionality (0)
-------------------------
Under Pythonista, yieldless is False by default, now.
This can be useful for models which have no active components (and just env.run() statements).

Bug fix (0)
-----------
In version 23.3.12 the naming of components, queues, etc. was changed.
Unfortunately, the role of , and . at the end of the name were swapped.
From this version, the naming/sequence number system works again as intended and documented. So
for i in range(3):
car = Car('Audi.')
print(car.name(), car.sequence_number())
for i in range(3):
car = Car('BMW,')
print(car.name(), car.sequence_number())

will now (again) result in:
Audi.0 0
Audi.1 1
Audi.2 2
BMW.1 1
BMW.2 2
BMW.3 3

Bug fix (1)
-----------
Under PyPy yieldless did not work properly. Fixed.

Clarification (0)
-----------------
The salabim documentation states that models could run much faster under PyPy.
("We have found 6 to 7 times faster execution compared to CPython.")

In practice, the performance gain is much smaller. It is not uncommon that
models run even slower under PyPy!
Therefore, the paragraph about PyPy has been removed from the documentation.

(Inspired by a comment by Luc van den Brink)

Clarification (1)
-----------------
For the alternative UI the package PySimpleGUI is required.
Just recently, PySimpleGUI has changed its license to a more restrictive one.
And for commercial applications, charges apply.
If you want to use the real open-source version (which I recommend), please install
PySimpleGUI with
pip install PySimpleGUI==4.60.5
of course, this version is not maintained any more, but the package is rather stable.

I have also cloned the old PySimpleGUIfile repository to salabim, so you can just
copy pysimplegui.py (the only required file) from that repo to your model folder.

This information is also added to the documentation.

24.0.1

==========================
New functionality (0)
---------------------
The method Environment.ui_granularity has been introduced.
With this, it is possible to set the number of simulation steps that have to be
called before _handle_ui_event is called (again).
This can significantly improve performance during simulation with animation off
and the UI shown.
The ui_granularity is 1 at start-up.
It might require some experimentation to find a suitable value:
- too low might result in slow execution
- too high might result in bad responsiveness


Enhancement (0)
---------------
Component.request() needed to have at least one resource specified.
From now on, the request method also works without any resource (tuple) specified. So
self.request()
is allowed, although it is just a dummy action, like self.hold(0).


Bug fix (0)
-----------
When passing (non-consumed) parameters to the Component.process method, an error was raised in
yieldless mode, so
class X(sim.Component):
def process(self, extra):
print(f"{extra=})
self.hold(1)
x = X(extra="extra")
didn't work properly in yieldless mode.
Fixed.


Bug fix (1)
-----------
In yieldless mode, the line number where a component becomes current,
sometimes incorrectly referred to a line in salabim, instead of the user program. Fixed.


Bug fix (2)
-----------
If ComponentGenerator was used with a spread (i.e. no iat) at a time not being 0,
an error was raised. Fixed.


Bug fix (3)
-----------
With blind_animation mode True, video production didn't work in yieldless mode. Fixed.
(Bug reported by max l)

24.0.0

==========================
Added functionality (0)
-----------------------
The parameter 'interrupted' for Component.hold() has been introduced.
With this it is possible to hold a component, and let it go immediately in interrupted state.
This is very useful to simulate breakdowns, where a component should immediately observe
the breakdown state:
yield self.hold(10, interrupted=machine.mode() == "down")
This functionality would be rather difficult to implement, otherwise.

Note that the parameter 'interrupted' may be also an integer >=1 to denote the interrupt level.


Changed functionality (0)
-------------------------
For stability reasons, Component.interrupt() is from now on only allowed for scheduled components.

Added test (0)
--------------
A common mistake is to test the value of a monitor, like Component.mode or Component.status with
a string or integer.
E.g.
if comp.status == "passive":
...
In this case the test will always fail. Of course it should read:
if comp.status() == "passive":
...

From this version on, testing a monitor against anything else than a monitor will raise
a TypeError.
So, now
if comp.status == "passive":
...
will show:
TypeError: Not allowed to compare Monitor with str . Add parentheses?

23.3.13

===========================
Bug fix (0)
-----------
When calling Component.from_store, the return value was incorrectly None when the request
could be honoured immediately.
Fixed.
(bug reported by Bart van Corven)

Bug fix (1)
-----------
Calling Environment.width() with adjust_x0_x1_y0=True didn't work properly. Fixed.

Bug fix (2)
-----------
Animating an animated gif or webp with AnimateImage(animation_repeat=True) caused a bug. Fixed.

Bug fix (3)
-----------
Calling Resource.release with a non anonymous resource caused an error. Fixed.
(bug reported by Floris Padt)

23.3.12

===========================
Changed functionality (0)
-------------------------
In order to avoid excessive cache size, the sequence number is not cached anymore
for non-serialized names (those that do not end in "." or ",").
To the user that has the effect that calling sequence_number method on non-serialized
components, queues, monitors, resources, environment and states will always return 1.
In practice that means that:
man0 = Man(name="man")
man1 = Man(name="man")
print(man0.sequence_number(), man1.sequence_number())
will now print
1 1
,whereas that used to be
1 2
For
man0 = Man()
man1 = Man()
print(man0.sequence_number(), man1.sequence_number())
the output is still
1 2
Internally, neither the base_name nor the sequence_number are stored anymore
for non-serialized names, which reduces the memory footprint (marginally).

The documentation has been updated reflecting this change.

(inspired by an observation by Floris Padt)

Changed functionality (1)
-------------------------
In AnimateImage, a width of 0, resulted in a ValueError, caused by Pillow.
From now on, a width of 0, is accepted, which can be useful for
dynamic sizing of an image. So,
sim.AnimateImage("my_image.png", width=lambda t: sim.interpolate(t, 0, 10, 1024, 0))
will now result "nothing" after env.t() > 10.

Bug fix (0)
-----------
A bug caused a ValueError when tracing with suppress_trace_linenumbers(True) in yieldless mode. Fixed.
(bug reported by Ben Moverley Smith)

Bug fix (1)
-----------
For some reason, adding audio to a video file didn't work anymore (new version of ffmpeg?).
Fixed by adding the -safe 0 command to the final ffmpeg command.

23.3.11

===========================
Changed functionality (0)
-------------------------
From now on, Monitor.print_statistics and Monitor.print_histogram does not show "no data"
anymore when the number of entries / total weight is zero. This change is made to be
have a more consistent output, which is important when post processing the output string.

In relation to this, histogram_autoscale now also returns 'sensible' values when
there are no entries or the total weight is zero.

Changed functionality (1)
-------------------------
When a component is cancelled, any claimed resources are now automatically released.
This is in line with the termination of a component.
(inspired by Luca Di Gaspero)

Extended functionality (0)
--------------------------
Under Windows, fonts are now also searched in the user/AppData/Local/Microsoft/Windows/Fonts
folder, as fonts are sometimes installed there as well.

Python in Excel functionality (0)
---------------------------------
In Python in Excel, line numbers are now completely suppressed in the trace.

The test for PythonInExcel has been changed (by testing whether __file__ is in globals())
to be compatible with the new runner functionality.

The file salabim.py now contains the line
module = salabim
, to make it compatible with Python in Excel, out of the box.

Bug fix (0)
-----------
A problem with activating a process in yieldless mode fixed.
(Bug reported by bonusguy)

Bug fix (1)
-----------
A bug in Component.cancel() prevented a process to stop correctly in yieldless mode. Fixed.
(Bug reported by Devin Kain)

Bug fix (2)
-----------
A bug in Component.passivate(), Component.standby(), Component.from_store() and Component.to_store()
in yieldless mode.
When called one of these methods were applied on a component that's not current (so not self), the
process of that component stopped incorrectly. E.g.
other_car.passivate()
Fixed.

Documententation updates (0)
----------------------------
The documentation (both html and pdf) have been updated considerably, mainly as a result of
the preparation of the printed user and reference manual.

Availability of printed user and reference manual (0)
-----------------------------------------------------
Now a printed manual is available from your local Amazon site in two formats:

* full colour premium paper hardcover (ISBN 9798867009403)
* full colour standard paper paperback (ISBN 9798865131472)

Please search for "salabim user and reference manual" on your local Amazon site and you can buy it directly there.

Page 1 of 24

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.