Salabim

Latest version: v25.0.8

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

Scan your dependencies

Page 12 of 28

21.0.3

==========================
Added functionality (0)
-----------------------
Environment.snapshot() now also supports the .ico image file format.
This may be useful when (mis)using salabim as an icon generator.

Bug fix (0)
----------
Bug in initializing system monitors at init of a component (not setting env to self.env). Fixed.

Bug fix (1)
-----------
When producing videos with blind_animation=True (to allow running without tkinter installed),
the Environment.animation_pre_tick_sys() method was not called prior to saving a frame,
causing problems with animating queues. Fixed.

21.0.2

==========================
Improved functionality (0)
--------------------------
The probabilities parameter of sim.Pdf can now be any iterable, so not just list or tuple.
This can be useful when using the keys or values of a dict as probabilities.

Improved functionality (1)
--------------------------
The spec parameter of sim.Pdf can now be a dict, where the keys are the x-values and the values
are the probabilities. In that case, the probabilities parameter can't be used.
E.g.
d = sim.Pdf({1:10, 2:70, 3:20})
d = sim.Pdf(dict(red=45, yellow=10, green=45))

Change in distribution (0)
--------------------------
The test scripts are now also available on GitHub (in the /test folder).

Bug fix (0)
-----------
Slicing of a merged level monitor didn't work properly, because the attribute start of the merged
monitor was not set correctly. Fixed.

21.0.1

==========================
Bug fix (0)
-----------
Bug in Component._remove() fixed.

21.0.0

==========================
New functionality (0)
---------------------
Added Environment.title()
With this, the title of the canvas window can be set. The title is set to "", the title will be completely suppressed.

Added Environment.show_menu_buttons()
With this, the menu buttons can be hidden

Added parameter title and show_menu_buttons to Environment.animation_parameters

The title of the canvas window now defaults to salabim, instead of tk. This can be overruled with Environment.title()

20.0.6

==========================
New functionality (0)
---------------------
Monitors can now optionally collect statistics only.
This minimizes memory usage as individual tallies will not be stored in that case.
But beware that some important functionality is not available in stats_only monitors (see below).

You can define the stats_only status at creation time of the monitor, like:
m = sim.Monitor('m', stats_only=True)

But, it is also possible to reset a monitor with a different stats_only value.
This can be useful if you want a system monitor, like Component.mode or Component.status to not keep individual
tallied values:
class Car(sim.Component):
def setup(self):
self.mode.reset(stats_only=True)
When stats_only is active, values are always forced to numeric, with a fallback value of 0.

Monitor with stats_only=True support
__call__/get (without arguments), base_name, deregister, duration, duration_zero, maximum, mean,
minimum, monitor, name, number_of_entries, number_of_entries_zero, print_histogram,
print_histograms, print_statistics, register, rename, reset, reset_monitors, sequence_number,
setup, stats_only, std, t, tally, weight, weight_zero

Monitors with stats_only=True do NOT support (these will raise a NotImplementedError):
__call__/get (with an argument), arithmeric operations (+, *, /), animate, bin_duration,
bin_number_of_entries, bin_weight, freeze, histogram_autoscale, median, merge, multiply,
percentile, slice, slicing, to_days, to_hours, to_microseconds, to_milliseconds, to_minutes,
to_seconds, to_time_unit, to_weeks, to_years, tx, value_duration, value_number_of_entries,
value_weight, values, x, xduration, xt, xweight

In line with the above, Queue.reset_monitors, Resource.reset_monitors, State.reset_monitors now
have a stats_only parameter, with which all monitors can set/reset the stats_only status.
So, if you want all eight monitors belonging to a resource, but the requesters' to be stats_only, you can write
r.reset_monitors(stats_only=True)
r.requesters.monitors(stats_only=False)

The current stats_only mode can be queried with Monitor.stats_only() .

New functionality (1)
---------------------
Queue.all_monitors() returns all (2) monitors associated with the queue
Resource.all_monitors() returns all (8) monitors associated with the resource
State.all_monitors() returns all (3) monitors associated with the state

Change of functionality (0)
---------------------------
Monitor.t is no longer a property, but a method. That means that to get the last tally time and value
of monitor m, you can write
last_tally_t = m.t()
last_tally = m() or last_tally = m.get()

Bug fix (0)
-----------
Non-level monitors did not always calculate the ex0=True mean and ex0=True std correctly when weights
other than one were in the monitor. Fixed.

20.0.5

==========================
Added functionality (0)
-----------------------
The methods Component.request() and Component.wait() now also support the urgent and priority parameters, which
make it possible to fine-tune race conditions.

Added functionality (1)
-----------------------
ComponentGenerator can now 'propagate' keyword parameters to the components generated.
In line with this, the name parameter is changed to generator_name, in order to make it possible to
define the name of the generated components.
Example:

import salabim as sim

class Worker(sim.Component):
def process(self, collar):
print(f"I am {self.name()} and I have a {collar} collar")

env = sim.Environment(trace=True)
sim.ComponentGenerator(Worker, "technician generator", iat=sim.Uniform(2,4), name="technician.", collar="blue")
sim.ComponentGenerator(Worker, "manager generator", iat=sim.Uniform(3,6), name="manager.", collar="white")
env.run(10)

Added functionality (2)
-----------------------
sim.Environment() has now an extra parameter, blind_animation that can be used to create videos
without showing the animation during production.
This is particularly useful when running a simulation on a platform where tkinter is not supported,
such a server.
This functionality can also be used to slightly increase the performance of video production.

Example usage:
try:
import tkinter
blind_animation = False
except ImportError:
blind_animation = True
env = sim.Environment(blind_animation = blind_animation)

Improved functionality (0)
--------------------------
Monitor.print_histogram() can now show a user specified collection of values. This can be done by giving
an iterable to the values parameter. If not all values present in the monitor are given, a <rest> value
will be shown at the bottom. Like:
x0.status.print_histogram(values=["scheduled", "current", "passive"])
may result in
Histogram of x.0.status
duration 50

value duration %
scheduled 10.100 20.2 ****************
current 0 0
passive 31.600 63.2 **************************************************
<rest> 8.300 16.6 *************

By default, the values are shown in the given order, but can also be sorted on value by specifying
sort_on_value=True.

Improved functionality (1)
--------------------------
Monitor.print_histogram() with values now supports sorting on weight (=number of entries if
all weights are 1) (for non-level monitors) and sorting on duration (for level monitors).
Therefore, two parameters have been added to print_histogram(): sort_on_weight and sort_on_duration.

So,
x0.status.print_histogram(values=["scheduled", "current", "passive"], sort_on_duration=True)
may result in
Histogram of x.0.status
duration 50

value duration %
passive 31.600 63.2 **************************************************
scheduled 10.100 20.2 ****************
current 0 0
<rest> 8.300 16.6 *************

Improved functionality (2)
--------------------------
Monitor.values() now supports sorting on weight (=number of entries if all weights are 1) (for non-level monitors) and sorting on duration (for level monitors).
Therefore, two parameters have been added to values(): sort_on_weight and sort_on_duration.
So, in the above example,
print(x0.status.values())
may result in
['data', 'interrupted', 'passive', 'scheduled']
, whereas
print(x0.status.values(sort_on_duration))
may result in
['passive', 'scheduled', data', 'interrupted']

Internal change (0)
-------------------
The Component.__del__ now explicitly checks for the existence of an _animation_children attribute to prevent
an error when deleting a component which is not completely initialized yet.

Page 12 of 28

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.