A pack of control system algorithms implemented in C to be used in embedded systems. In this project, MATLAB is used as simulation platform.
Pull-requests are welcome. If you find such implementations useful, feel free to submit a feature request and I'll try to provide more sample implementations (LQR, LQG, sliding-mode, etc.).
Please make sure that you have the latest version of MinGW installed in MATLAB so you can compile the C codes inside MATLAB.
Header file prototype.h is used as an interface between SIMULINK and C codes.
MRAC controller based on MIT rule structure. References and controller topology can be found at:
This is a classic controller based on the old topology can be found here:
Both FGS and MRAC topologies utilize an internal PID as well. In this project a tuning based on Ziegler–Nichols method is shown. Please pay enough attention to the sampling time and how it should be utilized in the tuning variable Tu.
Both MATLAB and C implementation of the controller are provided here based on the recent publications and most optimized topologies. A multi-order profile generator is needed for this controller. Currently an open-source one is used. I will add optimized multi-order profile generators as well.
- Modeling and Simulation of a Single Gain Tuning ADRC Controller in Matlab/Simulink
- Advanced Setpoints for Motion Systems
Since high-pass (washout), low-pass, band-pass and band-stop (notch) filters are commonly used in embedded systems, all simple implementations based on second-order transfer functions are provided and the formulation can be found here.
A filtered derivative is commonly used in PIDF structure. Instead of using a two-state differentiation and putting a first-order low-pass, use a native second-order low-pass differentiator.
Also a lead-lag controller/filter is provided based on the common theories.