=========================
Introduced a new process control method: wait.
This functionality is similar but not equal to the waitevent and queueevent
methods in SimPy2.
The method allows a process to wait for a any if all of (number of) certain
value(s) of a so called state.
A state has a value and each time this value change, all components waiting for
this state are checked.
The class State has a number of methods, which allow to control the state:
set(value) sets the value. Normally used without argument, in which
case True will be used.
reset() resets the value to False=
trigger(value) sets the value (default True), triggers any components waiting,
and then immediately resets to a given value (default False).
optionally, the number of components to be honored with the trigger
value may be limited (if used, most like 1).
The current value of a state can be retrieved with
get() or by directly calling the state.
So, e.g. dooropen.get() or dooropen()
On top of that, the queue of waiters may be accessed with
State.waiters()
And there is a monitor to register the the value over time, called State.value .
.
The waiters queue and value will be monitored by default.
Components can wait for a certain value of a state (or states) by
yield self.wait(dooropen)
or
yield self.wait((dooropen,False))
And for several states at one time:
yield self.wait(frontdooropen,backdooropen) to test for fontdooropen OR backdooropen
or
yield self.wait(dooropen,lighton,all=True) to test for dooropen AND lighton
It is also possible to check for several values of one state:
yield self.wait((light,'green'),(light,'yellow')) tests for lighth is green of yellow
The method wait can have an optional timeout parameter.
If they are timed out, Component.fail() is True.
If a component is in a wait state, the status waiting will be returned.
In order to test for this state, use either
c.state() == waiting
or
c.iswaiting()
See the example script demo wait.py for a demonstration of the trigger and time out functionality.
Deprecated functionality:
In method Component.request(), it is no longer allowed to specify
greedy behaviour. Also strict_order is not anymore supported.
The reason for this is its limited use and stability.
Technical note: The process of honouring requests is now optimized by keeping track of
the minimal requested quantity for each resource.
Method request_failed() changed to failed().
This method now also refers to fails of wait.
For Monitor and MonitorTimestamp, the tallied values are now converted to a numeric
equivalent, if not yet int/float. Values of type bool are converted to 0 for False and
1 for True (as usual).
For all other types a conversion to int/float is tried. If that's not possible,
0 is used.
So after
m=sim.Monitor(name='m')
m.tally(2)
m.tally(True)
m.tally('12')
m.tally('red')
m.x() is array([2,1,12,0])
This automatic conversion is used in all monitor methods, apart from getting the
current value.
So, after the above code,
m() will return 'red'
The unprocessed values are available in the lists
Monitor._x
end
MonitorTimestamp._x (along with the coresponding MonitorTimestamp._t)
So, after the above code m._x is (2,True,'12','red') .
The __repr__ methods of Environment, Queue, Component, Monitor, Resource and the
distributions, now return
Environment(name), Queue(name), ...
E.g. now
q=sim.Queue('visitors')
print(q)
returns
Queue(visitors)
Getting information about one of the above class instances is now provided by
the method print_info (formerly available via __repr__).
E.g.
q=sim.Queue('visitors')
print(q)
prints something like
Queue 0x26e8e78ada0
name=visitors
no components
The default random stream when initializing Environment is now 1234567. If a
purely, not reproducable, stream by by specifying Environment(random_seed=None)
or sim.random_seed(None).
If you don't want any action when calling Environment (thats usually for
subsequent run) (cf. Elevator animated.py specify the null string, so
Environment(random_seed='')
All sample models have been updated to reflect this change, i.e. no more
random_seed=1234567 in the call to Environment, there.
Convention change:
Instead of naming the default environment de, from now env is prefered.
All sample models have been updated accordingly.
Documentation change only:
Package numpy is required.
The order of components in Queue.union() and Queue.intersect() is now specified.
Packaging remarks:
Release notes.txt is now called changelog.txt, to be more in line with PyPI standards.
salabim is now on PyPI. So now you can install salabim also with pip install salabim!