HIL Simulation of a Quarter-Car Suspension Model
Hardware-in-the-Loop (HIL) simulation is a useful development tool when testing the actual physical system is risky, expensive or not an option. In HIL simulation, a model of the physical system is simulated in real time.
In this example, the model of a quarter-car suspension system is discretized and deployed to an Adafruit Metro Mini. A joystick connected to pin A3 of the board will be used to specify the reference road input to the HIL simulation running on the board. Finally, the real-time response of the system will be visualized using data obtained through the device framework.
The free-body diagram of the system.
The model with the as input and , and as outputs.
Discretize the model.
The joystick reads a value from 0V to 4.85V, with the default reading of 2.44V. Rescale the values to get the reference input of unit to 1 unit.
The model of the joystick.
The complete system with the joystick as input and , and as outputs.
The microcontroller specification with the input coming from analog pin A3 and the outputs transmitted over serial.
Deploy the model.
Open a serial connection to the HIL simulation.
Submit a task to read and parse the data.
The results of the HIL simulation.
Remove the task and close the device.