FAQ - QUARC Control Software

 

How can I set the sampling rate of my QUARC model?

The sampling interval (1/sampling rate) is set in the fixed-step size (fundamental sample time) field in the Simulink diagram Configuration Parameters of your QUARC model. Go to the QUARC menu | Options | Solver.

Note: QUARC has a demonstration model that uses the "Sample Time" block from the QUARC targets library to measure the actual time between each sampling instant. Type qc_show_demos in the MATLAB command window, click on "QUARC Harware-In-Loop Timebase Demo"

Why can't I set my sampling rate higher than 1kHz (below 1 ms)? I get an error that my system clock does not support this.

You need to use blocks from QUARC Targets\Data Acquisition\Generic\Timebases category. Example: use the HIL Read Timebase block instead of the HIL Read from the Immediate I/O category. The Timebase blocks force the controller to use the DAQ timer instead of the PC clock and you can then go to higher sampling rates (depending on the capability of the DAQ).

Quanser Q2-USB and Q8-USB DAQ device users: you also need to set the update_rate parameter in Board-Specific Options to "Fast Mode" in order to reach sampling rates higher than 1 kHz.

This image is an example of the Board-Specific Options window when Q8-USB DAQ is selected.

Can I control two plants simultaneously from one QUARC model running on my Host PC? Plant 1 which is connected to Target PC #1 and Plant 2 is connected to Target PC #2.

Yes, this is possible:
  • Type qc_show_demos in the Matlab command window to get access to all QUARC demonstration models.
  • Scroll down and look for the "Communications" group.
  • Run the "QUARC Basic Communications Demo" to learn how "Stream Server" and "Stream Client " blocks work.
  • The Host machine could have two Stream Server blocks. Each of these Server blocks would communicate with Target 1 and 2. Each Target PC would have a Stream Client block that would accept data from the Host. You could try, for instance, sending a square wave to Target 1 and a sine wave to Target 2 from the Host machine, then modify it to control the plants connected the Target PC.

How can I interface a Logitech webcam in QUARC?

Assuming your webcam is supported by OpenCV, you can use the QUARC Vision Capture Image beta block. This block is supported by our QUARC Linux ARM (gumstix) target, but can only be run in Normal mode in Windows. Under Windows, the model running in normal mode should also include a System Timebase block for pseudo-real-time performance and use our QUARC Stream block(s) (see the QUARC communication demos) to communicate the image data to the actual QUARC Windows target model.

How can I save data to Workspace?

Refer to the "QUARC Data Logging Demo".  Type qc_show_demos in Matlab command prompt, scroll down and look for the demo, click on "Open this model", build and run it. It's QUARC help page describes the model and shows you how to save data to workspace or to a file.

The Scope in my Simulink model is showing only 10 seconds of data, how can I increase it?

The Simulink Duration variable in the External Signal & Triggering panel has a default value of 10,000 data points. This sets, for example, the default buffer size for Simulink Scopes. This Duration variable can easily be set (e.g., increased) using the Simulink Tools/External Mode Control Panel.../Signal & Triggering... dialog. This setting is independent of QUARC. It can be increased as much as the system's RAM can handle. For example, if you want to show 20 seconds of date for a controller running at 1 ms (i.e. 1 kHz sampling), then set Duration to 20 / 0.001 = 20000. Make sure the Data History Parameters pane of the scope is properly configured as well, i.e. set the Limit data point to last parameter should be the same as the Duration parameter set the External Signal & Triggering  previously.

Is it possible to obtain a sampling rate of 20 kHz (sampling time of 50us) using QUARC?

Refer to the QUARC help documents  and note that QUARC supports different targets. In this case, you need to consider QNX x86, this is the only QUARC target that can handle 20kHz reliably.

Can I use S-functions with QUARC?

QUARC generates code using the MATLAB Coder and Simulink Coder toolboxes. Therefore only S-Functions that are compatible with the MATLABCoder and Simulink Coder toolboxes and written in C/C++ are compatible with QUARC. Note that M-File S-Functionsare not supported by Simulink Coder.

For a listing of what toolboxes are supported for C/C++ code generation, please go to the following page on The MathWorks™ website: https://www.mathworks.com/help/coder/language-supported-for-code-generation.html

Why can't I build and run my S-function in QUARC?

Here are some example reasons why an S-Function does not build or run in QUARC:
  • It contains functions (e.g., from certain The MathWorks toolboxes) that are not compatible with MATLAB Coder and/or Simulink Coder toolboxes.
  • It containsfile read/write operators.
  • It contains or calls third-party drivers that are not supported.
  • It contains an algorithm that itself may not be supported by the MATLAB Coder and/or Simulink Coder toolboxes for real-time execution (e.g., non-causal algorithms).
In addition if the custom S-Function cannot be compiled and run with The MathWorks™ Generic Real-Time(GRT) target, it will not be compatible and work with QUARC. However if it does compile and run with the GRT target, it is not guaranteed to work in QUARC. QUARC runs in a protected real-time environment that may not support third-party drivers, particularly those that attempt to access Microsoft Windows GUI elements, such as window handles (HWND).

Please refer to the following The MathWorks™ website for the limitations on the S-functions: http://www.mathworks.com/help/simulink/sfg/s-function-limitations.html

