Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-28910

Fix the Bug that Rotator Does not Stop Gently in Fault

    XMLWordPrintable

    Details

    • Story Points:
      2
    • Sprint:
      TSSW Sprint - Mar 29 - Apr 12
    • Team:
      Telescope and Site
    • Urgent?:
      No

      Description

      Fix the bug that rotator does not stop gently in Fault. The path generator in Simulink does generate a smooth curve to stop the rotator. However, the rotator does not follow this on summit.

      In the following figure, the purple line is the demand velocity and the blue line is the actual velocity. It is significant that they do not match with each other at the time around 10:17.

        Attachments

          Issue Links

            Activity

            Hide
            ttsai Te-Wei Tsai added a comment - - edited

            I suspected the problem comes from periodic_callback() in sys.c:

            if (sys->actuator->simulink_state == FaultState) {
                goal_state = DS402_STATE_SWITCH_ON_DISABLED;
            }
            

            This will call actuator_update() in actuator.c. In actuator_update(), the following two functions will be called: actuator_control_update() and drive_update_controlword(). In the drive_update_controlword(), the function ds402_sm_event() is called.

            In the ds402_sm_event(), the following function will be called: ds402_sm_enabled() in the Enabled state. If the goal state is DS402_STATE_SWITCH_ON_DISABLED, the following enum is used as the command: DS402_COMMAND_SHUTDOWN (6).

            Therefore, the time to enter the FaultState will decide the shutdown command of drive.

            Note:

            Another possibility is that the system does not enter the ControlledStopping_SubState actually.

            Show
            ttsai Te-Wei Tsai added a comment - - edited I suspected the problem comes from periodic_callback() in sys.c : if (sys->actuator->simulink_state == FaultState) { goal_state = DS402_STATE_SWITCH_ON_DISABLED; } This will call  actuator_update() in actuator.c . In actuator_update() , the following two functions will be called: actuator_control_update() and drive_update_controlword() . In the drive_update_controlword() , the function ds402_sm_event() is called. In the ds402_sm_event() , the following function will be called: ds402_sm_enabled() in the Enabled state. If the goal state is DS402_STATE_SWITCH_ON_DISABLED , the following enum is used as the command: DS402_COMMAND_SHUTDOWN (6). Therefore, the time to enter the FaultState  will decide the shutdown command of drive. Note: Another possibility is that the system does not enter the ControlledStopping_SubState actually.
            Hide
            ttsai Te-Wei Tsai added a comment - - edited

            It looks like the system does not enter the ControlledStopping (3) substate. In the following figure, the StateCommands_errorCheck = 1 is issued at time = 1.6 sec. But the EnabledSubState is still the MovingPt2Pt_SubState (1). In addition, the Fault state should not happen at 1.6 sec but after that actually (need to wait the ControlledStopping (3) substate.

            Show
            ttsai Te-Wei Tsai added a comment - - edited It looks like the system does not enter the ControlledStopping  (3) substate. In the following figure, the StateCommands_errorCheck = 1 is issued at time = 1.6 sec. But the EnabledSubState  is still the  MovingPt2Pt_SubState  (1). In addition, the Fault  state should not happen at 1.6 sec but after that actually (need to wait the ControlledStopping (3) substate.
            Hide
            ttsai Te-Wei Tsai added a comment - - edited

            Transition to the FaultState from the EnabledState.Stationary. This will go through the ControlledStopping substate. However, the path generator is still continue the calculation:

            It looks like the calculation of path generator will be reset after re-entering the EnabledState:

            The weird position angle between time=2.8 to 3.2 should come from the problematic plant model. This is the same as the time=0.4 to 0.8.

            Test to transition to FaultState again in EnabledState.Stationary:

             

            Because the Tekniker will replace all the path generator, I decided not to do the further modification of control algorithm. 

            Show
            ttsai Te-Wei Tsai added a comment - - edited Transition to the FaultState  from the EnabledState.Stationary . This will go through the ControlledStopping  substate. However, the path generator is still continue the calculation: It looks like the calculation of path generator will be reset after re-entering the EnabledState : The weird position angle between time=2.8 to 3.2 should come from the problematic plant model. This is the same as the time=0.4 to 0.8. Test to transition to FaultState again in EnabledState.Stationary :   Because the Tekniker will replace all the path generator, I decided not to do the further modification of control algorithm. 
            Hide
            ttsai Te-Wei Tsai added a comment -

            Simplify the low-level code to transition to the Fault state. It looks like the original developer want to stop the rotator's motion gently when the interlock is opened. However, the original state machine was not in this case. In addition, the interlock should cut off the power of actuators. Therefore, I removed the ControlledStopping intention when the interlock is opened. 

            Show
            ttsai Te-Wei Tsai added a comment - Simplify the low-level code to transition to the Fault state. It looks like the original developer want to stop the rotator's motion gently when the interlock is opened. However, the original state machine was not in this case. In addition, the interlock should cut off the power of actuators. Therefore, I removed the ControlledStopping intention when the interlock is opened. 
            Show
            ttsai Te-Wei Tsai added a comment - Please help to review the PRs: 1. https://github.com/lsst-ts/ts_mt_hexRot_simulink/pull/13 2. https://github.com/lsst-ts/ts_rotator_controller/pull/15 Thanks!
            Hide
            rowen Russell Owen added a comment -

            Looks good. Minor requests for clarification in the two version histories.

            Show
            rowen Russell Owen added a comment - Looks good. Minor requests for clarification in the two version histories.

              People

              Assignee:
              ttsai Te-Wei Tsai
              Reporter:
              ttsai Te-Wei Tsai
              Reviewers:
              Russell Owen
              Watchers:
              Russell Owen, Te-Wei Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Start date:
                End date:

                  Jenkins Builds

                  No builds found.