Selecting a QUARC Target Specific Targets navigation bar

Table of Contents > QUARC > User's Guide > QUARC Targets

Communicating with the Target

QUARC uses Universal Resource Identifier, or URIs, for all of its communications. A URI is similar to the URLs that are familiar to users of the World Wide Web, such as https://www.quanser.com. However, in QUARC, URIs identify a communication protocol, address and communication parameters. For example, the URI shmem://mymemory:1?memsize=8192 indicates the shared memory protocol, "shmem". The shared memory will use the prefix "mymemory" and "port" 1, and a buffer size of 8K or 8192 bytes for both the send and receive buffers. The benefits of using URIs is their flexibility and extensibility. Communication protocols may be added at any time, or new options added, and the mechanism for identifying the protocol is the same: a URI.

The basic form of a URI as employed by QUARC is:

<protocol>://<hostname>:<port>?<option>=<value>,...

where the <protocol> indicates the name of the communication protocol, and the <hostname> and <port> identify the address and port to which to connect. The rest of the URI supplies protocol-specific options. For example, the serial protocol has options for the baud rate, stop bits and parity, as well as additional options. Refer to the reference section, Universal Resource Identifiers, for the full form of a URI, a complete list of the communication protocols currently available and all of their options.

Of course, the question arises "What are we talking to when we are communicating with a target system?", or more precisely, "What is running on the target system that requires communications?". There are two components that are typically running on any target system:

QUARC Target Manager - the Target URI

The QUARC Target Manager is a small service or daemon running on each target system that allows QUARC to manage real-time code on the target. It allows code to be downloaded to the target and executed. It also provides an interface for stopping the real-time code on the target, enumerating the models that have been downloaded to the target or are currently running, and other facilities.

The QUARC Target Manager acts as a "server" on the target system. It listens for connections from remote hosts (such as a Simulink diagram running on the host PC) and services their requests. The QUARC Target Manager is capable of using more than one communication protocol at the same time.

Remote hosts, such as Simulink or Windows Explorer, connect to the QUARC Target Manager for the purpose of downloading and running real-time code using a URI called the target URI. The target URI provides all the information required to communicate with the QUARC Target Manager - the communication protocol, the address and port, and the communication parameters.

By using a target URI, the communication medium can be optimized for the configuration of the user's system. For example, if the host and target PC are the same PC then shared memory may be used. If they are different PCs, then TCP/IP may be used for the communications.

Real-Time Code - the Model URI

When code is generated from a Simulink model, QUARC generates a real-time "application". This application is downloaded to the target system using the target URI. Clicking on the Connect button on the model's toolbar causes QUARC to request that the model be loaded on the target by the QUARC Target Manager.

Once the model is loaded on the target, Simulink then connects to the real-time application itself via QUARC's external mode interface. At this point, the QUARC Target Manager is no longer involved. The external mode interface is used to stream data to the Simulink Scopes and displays, as well as to transmit parameter changes back to the real-time code running on the target.

The communication protocol used between Simulink and the real-time code is specified by, once again, a URI - in this case, a separate URI called the model URI. QUARC does not communicate with the real-time code through the QUARC Target Manager because the real-time code is often running as a separate application on the target to take advantage of the protection offered by virtual memory as well as other features of the operating system available to processes running on the target.

Furthermore, the use of a model URI allows the communication parameters to be tailored for the specific requirements of the model. For example, a model that streams a lot of data due to its fast sampling rate and large number of Scopes, can increase the buffer size used for its communications, while a slower model can minimize its memory requirements.

In addition, use of a model URI allows QUARC to communicate with more than one model running on the target system at the same time because each model can be assigned its own URI! This functionality is crucial to features such as QUARC's dynamic reconfiguration capability, but it also allows segmentation of real-time tasks into separate applications on the target. Such segmentation can be crucial for advanced, robust, real-time applications where portions of the real-time system are deliberately isolated from each other.

Specifying URIs

QUARC supplies a variety of techniques for specifying the target and model URIs, ranging from the simplest, where default URIs are used, to the most sophisticated, where separate target and model URIs are specified. QUARC allows the default URIs to be changed, so using default URIs is the most common method of specifying the URIs. For more information, click on one of the links below:

 

navigation bar