1
0
forked from ROMEO/nexosim

Change scheduler interface and add external inputs example.

Relevant for issue #13.
This commit is contained in:
Jaŭhien Piatlicki
2024-07-31 16:01:16 +02:00
parent a6a2c85129
commit 6e3d5bb132
15 changed files with 996 additions and 766 deletions

View File

@ -109,6 +109,8 @@ fn main() {
.add_model(assembly, assembly_mbox, "assembly")
.init(t0);
let scheduler = simu.scheduler();
// ----------
// Simulation.
// ----------
@ -120,13 +122,14 @@ fn main() {
assert!(position.next().is_none());
// Start the motor in 2s with a PPS of 10Hz.
simu.schedule_event(
Duration::from_secs(2),
MotorAssembly::pulse_rate,
10.0,
&assembly_addr,
)
.unwrap();
scheduler
.schedule_event(
Duration::from_secs(2),
MotorAssembly::pulse_rate,
10.0,
&assembly_addr,
)
.unwrap();
// Advance simulation time to two next events.
simu.step();