Running simulations and analyzing data

After running a simulation with SimpleMotorController, we gather an initial simulation log. A simulation log will be saved in JSON form thanks to the handy SerDe library. There should be an initial elevator specification, followed by an elevator state, for each iteration of the simulator. The simulation.log will end up looking something like the following:

{"floor_count":5,"floor_height":5.67,"carriage_weight":120000.0}[{"timestamp":0.001288587,"location":0.0,"velocity":0.0,"acceleration":0.0,"motor_input":{"Up":{"voltage":147000.0}}},2][{"timestamp":0.002877568,"location":0.0,"velocity":0.0,"acceleration":0.0002577174000002458,"motor_input":{"Up":{"voltage":147003.86576100003}}},2][{"timestamp":0.004389254,"location":0.0,"velocity":3.8958778553677168e-7,"acceleration":0.000575513599999411,"motor_input":{"Up":{"voltage":147008.632704}}},2] ...

Get Hands-On Functional Programming in Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.