Interactively Configuring LabVIEW EPICS I/O Clients and Servers

Updated Dec 22, 2023

Environment

Software

  • LabVIEW
  • LabVIEW Real-Time Module
  • LabVIEW Datalogging and Supervisory Control Module

LabVIEW software has the ability to communicate with other devices and software 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.
 

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 Introduction to EPICS.

Interactively Configuring an EPICS Server I/O Server

  1. Open and save a new LabVIEW project

 

  1. Add two virtual folders to the project

 
  1. Right click My Computer and select New » Virtual Folder

  2. Name one folder Client and the other Server
     

 

  1. Add a library into each folder

 

  1. Right click Client and select New » Library

  2. Right click Server and select New » Library

  3. Respectively title the libraries Client Library and Server Library

  4. The project should now look similar to Figure 1

 

Figure 1: Preparing the LabVIEW Project   
 

  1. Create the Shared Variables listed in Table 1        

 

  1. Right click Server Library.lvlib and select New » Variable

  2. Under the Variable tab, apply the parameters specified in Table 1

  3. 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
 

  1. Add a new I/O Server to the Server Library

 

  1. Right click Server Library.lvlib and select New » I/O Server

  2. Select EPICS Server » Continue... and the window in Figure 3 will appear

Figure 3: Configuring an EPICS Server I/O Server
 

  1. Add the shared variables created in Step 4 to the I/O Server

 

  1. Select Add/Remove Variables...

  2. Browse to Server Library.lvlib and select the two variables

  3. Select Add >> to add the variables to the I/O Server

  4. The configuration window should look similar to Figure 4

  5. Select OK
     

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

  1. Note the EPICS Process Variables (PVs) have been created for both shared variables

 

  1. At this time, take note of the Process Variable names, they will be needed in a later step

  2. The window will look similar to Figure 5, however PV names and paths will be different           

  3. 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

 

  1. Right click Server and select New » VI

  2. Save the VI as EPICS Server.vi

 

  1. Build a front panel similar to that shown in Figure 6

 

  1. Add two numeric controls (preferably knobs)       

  2. Add a boolean stop control 
     

Figure 6: EPICS Server VI Front Panel
 

  1. Build the block diagram shown in Figure 7

 

  1. Add a While Loop and wire the Stop Button to the conditional terminal of the loop

  2. Add the Amplitude and Frequency Shared Variables to the block diagram           

  3. Right click on the variables and select Access Mode » Write

  4. Wire the Amplitude and Frequency controls to the corresponding shared variables

  5. 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

 

  1. Right click Client Library.lvlib and select New » I/O Server

  2. Select EPICS Client » Continue...

  3. The "Configure EPICS Client I/O Server" window will appear
     

  1. Add new records to the I/O Server

 

  1. Click the Add Records button twice to add two new records in the PV List

  2. Replace the default PV names with the names generated by the Server I/O Server           

  3. Change the data types of both Process Variables to Double

  4. The window should now resemble Figure 8, select OK
     

Figure 8: Configuring the EPICS Client I/O Server
 

  1. Create corresponding Client Bound Shared Variables

 

  1. Right click EPICS Client1 and select Create Bound Variables...

  2. The "Create Bound Variables" window will appear, browse to Client Library.lvlib

  3. Under EPICS Client1, select the VAL fields for both variables

  4. Click the Add >> button to move the fields to the Added Variables list

  5. The window should now resemble Figure 9, select OK
     

Figure 9: Creating Bound Shared Variables on the EPICS Client
 

  1. Rename the bound variables

 

  1. After completing step 2, the "Multiple Variable Editor" window will appear

  2. It may be desirable to change the names of the variables to something more meaningful

  3. Change the variable names by double clicking in the Name field and typing the new name

  4. 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

 

  1. Right click Client and select New » VI

  2. Save the VI as EPICS Client.vi 

 

  1. Build a front panel similar to that of Figure 11

 

  1. Add a waveform chart

  2. Add a boolean stop control
     

Figure 11: EPICS Client VI Front Panel
 

  1. Build the block diagram show in Figure 12
 
  1. Add a While Loop and wire the Stop Button to the conditional terminal of the loop

  2. Add the ClientAmplitude and ClientFrequency shared variables to the block diagram

  3. Add a Basic Function Generator to the block diagram

  4. Wire the ClientFrequency shared variable to the frequency input of the function generator

  5. Wire the ClientAmplitude shared variable to the amplitude input of the function generator

  6. Wire the Signal Out terminal of the Basic Function Generator to the waveform chart

  7. 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
 

  1. Open Distributed System Manager (DSM)

 

  1. Select Tools » Distributed System Manager from the top menu of either VI

  2. Browse to Localhost then select Client Library and Server Library to expand

  3. The network published shared variables and process variables can now be viewed

  4. Multiple items can be viewed simultaneously by holding Ctrl during selection

  5. 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