Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TC/TC-IOC-01App/Db/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ include $(TOP)/configure/CONFIG
DB += single_axis.db
DB += axis_monitors.db
DB += autoonoff.db
DB += velo_monitor.db

#----------------------------------------------------
# If <anyname>.db template is not named <anyname>*.template add
Expand Down
8 changes: 8 additions & 0 deletions TC/TC-IOC-01App/Db/axis_monitors.db
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
21 changes: 21 additions & 0 deletions TC/TC-IOC-01App/Db/velo_monitor.db
Original file line number Diff line number Diff line change
@@ -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")
}
4 changes: 4 additions & 0 deletions TC/TC-IOC-01App/src/build.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions TC/configure/RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions TC/iocBoot/iocTC-IOC-01/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
<macro name="MTRCTRL" pattern="^[0-9]{1,2}$" description="Controller number used in motor address assignment" hasDefault="NO"/>
<macro name="PLC_VERSION" pattern="^[1]$" description="The PLC version to communicate with: 0 for the old ISIS code (now removed) and 1 for new collaboration code" defaultValue="1" hasDefault="YES" />
<macro name="FORWARD_DESC" pattern="^1|0$" description="Whether to poll and forward axis description to .DESC" hasDefault="YES" defaultValue="0" />
<macro name="FORWARD_VELO" pattern="^1|0$" description="Whether to poll and forward axis velocities to motor record" hasDefault="YES" defaultValue="0" />
<macro name="FORWARD_UNITS" pattern="^1|0$" description="Whether to poll and forward axis units to motor record" hasDefault="YES" defaultValue="0" />
<macro name="ALLOW_FROZEN_OFFSETS" pattern="^1|0$" description="Whether to allow frozen offset behaviour" hasDefault="YES" defaultValue="0" />
<macro name="ENABLE_AUTO_ON_OFF" pattern="^1|0$" description="Enable PVs for setting auto energising by controller" defaultValue="0" hasDefault="YES" />
<macro name="ENABLE_HOMING_PVS" pattern="^1|0$" description="Enable PVs for getting/setting homing configuration" defaultValue="0" hasDefault="YES" />
</macros>
</config_part>
</ioc_config>
23 changes: 22 additions & 1 deletion TC/iocBoot/iocTC-IOC-01/st-common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"}

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down