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

Add ACCS field with ACCU control #203

Merged
merged 11 commits into from
May 22, 2023
Merged

Conversation

kmpeters
Copy link
Member

Intended to be merged after #122

tboegi and others added 10 commits December 4, 2018 10:39
The problem:
When a user changes the velocity by writing to the VELO field,
but forgets to write to the ACCL field, the acceleration will
change and may be too high.
(Note: Many users are not aware of this side-effect).

Solution:
Introduce a field called ACCS, "Acceleration in seconds^2".

Once the field is written, the ACCL field is updated and the
acceleration is "locked".
It is locked for changes of VELO.
It can be be unlocked by writing to ACCL.

If the acceleration is locked (or not) is stored in the field ACCU,
which can be either "motorACCSused_Accl" or "motorACCSused_Accs".

And in this sense ACCU is not a lock, but just keeps track which
of the accelation fields ACCL or ACCS has been updated last, and
should be used in the next movement.
In any case an update to ACCS updated ACCL and the other way around.
Thanks to Mark Rivers for this nice idea.
When a database wants to use ACCS from the start, when the record is loaded
into the IOC, the init_record() function needs to look at it.
The new way is to set ACCS != 0.0 and ACCL == 0.0 and then ACCS takes over.
The compatible (call it old ?) way is to have ACCS == 0.0, and then ACCL
is used.
When the record is initialized, it could happen that the ACCS field
was not initalized at all.
Fix this:
- Introduce a new value for motorACCSused, motorACCSused_Undef.
  This is == 0, and temporally used until the record is initilized.
  Using 0 as Undef will allow a (mis-) use in e.g. CSS to make the ACCS
  field invisable, whe ACCU is 0
  (or not present at all in an older version of the motorRecord)
- At the end of check_speed_and_resolution() set ACCS and ACCU, if needed.
When the dbd file was loaded, EPICS base complained with

"Error initializing motor.ACCU initial Default"

Remove the 'initial("Default")' for the ACCU field.
Merge the master branch,
commit 891a66e,
into torsten/181203_1217_add_ACCS_field

Conflicts:
    motorApp/MotorSrc/motorRecord.dbd
The function accEGUfromVelo() returns acceleration in EGU,
but we need it expressed in steps.
Thanks to Kevin Peterson for noticing.
Correct this and divide by fabs(pmr->mres).
And while there, correct a typo in a comment
…cified when motor databases are loaded and is autosaved by default.
@kmpeters kmpeters merged commit 04a5ee7 into master May 22, 2023
@kmpeters kmpeters deleted the add_accs_field_with_accu_control branch May 22, 2023 16:49
@kmpeters kmpeters added this to the R7-3 milestone May 23, 2023
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

Successfully merging this pull request may close these issues.

2 participants