L_MC1P_SetControlMode

This FB serves to set the control type of the axis.

  • In the default setting, an axis always works in position-controlled operation ( PosCtrlDrive ). This FB is used for changing over to the active position control mode during the execution time.
  • The selected control type is always active except for the use of the cyclic L_MC1P_TorqueControl block.

 

 

 

L_MC1P_SetControlMode

 

 

 

AXIS_REF

-

Axis

xDone

-

BOOL

BOOL

-

xExecute

xBusy

-

BOOL

L_MC1P_ControlModeSet

-

eControlMode

xError

-

BOOL

BOOL

-

xKeepActPosPriorFdb

eErrorID

-

L_IE1P_Error

BOOL

-

xRestartPositioning

 

 

 

 

 

 

 

 

Inputs

Name

Data type

Information/possible settings

Axis

AXIS_REF

Transfer of the axis data structure

Motion axes (AXIS_REF)

xExecute

BOOL

FALSE รค TRUE

Start execution of the function block.

eControlMode

L_MC1P_ControlModeSet

Selection of the control type:

  • PosCtrlDrive: Position control active in the drive
  • PosCtrlPLC: Position control active in the control
    (speed control in the drive)
  • SpeedCtrlDrive: Speed control active in the drive

xKeepActPosPriorFdb

BOOL

TRUE

The position development is continued with the current values.

Only effective if a position control mode has been selected.

FALSE

The positions of the position encoder active after the switch-over are accepted.

xRestartPositioning

BOOL

TRUE

For an active movement, a recalculation of the motion profile is carried out after the switch-over.

The motion profile calculated is offset by the resulting position difference.

The recalculation only becomes effective if a position control mode has been selected.

Outputs

Name

Data type

Value/meaning

xDone

BOOL

TRUE

The command has been executed successfully.

xBusy

BOOL

TRUE

Processing is running.

xError

BOOL

TRUE

An error has occurred. For details see eErrorID .

eErrorID

If xError = TRUE: Error number for the error that has occurred.

Response when switching the position control function on or switching to another position control mode

Whereas in the case of the position control in the drive ( L_MC1P_ControlModeSet.PosCtrlDrive ) the drive-internal position encoder is utilised, the position control on the PLC ( L_MC1P_ControlModeSet.PosCtrlPLC ) requires the use of an external position encoder.

The external encoder to be used is selected via the Settings tab of the corresponding axis. In the possible settings for the position control mode, the selection of the external encoder is also offered in the form of a combobox. In the following example, an external position encoder with the LM_FreeEncoder designator of the LM_FreeEncoder type has been selected:

Note!

As a matter of principle, the attainable controller gain and the resulting control quality in the PosCtrlDrive mode are higher than in the PosCtrlPLC mode. This is basically caused by the communication dead time between control and drive, which in the PosCtrlPLC mode is part of the control path.

Application for the switch-over of the position encoder

In the example, on the basis of the positions provided by the motor M, the vehicle first enters the range from which the scanner S supplies valid position values. A switch-over to the scanner as position source would take place whilst the movement would still be carried out. The stop position H is approached with an absolute positioning movement towards the fixed path coordinate for H. The holding target can be exactly reached irrespective of deviations of the motor position to the absolute path coordinate. Position deviations can for instance be caused by the slip of the vehicle wheels.

For switching on a position control or switching to another position control, as is shown in the example (see "Scanner range reached"), it may be necessary to use the values of the position encoder activated with the switch-over of the control mode as absolute path coordinates. At the same time, however, it may be required (scanner range is exited) to continue the previous position development of the absolute path coordinates with the position encoder becoming active now. In this process, the encoder positions are interpreted as relative path coordinates and shifted to the previous position profile when a switch-over by means of an internal offset is carried out. The decision for this is made by means of the xKeepActPosPriorFdb control input.

Application example 1: Accepting the position of the target encoder when switching to another encoder

A switch-over from eControlMode = L_MC1P_ControlModeSet.PosCtrlDrive (value = 0) to eControlMode = L_MC1P_ControlModeSet.PosCtrlPLC (value = 1) with xKeepActPosPriorFdb = FALSE with encoder positions deviating by 10 units causes the position values of the axis both in the current position lrActPosition and in the setpoint position lrSetPosition to be offset by the differences of the encoder positions.

Application example 2: Maintaining the position of the original encoder when switching to another encoder

The switch-over from eControlMode = L_MC1P_ControlModeSet.PosCtrlPLC (value = 1) to eControlMode = L_MC1P_ControlModeSet.PosCtrlDrive (value = 0) with xKeepActPosPriorFdb = TRUE with encoder positions deviating by 10 units first causes the position values of the axis both in the current position lrActPosition and in the setpoint position lrSetPosition to advance in an unchanged fashion. The position of the current internal encoder, however, is corrected by the differences of the two encoder positions and therefore, from the point the switch-over takes place, continues with the values of the external encoder previously used.

These two switch-over processes in the example shown above would correspond to entering the scanner range and the switch-over to the scanner as an external position encoder and to subsequently exiting this area including the switch-back to the position encoder of the drive.

Recalculation of the motion profile

The additional xRestartPositioning control signal decides whether, in the course of switching the control mode, the profile is to be recalculated for a movement that is already active.

Parameters for motion control

For a new profile, the characteristic of the remaining movement is calculated, starting from the position after the switch-over. Otherwise, the use of the profile already available is continued and the profile is only offset by the position difference resulting from the switch-over process.

Application example 3: Recalculation of the motion profile in the case of an encoder switch-over

The switch-over from eControlMode with xRestartPositioning = TRUE initiates a recalculation of the motion profile for an active movement.

At the time the switch-over takes place, an absolute movement with target 5 is active, already braking the drive. With the newly calculated profile after the position offset, the drive accelerates again and only decelerates again later and stops at target position 5 on the basis of the positions valid after the switch-over.

Application example 4: Encoder switch-over without recalculation of the motion profile

When switching over from eControlMode with xRestartPositioning = FALSE, the motion profile is not recalculated.

Here, also, an absolute movement with target 5 is active at the time of switch-over, already braking the drive. The profile already calculated is continued to be used and, for this purpose, is offset by the position difference of 10 units resulting from the switch-over and therefore stops at -5, based on the positions valid after the switch-over.