Installation and initial use of EPICS sscan module

The following documents are available:

1) sscanRecord.html: sscan record document. This also contains some information about saveData, the synApps client program that writes scan data to disk.

2) scanparmRecord.html: scanparm record document.

3) saveData_fileFormat.txt: Description of the 'MDA' (Multidimensional Archive) file format written by saveData. For cross-platform compatibility, this file format uses the XDR standard.

4) saveData.req: An example copy of the file that tells saveData what to do.

5) XDR_RFC1014.txt: A description of the XDR (External Data Representation) standard.

6) Scans.ppt: Describes the ppt representation of this sscan module; shows how to use sscan records; describes the MDA file format of saveData; and explains how EPICS putNotify/ca_put_callback() behaves, and how to handle operations that do not meet EPICS execution-trace requirements chain.

1. Installation and Construction

After obtaining a copy of this distribution, it must be installed and built for use in your application. Typically, these step values ​​need to be executed once:

1) Unpack the distribution, for example, on Linux:

[blctrl@main-machine support]$ tar -xvzf sscan-R2-11-3.tar.gz
[blctrl@main-machine support]$ ln -s sscan-R2-11-3 sscan

Normally doing this in the EPICS 'support' directory, it will produce this subdirectory:

[blctrl@main-machine support]$ ls -l | grep sscan
lrwxrwxrwx.  1 root   root        13 Sep 12  2022 sscan -> sscan-R2-11-3
drwxr-xr-x. 10 root   root       168 Sep 12  2022 sscan-R2-11-3

2) Edit the configure/RELEASE file of sscan, and set these paths to point to the installation path of your EPICS base and other dependent modules.

#RELEASE Location of external products
# Run "gnumake clean uninstall install" in the application
# top directory each time this file is changed.

TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top

SUPPORT=/usr/local/EPICS/synApps/support
-include $(TOP)/../configure/SUPPORT.$(EPICS_HOST_ARCH)

#If using the sequencer, point SNCSEQ at its top directory:
SNCSEQ=$(SUPPORT)/seq

# EPICS_BASE usually appears last so other apps can override stuff:
EPICS_BASE=/usr/local/EPICS/base
-include $(TOP)/../configure/EPICS_BASE.$(EPICS_HOST_ARCH)

#Capfast users may need the following definitions
#CAPFAST_TEMPLATES=
#SCH2EDIF_PATH=

# These lines allow developers to override these RELEASE settings
# without having to modify this file directly.
-include $(TOP)/../RELEASE.local
-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local
-include $(TOP)/configure/RELEASE.local

3) Return to the top-level directory of the sscan module, and execute make, and check for any compilation errors.

[blctrl@main-machine sscan]$ make
make -C ./configure install
...
make[1]: Leaving directory '/usr/local/EPICS/synApps/support/sscan-R2-11-3/sscanApp'

2. Usage of sscan module in an EPICS IOC

The sscan module is not used to directly run an IOC application, but to contribute code libraries, databases, MEDM display windows, etc. to an IOC application. SynApps contains a sample IOC application (xxx module) that extracts software from the sscan module and deploys it in an IOC.

The necessary steps to use the sscan module code in an IOC application ("sscan_ex") are as follows:

1) Follow the steps below to build the program framework:

[root@main-machine exer]# mkdir sscan_ex
[root@main-machine exer]# cd sscan_ex/
[root@main-machine sscan_ex]# makeBaseApp.pl -t ioc sscan_ex
[root@main-machine sscan_ex]# makeBaseApp.pl -i -t ioc sscan_ex
Using target architecture linux-x86_64 (only one available)
The following applications are available:
    sscan_ex
What application should the IOC(s) boot?
The default uses the IOC's name, even if not listed above.
Application name?
[root@main-machine sscan_ex]# ls
configure  iocBoot  Makefile  sscan_exApp

2) Under configure/RELEASE of this program, include the following line:

SUPPORT=/usr/local/EPICS/synApps/support

# If using the sequencer, point SNCSEQ at its top directory:
ASYN=$(SUPPORT)/asyn
SSCAN=$(SUPPORT)/sscan
SNCSEQ = $(SUPPORT)/seq

3) Under the /sscan_ex/sscan_exApp/src path, edit the Makefile:

TOP=../..

include $(TOP)/configure/CONFIG
#----------------------------------------
#  ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================

#=============================
# Build the IOC application

PROD_IOC = sscan_ex
# sscan_ex.dbd will be created and installed
DBD += sscan_ex.dbd

# sscan_ex.dbd will be made up from these files:
sscan_ex_DBD += base.dbd

# Include dbd files from all support applications:
sscan_ex_DBD += sscanSupport.dbd
sscan_ex_DBD += sscanProgressSupport.dbd

# Add all the support libraries needed by this IOC
sscan_ex_LIBS += sscan scanProgress

