Interactively Configuring EPICS I/O Servers

Publish Date: Oct 26, 2012 | 4 Ratings | 4.50 out of 5 | Print

Overview

NI LabVIEW software has the ability to communicate with other devices and softwares using the Experimental Physics and Industrial Control Systems (EPICS) standards. As defined by Argonne National Laboratory, EPICS is a set of software tools and applications which provide a software infrastructure for use in building distributed control systems to operate devices such as particle accelerators, large experiments and major telescopes. This tutorial details how to interactively configure both EPICS Clients and EPICS Servers in LabVIEW.

Table of Contents

Table of Contents

  1. Requirements
  2. Interactively Configuring an EPICS Server I/O Server
  3. Building an EPICS Server VI
  4. Interactively Configuring an EPICS Client I/O Server
  5. Building an EPICS Client VI
  6. Examining Flow of Communication
  7. Related Links

Requirements

This tutorial requires the following NI software:

  • LabVIEW Full Development System or LabVIEW Professional Development System
  • LabVIEW DSC Module or LabVIEW Real-Time Module

This tutorial uses the LabVIEW Datalogging and Supervisory Control (DSC) Module or the LabVIEW Real-Time (RT) Module to enable LabVIEW to act as an EPICS Client or EPICS Server. The DSC Module allows the developer to configure and deploy EPICS I/O servers that serve as the bridge between the LabVIEW Shared Variable Engine and an EPICS network. For more information on how LabVIEW and DSC are used to communicate with an EPICS network, see the Developer Zone Article Introduction to EPICS.

Interactively Configuring an EPICS Server I/O Server

    1. Open and save a new LabVIEW project

    2. Add two virtual folders to the project
           a. Right click My Computer and select New » Virtual Folder
           
b. Name one folder Client and the other Server

    3. Add a library into each folder
           a. Right click Client and select New » Library
           
b. Right click Server and select New » Library
           
c. Respectively title the libraries Client Library and Server Library
           d. The project should now look similar to Figure 1


Figure 1: Preparing the LabVIEW Project   

    4. Create the Shared Variables listed in Table 1           
           a. Right click Server Library.lvlib and select New » Variable
           
b. Under the Variable tab, apply the parameters specified in Table 1
           c. The Shared Variable Properties window should look similar to Figure 2

Name Variable Type Data Type
Amplitude Network-Published Double
Frequency Network-Published Double

Table 1: Server Shared Variables


Figure 2: Shared Variable Properties Window

    5. Add a new I/O Server to the Server Library
           a. Right click Server Library.lvlib and select New » I/O Server
           
b. Select EPICS Server » Continue... and the window in Figure 3 will appear


Figure 3: Configuring an EPICS Server I/O Server

    6. Add the shared variables created in Step 4 to the I/O Server
           a. Select Add/Remove Variables...
           
b. Browse to Server Library.lvlib and select the two variables
           c. Select Add >> to add the variables to the I/O Server
           d. The configuration window should look similar to Figure 4
           e. Select OK


Figure 4: Adding New Variables to an EPICS Server I/O Server

    7. Note the EPICS Process Variables (PVs) have been created for both shared variables           
           a. At this time, take note of the Process Variable names, they will be needed in a later step
           b. The window will look similar to Figure 5, however PV names and paths will be different           
           c. Select OK


Figure 5: Newly Created EPICS Process Variables

Building an EPICS Server VI

The server VI in this tutorial will publish amplitude and frequency parameters to the EPICS network. These parameters will be read by a client and then fed into a function generator.

For more information on the differences between EPICS Servers and EPICS Clients, see the Developer Zone Article, Introduction to EPICS or the Argonne National Laboratory website. 

    1. Add a new VI to the Server virtual folder
           a. Right click Server and select New » VI
           
b. Save the VI as EPICS Server.vi

    2. Build a front panel similar to that shown in Figure 6
          a. Add two numeric controls (preferably knobs)       
          b. Add a boolean stop control 


