Programmable Limit Switch

From SoftMC-Wiki
Jump to: navigation, search
Language: English

TOP2.png

PLS Overview

A programmable limit switch (PLS) monitors position feedback on both real and simulated axes. When the axis reaches any of the defined PLS positions,
the PLS toggles the state of a specified system output, either digital or simulated.
A PLS offers more flexibility than a limit switch, as it allows many trip points and can be reconfigured on-the-fly.

PLS positions are defined in an array and must have values that are monotonic increasing.
Any number of positions can be defined for a PLS.

Any number of PLS switches can be defined for an element (axis or group). However, the number of defined PLS switches will have a direct affect on system performance.

The PLS is scanned at a rate of once per motion bus cycle.
Implementation of PLS in the Product includes three types of functionalty:

  • Axis-PLS: PLS positions defined for an axis
  • Path-PLS: PLS positions defined according to a motion path
  • High accuracy PLS: PLS positions are extrapolated and set based on system position, speed and acceleration. For use in high speed applications.

PLS Functional Description

Output State

A PLS toggles an output when a specified position is reached. The state is toggled each time the position is reached,
irrespective of the direction of motor travel.
AXY;PLS description.jpeg

PLS Polarity

The property PLSPolarity allows you to control the initial polarity of the PLS output, which is specified as 1 or 0. The default value is 0.
The output state is set when the PLS is enabled (PLSEnable).
The state of the output is determined by the axis position at the moment of PLSEnable, according to the following scheme:

If PCMD < PLSPosition[1]

Output = negative PLSPolarity (=1)

If PCMD >= PLSPosition[1] and PCMD < PLSPosition[2]

Output = PLSPolarity (=0)

If PCMD >= PLSPosition[2] and PCMD < PLSPosition[3]

Output = negative PLSPolarity (=1)

Consider the following example. The PLS positions are 10, 25, 30, 50 and 65. Polarity is 0. Once the PLS is enabled,
the output state will toggle on and off according to the location of the axis. Assuming PLS is enabled before position 10,
the output will toggle on at 10, remain on between 10 and 25, and toggle off between 25 and 30, and so on.

AXY;PLS plolarity description.jpeg

PLS Position Data

When a PLS is first defined, it does not have any associated positions. The CreatePLSData command is used to define the values for the PLS positions.
An unlimited number of PLS positions can be defined, but the array must be monotonic increasing.
PLS position values are always absolute (and not incremental). PLS positions are given in user units, and as such are affected by axis Displacement and PositionFactor properties.
Consider the following example. Positions 100 and 200 are specified, and the initial state of the digital output after enabling is 0.
The following table shows how the state of output changes as the position changes.

Position Output State
0 0
100 1 (Toggle)
150 1 (No change)
200 0 (Toggle)
210 0 (No change yet)
200 1 (Toggle again)
150 1 (No change)
100 0 (Toggle again)


AXY;Multiple PLS positions.jpeg

Hysteresis

If an axis stops at a specified PLS position, the state of the digital output may be continually toggled, due to slight oscillations in the actual axis position.
To accommodate this behavior, Product allows you to apply a hysteresis value around the output toggle positions.
Typically, 5 to 10 encoder counts (converted to position units) is sufficient.
The output state is toggled when the PLS position is reached and surpassed by the hysteresis value.
The following example shows a hysteresis value of 10; the output will toggle ON at position 110. It will toggle OFF at position 90.
If the axis driving the PLS stops at a PLS position within the hysterisis range, the PLS state does not change.
Hysteresis is necessary only if the system stops on or near a PLS position.
AXY;Hysteresis in PLS position.jpeg

Repetition Interval

PLS positions may be repeated continually at a specified interval of encoder counts.
The repetition interval must be both positive and greater than the absolute value difference between the lowest and highest PLS position values. That is:

Repetition Interval > abs(PLS_Pos_Max - PLS_Pos_Min)

Consider the following example:

  • PLS position values: -300, 100, 200
  • Repetition Interval: 2000
  • Polarity: 0

The output state is toggled at -300, 100, 200, and at 1700 (-300 + 2000), 2100 (100+2000), 2200, and at 3700 (-300 + 2000 + 2000), and so on in the position direction.
In the negative direction, the output state is toggled at -1800 (200 - 2000), -1900 (100 - 2000), -2300 (-300 - 2000), -3800, and so on.

AXY;PLS Repetition Interval.jpeg

Enable and Disable

When first defined, the PLS is disabled.
Once the PLS is enabled, the output is set according to the polarity and position, and the output pattern is generated.
The PLS must be disabled when modifying PLS properties.

