epics-modules / xxx

APS BCDA synApps module: xxx

Home Page:http://epics-modules.github.io/xxx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing HIGH_LIM specification in motors.iocsh

prjemian opened this issue · comments

When choosing a smaller MRES value than the default 0.01 in motorSim.substitutions, encountered that with MRES=1.0e-5, the high limit switch for a soft asynMotor was unexpectedly at 0.32.

{N, M, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, INIT}
{1, "m$(N)", 0, "motor $(N)", degrees, Pos, 1, .1, .2, 0, 1, .2, 0.01, 5, ""}

I note this is a coincidence with the values of HLM=32000 and MRES=1e-5.

This happens when using motorSim.iocsh from motorSim.iocsh:

#iocshLoad("$(MOTOR)/modules/motorMotorSim/iocsh/motorSim.iocsh", "INSTANCE=motorSim, HOME_POS=0, NUM_AXES=16, LOW_LIM=-32000, SUB=substitutions/motorSim.substitutions")

As noted elsewhere, the high limit switch value can be controlled by adding HIGH_LIM=32000, to motors.iocsh, such as with this sed patch:

sed -i s:'LOW_LIM=':'HIGH_LIM=32000, LOW_LIM=':g ./motors.iocsh

This change is not necessary since a default value of 32000 is supplied if HIGH_LIM is not defined:

root@poof:.../xxx-R6-2/iocBoot/iocxxx# more $MOTOR/iocsh/motorSim.iocsh
# ### motorSim.iocsh ###

#- ###################################################
#- PREFIX           - IOC Prefix
#- INSTANCE         - Instance name, used to create the low-level driver drvet name
#-                    Combined with the controller number to create the asyn port name
#-
#- SUB              - Optional: Subsitutions file (asyn_motor.db), Macros P, DTYP, PORT, 
#-                              DHLM, DLLM, and INIT will be predefined.
#-                    Default: $(MOTOR)/iocsh/EXAMPLE_motorSim.substitutions
#-
#- CONTROLLER       - Optional: Which controller is being configured
#-                    Default: 0
#-
#- NUM_AXES         - Optional: Number of axes on this controller
#-                    Default: 1
#-
#- LOW_LIM          - Optional: Low Limit
#-                    Default: -32000
#-
#- HIGH_LIM         - Optional: High Limit
#-                    Default: 32000
#- 
#- HOME_POS         - Optional: Home position
#-                    Default: 0
#- ###################################################

# Create simulated motors: ( start card , start axis , low limit, high limit, home posn, # cards, # axes to setup)
motorSimCreate($(CONTROLLER=0), 0, $(LOW_LIM=-32000), $(HIGH_LIM=32000), $(HOME_POS=0), 1, $(NUM_AXES=1))

# Setup the Asyn layer (portname, low-level driver drvet name, card, number of axes on card)
drvAsynMotorConfigure("$(INSTANCE)$(CONTROLLER=0)", "$(INSTANCE)", $(CONTROLLER=0), $(NUM_AXES=1))

dbLoadTemplate("$(SUB=$(MOTOR)/iocsh/EXAMPLE_motorSim.substitutions)", "P=$(PREFIX), DTYP='asynMotor', PORT=$(INSTANCE)$(CONTROLLER=0), DHLM=$(HIGH_LIM=32000), DLLM=$(LOW_LIM=-3
2000)")

What imposes the high limit switch value for this soft asynMotor?

The HIGH_LIM symbol is now in the substitutions file. Moved the second question to a new issue.