Test example with drive simulation
PLC test environment
Distance control from TwinCAT-CNC Build V2.10.1505.22
Configuration of a Z axis according to CANopen DS402 drive with additional distance sensor (0x60E4_01).
Configuration of CAN drive


Simulation in PLC
Simulation of CAN-PDO via PLC inputs/outputs

In PLC the drive encoder and the distance sensor additionally are charged with a small random noise.
Turning on the drives
After setting of drive permission (drive on, torque, feedhold off) drive can be moved.

Moving on a set position

Referencing of sensor, "sensor zero"
- Entering the set position
- Position=400000
- Selection of distance control
- Transition=1 (ON)

For the transmitted set position (SET_POS) the distance sensor delivers value = 0.
Changing the surface position "Surface offset"
The changed surface position results in a changing of the measured distance sensor.

This causes a re-adjusting of the real axis position until the distance sensor delivers the value = 0 again. In this case the desired distance to surface is reached.

"Freezing" of the current height
- Transition=2 (FREEZE)
If distance control is interrupted (Transition = FREEZE = 2), in this time a changed sensor value (-20000) has no influence on the axis correction.

After re-activation of distance control, the current sensor value is considered again.
Deselection
- Transition=0 (OFF)
After deselection of distance control (Transition = OFF = 0) the position offset caused by the distance sensor is cancelled.
