quarc_labview_srv02_demo_client.vi
quarc_labview_srv02_demo_server.mdl
Open these models

QUARC LabVIEW Interfacing SRV02-ET Demo

This example consists of a QUARC model and a LabVIEW GUI. The QUARC model has a module that emulates the dynamics of a Quanser SRV02-ET servo, and a PIV controller module that generates input signals to the servo based on the command signal generated from the "Smooth Signal Generator" block and the feedback signal from the servo model.

The user is able to tune the signal generator and the controller by changing the values of amplitude, frequency, kp, and kv parameters through the LabVIEW GUI. Then the values will be transmitted via TCP/IP connection to the QUARC model.

The GUI and the model can be run on the same computer or two separate computers within a network.

LabVIEW Interfacing SRV02-ET Demo Simulink Diagram

Requirements

LabVIEW 2009 or later must be installed.

Configuration the Demonstration

To set up the model, double-click on the Stream Server block in the quarc_labview_srv02_demo_server.mdl model and make sure the URI upon which to listen parameter is set to listening on localhost.

To run the GUI on the same computer, enter the block diagram of the GUI and make sure it is connecting to localhost and the port number is consistent with the number in the QUARC model URI.

To run the GUI on another computer, enter the block diagram of the GUI and make sure it is connecting to the IP address of the computer where the QUARC model is running and the port number is consistent with the number in the QUARC model URI.

Demonstration

Select Build from the QUARC menu of the diagram, or press Ctrl+B while the diagram is the active window. A great deal of output will appear in the Diagnostic Viewer about the progress of the build. If you cannot see the Diagnostic Viewer, you can open it by selecting View/Diagnostic Viewer from the menu of the diagram, or clicking on the View Diagnostics hyperlink at the bottom of the diagram. If you have MATLAB R2013b or earlier then the output will appear in the MATLAB Command Window.

Click on the Connect to Target button or select Connect to Target from the Simulation menu of the diagram to connect to the model.

Start the model by clicking on the Run button or selecting Run from the Simulation menu of the diagram. The Start item of the QUARC menu may also be used to both connect and start the model in one operation.

The sampling time can be changed by updating the value of Fixed-step size in Configuration Parameters.

Now in the LabVIEW GUI, click Run button to start the process. The SRV-02 Angle plot in the LabVIEW GUI will show the commanded signal and the actual response of the SRV-02, as shown below:

SRV02-ET LabVIEW Panel

Click on the Stop button or select Stop from the Simulation menu of the diagram to stop the model. The Stop item of the QUARC menu may also be used.

Click the Stop button of the VI to halt the LabVIEW GUI.