Mathworks' Simulink / Realtime Workshop


Thread Starter

Brett Haas

Anyone successfully integrated Mathworks' Simulink and Realtime Workshop (auto C code generator) into a control system using PID control? Curious how/if anti-windup unctionality for the Ki gain term was implemented?

Brett Haas

Gerrit M. van der Molen

Haven't used Realtime Workshop myself, but I presume it would code anything you modelled in Simulink over into C-code. Since the standard Simulink PID-block does not include anti-windup, you will not be able to use that. Instead, you will have to build your own PID controller from basic principles: either separate P and I (and D if required) terms, with anti-windup on the I-term, or an industrial controller-type PID-controller (with all two PI or three PID terms 'integrated').

Have you checked whether there is anything on the Matlab users forum? See the link to 'comp.soft-sys.matlab' on the MathWorks web-site:

Gerrit M. van der Molen
Industrial Systems and Control Ltd., 50 George Street, Glasgow G1 1QE, UK
Tel: (+44) (0)141-553 1111 Email: [email protected]
Fax: (+44) (0)141-553 1232 WWW:

Edgar Hilton

I implemented an anti-windup scheme in RTiC-Lab ( You can download the software, cd to the examples directory, and take a look at the "Five PID" example, at the file: user_controller.c, function PID(). I hope this helps.

By the way, the software is free and runs on RTLinux.. :)