Galil EPICS Driver Baseline Documentation

1 Install OS

1.1 Install Linux VM

2 Building EPICS base

2.1 Acquire and unpack EPICS source

2.2 Set environment variables

2.3 Install g++

2.4 Disable command-line editing and history in iocsh

2.5 Build the base

2.6 Permanently set path to EPICS base

3 Testing EPICS base (optional)

3.1 Build an example IOC.

3.2 Build Channel Access Host Example (optional)

3.3 Test EPICS utilities

4 Build asynDriver

4.1 Acquire and unpack asynDriver source

4.2 Modify RELEASE file

4.3 Build Asyn

5 Build Motor Record

5.1 Acquire and unpack Motor Record source

5.2 Edit config/RELEASE

5.3 Edit motorApp/Makefile

5.4 Build Motor Record

6 Install GalilTools library

7 Build Galil Epics Driver Baseline

7.1 Acquire source (from Galil intranet)

7.2 Edit config/MASTER_RELEASE if using path other than ~/epics/

7.3 Build Galil Epics Driver Baseline

8 Configure IP address and number of axes

9 Run Galil EPICS Driver Baseline IOC

9.1 Run st.cmd

10 Description of Process Variables

11 Interact with the Galil IOC server with caput, caget, and camonitor

11.1 Multiple Network Interface Cards

12 Helpful Motor Record Fields

13 Moving motors from Galil EPICS Baseline

13.1 Point-to-point moves

13.2 Jogging

13.3 Homing

14 Running DMC code, epics.dmc

15 Array Access

15.1 Disabling Array Access

15.2 Galil 4.2

16 Extending Galil EPICS driver baseline

16.1 Adding functionality through epics[] array

16.2 Adding epics[] Array Elements

 

Galil would like to thank Dr. Mark Clift for his consultation on this EPICS project. This motor record driver is derived from his original work. mark.clift@synchrotron.org.au

1 Install OS

1.1 Install Linux VM

Tested with Oracle VM VirtualBox 4.3.6 and ubuntu-12.04.4-desktop-amd64.iso,

https://www.virtualbox.org/

http://releases.ubuntu.com/12.04/ubuntu-12.04.4-desktop-amd64.iso.

 

The user name user was used in this installation. Please substitute the correct user name where necessary throughout this documentation.

 

This example builds EPICS in the user home directory. For final installations, a more permanent directory such as /usr/local or /opt may be more desirable.

2 Building EPICS base

2.1 Acquire and unpack EPICS source

user@user-epics:~$ mkdir epics

user@user-epics:~$ cd epics

user@user-epics:~/epics$ pwd

/home/user/epics

user@user-epics:~/epics$ wget http://www.aps.anl.gov/epics/download/base/baseR3.14.12.4.tar.gz

 

user@user-epics:~/epics$ tar -xf baseR3.14.12.4.tar.gz

2.2 Set environment variables

user@user-epics:~/epics$ cd base-3.14.12.4/startup/

user@user-epics:~/epics/base-3.14.12.4/startup$ export EPICS_HOST_ARCH=$(./EpicsHostArch.pl)

user@user-epics:~/epics/base-3.14.12.4/startup$ printenv EPICS_HOST_ARCH

linux-x86_64

For this installation,  linux-x86_64 is the EPICS host architecture as returned from the perl script EpicsHostArch.pl. Substitute the correct host architecture as necessary throughout this documentation.

2.3 Install g++

user@user-epics:~/epics/base-3.14.12.4$ sudo apt-get install g++

[sudo] password for user:

2.4 Disable command-line editing and history in iocsh

Comment out all COMMANDLINE_LIBRARY declarations in file CONFIG_SITE.Common.linux-x86_64

Skipping this step may result in a failed build.

user@user-epics:~/epics/base-3.14.12.4/configure/os$ grep COMMANDLINE_LIBRARY CONFIG_SITE.Common.linux-x86_64

#COMMANDLINE_LIBRARY = READLINE

#COMMANDLINE_LIBRARY = READLINE_NCURSES

#COMMANDLINE_LIBRARY = READLINE_CURSES

2.5 Build the base

Remove all files and directories from the previous build.

user@user-epics:~/epics/base-3.14.12.4$ make clean uninstall

Run make.

user@user-epics:~/epics/base-3.14.12.4$ make

2.6 Permanently set path to EPICS base

user@user-epics:~$ gedit ~/.bashrc

Add the following line to the end and save.

export PATH=~/epics/base-3.14.12.4/bin/linux-x86_64:$PATH

Open new terminals to invoke changes.

3 Testing EPICS base (optional)

3.1 Build an example IOC.

This step will create an example IOC to test the EPICS base and useful utilities in steps 3.2 and 3.3.

3.1.1 Make example IOC

user@user-epics:~/epics$ ls

base-3.14.12.4  baseR3.14.12.4.tar.gz

user@user-epics:~/epics$ echo $EPICS_HOST_ARCH

linux-x86_64

user@user-epics:~/epics$ mkdir test

user@user-epics:~/epics$ cd test

user@user-epics:~/epics/test$ ../base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -t example myexample

