Closed Loop Software Package

Description

The Closed Loop Package prevents an encoder-equipped stepper motor from stalling. If the motor encounters a load greater than the maximum torque the motor will apply maximum torque against the load. When the load reduces the motor will continue towards the destination. The closed loop effect is done in hardware which accumulates pulses coming from the controller until external loads permit motion. If external loads are less than the maximum torque then the stepper motor behaves like an open loop stepper with open loop accuracy and performance. There are some applications where the objective is to achieve a desired encoder position and any deviation from the desired encoder position results in a reaction from the motor. This is an additional behavior Modusystems calls "dual loop" which can be used instead of, or in addition to, closed loop behavior. Contact Modusystems for more information regarding dual loop techniques.

Terms

Here we define terms for clarification. Terminology varies and the following pertains specifically to how Modusystems describes this particular closed loop behavior.

Commanded Position

The Commanded Position of a motor is the calculated place it is intended to be. The calculation is done by continuously running math producing a smooth trajectory. Even axes that are not physical (virtual axes) can perform moves as expressed by their commanded position.

Actual Position

For an encoder the actual position is the physical current position as sensed by the encoder on the motor shaft. For a stepper motor the actual position (as distinct from encoder actual position) is based on the number of electrical pulses that have left the controller. The motor's commanded position and actual position are generally very close. The error between them is used to adjust the stepper pulse rate.

Lag

The Lag is the difference between the commanded position and the encoder position which can be substantial if the motor is held up by an interference. The lag will accumulate as the commanded position advances. When released the motor will catch up.

Tracking Speed

The Tracking Speed is how fast the motor is allowed to catch up to the commanded position. If the motor is operating at a speed faster than the tracking speed then any lag sustained because of an over-torque condition will remain until the motor speed becomes less than the tracking speed at which time the motor will catch up. if the tracking speed is higher than the current motor speed the motor will catch up during the move.

Deflection

Deflection, expressed as a percentage, is how far the rotor has moved within the magnetic field positioning it. Zero percent means the rotor is centered and not applying any torque. As torque is applied the rotor will rotate and experience reaction from from the magnetic field. At the maximum torque the deflection will indicate 100% (or -100% if the torque is in the opposite direction). At this 100% the closed loop effect will engage and the deflection and force will remain at 100% with the magnetic field rotated by the closed loop electronics conceding to the excessive external load but not stalling the motor. The Deflection is an expression of applied torque with a resolution of about 10%.

Encoder Line Count

Encoders are manufactured with a certain number of "slits" or "lines" in the code wheel. Two sensors internal to the encoder, positioned 90 degrees apart with respect to the optical period, examine these slits and resolve 4 distinct "count" positions for each slit. The number of slits is sometimes referred to as "pre-quadrature" and the 4x increased resolution as "post-quadrature". In the closed loop package encoders are described by their line count, not the 4x post-quadrature count.

Encoder Inversion

Closed Loops require information to have the proper signs or the loop diverges and is unstable. To allow for having the proper sign an encoder may need to invert the direction of motion it reports. This could be done with altering the wiring but is more conveniently done with a software command. The coordinate system of the motor and encoder, established on the Setup Tab, is a separate and independent decision from encoder inversion which may be required to achieve loop stability.

Using the Closed Loop Package

Use the "+" button on the console to select the Closed Loop Software package.

This will place the package into your project:

Selecting the Blocks Tab, More Blocks Category, and choosing "Closed Loop" from the drop-down list shows the available closed loop block commands:

The minimum number of configuration blocks is shown here. These blocks are normally in the Autostart list of the Closed Loop Package.

Note that all of the commands are directed to the motor and not to the encoder. If there are more motors these can be included in the same list. A separate package is not required for additional axes.

Setting closed loop on will turn on the motor, if it's not on already, and establish closed loop operation:

Limitations

For proper initialization the motor must be free to move when closed loop is first turned on. The motor field is activated, the rotor finds its neutral position in the field and after a short delay the closed loop is initialized to that position. The electronics is expecting the rotor to be centered. If the motor is not free to rotate, for example positioning a carriage which is up against the hard stop, then closed loop will not initialize properly. Symptoms of improper initialization include very low torque in one direction and an unstable runaway condition in the oppposite direction.