diff --git a/TC/TC-IOC-01App/Db/Makefile b/TC/TC-IOC-01App/Db/Makefile index c8ac22675..6b0db4521 100644 --- a/TC/TC-IOC-01App/Db/Makefile +++ b/TC/TC-IOC-01App/Db/Makefile @@ -13,6 +13,7 @@ include $(TOP)/configure/CONFIG DB += single_axis.db DB += axis_monitors.db DB += autoonoff.db +DB += velo_monitor.db #---------------------------------------------------- # If .db template is not named *.template add diff --git a/TC/TC-IOC-01App/Db/axis_monitors.db b/TC/TC-IOC-01App/Db/axis_monitors.db index bdbc4e1fe..e77fe531f 100644 --- a/TC/TC-IOC-01App/Db/axis_monitors.db +++ b/TC/TC-IOC-01App/Db/axis_monitors.db @@ -23,6 +23,14 @@ record(stringout, "$(P)MOT:$(MOTOR_PV):DESC_SEND") field(OMSL, "closed_loop") } +record(stringout, "$(P)MOT:$(MOTOR_PV):UNITS_SEND") +{ + field(DESC, "Forward axis units to mtr rec") + field(DOL, "$(P)$(I):ASTAXES_$(AXIS_NUM):STDESC-SUNITS CP") + field(OUT, "$(P)MOT:$(MOTOR_PV).EGU") + field(OMSL, "closed_loop") +} + record(longin, "$(P)MOT:$(MOTOR_PV)_AXIS_NUM") { field(DESC, "Beckhoff axis number") diff --git a/TC/TC-IOC-01App/Db/velo_monitor.db b/TC/TC-IOC-01App/Db/velo_monitor.db new file mode 100644 index 000000000..ed6e32608 --- /dev/null +++ b/TC/TC-IOC-01App/Db/velo_monitor.db @@ -0,0 +1,21 @@ +# DB to forward velocities from the beckhoff to the motor record. +# This was previously removed in https://github.com/ISISComputingGroup/EPICS-ioc/commit/7b9360a00f855225a5be585981c8d36b12af6d5c due to +# issues where the beckhoff would sometimes set velocity to zero and then this code would forward it and prevent moves. +# ISIS Beckhoffs before IMAT's recomission in 2026 still run the problematic code, so this is conditionally loaded by the IOC based on the FORWARD_VELO macro. + +record(dfanout, "$(P)MOT:$(MOTOR_PV):VELO_SEND") +{ + field(DESC, "Forward device velo SP to mtr rec") + field(DOL, "$(P)$(I):ASTAXES_$(AXIS_NUM):STCONTROL-FVELOCITY:RBV CP") + field(OUTA, "$(P)MOT:$(MOTOR_PV).VMAX") + field(OUTB, "$(P)MOT:$(MOTOR_PV).VELO") + field(OMSL, "closed_loop") +} + +record(dfanout, "$(P)MOT:$(MOTOR_PV):JVEL_SEND") +{ + field(DESC, "Forward device jog velo SP to mtr rec") + field(DOL, "$(P)$(I):ASTAXES_$(AXIS_NUM):STCONTROL-FJOGVELOCITY:RBV CP") + field(OMSL, "closed_loop") + field(OUTA, "$(P)MOT:$(MOTOR_PV).JVEL") +} diff --git a/TC/TC-IOC-01App/src/build.mak b/TC/TC-IOC-01App/src/build.mak index 3e350e875..d32cf7b66 100644 --- a/TC/TC-IOC-01App/src/build.mak +++ b/TC/TC-IOC-01App/src/build.mak @@ -38,6 +38,8 @@ $(APPNAME)_DBD += adsMotorSupport.dbd $(APPNAME)_DBD += luaSupport.dbd $(APPNAME)_DBD += asubFunctions.dbd $(APPNAME)_DBD += ads.dbd +$(APPNAME)_DBD += sampleChanger.dbd + # Add all the support libraries needed by this IOC @@ -67,6 +69,8 @@ $(APPNAME)_LIBS += utilities pugixml libjson zlib $(APPNAME)_LIBS += calc sscan $(APPNAME)_LIBS += pcrecpp pcre $(APPNAME)_LIBS += seq pv +$(APPNAME)_LIBS += sampleChanger +$(APPNAME)_LIBS += TinyXML # TC-IOC-01_registerRecordDeviceDriver.cpp derives from TC-IOC-01.dbd $(APPNAME)_SRCS += $(APPNAME)_registerRecordDeviceDriver.cpp diff --git a/TC/configure/RELEASE b/TC/configure/RELEASE index 485ca5e10..ee86275e4 100644 --- a/TC/configure/RELEASE +++ b/TC/configure/RELEASE @@ -72,6 +72,8 @@ SSCAN=$(SUPPORT)/sscan/master STREAMDEVICE=$(SUPPORT)/StreamDevice/master UTILITIES=$(SUPPORT)/utilities/master ZLIB=$(SUPPORT)/zlib/master +SAMPLECHANGER=$(SUPPORT)/sampleChanger/master +TINYXML=$(SUPPORT)/TinyXML/master # optional extra local definitions here -include $(TOP)/configure/RELEASE.private diff --git a/TC/iocBoot/iocTC-IOC-01/config.xml b/TC/iocBoot/iocTC-IOC-01/config.xml index 6bded790a..8f532ee2e 100644 --- a/TC/iocBoot/iocTC-IOC-01/config.xml +++ b/TC/iocBoot/iocTC-IOC-01/config.xml @@ -9,8 +9,11 @@ + + + diff --git a/TC/iocBoot/iocTC-IOC-01/st-common.lua b/TC/iocBoot/iocTC-IOC-01/st-common.lua index 36582690e..9b05bb0a0 100644 --- a/TC/iocBoot/iocTC-IOC-01/st-common.lua +++ b/TC/iocBoot/iocTC-IOC-01/st-common.lua @@ -10,8 +10,11 @@ function twincat_stcommon_main() local plc_version = ibex_utils.getMacroValue{macro="PLC_VERSION", default="1"} local ads_port = ibex_utils.getMacroValue{macro="ADS_PORT"} local forward_desc = ibex_utils.getMacroValue{macro="FORWARD_DESC", default="0"} + local forward_velo = ibex_utils.getMacroValue{macro="FORWARD_VELO", default="0"} + local forward_units = ibex_utils.getMacroValue{macro="FORWARD_UNITS", default="0"} local enable_frozen_offsets = ibex_utils.getMacroValue{macro="ALLOW_FROZEN_OFFSETS", default="0"} local enable_auto_on_off = ibex_utils.getMacroValue{macro="ENABLE_AUTO_ON_OFF", default="0"} + local enable_homing = ibex_utils.getMacroValue{macro="ENABLE_HOMING_PVS", default="0"} asyn_port = ibex_utils.getMacroValue{macro="PORT"} @@ -39,11 +42,22 @@ function twincat_stcommon_main() iocsh.dbLoadRecords("$(MOTOREXT)/db/desc_tc.db", desc_tc_args) end + + if forward_units == "1" then + local units_tc_args = string.format("P=%s,AXIS_NUM=%s,ADSPORT=%s,PORT=%s", ioc_prefix, axis_num, ads_port, asyn_port) + iocsh.dbLoadRecords("$(MOTOREXT)/db/units_tc.db", units_tc_args) + end + if enable_frozen_offsets == "1" then local frozen_offsets_db_args = string.format("P=%s,AXIS_NUM=%s,ADSPORT=%s,PORT=%s", ioc_prefix, axis_num, ads_port, asyn_port) iocsh.dbLoadRecords("$(MOTOREXT)/db/frozen_offsets.db", frozen_offsets_db_args) end + if enable_homing == "1" then + local homing_pvs_db_args = string.format("P=%s,AXIS_NUM=%s,ADSPORT=%s,PORT=%s", ioc_prefix, axis_num, ads_port, asyn_port) + iocsh.dbLoadRecords("$(MOTOREXT)/db/homing_tc.db", homing_pvs_db_args) + end + motor_pv = string.format("MTR%02i%02i", mtrctrl, axis_num) if enable_auto_on_off == "1" then @@ -65,8 +79,15 @@ function twincat_stcommon_main() axis_monitors = "$(TOP)/db/axis_monitors.db" axis_monitors_args = string.format("P=%s,I=%s,AXIS_NUM=%s,MOTOR_PV=%s", pv_prefix, ioc_name, axis_num, motor_pv) iocsh.dbLoadRecords(axis_monitors, axis_monitors_args) + + if forward_velo == "1" then + local forward_velo_args = string.format("P=%s,I=%s,AXIS_NUM=%s,MOTOR_PV=%s", pv_prefix, ioc_name, axis_num, motor_pv) + iocsh.dbLoadRecords("$(TOP)/db/velo_monitor.db", forward_velo_args) + end + autosave_file:write(string.format("file \"motor_settings.req\" P=%s, M=MOT:%s\n", pv_prefix, motor_pv)) - -- wrap around to next MTRCTRL - this is so we can show >8 axes in the IBEX table of motors. + -- wrap around to next MTRCTRL and alias - this is so we can show >8 axes in the IBEX table of motors. + -- for example, MTR0109 is also aliased to MTR0201, MTR0110 is aliased to MTR0202, etc. if axis_num > 8 then alias_args_orig = string.format("$(MYPVPREFIX)MOT:%s(.*)", motor_pv) alias_args_aliased = string.format("$(MYPVPREFIX)MOT:MTR%02i%02i\\1", ((axis_num-1)//8) + mtrctrl, (axis_num-1)%8 + 1)