pcdshub / lcls-twincat-motion

TwinCAT 3 Motion Control Utilities - PLC Motion Library for all PCDS Applications
https://pcdshub.github.io/lcls-twincat-motion
Other
35 stars 20 forks source link

Brake Enable/Disable Delays #52

Open ZLLentz opened 4 years ago

ZLLentz commented 4 years ago

I've encountered the first instance of a brake signal disengaging the brake before the motor has a chance to enable. This causes the stage to slip down because the holding current is not applied in time to counteract the vacuum load. In all other instances so far the motor enable has been much faster, to the extent that the enable delay in the EL7041 was the only parameter that needed to be adjusted.

We will need to add settings where you can configure how long the PLC waits between noticing that it should engage/disengage and applying/removing the voltage.

These parameters would need to be picked empirically such that:

You would set these in parallel with the CoE parameters. I'm not sure if we need to provide drive enable/disable delays in the settings as well.

ZLLentz commented 4 years ago

It's possible that the timing desynchronization between the NC process and the PLC process is very closely linked to the timing here, in which case we'll need to keep that in mind too and always delay with respect to the NC process. In the stage I'm using right now it completes the brake disengage and move about 1/4 of the time, which implies that sometimes the brake signal is sufficiently delayed by the 8ms difference between the two cycle times.

ZLLentz commented 4 years ago

Another approach may be looking for a better way to delay the move start so we do this in stages:

  1. Send enable
  2. Read enable (directly check the terminal current?)
  3. Delay
  4. No brake
  5. Delay
  6. Trigger move
  7. Move done
  8. Delay
  9. Yes brake
  10. Delay
  11. Send disable
  12. DMOV

It would also help to properly reset the setpoint once the brake is engaged so that the motor isn't trying to move before the move request.