What is the easiest way to create a C/C++S-function?

The easiest way to create a C/C++ S-Function is by using the Simulink S-Function Builder. If no hardware access is required, embedded MATLAB functions could work too. For more information, please visit the following The MathWorks™ website:

http://www.mathworks.com/help/simulink/s-function-basics.html
https://www.mathworks.com/help/simulink/sfg/how-to-implement-s-functions.html
http://www.mathworks.com/help/simulink/sfg/s-function-examples.html

My S-function works in Normal simulation mode, but does not work in External Simulation mode?

As described above, not all S-Functions are compatible with real-time operation in External simulation mode. This is mainly due to the C/C++ code calling functions that are not supported by the MATLAB Coder and/or Simulink Coder toolboxes. If you have to use these unsupported functions for your application in External mode, then as a workaround you should be able to set up a QUARC communication client/server configuration between two QUARC models, one running in Normal mode and the other running in External mode. In this configuration, the S-Function could be run in a communication client Simulink model configured for Normal simulation mode, and sending/receiving data to/from a QUARC-based Simulink model running in External mode, i.e., the communication server. The real-timecommunication between both client and server models can be readily implemented using the QUARC Stream blocks. For more information and details on how to do this, please refer to the QUARC communication built-in demos. These demos can be located by typing qc_show_demos in the MATLAB command window.

Note: When implementing the QUARC-based Simulink client model to run in Normal mode, make sure you also use the QUARC System Timebase block. This will slow down theNormal mode simulation time to make it run in pseudo-real-time, in a way that is compatible with its communication server model counterpart running in External mode.See the QUARC User Manual for more information.

I'm working with a sensor that transmit data through a serial port. How can I receive that data in QUARC model?

Please check our QUARC communications demos. QUARC provides Basic/Intermediate/Advanced Communications Demos and from the QUARC help you’ll get complete documents of all resources available for serial communications in your project.  Type qc_show_demos in the MATLAB command window, scroll down and look for the Communications Demos. You can start with the “QUARC Basic communications demo”.

We also recommend to check the Communications API at:
QUARC help/Quarc Targets/User’s guide/Quarc External Interfaces/C functions/Communications.
You can find there a complete document on Communications |  Stream API | "Getting started with the Stream C API"

How can I fix the error-message that appears in the MATLAB as "gethostbyname() call failed?

To fix the error, follow these steps:
  1. Go to the model options under QUARC > Options
  2. On the left side navigation go to Code Generation > Interface
  3. Under Data exchange, click on the Transport layer property and select “quarc”, even if it is already selected. This forces the MEX-file name to change to “quarc_comm”, which is what we need to run QUARC models.

How do I reconfigure my single-user QUARC license?

If the license’s extension is .qlic, you just need to double clicking the license file to open the license configuration window and click OK.
Note: For single-user license, make sure the Configure license manger and Configure QUARC are selected.

If your license’s extension is .lic, you need to go to start/programs/quanser/QUARC/Configure Licensing to open the QUARC License Registration window. When the QUARC license Registration window opens, click on OK.
Note: For single-user license, make sure the Configure license manger and Configure QUARC are selected.

When try building a demo model, I obtain the following error:
Warning: The autosave file for model 'quarc_sine_scope_demo' could not be created.
Error using rtw_create_directory_path (line 35)
Error creating folder 'C:\Windows\System32\slprj\quarc_win64\quarc_sine_scope_demo\tmwinternal' : Access is denied.

This error is usually caused when a model is being built in a directory when the user does not have full permission. I t is always recommended to build model in a local directory with full permission (e.g. My documents/user/John).

I want to run the QUARC model at 2 KHz. There were no building issues, but when I try running the model I get the following error message:
Error occurred while executing External Mode MEX-file 'quarc_comm':
Unable to set base rate. A value is outside the valid range.

When only QUARC’s Immediate I/O blocks (e.g. HIL Write, HIL read) are used in a Simulink model, the maximum sampling frequency is 1 kHz (system clock). In order to achieve a faster sampling frequency, the QUARC’s Timebases blocks (e.g. HIL Read Timebase block, HIL Write Timebase block). Note that the maximum sampling frequency is determined by the DAQ.

When trying to build the model, I get the following error:
..\quarc_sine_scope_demo.rt-win64 : fatal error LNK1120: 29 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\link.EXE"' : return code '0x460'

Stop.

The target of the QUARC model is set for a Windows 64-bit system. You are running QUARC on a Windows 32-bit system. To select the correct target, in the Simulink model go to QUARC -> Options -> Code Generation. In System target file, browse for quarc_windows.tlc.

Alternatively, you can go to QUARC -> Set Default Options for a quick fix.

Does QUARC 2.3 support MATLAB 2013?

QUARC 2.3 does not officially suport this version of MATLAB. However, preliminary tests and user reports indicate that at least some of the functions in QUARC 2.3.433 and newer versions work with MATLAB R2013a.

Can I use the Quanser QUBE servo with USB interface with QUARC 2.1 or QUARC2.2?

Unfortunately, QUARC 2.2 and older versions don't support the QUBE-Servo USB interface. You must have the latest revision of QUARC 2.3.


Did not find what you were looking for? Please contact our technical support team.

Privacy Policy
©2017 Quanser Inc.