user@user-epics:~/epics/test$ ../base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -i -t example myexample

Using target architecture linux-x86_64 (only one available)

The following applications are available:

    myexample

What application should the IOC(s) boot?

The default uses the IOC's name, even if not listed above.

Application name?

user@user-epics:~/epics/test$ ls

configure  iocBoot  Makefile  myexampleApp

user@user-epics:~/epics/test$ make

 

user@user-epics:~/epics/test$ ls

bin  configure  db  dbd  include  iocBoot  lib  Makefile  myexampleApp

3.1.2 Run example IOC

user@user-epics:~/epics/test$ cd iocBoot/iocmyexample/

user@user-epics:~/epics/test/iocBoot/iocmyexample$ ../../bin/linux-x86_64/myexample st.cmd

#!../../bin/linux-x86_64/myexample

## You may have to change myexample to something else

## everywhere it appears in this file

< envPaths

epicsEnvSet("ARCH","linux-x86_64")

epicsEnvSet("IOC","iocmyexample")

epicsEnvSet("TOP","/home/user/epics/test")

epicsEnvSet("EPICS_BASE","/home/user/epics/test/../base-3.14.12.4")

cd /home/user/epics/test

## Register all support components

dbLoadDatabase "dbd/myexample.dbd"

myexample_registerRecordDeviceDriver pdbbase

## Load record instances

dbLoadTemplate "db/userHost.substitutions"

dbLoadRecords "db/dbSubExample.db", "user=userHost"

## Set this to see messages from mySub

#var mySubDebug 1

## Run this to trace the stages of iocInit

#traceIocInit

cd /home/user/epics/test/iocBoot/iocmyexample

iocInit

Starting iocInit

############################################################################

## EPICS R3.14.12.4 $Date: Mon 2013-12-16 15:51:45 -0600$

## EPICS Base built Feb 26 2014

############################################################################

iocRun: All initialization complete

## Start any sequence programs

#seq sncExample, "user=userHost"

epics>

3.1.3 Send dbl to the IOC

epics> dbl

userHost:ai1

userHost:ai2

userHost:ai3

userHost:aiExample

userHost:aiExample1

userHost:aiExample2

userHost:aiExample3

userHost:aSubExample

userHost:calc1

userHost:calc2

userHost:calc3

userHost:calcExample

userHost:calcExample1

userHost:calcExample2

userHost:calcExample3

userHost:compressExample

userHost:subExample

userHost:xxxExample

epics>

exit will exit the EPICS server. However, for now, leave the server running for the next example.

3.2 Build Channel Access Host Example (optional)

This example will be used to interface to the example IOC above.

3.2.1 Set environment variables

In addition to the running EPICS server, open a new terminal prompt.

user@user-epics:~$ export EPICS_HOST_ARCH=linux-x86_64

user@user-epics:~$ echo $EPICS_HOST_ARCH

linux-x86_64

user@user-epics:~$

3.2.2 Make Channel Access Host Example

user@user-epics:~/epics$ ls

base-3.14.12.4  baseR3.14.12.4.tar.gz  test

user@user-epics:~/epics$ mkdir caClient

user@user-epics:~/epics$ cd caClient/

user@user-epics:~/epics/caClient$ ~/epics/base-3.14.12.4/bin/linux-x86_64/makeBaseApp.pl -t caClient caClient

user@user-epics:~/epics/caClient$ ls

caClientApp  configure  Makefile

user@user-epics:~/epics/caClient$ make

3.2.3 Run Channel Access Example

Choose a record name from the response of dbl in the EPICS IOC server. Note the value from calc1 below is variable.

user@user-epics:~/epics/caClient$ ./bin/linux-x86_64/caExample userHost:calc1

userHost:calc1 4.000000

user@user-epics:~/epics/caClient$

3.3 Test EPICS utilities

3.3.1 Set environment variable

If step 3.2 was completed, that terminal window can be used and this step can be skipped. Otherwise, open a new terminal window, in addition to the running IOC server.

user@user-epics:~$ export PATH=$PATH:~/epics/base-3.14.12.4/bin/linux-x86_64/

3.3.2 Use Channel Access Utilities

Choose record name userHost:xxxExample from the response of dbl in the EPICS IOC server.

user@user-epics:~$ caget userHost:xxxExample

userHost:xxxExample             0

user@user-epics:~$ caput userHost:xxxExample 123

Old : userHost:xxxExample             0

New : userHost:xxxExample             123

user@user-epics:~$ caget userHost:xxxExample

userHost:xxxExample             123

user@user-epics:~$

 

userHost:calc1 in the test IOC loops slowly from 0 through 9 to simulate a changing value.

user@user-epics:~$ cainfo userHost:calc1

userHost:calc1

    State:            connected

    Host:             10.0.2.15:5064

    Access:           read, write

    Native data type: DBF_DOUBLE

    Request type:     DBR_DOUBLE

    Element count:    1

user@user-epics:~$ camonitor userHost:calc1

userHost:calc1                  2014-02-27 14:30:45.654270 6 HIGH MINOR

userHost:calc1                  2014-02-27 14:30:46.654298 7 HIGH MINOR