# sscan_ex_registerRecordDeviceDriver.cpp derives from sscan_ex.dbd
sscan_ex_SRCS += sscan_ex_registerRecordDeviceDriver.cpp

# Build the main IOC entry point on workstation OSs.
sscan_ex_SRCS_DEFAULT += sscan_exMain.cpp
sscan_ex_SRCS_vxWorks += -nil-

# Add support from base/src/vxWorks if needed
#sscan_ex_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary

# Finally link to the EPICS Base libraries
sscan_ex_LIBS += $(EPICS_BASE_IOC_LIBS)

#===========================

include $(TOP)/configure/RULES
#----------------------------------------
#  ADD RULES AFTER THIS LINE

4) Load the database standardScans and saveData by the following lines in st.cmd:

dbLoadRecords("$(SSCAN)/sscanApp/Db/standardScans.db","P=SSCAN-EX:,MAXPTS1=2000,MAXPTS2=1000,MAXPTS3=1000,MAXPTS4=10,MAXPTSH=2000")
dbLoadRecords("$(SSCAN)/sscanApp/Db/saveData.db","P=SSCAN-EX:")
dbLoadRecords("$(SSCAN)/sscanApp/Db/scanProgress.db","P=SSCAN-EX:scanProgress:")

5) If you use autosave, include standardScans_settings.req and saveData_settings.req in your autosave request file:

file standardScans_settings.req P=$(P)
file saveData_settings.req P=$(P)

6) Tell saveData how to initialize by editing saveData.req, and place it in the ioc startup directory. Usually, the only part of this file that you modify is the one marked [extraPV]. In this section, enter the name of the PV you want saveData to include in each scan data file. If a PV is not explicitly annotated by its record's .DESC field, you can append your own description.

7) Initialize saveData by including the following line after iocInit in st.cmd:

saveData_Init("saveData.req", "P=xxx:")

8) Before running any scans, specify where saveData writes the scan data files. Open the medm display window, scan_saveData.adl and fill in the "File System" and "Subdirectory" fields. (Example: $(P)saveData_fileSystem and $(P)saveData_subDir for PV).

9) After the above steps are completed, switch to the top-level directory of this IOC and execute make.

10) Switch to the ioc startup directory and execute the startup script of the IOC program:

[root@main-machine iocsscan_ex]# ../../bin/linux-x86_64/sscan_ex st.cmd

Start result:

#!../../bin/linux-x86_64/sscan_ex
< envPaths
epicsEnvSet("IOC","iocsscan_ex")
epicsEnvSet("TOP","/usr/local/EPICS/exer/sscan_ex")
epicsEnvSet("SUPPORT","/usr/local/EPICS/synApps/support")
epicsEnvSet("ASYN","/usr/local/EPICS/synApps/support/asyn")
epicsEnvSet("SSCAN","/usr/local/EPICS/synApps/support/sscan")
epicsEnvSet("CALC","/usr/local/EPICS/synApps/support/calc")
epicsEnvSet("SNCSEQ","/usr/local/EPICS/synApps/support/seq")
epicsEnvSet("EPICS_BASE","/usr/local/EPICS/base")
cd "/usr/local/EPICS/exer/sscan_ex"
## Register all support components
dbLoadDatabase "dbd/sscan_ex.dbd"
sscan_ex_registerRecordDeviceDriver pdbbase
## Load record instances
#dbLoadRecords("db/xxx.db","user=blctrl")
dbLoadRecords("/usr/local/EPICS/synApps/support/sscan/sscanApp/Db/standardScans.db","P=SSCAN-EX:,MAXPTS1=2000,MAXPTS2=1000,MAXPTS3=1000,MAXPTS4=10,MAXPTSH=2000")
dbLoadRecords("/usr/local/EPICS/synApps/support/sscan/sscanApp/Db/saveData.db","P=SSCAN-EX:")
dbLoadRecords("/usr/local/EPICS/synApps/support/sscan/sscanApp/Db/scanProgress.db","P=SSCAN-EX:scanProgress:")
cd "/usr/local/EPICS/exer/sscan_ex/iocBoot/iocsscan_ex"
iocInit
Starting iocInit
############################################################################
## EPICS R7.0.3.1
## EPICS Base built Sep  8 2022
############################################################################
recDynLinkOut: waiting for CA context
recDynLinkOut: got CA context
iocRun: All initialization complete
## Start any sequence programs
#seq sncxxx,"user=blctrl"
epics> dbl
SSCAN-EX:scan1
...
SSCAN-EX:scanActive

11) Open the medm window for testing:

[blctrl@main-machine adls]$ medm -x -macro "P=SSCAN-EX:,S=scan1" scan_more.adl

The window that opens is as follows:

12) To test this scan, enter the locator PV name in Read and Driver in the above window, and specify the start position, end position and step size of the locator; enter the detector name in Detector.

 Click the SCAN button to start scanning, the results are as follows:

Guess you like

Origin blog.csdn.net/yuyuyuliang00/article/details/129996040