|
Size: 28635
Comment:
|
Size: 28647
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 31: | Line 31: |
| - A typical Acromag chassis can easily draw more than 1 amperes from the power supply, therefore '''the wires' gauge should be at least 16AWG.''' | - A typical Acromag module draws ~ 0.1A. Based on the number of modules to be installed choose wires that can handle the expected total amount of current.''' |
Slow Controls Upgrade Procedure
Updated Mar 2019 Jon Richardson
Updated Jul 2019 gautam
Hardware
Auxiliary DAQ Modules
The new auxiliary DAQ systems use the Acromag XT series DIN-rail mounted ADC, DAC and BIO modules. The model numbers are in the format XTYYY1, where "XT" is a static prefix, "YYY" determines the function, and the "1" as the last digit denotes the ModBus/TCP version of the model. The 1 at the end is important, as the other variations will not be able to interface with CDS through EPICS.
Module |
Function |
# Channels |
Notes |
Manual |
XT1111 |
BIO |
16 |
Sinking outputs |
|
XT1121 |
BIO |
16 |
Sourcing outputs |
|
XT1221 |
ADC |
8 |
Differential inputs |
|
XT1541 |
DAC |
8 |
4 sourcing output BIO channels |
Rackmount Chassis
The Acromag units are mounted on a DIN rail inside a custom 6U rackmount chassis. To mount the DIN rails two screw holes need be drilled on each side of the Acromag chassis. The Din rails are then screwed to the sides using spacers as shown below. A 24 V DC power source connected through the rear of the chassis provides power for the Acromag units. A second 15 V DC source connected in the same way provides the excitation source for Acromag outputs. Note that the XT1121 model can get the excitation voltage only from the terminals so additional wiring is needed.
A diagram of the internal chassis wiring is shown below. Note:
- Although not shown in the diagram, all the LEDs should be connected in series to 1kOhm resistors in order to work properly.
- A typical Acromag module draws ~ 0.1A. Based on the number of modules to be installed choose wires that can handle the expected total amount of current.
The Acromag modules communicate with a central host computer on a local network. The computer runs an EPICS IOC which interfaces with the Acromag modules via Modbus/TCP and hosts the EPICS records for analog and binary auxiliary channels. For these systems, we've chosen to use Supermicro SYS-5017A-EP 1U rackmount servers, which have two Ethernet interfaces. Two network interfaces are necessary for creating a closed local network between Acromag modules and host.
The following has proven to work with Debian 8 (x64) on a Supermicro SYS-5017A-EP. Setting up the machine initially requires a local monitor, keyboard, and mouse connection. Once networking and remote access have been set up, the remaining steps can be carried out remotely. Before beginning to install the OS, you need to give the machine a hard drive and some RAM. See this elog for some pics of where these go. Hostname: same as the old system. For testing purposes, you may want to append a numeral to the old hostname (e.g. c1susaux1) to permit the existing machine to run while the new one is being bench-tested. Username: Optional: lightweight desktop environment Hard-disk partitioning: During the install, the installer will ask you about the default network interface to use (since the SuperMicro has 2 network cards). Choose eth0. Note that attempting to set up a DHCP connection to the internet for the installation process, you will have to plug into the correct physical ethernet jack - eth0 is the one on the left, with the SuperMicro seen from the rear. Also be sure to plug into the general-computing network switch, not the martian network switch. The static IP setup can be done later. Give Assign the host machine an available IP address on the martian network, 192.168.113.<XXX> See here for the list of in-use addresses Register the host machine in the Add the following line to /var/lib/bind/martian.hosts Search the file to make sure Add the following line to /var/lib/bind/rev.113.168.192.in-addr.arpa Edit /etc/network/interfaces as follows Add the following lines to /etc/resolv.conf. Comment out all of the existing lines. Set up incoming SSH access (second line is critical, check status of the ssh service using sudo service ssh status): Add the following line to /etc/fstab
Initial configuration via USB is required before the units can be used on the network. This requires: Configuration Utilities: 9500465D.zip The above zip file contains the setup executable to install the configuration software for all different modules. Depending on the module, a different version of the utility needs to be launched after install. In each screen in the utilities, parameters can be read (get) from or written (send) to the Acromag devices. During operation, the to-be-configured device needs to be powered by a 12-32V DC voltage source, either through the designated blue plug-in terminal on the bottom, or the clip-on dock on the rail. It is a good idea to "sanitize" used Acromagas before configuring them.
The primary screen of the configuration utilities looks identical for all models: Once the device is connected to the host via USB and the correct application has been launched, it will appear in the drop-down menu. On the right, the device IP and other network parameters can be set. Every host machine of the auxiliary DAQ acts as a node between the martian network and a local subnet to which the Acromag modules belong and which is not directly accessible from other machines on the martian network. Hostname Local IP C1XXX-ADC[DAC,BIO]YY 192.168.114.xxx
The second screen varies by module type. Non-default options are circled.
For reasons discussed in elog 14495, the new Acromag systems cannot be reliably run using the modbus executable on the network drive. It should be installed locally. The following installation instructions are largely copied from an earlier note by Andrew Wade. There are three packages needed to get modbus over TCP/IP (Acromags) working with an EPICS IOC process: the EPICS base and two modules that extend its function, asyn and modbus. The latest modbus package and its required modules must be downloaded from the official source. Now we need to add some environment variables so the Add the following lines to /home/controls/.bashrc For asyn, open the file /opt/epics/modules/asyn/configure/RELEASE and comment out the lines for For modbus, open the file /opt/epics/modules/modbus/configure/RELEASE and change the Add the following line to /home/controls/.bashrc
The EPICS binary modbusApp which launches the EPICS IOCs for the auxiliary DAQ system requires a .cmd instruction file which sets up the communication between the Acromag units and the EPICS IOC. The .cmd file is placed in /cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.cmd. It is largely similar to other EPICS binaries which launch an IOC, such as softIOC, with the addition that it can load the appropriate drivers for the modbus protocol prior to launching the IOC. The file header consists of path definitions. At the current time there are no system variables pointing to these paths globally set, so the paths are explicitly defined. Each Acromag unit requires a set of three instructions which define the driver and Modbus parameters for the handshake during communication.
A generic example sequence would be Note that the default values for the last instruction differ between the different XT DAQ modules. ADC Module XT1221: DAC (+4x BIO) Module XT1541: BIO Modules XT1111 & XT1121: After loading the drivers and setting up the modbus communication, the .cmd file instructs to load EPICS database files, just like other EPICS IOC starters. Like the .cmd file, the database files are located in /cvs/cds/caltech/target/<HOSTNAME>.
Note: Modbus/TCP is simply a protocol for sending commands via TCP that the XT units can interpret, as in read/write the correct register values to/from the channels. There may be multiple ways to define the channels have the same effect. The settings reported here have been found to work as intended. A good resource for some example/template ways of representing various types of EPICS channels in modbus parlance is given in the modbus installation itself. If you followed the instructions on this page and installed a local copy of EPICS, you may find the example files in /opt/epics/modules/modbus/modbusApp/Db. Otherwise, go look in the modbusApp/Db directory wherever you installed it. The examples are The EPICS records in the .db files for the different DAQ channels are defined as follows (only fields relevant for proper addressing and conversion are shown): For both binary input and output: Ch <X> 1x<Y> 0 0 0x1 1 0 0x2 2 0 0x4 3 0 0x8 4 1 0x1 5 1 0x2 6 1 0x4 7 1 0x8 8 2 0x1 9 2 0x2 10 2 0x4 11 2 0x8 12 3 0x1 13 3 0x2 14 3 0x4 15 3 0x8 The above mapping can be used for the mbboDirect record type as well. This datatype basically maps multiple hardware BIO channels into a "BIT"/control word. An important specifier is the EPICS variable
Now we'll set up the modbus IOC as a system service managed by the kernel. This allows the process to be automatically started on boot and restarted on failures. Also, during maintenance, the IOC can easily be stopped and started via simple command-line calls. Create a new file /etc/systemd/system/modbusIOC.service with the following content. The field Create an environment file /cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.env with the following content. Any environment variables, including PATH, must be supplied through this file, as systemd does not have access to the bash shell environment.
Sometimes, there are auxiliary scripts that need to be run on the Supermicro machines that interface with Acromags. For example, the interlock code on the vacuum system, or the latch logic for the CM and IMC servo boards. For this, it may be that you need to (locally) access some EPICS channels using, for example, ezca in python. In order to get the relevant python3 packages installed, the following steps are required: Add the following line to /etc/apt/sources.list.d/lscsoft.list Then, you can setup the python script to run as a systemd service as was done for the modbusIOC.
Host Computer
Set-Up Instructions
Configure Host Machine
controls $ su
$ usermod -aG sudo controls
$ exit
Log out and log back in for the change to take effect.
<HOSTNAME> is a placeholder for the assigned hostname $ ssh -X 192.168.113.104
<HOSTNAME> A 192.168.113.<XXX>
<XXX> PTR <HOSTNAME>
Restart the DNS server and log off $ sudo service bind9 restart
$ logout
allow-hotplug eth0
iface eth0 inet static
address 192.168.113.<XXX>
netmask 255.255.255.0
gateway 192.168.113.2
dns-nameservers 192.168.113.104 131.215.125.1 131.215.139.100
dns-search martian
allow-hotplug eth1
iface eth1 inet static
address 192.168.114.<YYY>
netmask 255.255.255.0
search martian
nameserver 192.168.113.104
$ su
$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ exit
Configure IP tables to allow outgoing connections, while keeping the subnet invisible from the outside $ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ sudo iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
$ sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
EPICS_CA_AUTO_ADDR_LIST=NO
EPICS_CA_ADDR_LIST=192.168.114.<YYY>
Load the changes into the bash shell $ source /home/controls/.bashrc
$ sudo /etc/init.d/networking restart
$ sudo apt update
$ sudo apt upgrade
$ sudo apt update
$ sudo apt -y install openssh-client
$ sudo apt -y install openssh-server
$ sudo apt -y install xrdp
$ sudo apt -y install nfs-common
$ sudo mkdir /cvs/
$ sudo mkdir /cvs/cds
chiara:/home/cds /cvs/cds nfs rw,bg,nfsvers=3
Mount the network drive $ sudo mount -a
Configure Acromag DAQ Modules
Network Configuration
I/O Configuration
Install Modbus
make process knows where to look for and put things. $ sudo apt -y install curl g++ make libperl-dev libreadline-dev wget
export EPICS_HOST_ARCH=linux-x86_64
export EPICS_ROOT=/opt/epics
export EPICS_BASE=${EPICS_ROOT}/base
export EPICS_BASE_BIN=${EPICS_BASE}/bin/${EPICS_HOST_ARCH}
export EPICS_BASE_LIB=${EPICS_BASE}/lib/${EPICS_HOST_ARCH}Then load the changes into the bash shell $ source /home/controls/.bashrc
$ cd /home/controls/Downloads
$ wget https://epics.anl.gov/download/base/base-7.0.1.1.tar.gz
$ wget https://epics.anl.gov/download/modules/asyn4-33.tar.gz
$ wget https://github.com/epics-modules/modbus/archive/R2-11.tar.gz -O modbus-R2-11.tar.gz
$ sudo mkdir /opt/epics
$ sudo mkdir /opt/epics/modules
$ sudo tar xvzf base-7.0.1.1.tar.gz -C /opt/epics/
$ sudo tar xvzf asyn4-33.tar.gz -C /opt/epics/modules/
$ sudo tar xvzf modbus-R2-11.tar.gz -C /opt/epics/modules/
$ sudo ln -s /opt/epics/base-7.0.1.1 /opt/epics/base
$ sudo ln -s /opt/epics/modules/asyn4-33 /opt/epics/modules/asyn
$ sudo ln -s /opt/epics/modules/modbus-R2-11 /opt/epics/modules/modbus
#RELEASE Location of external products
SUPPORT=/opt/epics/modules
-include $(TOP)/../configure/SUPPORT.$(EPICS_HOST_ARCH)
# IPAC is only necessary if support for Greensprings IP488 is required
# IPAC release V2-7 or later is required.
#IPAC=$(SUPPORT)/ipac-2-14
# SEQ is required for testIPServer
#SNCSEQ=$(SUPPORT)/seq-2-2-4
# EPICS_BASE 3.14.6 or later is required
EPICS_BASE=/opt/epics/base
-include $(TOP)/../configure/EPICS_BASE.$(EPICS_HOST_ARCH)
#RELEASE Location of external products
# Run "gnumake clean uninstall install" in the application
# top directory each time this file is changed.
#
# NOTE: The build does not check dependancies on files
# external to this application. Thus you should run
# "gnumake clean uninstall install" in the top directory
# each time EPICS_BASE, SNCSEQ, or any other external
# module defined in the RELEASE file is rebuilt.
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
SUPPORT=/opt/epics/modules
-include $(TOP)/../configure/SUPPORT.$(EPICS_HOST_ARCH)
ASYN=$(SUPPORT)/asyn
# If you don't want to install into $(TOP) then
# define INSTALL_LOCATION_APP here
#INSTALL_LOCATION_APP=<fullpathname>
# EPICS_BASE usually appears last so other apps can override stuff:
EPICS_BASE=/opt/epics/base
-include $(TOP)/../configure/EPICS_BASE.$(EPICS_HOST_ARCH)
#Capfast users may need the following definitions
#CAPFAST_TEMPLATES=
#SCH2EDIF_PATH=
$ cd /opt/epics/base
$ sudo make
Next build the asyn module $ cd /opt/epics/modules/asyn
$ sudo make
Finally build the modbus module $ cd /opt/epics/modules/modbus
$ sudo make
export PATH=/opt/epics/base/bin/linux-x86_64:/opt/epics/extensions/bin/linux-x86_64:/opt/epics/modules/modbus/bin/linux-x86_64:/opt/epics/modules/asyn/bin/linux-x86_64:$PATH
Load the changes into the bash shell $ source /home/controls/.bashrc
Configure Modbus Driver
epicsEnvSet("IOC", "c1<HOSTNAME>_iocconfig") # insert proper hostname
epicsEnvSet("ARCH","linux-x86_64")
epicsEnvSet("TOP","/opt/epics/modules/modbus")
epicsEnvSet("MDBTOP","$(TOP)")
dbLoadDatabase("$(MDBTOP)/dbd/modbus.dbd")
modbus_registerRecordDeviceDriver(pdbbase)drvAsynIPPortConfigure(const char *portName, # user-defined: used for subsequent referencing,
const char *hostInfo, # format: "IP-Address:Port". Standard port for Modbus is 502
unsigned int priority, #
int noAutoConnect, #
int noProcessEos); #
modbusInterposeConfig(const char *portName, # reference to portName created with drvAsynIPPortConfigure command
modbusLinkType linkType, #
int timeoutMsec, # define timeout for waiting for response from unit
int writeDelayMsec) #
drvModbusAsynConfigure(portName, # used by channel definitions in .db file to reference this unit)
tcpPortName, # reference to portName created with drvAsynIPPortConfigure command
slaveAddress, #
modbusFunction, # defines driver function for the unit (read register = 4, write register = 6, write single coil = 5) - see examples in next section
modbusStartAddress, # ADC and binary channel numbering starts with 0, DAC channel numbering with 1
modbusLength, # length in dataType units - see examples in next section
dataType, # 4 = 16-bit signed integers (for A/D and D/A), 0 = binary (for BIO, duh)
pollMsec, # how frequently to request a value in [ms]
plcType); #Examples
drvAsynIPPortConfigure("<TCP_PORT_NAME>","<UNIT_IP_ADDRESS>:502",0,0,1)
modbusInterposeConfig("<TCP_PORT_NAME>",0,5000,0)
drvModbusAsynConfigure("<PORT_NAME>","<TCP_PORT_NAME>",0,<modbusFunction>,<modbusStartAddress>,<modbusLength>,<dataType>,<pollMsec>,"Acromag")drvAsynIPPortConfigure("c1susaux_adc00","192.168.115.20:502",0,0,1)
modbusInterposeConfig("c1susaux_adc00",0,5000,0)
drvModbusAsynConfigure("C1SUSAUX_ADC00","c1susaux_adc00",0,4,0,8,4,32,"Acromag")drvAsynIPPortConfigure("c1susaux_dac00","192.168.115.40:502",0,0,1)
modbusInterposeConfig("c1susaux_dac00",0,5000,0)
drvModbusAsynConfigure("C1SUSAUX_DAC00","c1susaux_dac00",0,6,1,8,4,1,"Acromag")
drvModbusAsynConfigure("C1SUSAUX_DAC00_BIO","c1susaux_dac00",0,5,0,4,0,1,"Acromag") # Separate instruction for integrated BIO channelsdrvAsynIPPortConfigure("c1susaux_bio00","192.168.115.60:502",0,0,1)
modbusInterposeConfig("c1susaux_bio00",0,5000,0)
drvModbusAsynConfigure("C1SUSAUX_BIO00","c1susaux_bio00",0,6,0,4,0,1,"Acromag")dbLoadDatabase("/cvs/cds/caltech/target/<HOSTNAME>/<SUBSYSTEM>.db")Define EPICS channels
record(ai,"C1:<CHANNEL_NAME>")
{
field(DTYP,"asynInt32")
field(INP, "@asynMask(<PORT_NAME> <X> -16)MODBUS_DATA") # <X>: 0-7 physical channel on Acromag unit
field(LINR,"LINEAR") # For count to float conversion: The ADC module converts +/-10V inputs to +/-30,000 counts (if legacy support is disabled, +/- 20,000 counts otherwise)
field(ALSO,"1.09225") # Rescales the raw counts from +/-30,000 to +/-32,767 BEFORE applying the linear conversion
field(EGUF,"10") # Corresponds to +32767 after rescale
field(EGUL,"-10") # Corresponds to -32767 after rescale
}record(ao,"C1:<CHANNEL_NAME>")
{
field(DTYP,"asynInt32")
field(OUT, "@asynMask(<PORT_NAME>, <X>, -16)MODBUS_DATA") # <X>: 0-7 physical channel on Acromag unit
field(LINR,"LINEAR") # For count to float conversion: The DAC module converts +/-10V outputs to +/-30,000 counts (if legacy support is disabled, +/- 20,000 counts otherwise)
field(EGUF,"10") # Corresponds to +32767 in the above scale
field(EGUL,"-10") # Corresponds to -32767 in the above scale
field(ALSO,"1.09225") # Finally rescales the raw counts from +/-32,767 to +/-30,000
}
'''XT1541 BIO Channels:'''
record(bo, "<CHANNEL_NAME>")
{
field(DTYP,"asynInt32")
field(OUT,"@asynMask(<PORT_NAME>, <X>, -16)MODBUS_DATA")
}record(bo, "C1:<CHANNEL_NAME>")
{
field(DTYP,"asynUInt32Digital")
field(OUT,"@asynMask(<PORT_NAME>, <X>, 0x<Y>)") # <X>: 0-3 <Y>: 1,2,4,or 8
}Note: The addressing scheme used to map the physical BIO channels to the above <X>, <Y> notation is as follows:
grecord(mbboDirect,"C1:LSC-CM_BOOST2_BITS")
{
field(DESC,"AO gain bits")
field(DTYP,"asynUInt32Digital")
field(OUT,"@asynMask(C1ISCAUX_BIO03 0 0x8)")
field(NOBT,"2")
# field(PHAS,"5")
# field(SCAN,".1 second")
field(OMSL,"closed_loop")
field(DOL,"C1:LSC-CM_BOOST2_SET")
field(PINI,"YES")
}Channel Calibrations
Final Scripting
<HOSTNAME> is a placeholder for the system name. $ sudo apt -y install procserv
[Unit]
Description=ModbusIOC Service via procServ
Requires=network.target
After=syslog.target network.target
ConditionFileIsExecutable=/usr/bin/procServ
ConditionFileIsExecutable=/opt/epics/modules/modbus/bin/linux-x86_64/modbusApp
ConditionFileIsExecutable=/cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.cmd
[Service]
User=controls
Group=controls
WorkingDirectory=/cvs/cds/caltech/target/<HOSTNAME>
# Set environment variables for EPICS
EnvironmentFile=/cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.env
# First line enables logging to local file for debugging. The logfile tends to grow large when there are problems. Use second line for normal operation.
#ExecStart=/usr/bin/procServ -f -L /cvs/cds/caltech/target/<HOSTNAME>/modbusIOC.log -p /run/modbusioc.pid 8008 /opt/epics/modules/modbus/bin/linux-x86_64/modbusApp /cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.cmd
ExecStart=/usr/bin/procServ -f -p /run/modbusioc.pid 8008 /opt/epics/modules/modbus/bin/linux-x86_64/modbusApp /cvs/cds/caltech/target/<HOSTNAME>/<HOSTNAME>.cmd
Restart=always
RestartSec=30
KillMode=process
[Install]
WantedBy=multi-user.target
export PATH=/opt/epics/base/bin/linux-x86_64:/opt/epics/extensions/bin/linux-x86_64:/opt/epics/modules/modbus/bin/linux-x86_64:/opt/epics/modules/asyn/bin/linux-x86_64:$PATH
$ sudo systemctl enable modbusIOC.service
$ sudo systemctl start modbusIOC.service
Optional: installation of CDS Workstation tools
deb http://software.ligo.org/lscsoft/debian/ jessie contrib
$ sudo apt-get update --allow-insecure-repositories
$ sudo apt-get -y --force-yes install lscsoft-archive-keyring
$ wget -c http://apt.ligo-wa.caltech.edu/debian/pool/jessie-unstable/cdssoft-release-jessie/cdssoft-release-jessie_1.3.3_all.deb
$ sudo dpkg -i cdssoft-release-jessie_1.3.3_all.deb
$ sudo apt update
$ sudo apt install cds-workstation