userHost:calc1                  2014-02-27 14:30:47.654239 8 HIHI MAJOR

userHost:calc1                  2014-02-27 14:30:48.654278 9 HIHI MAJOR

userHost:calc1                  2014-02-27 14:30:49.654243 0 LOLO MAJOR

userHost:calc1                  2014-02-27 14:30:50.655309 1 LOLO MAJOR

^C

user@user-epics:~$

 

4 Build asynDriver

4.1 Acquire and unpack asynDriver source

user@user-epics:~/epics$ mkdir support

user@user-epics:~/epics$ cd support

user@user-epics:~/epics/support$ mkdir asyn

user@user-epics:~/epics/support$ cd asyn

user@user-epics:~/epics/support/asyn$ wget http://www.aps.anl.gov/epics/download/modules/asyn4-22.tar.gz

 

user@user-epics:~/epics/support/asyn$ tar -xf asyn4-22.tar.gz

4.2 Modify RELEASE file

user@user-epics:~/epics/support/asyn/asyn4-22/configure$ gedit RELEASE &

Edit the following defines

4.3 Build Asyn

user@user-epics:~/epics/support/asyn/asyn4-22/configure$ cd ..

user@user-epics:~/epics/support/asyn/asyn4-22$ make

5 Build Motor Record

5.1 Acquire and unpack Motor Record source

user@user-epics:~/epics/support$ mkdir motor

user@user-epics:~/epics/support$ cd motor

user@user-epics:~/epics/support/motor$ wget http://www.aps.anl.gov/bcda/synApps/motor/tar/motorR6-8.tar.gz

 

user@user-epics:~/epics/support/motor$ tar -xf motorR6-8.tar.gz

5.2 Edit config/RELEASE

user@user-epics:~/epics/support/motor$ cd motorR6-8/

user@user-epics:~/epics/support/motor/motorR6-8$ gedit configure/RELEASE &

Edit the following defines:

5.3 Edit motorApp/Makefile

user@user-epics:~/epics/support/motor/motorR6-8$ gedit motorApp/Makefile &

Edit the following defines:

Comment out the following lines (all motor definitions and MX) with a #

DIRS += DeltaTauSrc

DeltaTauSrc_DEPEND_DIRS = MotorSrc

DIRS += OmsSrc

OmsSrc_DEPEND_DIRS   = MotorSrc

DIRS += SoftMotorSrc

SoftMotorSrc_DEPEND_DIRS = MotorSrc

DIRS += OmsAsynSrc

OmsAsynSrc_DEPEND_DIRS   = MotorSrc

DIRS += MotorSimSrc

MotorSimSrc_DEPEND_DIRS = MotorSrc

DIRS += NewportSrc

NewportSrc_DEPEND_DIRS = MotorSrc

DIRS += ImsSrc

ImsSrc_DEPEND_DIRS = MotorSrc

DIRS += AcsSrc

AcsSrc_DEPEND_DIRS = MotorSrc

DIRS += MclennanSrc

MclennanSrc_DEPEND_DIRS = MotorSrc

DIRS += PiSrc

PiSrc_DEPEND_DIRS = MotorSrc

DIRS += PIGCS2Src

PIGCS2Src_DEPEND_DIRS = MotorSrc

DIRS += MicroMoSrc

MicroMoSrc_DEPEND_DIRS = MotorSrc

DIRS += MicosSrc

MicosSrc_DEPEND_DIRS = MotorSrc

DIRS += FaulhaberSrc

FaulhaberSrc_DEPEND_DIRS = MotorSrc

DIRS += PC6KSrc

PC6KSrc_DEPEND_DIRS = MotorSrc

DIRS += NewFocusSrc

NewFocusSrc_DEPEND_DIRS = MotorSrc

DIRS += AcsTech80Src

AcsTech80Src_DEPEND_DIRS = MotorSrc

DIRS += OrielSrc

OrielSrc_DEPEND_DIRS = MotorSrc

DIRS += ThorLabsSrc

ThorLabsSrc_DEPEND_DIRS = MotorSrc

DIRS += SmartMotorSrc

SmartMotorSrc_DEPEND_DIRS = MotorSrc

DIRS += PiJenaSrc

PiJenaSrc_DEPEND_DIRS = MotorSrc

DIRS += KohzuSrc

KohzuSrc_DEPEND_DIRS = MotorSrc

DIRS += AttocubeSrc

AttocubeSrc_DEPEND_DIRS = MotorSrc

DIRS += AerotechSrc

AerotechSrc_DEPEND_DIRS = MotorSrc

DIRS += HytecSrc

HytecSrc_DEPEND_DIRS = MotorSrc

DIRS += ACRSrc

ACRSrc_DEPEND_DIRS = MotorSrc

DIRS += SmarActMCSSrc

SmarActMCSSrc_DEPEND_DIRS = MotorSrc

DIRS += NPointSrc

NPointSrc_DEPEND_DIRS = MotorSrc

ifdef MX

DIRS += MXmotorSrc

endif

5.4 Build Motor Record

Remove all files and directories from the previous build.

user@user-epics:~/epics/support/motor/motorR6-8$ make clean uninstall

