External set value generation
External setpoint generation (external setpoint specification) enables the implementation of individual setpoint generators within the PLC, or appropriate connection of existing internal and external generators, and their simple and transparent integration into the TwinCAT system. Axes can be positioned either with an external setpoint generator alone, or superposition (mixing) of existing internal generators and external setpoint sources is possible.
These characteristics and the fact that an axis can change its different operation modes at runtime (e.g. interpolating path axis (NCI), master PTP axis, slave axis, external setpoint generation) further increase the flexibility of a TwinCAT axis.
The superimposition of internal and external setpoint sources generally enables a wide range of new applications and solutions.
Examples of use:
- External setpoint specification can be used for implementing an individual new setpoint profile, which is not available in TwinCAT NC. This profile can be mathematically very simple or as complex as necessary. Since the externally generated setpoint profile can also be superimposed on the standard profile, corrective functions can thus also be supplemented.
In this way, a position-based setpoint profile can be implemented for systems that are difficult to control or non-linear, for example a position-based deceleration ramp for hydraulic axes. - One application for the superposition (mixing) of two internal setpoint sources is the combination of interpolating path processing (NCI) and the 'flying saw' function (PTP slave). Multi-dimensional machining, e.g. a circle, on a moving workpiece is thus possible, which previously was only possible with stationary workpieces. This measure increases the efficiency of a machine.
- The external setpoint generation can also be used in order to enable a certain lead time (in the multi-digit second range) between the unit generating the setpoints (e.g. the execution of a DIN-NC program feeding virtual axes) and the real axes. Collision monitoring and strategies for collision avoidance can then be realized.
- A further important application are coordinate transformations (restricted to regular and unambiguous transformations without singularities), e.g. geometries such as a 'two-bar linkage' or conversion between rotary and translatory coordinates.
This new function is available with the PLC function blocks MC_ExtSetPointGenEnable and MC_ExtSetPointGenDisable in the Tc2_MC2 library. Furthermore, there is an example for an external setpoint generator (3-phase profile with acceleration rectangle), see section TwinCAT NC-PTP Examples.
Activation of the external setpoint generation:
The adoption of the external setpoint specifications is initiated by an ADS axis function from the PLC with the function block MC_ExtSetPointGenEnable. The axis start types absolute (1) or relative (2) and, if sensible and required, the target position of the axis, are specified as parameters. This target position has either an absolute or relative effect, depending on the starting mode, and enables position and target position window monitoring (PEH). Thus, enabling the external setpoint generation is similar to a conventional axis start.
A status bit of the axis reference Axis.Status.ExtSetPointGenEnabled informs about the status, namely whether the external setpoint generation, is enabled or disabled.
So that enabling is accepted without errors:
- no axis error should be present
- the controller and feed enables must be active
- the drive hardware must be ready to operate
- the axis must not be coupled (no slave)
To be observed:
|
Disabling the external setpoint generation:
External setpoint specification is switched off from the PLC via the function block MC_ExtSetPointGenDisable. A feedback is given by the already mentioned status bit of the axis reference Axis.Status.ExtSetPointGenEnabled.
After disabling the external setpoint generation, the external target position is taken over for exactly one more cycle. |
Specification of setpoints via the cyclic axis interface:
After faultless activation of the external setpoint generation, in each PLC cycle a setpoint packet can now be created at the axis interface. A setpoint package consists of the external set position, target velocity, set acceleration and set direction (-1, 0, +1).
The set direction is of particular importance here, because setpoints are only accepted and applied internally if this is not equal to zero (0: no movement). For the complete range of external setpoint generation, the direction flag therefore has to be set overlapping at the start and at the end.
To be observed:
|
Settings of the PLC task:
The PLC task that generates and specifies the setpoints must operate synchronously, i.e. with the same cycle time as the NC SAF task (port 501). This PLC task also has to have the same high priority, perhaps an even higher one, than the NC-SVB task (port 511).
Optimization options:
Dead time caused by transport via the cyclic axis interface can be compensated for an axis. This dead time compensation can be set by means of the dialogs on the encoder and drive of the NC axis (ON (with velocity)).