Figure 6: EPICS Server VI Front Panel

    3. Build the block diagram shown in Figure 7
           a. Add a While Loop and wire the Stop Button to the conditional terminal of the loop
           b. Add the Amplitude and Frequency Shared Variables to the block diagram           
           c. Right click on the variables and select Access Mode » Write
           
d. Wire the Amplitude and Frequency controls to the corresponding shared variables
           e. Add a 100 ms Wait to the loop to give the processor time for other tasks


Figure 7: EPICS Server VI Block Diagram

Interactively Configuring an EPICS Client I/O Server

    1. Add a new I/O Server to Client Library
           a. Right click Client Library.lvlib and select New » I/O Server
           
b. Select EPICS Client » Continue...
           
c. The "Configure EPICS Client I/O Server" window will appear

    2. Add new records to the I/O Server
           a. Click the Add Records button twice to add two new records in the PV List
           b. Replace the default PV names with the names generated by the Server I/O Server           
           c. Change the data types of both Process Variables to Double
           
d. The window should now resemble Figure 8, select OK


Figure 8: Configuring the EPICS Client I/O Server

    2. Create corresponding Client Bound Shared Variables
           a. Right click EPICS Client1 and select Create Bound Variables...
           
b. The "Create Bound Variables" window will appear, browse to Client Library.lvlib
           
c. Under EPICS Client1, select the VAL fields for both variables
           d. Click the Add >> button to move the fields to the Added Variables list
           e. The window should now resemble Figure 9, select OK


Figure 9: Creating Bound Shared Variables on the EPICS Client

    3. Rename the bound variables
           a. After completing step 2, the "Multiple Variable Editor" window will appear
           b. It may be desirable to change the names of the variables to something more meaningful
           c. Change the variable names by double clicking in the Name field and typing the new name
           d. The window should now look similar to Figure 10, select Done


Figure 10: Changing Variable Names With the Multiple Variable Editor

Building an EPICS Client VI

    1. Add a new VI to the Client virtual folder
           a. Right click Client and select New » VI
           
b. Save the VI as EPICS Client.vi 

    2. Build a front panel similar to that of Figure 11
           a. Add a waveform chart
           b. Add a boolean stop control


Figure 11: EPICS Client VI Front Panel

    3. Build the block diagram show in Figure 12
           a. Add a While Loop and wire the Stop Button to the conditional terminal of the loop
           b. Add the ClientAmplitude and ClientFrequency shared variables to the block diagram
           c. Add a Basic Function Generator to the block diagram
           d. Wire the ClientFrequency shared variable to the frequency input of the function generator
           e. Wire the ClientAmplitude shared variable to the amplitude input of the function generator
           f. Wire the Signal Out terminal of the Basic Function Generator to the waveform chart
           g. Add a 100 ms Wait to the loop to give the processor time for other tasks

     
Figure 12: EPICS Client VI Block Diagram

Examining Flow of Communication

    1. Run Server.vi, notice that Server Library.lvlib is automatically deployed

    2. Run Client.vi, notice that Client Library.lvlib is automatically deployed

    3. Make changes to the controls on the Server front panel, the client will update accordingly

    4. See Figure 13 for a view of the front panels side by side


Figure 13: Server & Client Front Panels Running Simultaneously

    5. Open Distributed System Manager (DSM)
           a. Select Tools » Distributed System Manager from the top menu of either VI
           b. Browse to Localhost then select Client Library and Server Library to expand
           c. The network published shared variables and process variables can now be viewed
           d. Multiple items can be viewed simultaneously by holding Ctrl during selection
           e. See Figure 14 for a view of DSM that shows all values being updated


Figure 14: Viewing Flow of Communication in Distributed System Manger

Figure 14 shows the flow of communication as data passes between the EPICS Server and EPICS Client. The four steps in this process for each element are as follows:

  1. LabVIEW Server VI writes to shared variables hosted on the server
  2. EPICS Server I/O server updates values from shared variables to EPICS process variables
  3. EPICS Client I/O Server reads values from EPICS process variables and writes to shared variables
  4. LabVIEW Client VI reads from shared variables hosted on client

Related Links

NI Developer Zone: Introduction to EPICS
NI
Developer Zone: How LabVIEW uses I/O Servers

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit