Library Simulink [cracked]: Quarc

The QUARC library for Simulink is a set of blocks provided by Quanser that integrates real-time control with Simulink. It allows you to:

  • Run Simulink models in real time on Windows or real-time targets.
  • Interface directly with Quanser hardware (e.g., QUBE-Servo, IP02, SRV02, AERO, rotary and linear plants).
  • Use hardware-in-the-loop (HIL) and rapid control prototyping (RCP).

3.1. Main Libraries

  • Quarc Targets: Blocks that define the configuration and communication settings for the target machine.
  • Data Communication: Blocks for Inter-Process Communication (IPC). These allow different models to talk to each other or interface with external software (like user interfaces) via TCP/IP, UDP, or Shared Memory.
  • Data Types: Blocks for handling specific data types often required by low-level hardware (uint8, int16, etc.).
  • Math and Control: Enhanced versions of standard math blocks optimized for embedded targets, including discrete filters and PID controllers with anti-windup features.

Part 2: Architecture of the QUARC Real-Time System

To understand the library, one must grasp the underlying architecture: quarc library simulink

  1. Host PC (Development Environment): Runs MATLAB/Simulink. You design, compile (using the QUARC compiler), and initiate the model.
  2. Target PC (Execution Environment): Can be the same as the host or a separate computer running the Quanser Real-Time Kernel (a high-precision extension to Windows). This machine executes the compiled Simulink model.
  3. QUARC Blocks: These blocks replace standard I/O blocks. For example, instead of a Sine Wave source, you might use a QUARC Waveform Generator. Instead of a To Workspace sink, you use QUARC Stream Data.

The library also includes HIL (Hardware-In-the-Loop) blocks that interface with specific drivers (e.g., HIL Initialize, HIL Read Analog, HIL Write PWM). The QUARC library for Simulink is a set


Issue 4: Encoder counts are jumping erratically

  • Solution: Check your encoder wiring (A, B channels). Use a HIL Read Encoder block with the "Quadrature" mode and enable noise filtering if available.

Typical workflow:

  1. Design controller in Simulink using standard blocks.
  2. Replace I/O with QUARC Source/Sink blocks (e.g., encoder input, analog output).
  3. Configure target (e.g., Quanser QPIDe, Windows real-time).
  4. Click QUARC → Build & Run to compile and execute.