Run make.

user@user-epics:~/epics/support/motor/motorR6-8$ make

6 Install GalilTools library

user@user-epics:~$ wget http://www.galil.com/support/downloads/software/galiltools/linux/galiltools_1.6.3_amd64.deb

 

user@user-epics:~$ sudo dpkg -i galiltools_1.6.3_amd64.deb

[sudo] password for user:

7 Build Galil Epics Driver Baseline

7.1 Acquire source (from Galil intranet)

7.1.1 Install Subversion

user@user-epics:~$ sudo apt-get install subversion

 

user@user-epics:~/epics$ mkdir ioc

user@user-epics:~/epics$ cd ioc

user@user-epics:~/epics/ioc$ svn co svn://rd6/epics/galil

user@user-epics:~/epics/ioc$ cd galil/

user@user-epics:~/epics/ioc/galil$ ls

config  configure  documentation  GalilSup  GalilTestApp  iocBoot  Makefile

7.2 Edit config/MASTER_RELEASE if using path other than  ~/epics/

user@user-epics:~/epics/ioc/galil$ gedit config/MASTER_RELEASE &

The following lists the whole file.

SUPPORT=~/epics/support

EPICS_BASE=~/epics/base-3.14.12.4

ASYN=$(SUPPORT)/asyn/asyn4-22

MOTOR=$(SUPPORT)/motor/motorR6-8

GALIL=~/epics/ioc/galil

7.3 Build Galil Epics Driver Baseline

user@user-epics:~/epics/ioc/galil$ make clean uninstall

 

user@user-epics:~/epics/ioc/galil$ make

8 Configure IP address and number of axes

The IP address is set in galil.cmd in the GalilCreateController() call.

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ gedit galil.cmd

To change the number of axes, update, in galil.cmd, the numAxes argument in GalilCreateController(), comment out the GalilCreateAxis() call for each unsupported axis, and comment out the unsupported axis lines in galil_motor.substitutions.

user@user-epics:~/epics/ioc/galil/GalilTestApp/Db$ gedit galil_motor.substitutions

For test purposes, an 8 axis driver can be used with a lower-count controller. Just avoid the motor record PVs for those axes.

9 Run Galil EPICS Driver Baseline IOC

9.1 Run st.cmd

user@user-epics:~$ cd epics/ioc/galil/iocBoot/iocGalil/

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ chmod +x st.cmd

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ ./st.cmd

At the EPICS prompt, type dbl to list process variables.

############################################################################

## EPICS R3.14.12.4 $Date: Mon 2013-12-16 15:51:45 -0600$

## EPICS Base built Feb 26 2014

############################################################################

iocRun: All initialization complete

epics> dbl

galil01:TIME

galil01:epics[1]get

galil01:epics[2]get

galil01:epics[3]get

galil01:epics[4]get

galil01:epics[5]get

galil01:epics[6]get

galil01:epics[7]get

galil01:epics[1]put

galil01:epics[2]put

galil01:epics[3]put

galil01:epics[4]put

galil01:epics[5]put

galil01:epics[6]put

galil01:epics[7]put

galil01:A

galil01:B

galil01:C

galil01:D

galil01:E

galil01:F

galil01:G

galil01:H

epics>  

Leave this window running. This is the Galil EPICS IOC server.

10 Description of Process Variables

Process Variable

Description

galil01:TIME

Galil TIME operand. Loaded in epics.dmc into epics[0]

galil01:epics[1]get

Galil epics[] read access

galil01:epics[2]get

Galil epics[] read access

galil01:epics[3]get

Galil epics[] read access

galil01:epics[4]get

Galil epics[] read access

galil01:epics[5]get

Galil epics[] read access

galil01:epics[6]get

Galil epics[] read access

galil01:epics[7]get

Galil epics[] read access

galil01:epics[1]put

Galil epics[] write access

galil01:epics[2]put

Galil epics[] write access

galil01:epics[3]put

Galil epics[] write access

galil01:epics[4]put

Galil epics[] write access

galil01:epics[5]put

Galil epics[] write access

galil01:epics[6]put

Galil epics[] write access

galil01:epics[7]put

Galil epics[] write access

galil01:A

Axis A motor record

galil01:B

Axis B motor record

galil01:C

Axis C motor record

galil01:D

Axis D motor record

galil01:E

Axis E motor record

galil01:F

Axis F motor record

galil01:G

Axis G motor record

galil01:H

Axis H motor record

 

11 Interact with the Galil IOC server with caput, caget, and camonitor

Open a new terminal.

user@user-epics:~$ caget galil01:epics[7]get

galil01:epics[7]get            0

From a Galil terminal (E.G. GalilTools), change the value of array element epics[7]

:epics[7]=3.14

:

Check it again with caget.

user@user-epics:~$ caget  galil01:epics[7]get

galil01:epics[7]get            3.14

Now set the value with caput.

user@user-epics:~$ caput  galil01:epics[7]put 2.7183

Old : galil01:epics[7]put            0

New : galil01:epics[7]put            2.7183

And check it from the Galil terminal.

:epics[7]=?

