Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbayer committed Sep 14, 2020
2 parents e997c75 + 4e780db commit dd929ce
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 70 deletions.
6 changes: 3 additions & 3 deletions Project.toml
@@ -1,7 +1,7 @@
name = "DiscreteEvents"
uuid = "127e53a7-d08a-4bd9-afb0-daf0d2b65a85"
authors = ["Paul Bayer <Paul.Bayer@gleichsam.de>"]
version = "0.3.0"
version = "0.3.1"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand All @@ -12,8 +12,8 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[compat]
DataStructures = "0.17"
Distributions = "0.23"
Unitful = "1.4"
Distributions = "^0.22"
Unitful = "1"
julia = "1"

[extras]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -22,7 +22,7 @@ using DiscreteEvents, Printf, Distributions, Random
function serve(clk::Clock, id::Int, input::Channel, output::Channel, X::Distribution)
job = take!(input)
print(clk, @sprintf("%6.3f: server %d serving customer %d\n", tau(clk), id, job))
delay!(clk, X)
@delay! clk, X
print(clk, @sprintf("%6.3f: server %d finished serving %d\n", tau(clk), id, job))
put!(output, job)
end
Expand All @@ -43,11 +43,11 @@ clock = Clock() # create a clock
input = Channel{Int}(Inf)
output = Channel{Int}(Inf)
for i in 1:3 # start three server processes
process!(clock, Prc(i, serve, i, input, output, Exponential(1/μ)))
@process serve(clock, i, input, output, Exponential(1/μ))
end
# create a repeating event for 10 arrivals
event!(clock, fun(arrive, clock, input, count), every, Exponential(1/λ), n=10)
run!(clock, 20) # run the clock
@event arrive(clock, input, count) every Exponential(1/λ) 10
@run! clock 20 # run the clock
```

If we source this program, it runs a simulation.
Expand Down
66 changes: 66 additions & 0 deletions docs/src/history.md
@@ -1,5 +1,71 @@
# Version history

## v0.3.0

v0.3.0 was a significant improvement over 0.2.0 with a name change,
multi-threading, resource handling and a streamlined documentation.

### Breaking Name Changes

- following the [advice on discourse](https://discourse.julialang.org/t/simulate-v0-2-0-a-julia-package-for-discrete-event-simulation/31822) and in
[issue #13](https://github.com/pbayer/DiscreteEvents.jl/issues/13) `Simulate.jl` was renamed to `DiscreteEvents.jl`. Github maintains and forwards the links.
- there are further renamings to make the API more consistent:
- `Simfunction`[`fun`](@ref), `SF` is no longer defined,
- `SimProcess`[`Prc`](@ref), `SP` is no longer defined,
- `SimEvent`[`DiscreteEvent`](@ref),
- `SimCond`[`DiscreteCond`](@ref),
- `sample!`[`periodic!`](@ref), was a name collision with `Distributions.jl`.
- `reset!`[`resetClock!`](@ref), was a name collision with `DataStructures.jl`

### Streamlined Documentation

- 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](https://github.com/pbayer/DiscreteEventsCompanion.jl).

### New Functionality in v0.3.0

- [`Action`](@ref) is introduced as synonym for `Union{Function,Expr,Tuple}`,
- thereby in addition to [`fun`](@ref), you can now schedule arbitrary function closures as events,
- [`periodic!`](@ref) takes an `Action` as argument,
- you can pass also symbols, expressions or other `fun`s or function closures as arguments to [`fun`](@ref). They get evaluated at event time before being passed to the event function,
- [`DiscreteEvents.version`](@ref) gives now the package version,
- `DiscreteEvents.jl` is now much faster due to optimizations,
- [`onthread`](@ref) allows simulations with asynchronous tasks (processes and actors) to run much faster on threads other than 1,
- [`Resource`](@ref) provides an API for modeling limited resources,
- you can now create a real time clock [`RTClock`](@ref) and schedule events to it (experimental),
- actors can register their message channels to the `clock.channels` vector and the clock will not proceed before they are empty,
- processes and actors (asynchronous tasks) can transfer IO-operations to the clock with [`now!`](@ref) or print directly via the clock,
- `event!` and `delay!` now also accept stochastic time variables (a `Distribution`),
- there is a `n` keyword parameter for the number of repeat `event!`s,
- you can seed the thread-specific RNGs with [`pseed!`](@ref).

### Multi-Threading (Experimental)

- The data structure of [`Clock`](@ref) has been changed, it now has a field `ac` providing channels to parallel clocks,
- [`PClock`](@ref) sets up a clock with parallel active clocks on each available thread,
- with [`pclock`](@ref) all parallel clocks can be accessed and referenced,
- [`process!`](@ref) can now start tasks on parallel threads,
- [`event!`](@ref) can now schedule events for execution on parallel threads,
- [`periodic!`](@ref) can now register sampling functions or expressions to parallel clocks,
- if setup with parallel clocks, [`Clock`](@ref) becomes the master to drive them and synchronize with them at each `Δt` time step,

### Other Breaking Changes in v0.3.0

- `τ` as an alias for [`tau`](@ref) is no longer defined.
- The macros `@tau`, `@val`, `@SF`, `@SP` are no longer defined.
- Logging functions have been removed (they were not useful enough).
- A function `f` given to [`Prc`](@ref) must now take a
[`Clock`](@ref)-variable as its first argument.
- The first `::Clock`-argument to [`delay!`](@ref) and [`wait!`](@ref) and [`now!`](@ref) can no longer be omitted. Since the task function has now a `Clock`-variable available (see above), it must provide it to `delay!`, `wait!` and `now`.
- [`event!`](@ref) no longer accepts a `Vector` as argument.
- `Clk` as alias of [`𝐶`](@ref) is no longer provided.
- [`event!`](@ref) now returns nothing.
- [`event!`](@ref) and [`periodic!`](@ref) now doesn't take anymore the scope as an argument. Symbols or expressions given to them or included in `fun`s are only evaluated in `Main` scope: this feature therefore can be used only by end users but not by any packages using `DiscreteEvents.jl`.

### Deprecated functionality in v0.3.0

- 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.)

## v0.2.0

This is the first version fully supporting three modeling schemes: events, processes and sampling.
Expand Down
70 changes: 7 additions & 63 deletions docs/src/news.md
@@ -1,72 +1,16 @@
# News in v0.3.0
# News in v0.3.1

```@meta
CurrentModule = DiscreteEvents
```

v0.3.0 is a significant improvement over 0.2.0 with a name change,
multi-threading, resource handling and a streamlined documentation.
A few days after the release of v0.3.0 Hector Perez created some macros facilitating the use of `DiscreteEvents` for most use cases:

## Breaking Name Changes

- following the [advice on discourse](https://discourse.julialang.org/t/simulate-v0-2-0-a-julia-package-for-discrete-event-simulation/31822) and in
[issue #13](https://github.com/pbayer/DiscreteEvents.jl/issues/13) `Simulate.jl` was renamed to `DiscreteEvents.jl`. Github maintains and forwards the links.
- there are further renamings to make the API more consistent:
- `Simfunction`[`fun`](@ref), `SF` is no longer defined,
- `SimProcess`[`Prc`](@ref), `SP` is no longer defined,
- `SimEvent`[`DiscreteEvent`](@ref),
- `SimCond`[`DiscreteCond`](@ref),
- `sample!`[`periodic!`](@ref), was a name collision with `Distributions.jl`.
- `reset!`[`resetClock!`](@ref), was a name collision with `DataStructures.jl`

## Streamlined Documentation

- 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](https://github.com/pbayer/DiscreteEventsCompanion.jl).

## New Functionality in v0.3.0

- [`Action`](@ref) is introduced as synonym for `Union{Function,Expr,Tuple}`,
- thereby in addition to [`fun`](@ref), you can now schedule arbitrary function closures as events,
- [`periodic!`](@ref) takes an `Action` as argument,
- you can pass also symbols, expressions or other `fun`s or function closures as arguments to [`fun`](@ref). They get evaluated at event time before being passed to the event function,
- [`DiscreteEvents.version`](@ref) gives now the package version,
- `DiscreteEvents.jl` is now much faster due to optimizations,
- [`onthread`](@ref) allows simulations with asynchronous tasks (processes and actors) to run much faster on threads other than 1,
- [`Resource`](@ref) provides an API for modeling limited resources,
- you can now create a real time clock [`RTClock`](@ref) and schedule events to it (experimental),
- actors can register their message channels to the `clock.channels` vector and the clock will not proceed before they are empty,
- processes and actors (asynchronous tasks) can transfer IO-operations to the clock with [`now!`](@ref) or print directly via the clock,
- `event!` and `delay!` now also accept stochastic time variables (a `Distribution`),
- there is a `n` keyword parameter for the number of repeat `event!`s,
- you can seed the thread-specific RNGs with [`pseed!`](@ref).

### Multi-Threading (Experimental)

- The data structure of [`Clock`](@ref) has been changed, it now has a field `ac` providing channels to parallel clocks,
- [`PClock`](@ref) sets up a clock with parallel active clocks on each available thread,
- with [`pclock`](@ref) all parallel clocks can be accessed and referenced,
- [`process!`](@ref) can now start tasks on parallel threads,
- [`event!`](@ref) can now schedule events for execution on parallel threads,
- [`periodic!`](@ref) can now register sampling functions or expressions to parallel clocks,
- if setup with parallel clocks, [`Clock`](@ref) becomes the master to drive them and synchronize with them at each `Δt` time step,

## Other Breaking Changes in v0.3.0

- `τ` as an alias for [`tau`](@ref) is no longer defined.
- The macros `@tau`, `@val`, `@SF`, `@SP` are no longer defined.
- Logging functions have been removed (they were not useful enough).
- A function `f` given to [`Prc`](@ref) must now take a
[`Clock`](@ref)-variable as its first argument.
- The first `::Clock`-argument to [`delay!`](@ref) and [`wait!`](@ref) and [`now!`](@ref) can no longer be omitted. Since the task function has now a `Clock`-variable available (see above), it must provide it to `delay!`, `wait!` and `now`.
- [`event!`](@ref) no longer accepts a `Vector` as argument.
- `Clk` as alias of [`𝐶`](@ref) is no longer provided.
- [`event!`](@ref) now returns nothing.
- [`event!`](@ref) and [`periodic!`](@ref) now doesn't take anymore the scope as an argument. Symbols or expressions given to them or included in `fun`s are only evaluated in `Main` scope: this feature therefore can be used only by end users but not by any packages using `DiscreteEvents.jl`.

## Deprecated functionality in v0.3.0

- 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.)
- [`@event`](@ref):
- [`@process`](@ref):
- [`@delay`](@ref):
- [`@wait`](@ref):
- [`@run`](@ref):

## Earlier releases

Expand Down

0 comments on commit dd929ce

Please sign in to comment.