The QUARC library for Simulink removes the low-level programming barriers that traditionally slow down hardware implementation. By treating real-time hardware targets as natural extensions of the Simulink workspace, it allows engineers to focus strictly on algorithm design, system identification, and safety validation. Whether you are controlling a 6-DOF robotic arm, stabilizing an unmanned aerial vehicle, or teaching control theory fundamentals, QUARC provides the high-fidelity link required to turn simulated models into physical reality.
: Develop once and deploy to various operating systems (Windows, Linux, QNX) by simply changing the target configuration.
The QUARC library is an extension for MathWorks Simulink that provides specialized blocks for connecting Simulink models to hardware. Unlike standard Simulink libraries, which are often used for simulation only, the QUARC library generates real-time C-code that runs on a target computer (such as a Windows PC or an embedded device). Core Functionalities
. This library provides specialized blocks that extend standard Simulink capabilities for hardware-in-the-loop (HIL) testing and real-time communication. Data Acquisition (DAQ):
Always place this at the top level of your model to define your hardware parameters globally. quarc library simulink
: If needed, run the following command in the MATLAB Command Window to add QUARC to the path: quarc_setup Use code with caution. Copied to clipboard Opening the Library : You can access the blockset via the Simulink Library Browser or by entering qc_open_library('quarc_library') in the command window.
Click the (or Build Model ) button. QUARC will compile the diagram into a C binary, download it to the target real-time engine, and execute it.
The adds specialized blocks to your Simulink Library Browser including:
| Feature | QUARC | Simulink Desktop RT | Speedgoat | RTAI/Linux | |---------|-------|---------------------|-----------|-------------| | | ✅ (1 kHz+) | ❌ (soft, ~1 ms jitter) | ✅ | ✅ | | Simulink integration | Excellent | Good | Excellent | Poor (manual) | | Cost | High | Free (with MATLAB) | Very high | Free (open source) | | Hardware support | Quanser-centric | Limited (sound card, serial) | Wide (I/O modules) | Generic | | Ease of use | Moderate | Easy | Moderate | Difficult | The QUARC library for Simulink removes the low-level
QUARC eliminates the complexity of network programming with stream-based communication blocks that support multiple protocols (TCP/IP, UDP, Serial, Shared Memory, Bluetooth, and SPI/I2C):
Ultimate Guide to the QUARC Library in Simulink: Real-Time Control Made Easy
Mastering the QUARC Library in Simulink: A Complete Guide for Real-Time Control
When you open the Simulink Library Browser after installing QUARC, you will find a dedicated library. This library is organized into functional categories that handle everything from hardware interfacing to communication protocols. 1. Hardware-in-the-Loop (HIL) API Blocks : Develop once and deploy to various operating
The real-time constraints (e.g., avoiding infinite loops, stack overruns) can trip users new to hard real-time systems.
Built-in support for TCP/IP, UDP, Serial (RS-232/RS-485), Shared Memory (for ultra-fast communication between two models on the same PC), and SPI/I2C for microcontrollers.
Reads inputs from standard USB controllers or flight sticks to command robotic systems in real-time.
Double-click the block and select your specific DAQ board from the board type dropdown list.
: Create your controller using standard Simulink blocks.
Select (e.g., Windows Real-Time Target or a remote Linux RT target like a Raspberry Pi). Click Build to compile the model into an executable binary. Click Connect to Target and press Run .