Model-Based Design of a Closed-Loop Speed Controller for a Hybrid System

Model-Based Design (MBD) has been used for decades to design controllers for hybrid systems. MBD requires special considerations when modeling, designing, and analyzing hybrid systems. Hybrid systems are often modeled and simulated in order to tune the controller parameters before testing on target hardware. We present an approach to modeling, design, and analysis of a closed-loop RC car speed controller. We model this system with state-space equations using estimated parameters and tune a discrete PID controller so that an appropriate system response is achieved. With a successful model, we utilize Simulink’s support package for Raspberry Pi to automatically generate and run an executable model on the target hardware. We present and discuss the challenges associated with hybrid system modeling and testing. With varied experiments, we show the modeling challenges associated with hybrid systems and the gap between simulated models and executable models for controlling these systems. We show a successful PID controller in a Simulink simulation followed by unacceptable performance on target hardware caused by the high CPU usage of Simulink’s auto generated code and the strict real-time sampling time requirements of our controller.

The Simulink models are available on GitHub here under an MIT License