Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set the value of SREV correctly in motor record? #216

Open
1458861693 opened this issue Apr 22, 2024 · 5 comments
Open

How to set the value of SREV correctly in motor record? #216

1458861693 opened this issue Apr 22, 2024 · 5 comments

Comments

@1458861693
Copy link

1458861693 commented Apr 22, 2024

Hi, I have some doubts about the set of SREV in the description of "Motor Record and related software".
https://epics.anl.gov/bcda/synApps/motor/R7-3/motorRecord.html
For example, there is a motor, it's partial parameters are as follows.
fullstep: 0.004 degree
max velocity: 20 degree / sec
If I set 20 subdivisions, then the microstep will be 0.0002 degree. In this case, how to set SREV value?
Is 360°/0.0002° = 1800000?

Another question, what should be set for INIT field of motor record for Kohzu ARIES/LYNX Controller? Is necessary? I noticed some people have set this field to "AN", but I can't find the description about "AN". I am puzzled.

Thanks for your reply very much!

@kmpeters
Copy link
Member

The motor record keeps SREV and UREV consistent with MRES, but only MRES is used to calculate the positions, velocities and accelerations that are sent to the controller. For the example motor with an EGU of degrees, you could set MRES to 0.0002 degrees/step and ignore UREV and SREV. If you want UREV and SREV to be meaningful for users, you could use either of the following combinations:

  1. SREV = 1,800,000 & UREV = 360
  2. SREV = 5,000 & UREV = 1

The first approach is truer to the definitions of SREV & UREV, but I like the smaller numbers used by the 2nd approach.

The INIT only works for older, model-1 motor drivers (the ones that lack idle polling). It exists to allow sending a command to the controller at iocInit. There are also PREM and POST fields for sending command before and after moves.

I don't know what the AN command, which is controller-specific, does, so I can't say why someone put it in the INIT field.

@1458861693
Copy link
Author

Thanks for your reply firstly.
The above reply means that I only need to set MRES for motor resolution and I can ignore SREV & UREV?

Another question is about ERES & UEIP、RRES & URIP, especially RRES & URIP.
The value of ERES is set based on the actual encoder. But if there is no encoder, how should I set ERES & UEIP and RRES & URIP correctly.
On the contrary, if there is a encoder, how should I set ERES & UEIP and RRES & URIP correctly.

@kmpeters
Copy link
Member

kmpeters commented May 7, 2024

The above reply means that I only need to set MRES for motor resolution and I can ignore SREV & UREV?

Yes, that is correct.

Another question is about ERES & UEIP、RRES & URIP, especially RRES & URIP. The value of ERES is set based on the actual encoder. But if there is no encoder, how should I set ERES & UEIP and RRES & URIP correctly. On the contrary, if there is a encoder, how should I set ERES & UEIP and RRES & URIP correctly.

RRES is only used when URIP is Yes, which only works if the position of the motor is being read from another PV using the RDBL field. Note: RRES is a scaling factor between the PV specified in the RDBL field and the motor's DVAL. It is often the case that RRES should be set to 1.0.

ERES is only used when UEIP is Yes. This only works if the EPICS motor driver is querying the raw encoder position, REP, in addition to the raw motor position, RMP. The ERES should be the actual resolution of the encoder. Note: when UEIP is Yes and RTRY > 0, the motor record issues relative moves equal to the remaining position error for each move (and retry).

If there is no encoder, URIP and UEIP are set to No and the values of RRES and ERES don't matter.

@1458861693
Copy link
Author

OK, thanks very much for your reply.
I also want to know that if there is no encoder and UEIP & URIP is set to NO, will the readback value (i.e. RBV and DRBV) will change at real time? In my use(no encoder and UEIP & URIP is set to No), the RBV and DRBV value will only change when motor stop. It's a bit strange.
From the definition of RBV and DRBV, if UEIP and URIP is set to NO, the value of RBV and DRBV will be from the motor hardware, this means the RBV and DRBV value will be from the counts of motor controller pulses?
Looking forward to your reply.

@kmpeters
Copy link
Member

For most controllers the RBV and DRBV update during a move at the move poll frequency, even for motors with no encoders or motors with encoders that have UEIP and URIP set to No. The DRBV in this case is usually the theoretical position of the motor.

If the motor controller's move command blocks communication with the controller, it might not be possible for the driver to query the position while a move is in progress. It might also be the case that there are errors when polling the controller (unsupported commands or incorrect asyn terminators) that result in much slower polling than expected. One way to test for this is to lower the velocity and make a very long move. Does the RBV/DRBV update at all during the move?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants