1
0
forked from ROMEO/nexosim

21 Commits

Author SHA1 Message Date
Serge Barral
0f1d876aed Return both simulation and scheduler at init 2024-11-15 16:52:24 +01:00
Serge Barral
f4686af49a Finalize the Context and BuildContext API
The API style is now more uniform: both are passed by mutable ref, and
only expose accessors. Additionally, the methods that were initially
accessed through the scheduler field are now directly implemented on
`Context`.
2024-11-15 16:12:07 +01:00
Serge Barral
b5aea810ae Merge step_by and step_until into a unique method
Now that `step_by` returns an error anyway (it was unfaillible before),
there is no more incentive to keep it as a separate method.
The `step_until` method now accepts an `impl Deadline`, which covers
both cases (`Duration` and `MonotonicTime`).
2024-11-14 17:01:33 +01:00
Jaŭhien Piatlicki
1af4de1832 Remove println from examples 2024-11-13 23:59:50 +01:00
Serge Barral
ba1e668447 Report panics as errors + identify panicking model
The build context is now passed as a mutable reference due to the need
to mutate data when adding a model.

Contains small unrelated cleanups and documentation improvements too.
2024-11-13 19:40:58 +01:00
Serge Barral
039fefad47 Introduce ProtoModel trait, remove Model::setup
The external_input example has been as well adapted and (at least
temporarily) simplifiedi/modified to remove the dependencies on
`atomic_wait` and `mio`.
2024-11-05 16:16:42 +01:00
Serge Barral
1cfaa00f9e Make execution failible, impl deadlock detection
TODO: return the list of models involved in a deadlock.

Note that Many execution errors are not implemented at all at the
moment and will need separate PRs, namely:
- Terminated
- ModelError
- Panic
2024-10-20 12:35:44 +02:00
Serge Barral
2a8a3738cb Use better supported UTF symbols for arrow heads 2024-09-08 17:38:58 +02:00
Jaŭhien Piatlicki
3b4a3e9b0e More idiomatic loop 2024-08-02 16:19:36 +02:00
Jaŭhien Piatlicki
5d61abd729 Fix method visibility 2024-08-02 16:13:21 +02:00
Jaŭhien Piatlicki
6e3d5bb132 Change scheduler interface and add external inputs example.
Relevant for issue #13.
2024-08-02 14:06:49 +02:00
Jaŭhien Piatlicki
195bcdceba Add instance name to model contexts 2024-05-10 14:32:07 +02:00
Jaŭhien Piatlicki
0734dc2fac Implement clonable outputs and add submodels example 2024-04-29 21:00:12 +02:00
Jaŭhien Piatlicki
7526ffbcea Add setup step. 2024-04-26 11:48:11 +02:00
Serge Barral
e84e802f09 Initial (g)RPC implementation 2024-04-25 11:12:54 +02:00
Serge Barral
1be2f48a00 Revert "Merge pull request #12 from asynchronics/feature/event-sinks"
This reverts commit 7e881afb638ccc0dbcfc7b539fc152dc923d63e1, reversing
changes made to 9d78e4f72a4c6ff459fc386b2f25beae40b94429.
2024-03-06 16:16:55 +01:00
Serge Barral
863f995f1b Small changes and cleanups to prepare the RPC work 2024-02-19 13:20:02 +01:00
Serge Barral
22516fe190 Overload schedule_*event methods
The `schedule_*event_in` and `schedule_*event_at` pairs of methods are
each merged into a single overloaded method accepting either a relative
`Duration`or an absolute `MonotonicTime`.
2023-08-14 15:47:08 +02:00
Serge Barral
b0f7e69039 Implement periodic events 2023-07-28 16:18:10 +02:00
Serge Barral
f458377308 Make it possible to cancel current-time events
This is a pretty large patch that impacts the API.

Until now, it was not possible to cancel events that were scheduled for
the current simulation time slice, making it necessary for the user to
use complex workarounds (see former version of the espresso machine
example).

The new implementation makes this possible but the generation of a key
associated to an event has now a non-negligible cost (basicaly it
creates three references to an Arc). For this reason, the API now
defaults to NOT creating a key, and new methods were added for
situations when the event may need to be cancelled and a key is
necessary.

See the much simplified implementation of the espresso machine example
for a motivating case.
2023-07-21 14:23:20 +02:00
Serge Barral
31520d461a First release candidate for v0.1.0 2023-01-16 23:05:46 +01:00