State Output Switching In navigation bar

Table of Contents

Target Switch Model

Switches models on a QUARC target.

Library

QUARC Targets/Advanced/Dynamic Reconfiguration

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Advanced/Dynamic Reconfiguration')

Description

Target Switch Model

The Target Switch Model block switches models on the QUARC target identified by the connection name. The connection name matches the name of a Target Connect block in the diagram. A Target Connect block must be present.

This block switches out the model identified by the reconfiguration group specified and switches in the model identified by name. The incoming model must already be downloaded to the target.

Warning

The "-w" (wait) option should not be specified as a model argument or the switch will not occur until an external mode connection is made to the incoming model from the corresponding Simulink diagram.

In particular, suppose the supervisory model containing the Target Switch Model block is running on Target A. Furthermore, suppose the supervisory model contains a Target Connect block configured to connect to Target B. Thus, if the Target Switch Model block's Name of model to switch in parameter is set to Model A then when the supervisory model is run on Target A, the Target Switch Model block will switch to Model A on Target B, switching out any model in the given reconfiguration group that is currently running on Target B.

Any Switching In blocks in the incoming model will execute the Function Call Subsystem connected to their output. Likewise, any Switching Out blocks in the outgoing model will execute the Function Call Subsystem connected to their output.

This block is part of the dynamic reconfiguration facilities of QUARC which allow running models to be swapped for another model on-the-fly. In particular, dynamic reconfiguration may be performed under the control of a supervisory model.

Models which will be dynamically reconfigured should have the Support dynamic reconfiguration option checked on the Code Generation/QUARC tab of the Configuration Parameters dialog.

Input Ports

This block has no input ports.

Output Ports

This block has no output ports.

Parameters and Dialog Box

Target Switch Model

Connection name

The name of the connection identifying the QUARC target on which the specified model will be switched in. The connection names correspond to the names of Target Connect blocks in the diagram. Using connection names as an alias for the actual target URI allows the target URI to be changed in one place rather than in every block using the connection.

Reconfiguration group of model to switch out

A positive integer identifying the reconfiguration group of the model to switch out. Models that do not contain a Reconfiguration Group block are assigned to group 0.

Name of model to switch in

The name of the model to switch in. The code for this model must have already been built and downloaded to the target associated with the connection.

Arguments for model to switch

The command-line arguments to pass to the model loaded. Standard command-line arguments are:

-tf <time>
set the final time for the model to <time>. The model will stop at this time. Set to inf to run indefinitely.
-d <folder>
set the initial current directory for the model to <folder>.
-pri <priority>
set the base priority of the model threads to <priority>.
-ss <stack_size>
set the stack size of the model threads to <stack_size>.
-w
do not specify this option! It causes the model to wait for an external mode connection from the model's Simulink diagram before starting. This option is only available when external mode is enabled.
-uri <uri>
set the URI used by the model for external mode communications to <uri>. This option is only available when external mode is enabled.
-part <partition>
causes the model to run in the adaptive partition <partition>. The <partition> argument may be the name or identifier of the adaptive partition. This option is only supported on QNX targets.
-reconfig <group_id>
set the reconfiguration group of the model to <group_id>. This option is only available when dynamic reconfiguration is enabled.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. The sample time must be inherited when the block is placed in a conditionally executed subsystem, like a Triggered Subsystem, Enabled Subsystem, Function Call Subsystem or in a referenced model.

To use the fundamental sampling time of the model, set the sample time to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model.

The default sample time is set to -1 because this block is typically used in a conditionally-executed or asynchronous subsystem.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

Unlike normal simulation, the Target Switch Model block will switch code on the QUARC Target indicated by the Target URI.

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

The Target Switch Model block will stop the Simulink diagram of a model running in normal simulation in the given reconfiguration group. It will then run the model to be switched in as a normal simulation. Switching In and Switching Out blocks will execute their Function Call Subsystems as appropriate.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar