epics-modules / xxx

APS BCDA synApps module: xxx
http://epics-modules.github.io/xxx
Other
5 stars 6 forks source link

Missing HIGH_LIM specification in motors.iocsh #46

Closed prjemian closed 1 year ago

prjemian commented 3 years ago

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. https://github.com/epics-modules/xxx/blob/bbe1efc10095898839d8d240ba3a0cb9bb22e1b7/iocBoot/iocxxx/substitutions/motorSim.substitutions#L4-L5

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: https://github.com/epics-modules/xxx/blob/bbe1efc10095898839d8d240ba3a0cb9bb22e1b7/iocBoot/iocxxx/examples/motors.iocsh#L6

prjemian commented 3 years ago

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
prjemian commented 3 years ago

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)")
prjemian commented 3 years ago

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

prjemian commented 1 year ago

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