Experimental Physics and Industrial Control System (EPICS) is a Channel Access (CA) Protocol communication method often used by Big Physics to implement distributed control systems for large scale experiments. EPICS uses a client/server architecture to communicate between various devices.
Using LabVIEW and the Datalogging and Supervisory Control (DSC) Module a LabVIEW VI can be configured as either an EPICS server or an EPICS client. The following tutorial details how to interactively configure both an EPICS client and EPICS server in LabVIEW.
GOAL: Create an EPICS server which publishes parameters (frequency and amplitude) to an EPICS network. Create an EPICS client which reads parameters published by the server and generates a sine function.
1. Create a new LabVIEW project and save the project as "EPICS Example.lvproj"
2. Add two Virtual Folders to the project. Name one "Client" and the other "Server". Your project should now look like Figure 1.
a. (Right Click) My Computer » New » Virtual Folder
Figure 1: Project Window
3. Add a new Library to the Server folder created in step 2. Name this library "Server Library.lvlib"
a. (Right Click) Server » New » Library
4. Add the Network - Published Shared Variables listed in Table 1 to Server Library.lvlib created in step 3.
a. (Right Click) Server Library.lvlib » New » Variable
b. Configure the variables based on the parameters in Table 1. See Figure 2
|Name||Variable Type||Data Type|
|Amplitude||Network - Published||Double|
|Frequency||Network - Published||Double|
Figure 2: Shared Variable Properties
5. Add a new EPICS Server I/O Server to Server Library.lvlib
a. (Right Click) Server Library.lvlib » New » I/O Server
b. Select EPICS Server » Continue...
c. Select Add/Remove Variables...
d. Navigate to the shared variables created in step 4 and add them to the I/O Server. See Figure 3.
e. Click OK
Figure 3: Adding Variables to the EPICS Server I/O Server
6. A window labeled "Configure EPICS Server I/O Server" will appear. Make note of the PV (Process Variable) names as they will be needed in a later step. See Figure 4.
Figure 4: Newly Created EPICS Process Variables
7. Create a new VI under the Server folder.
a. (Right Click) Server » New » VI
b. Create the VI shown in Figure 5
c. Save the VI as "Server.vi"
Figure 5: EPICS Server VI
8. The EPICS Server is now complete.
1. Add a new Library to the Client folder. Name this library "Client Library.lvlib".
a. (Right Click) Client » New » Library
2. Add a new EPICS Client I/O Server to "Client Library.lvlib"
a. (Right Click) Client Library.lvlib » New » I/O Server
b. Select EPICS Client » Continue...
c. In the "Configure EPICS Client I/O Server" window, add two Records to the Process Variables list. See Figure 6.
d. Change the name of each record to match the name of the server process variables created in step 5 and 6 of the above section. See Figure 6.
e. Click OK
Figure 6: Linking EPICS Client to Server Process Variables
3. Create Network Published Shared Variables bound to the EPICS Client I/O Server
a. (Right Click) EPICS Client1 » Create Bound Variables...
b. Expand the Browse Source tree down to the EPICS Client until you can see the process variables for frequency & amplitude.
c. Expand amplitude and frequency so you can see the VAL for each.
d. Add the VAL for each process variable to the Added Variables list. See Figure 7.
e. Click OK
Figure 7: Creating Shared Variables Bound to EPICS Client
4. (OPTIONAL but recommended) Upon the creation of the bound shared variables, the Multiple Variable Editor window opens.
a. It is useful, but not required to rename the shared variables created in step 3 to something more meaningful than VAL and VAL1.
b. By looking under the Network-Published: Project Path column one can see the process variable that the shared variables are bound to. See Figure 8.
c. Change the Name of the shared variable accordingly. To something such as "Client Amplitude" (thus to avoid confusion with the variables on the server side).
Figure 8: Renaming Client Shared Variables
5. Create a new VI under the Client folder.
a. (Right Click) Client » New » VI
b. Create the VI shown in Figure 9.
c. Save the VI as "Client.vi"
6. The EPICS Client is now complete.
1. Run Server.vi
2. Run Client.vi
3. Observe the communication between the server and client by adjusting the parameters on the client side. See Figure 10.
4. Open Distributed System Manager
a. Tools » Distributed System Manager
b. Browse into Localhost. See Figure 11.
c. Here you can observe all the shared variables and EPICS Process variables. Note the flow of data between the elements of this communication process.
1. Amplitude - Shared variable on the server side (Bound to EPICS server process variable)
2. VAL - Value of Amplitude process variable published by the EPICS server.
3. VAL - Value of Amplitude process variable read by the EPICS client.
4. Client Amplitude - Shared variable on the server side (Bound to EPICS client process variable)
Figure 11: Viewing the Communication Process in Distributed System Manager
Attached are zipped versions of this project for both LabVIEW 2011 and LabVIEW 2009.
*NOTE: Project will not run properly when opened on other computers because the process variables will not exist with the same name or path. It will be necessary to rebuild the Client & Server I/O servers and rebind the shared variables on the client side. *