2.7183

:

Now run a monitor.

user@user-epics:~$ camonitor  galil01:epics[7]get

galil01:epics[7]get            2014-03-21 15:52:11.138887 2.7183  

From the Galil terminal, change the value a few times.

:epics[7]=2

:epics[7]=3

:epics[7]=5

:epics[7]=7

:epics[7]=11

:

As the value is changed, the EPICS monitor prints the change.

galil01:epics[7]get            2014-03-21 15:52:49.139644 2  

galil01:epics[7]get            2014-03-21 15:52:52.140042 3  

galil01:epics[7]get            2014-03-21 15:52:54.138563 5  

galil01:epics[7]get            2014-03-21 15:52:57.139673 7  

galil01:epics[7]get            2014-03-21 15:52:59.138488 11  

11.1 Multiple Network Interface Cards

The following shows an error possibly seen when dual NIC cards are present, and the same PC hosts the server and the client.

user@user-epics:~$ caget galil01:epics[7]get

galil01:epics[7]get                   3.14

CA.Client.Exception...............................................

    Warning: "Identical process variable names on multiple servers"

    Context: "Channel: "galil01:epics[7]get", Connecting to: 10.0.2.15:5064, Ignored: user-epics.local:5064"

    Source File: ../cac.cpp line 1298

    Current Time: Fri Mar 21 2014 15:14:18.256590842

..................................................................

user@user-epics:~$

To prevent this error, environment variables can be used to tell the channel access client which IP address to use to connect to the server.

user@user-epics:~$ export EPICS_CA_AUTO_ADDR_LIST=NO

user@user-epics:~$ export EPICS_CA_ADDR_LIST=192.168.0.234

user@user-epics:~$ caget galil01:epics[7]get

caget galil01:epics[7]get             3.14

user@user-epics:~$

12 Helpful Motor Record Fields

See EPICS documentation for more detail. http://www.aps.anl.gov/bcda/synApps/motor/R6-8/motorRecord.html#Fields

Field

Description

Data type

Access

Default, see galil_motor.substitutions

 

ACCL

Acceleration, Deceleration specified in seconds. Duration of the accel/decel region.

Double

R/W

1

ATHM

At home. State of HM input.

Short

R

 

DHLM

Dial High Limit. Essentially a soft forward end of travel.

Double

R/W

2147483647

DLLM

Dial Low Limit. Essentially a soft reverse end of travel.

Double

R/W

-2147483648

DMOV

Motion complete Boolean. 1 = finished; 0 = moving.

Uses motion complete bit from data record.

Short

R

N/A

EGU

Engineering units. Galil baseline normalized to counts/steps.

String

R/W

cts

ERES

Encoder step size in EGU

Double

R/W

0

HOMF

Home Forward. Set to 1 to initiate home.1

Short

R/W

0

HOMR

Home Reverse.  Set to 1 to initiate home.

Short

R/W

0

HVEL

Homing velocity.

Double

R/W

VELO

ICOF

Integral Gain (KI normalized). Valid range; 0.0 <= ICOF <= 1.0

Double

R/W

0

JAR

Jog Acceleration (EGU/s/s).

Double

R/W

VELO / ACCL

JOGF

Jog motor forward.  Set to 1 to initiate jog forward.

Short

R/W

0

JOGR

Jog motor reverse.  Set to 1 to initiate jog reverse.

Short

R/W

0

JVEL

Jog Velocity.

Double

R/W

VELO

MRES

Motor step size (EGU)

Double

R/W

1

PCOF

Proportional Gain

Double

R/W

0

REP

Raw Encoder Position

Double

R

N/A

RMP

Raw Motor Position. The contents of the hardware's step-count register. Maps to Galil TD.

Double

R

N/A

STOP

Stop motion. Set to 1 to initiate stop (ST)

Short

R/W

N/A

VAL

Desired position. Will call a PA/PR to move the motor.

Double

R/W

0

VELO

Velocity (EGU/s)

Double

R/W

25000

VMAX

Max Velocity (EGU/s)

Double

R/W

3000000

13 Moving motors from Galil EPICS Baseline

13.1 Point-to-point moves

Command

Description

user@user-epics:~/epics/ioc/galil$ caget galil01:A.ACCL

galil01:A.ACCL                 1

user@user-epics:~/epics/ioc/galil$ caput galil01:A.ACCL 0.25

Old : galil01:A.ACCL                 1

New : galil01:A.ACCL                 0.25

Check and set acceleration in seconds for the acceleration and deceleration region.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.VELO

galil01:A.VELO                 25000

user@user-epics:~/epics/ioc/galil$ caput galil01:A.VELO 50000

Old : galil01:A.VELO                 25000

New : galil01:A.VELO                 50000

Check and set slew speed, EGU/s.

user@user-epics:~/epics/ioc/galil$ caput galil01:A 1000000

Old : galil01:A                      1

New : galil01:A                      1e+06

Profile a move to 1 million counts.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.DMOV

galil01:A.DMOV                 0

user@user-epics:~/epics/ioc/galil$ caget galil01:A.DMOV

galil01:A.DMOV                 0

