demo/gearbox.rb in driving_physics-0.0.1.1 vs demo/gearbox.rb in driving_physics-0.0.1.2
- old
+ new
@@ -19,10 +19,13 @@
# rotational kinematics
alpha = 0.0
omega = 0.0
theta = 0.0
+start = Timer.now
+paused = 0
+
(duration * env.hz + 1).times { |i|
# just for info, not used in the simulation
friction = gearbox.spinner.rotating_friction(omega)
# update rotational kinematics
@@ -36,12 +39,14 @@
# periodic output
if i < 10 or
(i < 100 and i % 10 == 0) or
(i < 1000 and i % 100 == 0) or
i % 1000 == 0
- puts DrivingPhysics.elapsed_display(i)
+ puts Timer.display(i)
puts format("RPM %d Torque: %.3f Nm (%d Nm) Friction: %.3f Nm",
DrivingPhysics.rpm(omega), net_torque, torque, friction)
puts format("%.1f rad %.1f rad/s %.1f rad/s/s", theta, omega, alpha)
puts
end
}
+
+puts Timer.summary(start, num_ticks, paused)