(released 2023-02-23)
- updated compat
- removed multi-threading (parallel clocks) from export and docs
(released 2020-09-16) A few days after the release of v0.3.0 Hector Perez contributed some macros to make the DiscreteEvents API more Julian for common cases:
@event: wrapsfunandevent!into one call,@periodic: wrapsfunandperiodic!into one call,@process: wrapsPrcandprocess!into one call,@wait: simplified call ofwait!,
The following macros provide syntactic sugar to existing functions:
@delay: callsdelay!,@run!: callsrun!.
(released 2020-09-11) v0.3.0 was a significant improvement over 0.2.0 with a name change, multi-threading, resource handling and a streamlined documentation (announcement on Julia discourse).
- following the advice on discourse and in
issue #13
Simulate.jlwas renamed toDiscreteEvents.jl. Github maintains and forwards the links. - there are further renamings to make the API more consistent:
Simfunction→fun,SFis no longer defined,SimProcess→Prc,SPis no longer defined,SimEvent→DiscreteEvent,SimCond→DiscreteCond,sample!→periodic!, was a name collision withDistributions.jl.reset!→resetClock!, was a name collision withDataStructures.jl
- the documentation has been reduced to minimal introductory examples and API documentation,
- everything else (explanations, further examples, notebooks, benchmarks) has been moved to a companion site: DiscreteEventsCompanion.
Actionis introduced as synonym forUnion{Function,Expr,Tuple},- thereby in addition to
fun, you can now schedule arbitrary function closures as events, periodic!takes anActionas argument,- you can pass also symbols, expressions or other
funs or function closures as arguments tofun. They get evaluated at event time before being passed to the event function, DiscreteEvents.versiongives now the package version,DiscreteEvents.jlis now much faster due to optimizations,onthreadallows simulations with asynchronous tasks (processes and actors) to run much faster on threads other than 1,Resourceprovides an API for modeling limited resources,- you can now create a real time clock
RTClockand schedule events to it (experimental), - actors can register their message channels to the
clock.channelsvector and the clock will not proceed before they are empty, - processes and actors (asynchronous tasks) can transfer IO-operations to the clock with
now!or print directly via the clock, event!anddelay!now also accept stochastic time variables (aDistribution),- there is a
nkeyword parameter for the number of repeatevent!s, - you can seed the thread-specific RNGs with
pseed!.
- The data structure of
Clockhas been changed, it now has a fieldacproviding channels to parallel clocks, PClocksets up a clock with parallel active clocks on each available thread,- with
pclockall parallel clocks can be accessed and referenced, process!can now start tasks on parallel threads,event!can now schedule events for execution on parallel threads,periodic!can now register sampling functions or expressions to parallel clocks,- if setup with parallel clocks,
Clockbecomes the master to drive them and synchronize with them at eachΔttime step,
τas an alias fortauis no longer defined.- The macros
@tau,@val,@SF,@SPare no longer defined. - Logging functions have been removed (they were not useful enough).
- A function
fgiven toPrcmust now take aClock-variable as its first argument. - The first
::Clock-argument todelay!andwait!andnow!can no longer be omitted. Since the task function has now aClock-variable available (see above), it must provide it todelay!,wait!andnow. event!no longer accepts aVectoras argument.Clkas alias of𝐶is no longer provided.event!now returns nothing.event!andperiodic!now doesn't take anymore the scope as an argument. Symbols or expressions given to them or included infuns are only evaluated inMainscope: this feature therefore can be used only by end users but not by any packages usingDiscreteEvents.jl.
- Evaluating expressions or symbols at global scope is much slower than using functions and gives now a one time warning. This functionality may be removed entirely in a future version. (Please write an issue if you want to keep it.)