user@user-epics:~/epics/ioc/galil$ caget galil01:A.DMOV

galil01:A.DMOV                 1

user@user-epics:~/epics/ioc/galil$

Motion complete boolean

user@user-epics:~/epics/ioc/galil$ caget galil01:A.REP

galil01:A.REP                  999975

Actual encoder position

user@user-epics:~/epics/ioc/galil$ caput galil01:A.ICOF 0.001

Old : galil01:A.ICOF                 0

New : galil01:A.ICOF                 0.001

Set normalized KI term. 0.001 equates to KIm=0.2559.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.REP

galil01:A.REP                  1000000

Actual encoder position. Note KI zeroed error.

13.2 Jogging

Command

Description

user@user-epics:~/epics/ioc/galil$ caget galil01:A.JAR

galil01:A.JAR                  25000

user@user-epics:~/epics/ioc/galil$ caput galil01:A.JAR 50000

Old : galil01:A.JAR                  25000

New : galil01:A.JAR                  50000

Check and set jog acceleration. Units are EGU/s/s.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.JVEL

galil01:A.JVEL                 25000

user@user-epics:~/epics/ioc/galil$ caput galil01:A.JVEL 50000

Check and set jog speed, EGU/s

user@user-epics:~$ caput galil01:A.JOGF 1

Old : galil01:A.JOGF                 0

New : galil01:A.JOGF                 1

Start forward jog.

user@user-epics:~/epics/ioc/galil$ caput galil01:A.STOP 1

Old : galil01:A.STOP                 0

New : galil01:A.STOP                 0

Stop jog.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.REP

galil01:A.REP                  2416656

Actual encoder position.

user@user-epics:~/epics/ioc/galil$ caput galil01:A.JOGR 1

Old : galil01:A.JOGR                 0

New : galil01:A.JOGR                 1

Start reverse jog.

user@user-epics:~/epics/ioc/galil$ caput galil01:A.STOP 1

Old : galil01:A.STOP                 0

New : galil01:A.STOP                 0

Stop jog.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.REP

galil01:A.REP                  -7173398

Actual encoder position.

13.3 Homing

Command

Description

user@user-epics:~/epics/ioc/galil$ caget galil01:A.HVEL

galil01:A.HVEL                 25000

user@user-epics:~/epics/ioc/galil$ caput galil01:A.HVEL 4000

Old : galil01:A.HVEL                 25000

New : galil01:A.HVEL                 4000

Check and set Homing velocity.

user@user-epics:~/epics/ioc/galil$ caput galil01:A.HOMF 1

Old : galil01:A.HOMF                 0

New : galil01:A.HOMF                 1

Start homing. Note HOMF is the same as HOMR. See CN,n1 for direction.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.ATHM

galil01:A.ATHM                 0

user@user-epics:~/epics/ioc/galil$ caget galil01:A.ATHM

galil01:A.ATHM                 1

Actual state of homing switch.

user@user-epics:~/epics/ioc/galil$ caget galil01:A.REPgalil01:A.REP                  0

Actual encoder position.

14 Running DMC code, epics.dmc

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ gedit galil.cmd

Note the line GalilStartController("Galil", "epics.dmc", "#epics")

This indicates that when the IOC starts, the file epics.dmc shall be downloaded and XQ#epics shall be called. Leaving the file path as a null string, “”, will prevent any program download. Leaving the label as a null string, “”, will prevent the XQ code execution.

Now look at epics.dmc.

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ gedit epics.dmc

The following is the entire file:

'Galil Motion Control epics@galil.com http://www.galil.com/

#epics

'Insert code to run on GalilStartController() here...

'include any motor initialization, etc.

SH

WT 100

DP*=0

XQ#update,1;'spawn update thread

EN

'

#update;'Example update loop

AT0

epics[0]=TIME;'time tick

AT200;'see SCAN field in galil_array_access.substitutions

JP#update

The user should put any code necessary to initialize the controller for the IOC in the #epics label. This may include tasks such as motor commutation, connection to Ethernet slaves, configuration of the controller such as SSI, BiSS, or sine/cosine interpolation, etc.

 

The example code spawns a thread at #update. This is explained in the next section.

15 Array Access

The Galil Epics Baseline includes read/write access to array epics[8]. The dimension of this array and access to it can be expanded, as described in the next section. Note that each element has a get process variable for caget-like reads, and a put process variable for caput-like writes. The process variable galil01:TIME is actually a read of epics[0] as updated in epics.dmc, #update loop. This process variable demonstrates how the array access feature allows eash extension with the following steps.

user@user-epics:~/epics/ioc/galil/GalilTestApp/Db$ gedit galil_array_access.substitutions

  1. 1.Edit the substitutions file fields for NAME, DESC, and SCAN. 

  2. 2.Comment out the write (or read) fields appropriately. 

  3. 3.Update epics.dmc to load any values that should be read, or to use any values that are written to the epics[] array. 

 

See the next section for some examples.

15.1 Disabling Array Access

EPICS access to epics[] can be prevented by editing galil.cmd.

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ gedit galil.cmd

Comment out the line