PLS Commands and Properties

PLS Commands and Properties.

The following commands and properties are used for defining and using PLS functionality in a Product system.

MC-Basic Command/Property Description
COMMON SHARED <PLS name> AS PLS <axis> <output> Command Declares a PLS variable. The name of the element and the output associated with the PLS are specified in the declaration.
CreatePlsData Command Creates a PLS data table containing the positions associated with a defined PLS.
DeletePls Command Deletes a defined PLS and all actions associated with that PLS.
PLSList Command Returns a list of the PLS names defined in the system.
WithPLS Command Nodal assignment of path-PLS. Enables path-PLS at the start of motion.
The specified PLSes will be enabled during execution of the specified motion and disabled when the motion ends.
HWAssistance Property Enables/disables high-accuracy (hardware-enabled) PLS mode.
HWIOtime Property Returns the current contents of the hardware time buffers. Applicable only to high-accuracy PLS.
PLSAxisName/PLSElementName Property Returns the name of the axis or group for which the specified PLS is defined.
PLSDelayTime Property Returns the current contents of the PLS time buffers.
PLSEnable Property Enables or disables the PLS functionality.
PLSHysteresis Property Sets or queries the hysteresis level of a PLS.
PLSOutput Property Sets or queries the system output associated with a PLS.
PLSPolarity Property Sets or queries the initial polarity associated with a PLS.
PLSPosition Property Sets or queries an individual PLS position.
PLSPropagationDelay Property Expresses the elapsed time from the moment the position command is sent to the drive until it is set as a command value in the drive’s position loop.
PLSPropagationDisableDelay Property Propagation delay value, used when the PLS sets the external device to the disabled state.
PLSPropagationEnableDelay Property Propagation delay value, used when the PLS sets the external device to the enabled state.
PLSRelatedTo Property Flag used by PLSSource to define whether relative PLS position values are computed relative to the start of motion or the target position.
PLSRepeat Property Sets or queries the repetition interval of the PLS positions.
PLSSource Propert Defines certain attributes of PLS positions.


Axis-PLS Programming Sequence

Step 1 – Declare

Create the PLS using COMMON SHARED ... AS PLS in 'Config.Prg' or in the terminal.

The declaration must define a name for the PLS, specify the element that drives the PLS, and specify the output controlled by the PLS.
The PLS is disabled until activated by PLSEnable=1.

The following example sets up 'MyPLS' as a PLS driven by axis A1 connected to system digital output 1.

Common Shared MyPLS as PLS A1 System.Dout.1

By default, the PLS has the following properties:

  • One PLS position, set to 0.
  • PLSPolarity = 0 (initial polarity of the PLS output off).
  • PLSRepeat = 0 (no repetition)
  • PLSHysteresis = 0 (no hysteresis)

See: Input/Output.

Step 2 – Positions

Create the PLS data structure and define the PLS position data using CreatePlsData.
The position array is 1- based, and position values must be monotonic increasing.
An attempt to access an index outside the array will produce an error.
For example:

CreatePLSData 4 MyPLS
MyPLS.PLSPosition[1] = 1000
MyPLS.PLSPosition[2] = 1100

Alternately, use the short form PPOS instead of PLSPosition:

MyPLS.Ppos[3] = 2000
MyPLS.Ppos[4] = 2200

Step 3 – Initial Polarity

Set the initial polarity of the PLS output using PLSPolarity
.

PLSPolarity default is 0 (off), indicating the PLS output will toggle on at the first PLS position.

Change the initial polarity to 1 (on):

MyPLS.PLSPolarity = 1

PLSPOLARITY defaults to off, indicating the PLS state will be off after the first PLS position.

Step 4 – Repetition

To repeat the PLS function at recurring intervals, set the value of PLSRepeat to a non-zero, positive number.
For example, repeat the PLS at every 10,000 position units:

MyPLS.PLSRepeat = 10000

Step 5 – Hysterisis

Set PLSHysteresis if the application requires it. Otherwise, leave it set to 0. The value is in user units.

MyPLS.PLSHysteresis = 0.01

Step 6 – Enable

Enable the PLS:

MyPLS.PLSEnable = 1

Additional PLS Programming Instructions

PLS State

The PLS must be disabled in order to modify various PLS properties, modify PLS position values, and delete a PLS.
Disabling a PLS also helps conserve CPU resources.

Disable a PLS:

MyPLS.PLSEnable = 0

Enable a PLS:

MyPLS.PLSEnable = 1

Query the state of a PLS:

