1
0
forked from ROMEO/nexosim

Return both simulation and scheduler at init

This commit is contained in:
Serge Barral
2024-11-15 16:52:24 +01:00
parent f4686af49a
commit 0f1d876aed
20 changed files with 101 additions and 86 deletions

View File

@ -133,12 +133,10 @@ fn main() -> Result<(), SimulationError> {
let t0 = MonotonicTime::EPOCH;
// Assembly and initialization.
let mut simu = SimInit::new()
let (mut simu, scheduler) = SimInit::new()
.add_model(assembly, assembly_mbox, "assembly")
.init(t0)?;
let scheduler = simu.scheduler();
// ----------
// Simulation.
// ----------

View File

@ -366,14 +366,12 @@ fn main() -> Result<(), SimulationError> {
let t0 = MonotonicTime::EPOCH;
// Assembly and initialization.
let mut simu = SimInit::new()
let (mut simu, scheduler) = SimInit::new()
.add_model(controller, controller_mbox, "controller")
.add_model(pump, pump_mbox, "pump")
.add_model(tank, tank_mbox, "tank")
.init(t0)?;
let scheduler = simu.scheduler();
// ----------
// Simulation.
// ----------

View File

@ -210,7 +210,8 @@ fn main() -> Result<(), SimulationError> {
let mut simu = SimInit::new()
.add_model(listener, listener_mbox, "listener")
.set_clock(AutoSystemClock::new())
.init(t0)?;
.init(t0)?
.0;
// ----------
// Simulation.

View File

@ -144,7 +144,8 @@ fn main() -> Result<(), SimulationError> {
.add_model(load1, load1_mbox, "load1")
.add_model(load2, load2_mbox, "load2")
.add_model(load3, load3_mbox, "load3")
.init(t0)?;
.init(t0)?
.0;
// ----------
// Simulation.

View File

@ -206,13 +206,11 @@ fn main() -> Result<(), asynchronix::simulation::SimulationError> {
let t0 = MonotonicTime::EPOCH;
// Assembly and initialization.
let mut simu = SimInit::new()
let (mut simu, scheduler) = SimInit::new()
.add_model(driver, driver_mbox, "driver")
.add_model(motor, motor_mbox, "motor")
.init(t0)?;
let scheduler = simu.scheduler();
// ----------
// Simulation.
// ----------