#!../../bin/rhel6-x86_64/bcsSoft
#==============================================================
#
#  Abs:  Startup Script for Beam Containment
#
#  Name: st.cmd
#
#  Facility:  LCLS-II Beam Containment System
#
#  Auth: 22-Oct-2019, M. Dunning       (DUNNING)
#  Rev:  dd-mmm-yyyy, Reviewer's Name  (USERNAME)
#--------------------------------------------------------------
#  Mod:
#
#==============================================================

# Set environment variables
epicsEnvSet("IOC_NAME", "SIOC:SYS0:BC01")
epicsEnvSet("LOCATION", "LCLS")

# Load common startup script
# Note: same file works for linuxRT
< ../common/st.cmd.soft

# SOC Beckhoff #1
iocshLoad("$(TOP)/iocBoot/common/init_beckhoff_soc.iocsh", "BKH_PORT=BKH1,BKH_IP=soc-sys0-bc01,BKH_P=SOC:SYS0:BC01")
dbLoadRecords("db/bcs_soc_bc01.db", "P=SOC:SYS0:BC01,M=BKH1,LOC=L2KG01-21,IOC=$(IOC)")

# SOC Beckhoff #2
iocshLoad("$(TOP)/iocBoot/common/init_beckhoff_soc.iocsh", "BKH_PORT=BKH2,BKH_IP=soc-sys0-bc02,BKH_P=SOC:SYS0:BC02")
dbLoadRecords("db/bcs_soc_bc02.db", "P=SOC:SYS0:BC02,M=BKH2,LOC=B005-L13,IOC=$(IOC)")

# Restore PVs
# Note: must be in TOP of app
< iocBoot/common/init_restore.cmd.soft

# Start EPICS
iocInit()

# Start monitoring pvs
< iocBoot/common/restore.cmd.soft

# Initialize caPutLog
caPutLogInit("${EPICS_CA_PUT_LOG_ADDR}")

# End of script