?MyPls.PLSEnable
if(MyPLS.PLSEnable = 0)

Drive an event via PLSEnable:

EventOn MyEvent MyPLS.PLSOutput = 1

Delete a PLS

A PLS can be removed from the system only when the PLS is disabled and there are no tasks in memory.
Delete a PLS:

DeletePLS MyPLS

Query the PLS Axis Name

Query the name of the axis that activates the PLS:

?MyPLS.PLSAxisName
MyPLS.PLSAxisName = AXIS1

Query the PLS Output State

Query the state of the PLS output by querying the digital output associated with the PLS.
For example, if PLS output is assigned to SYSTEM.DOUT.1, query the state of SYSTEM.DOUT.1:

?Sys.Dout.1
Sys.Dout.1 = 0

Axis-PLS Program Example – PLS Setup

The following program example demonstrates the set up of a PLS data structure.

NOTE: The PLS data object must first be defined in Config.prg or Terminal:
Common Shared <PLS Name> as PLS <Axis> System.Dout.<DOut number>

PLS SETUP PROCEDURE PROGRAM EXAMPLE

PLS Source

PLSSource defines the type of position that toggles the PLS output.
The following table shows how PLSSource defines the PLS position for axis-PLS and path PLS.
PLSSource can be based either on an absolute position (either XYZ or axis), or on a position relative to the current movement. The difference is evident only during motion blending (and not more than 2 motions).
When PLSSource is relative, and actual blending occurs (the time during which two motions are executed simultaneously), the system executes two separate PLS events.

Source Description Absolute/Relative Axis PLS Path PLS
PositionCommand Axis position command Absolute Yes
PositionFeedback Axis position feedback Absolute Yes -
PositionExternal External position Absolute Yes
Setpoint1 X axis position (Setpoint{1} value) Absolute Yes
Setpoint2 Y axis position (Setpoint{2} value) Absolute Yes
Setpoint3 Z axis position (Setpoint{3} value) Absolute Yes
PathLength Distance on the path, in user units Relative to start/ target position Yes Yes
PathPercentage Percentage of the path Relative to start/ target position Yes Yes
PathTime Time duration, in milliseconds Relative to start/ target position Yes Yes


Path Percentage and Path Length

PathPercentage and PathLength are are discontinuous variables that change their value abruptly at the transition point between two consecutive movements.
PathPercentage is a percentage of the motion path from the start position. It has no physical attribute. This variable is universal, as it can be used for all types of motions.
It can be very useful in motions having a dominant orientation.
Example: At point A, the source value changes from 100 to 0.

  • MOVE A PLSSource 0 → 100
  • MOVE B PLSSource 0 → 100

For PathPercentage, the values of PLSPosition, PLSHysteresis and PLSRepetition are percentages on a scale of 0 to 100. Negative values are considered 0; values greater than 100 are considered 100.
PathLength is the distance of the position from the start position, in position user units, such as millimeters.
Example: At point A, the source value changes from L1 to 0.

  • MOVE A PLSSource 0 → L1
  • MOVE B PLSSource 0 → L2

In a straight line motion (MOVES), PathLength is the distance from the start position.
In a joint interpolated motion (MOVE), PathLength has no physical attribute.
In circular interpolation, you can set PathLength as either the arc length or the angle from the start position.
If units are not homogenous, the value in aggregate units is used for PathLength. For circular interpolation this will be the angle on the circle-arc from the start position.

Path Time

Path time is the time elapsed from the start of the motion.
Path time is applicable only in time-based profiles (PRFTYPE = 2).

Setpoints

Setpoints are XYZ coordinates. This is the easiest method of defining a PLSsource, as it can be applied to any type of motion interpolation.
However, it may cause multiple triggering of the PLSPosition during one movement.
Setpoint sources are defined in the robot world frame.
During Conveyor Tracking, Setpoint1, Setpoint2, Setpoint3 assume the values of absolute robot coordinates (Setpoint, Here) and not robot frame coordinates moving with the robot.
During joint-interpolated motions (MOVE), values of Setpoint1, Setpoint2, Setpoint3 are interpolated linearly between the samples. Therefore, depending on the sample rate and velocity, an interpolation error may occur.

PLS Execution during PROCEED Command

The STOP command disables all PLS events in the currently executing motion.
The PROCEED command is used to resume execution of a motion that was stopped by a STOP command issued by a task other than the one moving the axis or group.
Depending on PLSsource, the PROCEED command has the following effect on PLS events:

