When working with Siemens Sinamics S120 drives, it’s common to have to home/reference the drives at a known location. The drive should be referenced during commissioning, after replacing the motor, or after any event that would cause the position of the encoder to differ from the actual position of the machine axis.
Referencing the drive is not a very difficult task to do through STARTER, but to avoid the need for maintenance staff to use a laptop to reference the drives, we created a function block that allows the user to home the drive from the HMI. As an extra bonus, this block is also capable of changing the jog speeds and overtravel position limits from the same HMI screen.
Click to expand
To use the block, we set up logic to tell the block the Control Unit’s diagnostic address from the hardware config, as well as the Axis’ drive object number as shown in the STARTER project, the io address of the axis, and the DB used to pass in to Siemens’ S120 Toolbox block (FB283). When the block gets a trigger for either homing, setting overtravel limits, or changing the jog speed, it validates the associated data for the operation and begins sending the drive parameter changes acyclically. While the block is communicating with the drive, it outputs an “In Sequence” bit. When the operation is complete, it outputs a “Complete” bit. It also outputs an error bit and provides an error code to indicate the reason for failure.
Since this block was originally used in a project that followed the Ford Fast framework, the block also outputs a bit which is used to enable or disable the Ford Fast Servo Control block. While this block is operating on the drive, we disable the Fast block from also operating on the drive.
Inside the block, to set the home position, for example, there is a simple step sequence which performs the following steps:
- First, parameter 2599 (reference position value) is written to. We then read the value back to make sure it has been written correctly.
- Then, we write to parameter 2507 to initiate the encoder value adjustment. We monitor this value until it changes to a value of 3, which indicates the encoder value has been adjusted.
- Finally, we write a value of 1 to parameters 971 of the drive and 977 of the control unit to command them to copy ram to rom (saving the changes).