dbLoadTemplate("$(TOP)/GalilTestApp/Db/galil_array_access.substitutions")

 

To prevent GalilStartController() from creating epics[], change epics_array_dimension in GalilController.cpp to 0 and rebuild the Galil EPICS IOC. Also, epics.dmc should be changed to no longer make use of epics[].

15.2 Galil 4.2

Galil array elements are typed in Galil 4.2 format. This is a fixed-point number with 4 bytes of integer, and 2 bytes of fraction. In order to contain the full number range, Galil EPICS Baseline transacts Galil array elements as doubles. The precision (PREC) for displaying the numbers is set in the array access templates to display the entire number. The client may need to be told to honor the server-side precision display in the case where the full Galil 4.2 is not displayed. An example follows.

user@user-epics:~$ caput galil01:epics[1]put -2147483647.1234

Old : galil01:epics[1]put            -2.14748e+09

New : galil01:epics[1]put            -2.14748e+09

user@user-epics:~$ caget  galil01:epics[1]get

galil01:epics[1]get            -2.14748e+09

user@user-epics:~$ caget -s galil01:epics[1]get

galil01:epics[1]get            -2.1474836471234e+09

user@user-epics:~$

16 Extending Galil EPICS driver baseline

16.1 Adding functionality through epics[] array

The Galil array access feature allows the user to quickly extend the Galil EPICS baseline beyond the basic feature set. The following example will provide access to the A axis stop code and Galil's gearing feature.

16.1.1 Edit the substitutions file

user@user-epics:~/epics/ioc/galil/GalilTestApp/Db$ gedit galil_array_access.substitutions

Update part of the read section.

#Expose read access to Galil array epics[]

file "$(TOP)/GalilSup/Db/galil_array_read.template"