PLSSource If Absolute If Relative
Axis-PLS/Absolute Modal: source defined according to the command PLSEnable. PLS event will be executed. Execution will begin at the first PLS position in the buffer.
Path-PLS/Absolute & Relative Nodal: source defined according to motion issued by the command WithPLS. PLS event will be executed. No execution because the original path no longer exists.


PLS High Accuracy

PLS High Accuracy Overview

When PLS high accuracy is not active, the response time of the PLS switch is determined by the value of PositionErrorDelay.
When PositionErrorDelay = 3, for example:

  • If PLSsource is a position command, the PLS output will be toggled 2 samples before the position command is set in the drive.
  • If the PLSsource is position feedback, the PLS output will be toggled 1 sample after the event.

When PLS high accuracy is active, the response time of the PLS switch is determined by a combination of hardware and software functions.
In normal PLS functionality, the target position is compared to the actual position (either reference or feedback) at every system cycle, and a response occurs.
Since the system motion bus cycle is limited to 2 milliseconds, or even 4 milliseconds, the PLS response time may not be sufficient for high-speed applications such as laser cutting and packaging.
To overcome the scan time limitation, the PLS functionality includes a high-accuracy PLS timing mode (HWAssistance) in which the timing of the PLS is computed to an accuracy of microseconds.
When high-accuracy mode is active, the Product software extrapolates the exact time at which the axis will reach the PLS position, based on its current position, velocity and acceleration, and sets an output for that time.
PLS High Accuracy Overview 1.png PLS High Accuracy Overview 2.png

Several properties are used in PLS high accuracy timing:


PLS High Accuracy Timing

Samples in motions in which the acceleration profile changes its basic formula (jerk discontinuity) will have an increased error in computing the inter-sample delay (Δt).
This is due to the unavailability of an exact profile change parameter within one sample.
In addition, higher-order (e.g., quadratic, cube, sine) acceleration profiles are not modeled in the inter-sample delay (Δt) calculations, and thus a position error is to be expected.
While difficult to estimate the error, it is typically around JT3/6.
NOTE: In cases of extremely short motions (velocity or acceleration too high or path length too short), the system will automatically change the profile to trapezoidal velocity, regardless of the command issued by the user.
NOTE: The PLS will always be triggered too late if it is triggered by a feedback source such as PFB or PEXT. But in such instances, no additional delay should be added.
Examples of Computing Errors in the inter-sample delay (Δt): Error introduced due to the jerk value in sine-acceleration profile at the transition sample between acceleration saturation and acceleration decrease.
Axystems;Plstiming-acc.png
Error introduced due to the acceleration change in trapezoidal acceleration profile at the transition sample between acceleration saturation and acceleration decrease.
Axystems;Plstiming-tracc.png
Error introduced due to the transition point between cruise velocity and deceleration in trapezoidal velocity profile.
Axystems;Plstiming-trvel.png

PLS High Accuracy Buffering

The delay of the motion bus forces the system to postpone the toggling of the PLS output. Therefore, the PLS output events are stored in the buffer and executed after the estimated delay.
Two different buffers (per each PLS) are dedicated to the PLS delayed outputs:

  • Motion Bus PLS Delay Buffer. Used for storing PLS-delays through multiple sampling periods. The size of this buffer is: 40 (4x10).
  • Digital Output Microsecond Delay Buffer. Used for storing microsecond delays of only one motion bus sample. The size of this buffer is 4, and it is hardware defined.

If a systems has a relatively large motion bus delay (PositionErrorDelay is significantly greater than 3), the resulting number of stored PLS switches might be greater than the size of the Motion Bus Delay Buffer.
This will produce error 3298: "The PLS positions are too close to each other and/or the velocity is too high for output to toggle".
If one sample has more than 4 PLS switches, it will produce the IO error 21011: "Too many PLS toggling requested".

PLS High Accuracy Timing and Buffering Diagram
Axystems;Plstiming-scheme.png

Path-PLS Functional Description

A path-PLS is defined in the same way as an axis-PLS.
Path-PLS properties and behavior are the same as for axis-PLS, except for the following:

  • Path-PLS is activated only when a command is explicitly issued in a motion statement. Thus, instead of enabling/disabling using the command PLSEnable, path PLS is automatically enabled at motion start and disabled at motion end.
  • The path-PLS output must be set to its initial state by the user. From then on, when path-PLS is enabled, it will toggle the output. Disabling path-PLS does not affect the state of the digital output.
  • Path-PLS is not applicable to advanced interpolation path forms due to their complex nature.
  • Path-PLS is not applicable to JOG, DELAY, PASS and DOPASS commands.
  • PositionFeedback is not applicable to PLSSource.