Start of trail End of trail navigation bar

Table of Contents

Running QUARC Examples on Remote Targets

The QUARC Simulink examples are designed to automatically reconfigure themselves for the current default target. Hence, there is normally no need to change anything to run the examples.

However, if a new target is desired, there are two ways to change the target for an example, which are discussed in the sections below:

For more information on QUARC targets and how QUARC communicates with a target, refer to QUARC Targets - Generating Code for Various Target Platforms.

After changing the target type, it may be necessary to change the default model URI to refer to the new target's IP address (assuming the new target is remote). Again, there are two ways to configure this information.

For a detailed discussion of how QUARC communicates with targets and the notion of a model URI, refer to Communicating with the Target.

Changing the Default Target Type

The easiest way to run the examples on a different target is to change the default target type. By changing the default target type, all the examples will automatically build and run for the new target (with the exception of examples explicitly designed for a particular target). All new models created will also default to the new target type.

To change the default target type, use the Target Type tab of the QUARC Preferences dialog. The QUARC Preferences dialog may be opened via the QUARC/Preferences menu item of any Simulink model. Refer to the instructions for the QUARC Preferences dialog for details.

Warning

The examples only reconfigure themselves when they are first opened. Hence, be sure to close any open example models and re-open them after changing the default target type.

At this point, the model URI may need to be changed, either by changing the default model URI or by setting the model URI for the model.

Copying the Configuration Set

Another way to change the target for an example is to copy the configuration set and select a new target. This method allows the sample time of the model and other parameters to be changed without affecting the original defaults for the example. It also makes it easy to switch between configurations once the new configuration has been created.

Every Simulink model supports configuration sets. There is always at least one configuration, defining the target for code generation as well as the sample time of the model and many other configuration parameters. However, a Simulink model may have more than one configuration set. It is then possible to select which configuration is currently active and thereby switch quickly between targets, with unique settings for every target.

The process of creating multiple configurations and activating a particular configuration is described in detail on the Defining Multiple Configurations page.

The following discussion describes the easiest way to create a new configuration set for any of the QUARC example models. It assumes that the example model is currently open.

  1. Open Model Explorer by selecting Model Explorer from the View menu of the diagram, clicking on the Launch Model Explorer button on the toolbar, or pressing Ctrl+H . You may have to make the diagram a little wider to see the full toolbar.

  2. Expand the node for your model in the treeview in the Model Hierarchy pane. Make sure the model is selected in the Model Hierarchy pane.

  3. Copy the default configuration set by right-clicking on the QUARC Default Target Configuration item in the treeview and choosing Copy from the context menu. Then right-click on the model name in the Model Hierarchy treeview and choose Paste from the context menu.

  4. A new configuration will now be created. It is usually a good idea to rename the configuration to a more meaningful (and unique) name. Simply click on the name of the new configuration and then change then name in the Name field. Use the Apply button to save the new name.

  5. To change the target type, select the Code Generation item in the middle column. Then choose the General tab under the Code Generation section on the right, as shown in the Model Explorer window depicted above.

  6. Click on the Browse... button next to the System target file field.

  7. In the System Target File Browser dialog choose the desired target from the list and click OK.

  8. Click Apply to save the changes to the configuration set.

  9. Activate the new configuration by right-clicking on the new configuration and selecting Activate from the context menu.

  10. At this point, the desired target type and configuration has been selected. Save the model. The configuration set only needs to be configured once for a particular model. It does not have to be created each time you wish to build code for that example.

    To switch between configuration sets, simply activate the desired configuration. The model will then build and run on the selected target until a new configuration is activated.

At this point, the model URI may need to be changed, either by changing the default model URI or by setting the model URI for the model.

Changing the Default Model URI

The easiest way to change the IP address for a remote target is to set the default model URI. The model URI defines how QUARC talks to the model on the target. Each type of target has its own default model URI. For example, the quarc_win64 target and the quarc_linux_duovero target both have their own default model URI. By changing the default model URI, any model configured for a particular target type will use the associated default model URI to communicate with the model on that target.

This scheme works really well when you only have one target of each type because all your models will be directed to the right place automatically. For example, suppose you have a single Quanser QBall 2 running the QUARC Linux DuoVero target. Set the default model URI for the quarc_linux_duovero target to tcpip://192.168.2.2:17001, assuming the Quanser QBall 2 has an IP address of "192.168.2.2". From that point onward, all models configured to use the QUARC Linux DuoVero target will automatically be downloaded and run on the Quanser QBall 2 with that IP address. Meanwhile, any models configured for the appropriate QUARC Target for Windows will run on the local machine.

To change the default model URI, use the Model tab of the QUARC Preferences dialog. The QUARC Preferences dialog may be opened via the QUARC/Preferences menu item of any Simulink model. Refer to the instructions for the QUARC Preferences dialog for details.

Setting the Model URI

Another way to specify where a model will be run is to set the model URI of the model itself. Every model can be assigned its own model URI. The model URI defines how QUARC talks to the model on the target. QUARC uses the model URI to determine the IP address (assuming TCP/IP is being used) of the remote target. For instructions on how to set the model URI for a specific model, refer to Specifying a Model and/or Target URI.

 

navigation bar