Skip to content

Commit d0f9441

Browse files
committed
Update README
1 parent d474c3d commit d0f9441

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,38 @@ julia> Pkg.add("SimJulia")
4242
* Scheduling is based on TimeType and Period.
4343
* The discrete event features are on par with version 0.3. (STABLE)
4444
* Two ways of making `Processes` are provided:
45-
- using the existing concept of `Tasks`: previous behaviour
46-
- using a novel finite-statemachine approach: a lot faster but less transparent for the end user
45+
- using the existing concept of `Tasks`:
46+
```
47+
function fibonnaci(sim::Simulation)
48+
a = 0.0
49+
b = 1.0
50+
while true
51+
println(now(sim), ": ", a)
52+
yield(Timeout(sim, 1))
53+
a, b = b, a+b
54+
end
55+
end
56+
57+
sim = Simulation()
58+
@Process fibonnaci(sim)
59+
run(sim, 10)
60+
```
61+
- using a novel finite-statemachine approach:
62+
```
63+
@stateful function fibonnaci(sim::Simulation)
64+
a = 0.0
65+
b = 1.0
66+
while true
67+
println(now(sim), ": ", a)
68+
@yield return Timeout(sim, 1)
69+
a, b = b, a+b
70+
end
71+
end
72+
73+
sim = Simulation()
74+
@Coroutine fibonnaci(sim)
75+
run(sim, 10)
76+
```
4777
* The continuous time simulation is based on a quantized state system solver. (EXPERIMENTAL)
4878
* Documentation is automated with [Documenter.jl](https://github.com/JuliaDocs/Documenter.jl).
4979

0 commit comments

Comments
 (0)