1
0
forked from ROMEO/nexosim

Remove println from examples

This commit is contained in:
Jaŭhien Piatlicki 2024-11-08 14:14:58 +01:00
parent 1a0dff0f6e
commit 1af4de1832

View File

@ -56,15 +56,8 @@ impl Motor {
/// For the sake of simplicity, we do as if the rotor rotates
/// instantaneously. If the current is too weak to overcome the load or when
/// attempting to move to an opposite phase, the position remains unchanged.
pub async fn current_in(&mut self, current: (f64, f64), context: &Context<Self>) {
pub async fn current_in(&mut self, current: (f64, f64)) {
assert!(!current.0.is_nan() && !current.1.is_nan());
println!(
"Model instance {} at time {}: setting currents: {:.2} and {:.2}",
context.name(),
context.scheduler.time(),
current.0,
current.1
);
let (target_phase, abs_current) = match (current.0 != 0.0, current.1 != 0.0) {
(false, false) => return,
@ -88,16 +81,9 @@ impl Motor {
}
/// Torque applied by the load [N·m] -- input port.
pub fn load(&mut self, torque: f64, context: &Context<Self>) {
pub fn load(&mut self, torque: f64) {
assert!(torque >= 0.0);
println!(
"Model instance {} at time {}: setting load: {:.2}",
context.name(),
context.scheduler.time(),
torque
);
self.torque = torque;
}
}
@ -141,13 +127,6 @@ impl Driver {
/// Pulse rate (sign = direction) [Hz] -- input port.
pub async fn pulse_rate(&mut self, pps: f64, context: &Context<Self>) {
println!(
"Model instance {} at time {}: setting pps: {:.2}",
context.name(),
context.scheduler.time(),
pps
);
let pps = pps.signum() * pps.abs().clamp(Self::MIN_PPS, Self::MAX_PPS);
if pps == self.pps {
return;
@ -172,12 +151,6 @@ impl Driver {
_: (),
context: &'a Context<Self>,
) -> impl Future<Output = ()> + Send + 'a {
println!(
"Model instance {} at time {}: sending pulse",
context.name(),
context.scheduler.time()
);
async move {
let current_out = match self.next_phase {
0 => (self.current, 0.0),