{

pattern

 {         P,    PORT, ADDR,          NAME,                                DESC, INDEX,       SCAN}

#{ "galil01", "Galil",    0, "epics[0]get", "Galil epics[0] array element read",     0, "1 second"}

 { "galil01", "Galil",    0, "TIME"       , "Galil TIME loaded in epics[0]"    ,     0, ".2 second"}

#{ "galil01", "Galil",    0, "epics[1]get", "Galil epics[1] array element read",     1, "1 second"}

 { "galil01", "Galil",    0, "SCA"        , "A axis Stop Code"                 ,     1, "1 second"}

#{ "galil01", "Galil",    0, "epics[2]get", "Galil epics[2] array element read",     2, "1 second"} s

and part of the write section...

#Expose write access to Galil array epics[]

file "$(TOP)/GalilSup/Db/galil_array_write.template"

{

pattern

 {         P,    PORT, ADDR,          NAME,                                 DESC, INDEX}

#{ "galil01", "Galil",    0, "epics[0]put", "Galil epics[0] array element write",     0}

#{ "galil01", "Galil",    0, "epics[1]put", "Galil epics[1] array element write",     1}

#{ "galil01", "Galil",    0, "epics[2]put", "Galil epics[2] array element write",     2}

 { "galil01", "Galil",    0, "GRB"        , "B axis gear ratio, slaved to A"    ,     2}

16.1.2 Edit epics.dmc

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ gedit epics.dmc

The following lists the entire file.

'Galil Motion Control epics@galil.com http://www.galil.com/

#epics

'Insert code to run on GalilStartController() here...

'include any motor initialization, etc.

SH

WT 100

DP*=0

GAB=CA;' gear B to commanded position of A

GMB=1;' turn on B axis strong gearing

GRB=1;' set a 1:1 gear ratio

epics[2]=_GRB;' save the current gear ratio

XQ#update,1;'spawn update thread

EN

'

#update;'Example update loop

AT0

epics[0]=TIME;'time tick

IF (epics[2] <> _GRB);'check for gear ratio change

 GRB=epics[2];' update the ratio

ENDIF

epics[1]=_SCA;'load A stop code

AT200;'see SCAN field in galil_array_access.substitutions

JP#update

16.1.3 Run the Galil IOC, and call dbl at the prompt

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ ./st.cmd

 

epics> dbl

galil01:SCA

galil01:TIME

galil01:epics[3]get

galil01:epics[4]get

galil01:epics[5]get

galil01:epics[6]get

galil01:epics[7]get

galil01:GRB

galil01:epics[3]put

galil01:epics[4]put

galil01:epics[5]put

galil01:epics[6]put

galil01:epics[7]put

galil01:A

galil01:B

galil01:C

galil01:D

galil01:E

galil01:F

galil01:G

galil01:H

epics>

16.1.4 Verify new features

Gearing

user@user-epics:~$ caget galil01:A.REP

galil01:A.REP                  0

user@user-epics:~$ caget galil01:B.REP

galil01:B.REP                  0

user@user-epics:~$ caput galil01:A 10000

Old : galil01:A                      0

New : galil01:A                      10000

user@user-epics:~$ caget galil01:A.REP

galil01:A.REP                  9931

user@user-epics:~$ caget galil01:B.REP

galil01:B.REP                  9963

user@user-epics:~$ caput galil01:A.ICOF 0.0005

Old : galil01:A.ICOF                 0

New : galil01:A.ICOF                 0.0005

user@user-epics:~$ caput galil01:B.ICOF 0.0005

Old : galil01:B.ICOF                 0

New : galil01:B.ICOF                 0.0005

user@user-epics:~$ caget galil01:A.REP

galil01:A.REP                  10000

user@user-epics:~$ caget galil01:B.REP

galil01:B.REP                  10000

user@user-epics:~$ caput galil01:GRB 0.5

Old : galil01:GRB                    0

New : galil01:GRB                    0.5

user@user-epics:~$ caput galil01:A 0

Old : galil01:A                      9930

New : galil01:A                      0

user@user-epics:~$ caget galil01:A.REP

galil01:A.REP                  0

user@user-epics:~$ caget galil01:B.REP

galil01:B.REP                  5000

user@user-epics:~$

Stop Code

user@user-epics:~$ caget galil01:SCA

galil01:SCA                    1

user@user-epics:~$ caput galil01:GRB 0

Old : galil01:GRB                    0.5

New : galil01:GRB                    0

user@user-epics:~$ caput galil01:A.HOMF 1

Old : galil01:A.HOMF                 0

New : galil01:A.HOMF                 1

user@user-epics:~$ caget galil01:SCA

galil01:SCA                    0

user@user-epics:~$ caget galil01:SCA

galil01:SCA                    10

user@user-epics:~$ caput galil01:A.JOGF 1

Old : galil01:A.JOGF                 0

New : galil01:A.JOGF                 1

user@user-epics:~$ caget galil01:SCA

galil01:SCA                    0

user@user-epics:~$ caput galil01:A.STOP 1

Old : galil01:A.STOP                 0

New : galil01:A.STOP                 0

user@user-epics:~$ caget galil01:SCA

galil01:SCA                    4

user@user-epics:~$

16.2 Adding epics[] Array Elements

For brevity of the process variable list, Galil EPICS baseline provides access to only 8 array elements. The access can be expanded arbitrarily, up to the number of array elements the controller provides. The following demonstrates how to add an array element.

16.2.1 Edit the substitutions file

user@user-epics:~/epics/ioc/galil/GalilTestApp/Db$ gedit galil_array_access.substitutions

Add a read element....

 { "galil01", "Galil",    0, "epics[8]get", "Galil epics[8] array element read",     8, "1 second"}

and a write element...

 { "galil01", "Galil",    0, "epics[8]put", "Galil epics[8] array element write",     8}

16.2.2 Add a name define and a class member to GalilController.h

Part of the define block at the top of the header file

#define GalilArray0String              "ARRAY0"

#define GalilArray1String              "ARRAY1"

#define GalilArray2String              "ARRAY2"

#define GalilArray3String              "ARRAY3"

#define GalilArray4String              "ARRAY4"

#define GalilArray5String              "ARRAY5"

#define GalilArray6String              "ARRAY6"

#define GalilArray7String              "ARRAY7"

#define GalilArray8String              "ARRAY8"

In the GalilController class declaration

  //add new array element here

  int GalilArray8_;

  #define LAST_GALIL_ARRAY_PARAM GalilArray8_

Note the #define value changes.

16.2.3 Update epics_array_dimension  in GalilController.cpp

static const int epics_array_dimension = 9; //epics[] array on Galil. Set to <=0 to prevent the array from being created.

16.2.4 Add a createParam() call to GalilController.cpp

Part of the define createParam() block

  createParam(GalilArray6String, asynParamFloat64, &GalilArray6_);

  createParam(GalilArray7String, asynParamFloat64, &GalilArray7_);

  createParam(GalilArray8String, asynParamFloat64, &GalilArray8_);

16.2.5 Rebuild

user@user-epics:~/epics/ioc/galil$ make clean uninstall

 

user@user-epics:~/epics/ioc/galil$ make

16.2.6 Run the Galil IOC, and call dbl at the prompt

user@user-epics:~/epics/ioc/galil/iocBoot/iocGalil$ ./st.cmd

 

epics> dbl

galil01:TIME

galil01:epics[1]get

galil01:epics[2]get

galil01:epics[3]get

galil01:epics[4]get

galil01:epics[5]get

galil01:epics[6]get

galil01:epics[7]get

galil01:epics[8]get

galil01:epics[1]put

galil01:epics[2]put

galil01:epics[3]put

galil01:epics[4]put

galil01:epics[5]put

galil01:epics[6]put

galil01:epics[7]put

galil01:epics[8]put

galil01:A

galil01:B

galil01:C

galil01:D

galil01:E

galil01:F

galil01:G

galil01:H

epics>

16.2.7 Verify new feature between console and Galil Terminal

:epics[8]=4321

:

user@user-epics:~/epics/ioc/galil$ caget galil01:epics[8]get

galil01:epics[8]get            4321

user@user-epics:~/epics/ioc/galil$ caput galil01:epics[8]put 9876

Old : galil01:epics[8]put            0

New : galil01:epics[8]put            9876

user@user-epics:~/epics/ioc/galil$

:epics[8]=?

 9876.0000

:

1The second argument of CN determines direction of home. HOMF and HOMR perform the same function.