TIA portal
Using TGZ in TIA Portal¶
- Be careful that the drive can start to move without previous warning.
- Take the appropriate measures to ensure that the operating and service personnel is aware of this danger.
- Implement appropriate protections to ensure that any unintended movement of the machines cannot result in any dangerous situation.
- The user is responsible that, in the event of failure of the drive, the complete system is set to state that is safe for both the machinery and personnel.
Positioning mode with telegram 111¶
The most used operating mode is the positioning mode using the basic positioner of TGZ and the TIA Portal function block SinaPos with telegram 111. Following are the possible steps to create a new project with two TGZ servo amplifiers, both in two axes variant.
- Create a new project.
- Open the project view.
- Install the XML GSD files describing the TGZ device in PROFINET network.
There are two types of files, one for the single axis variant, called
GSDML-V2.4-TGDrives-TGZ-S-xxxxx.xml
and the second for the double axis TGZ variantGSDML-V2.4-TGDrives-TGZ-D-xxxxx.xml
(wherexxxxx
stands for file creation date).
The files can be downloaded from the TG Drives website.
- Select menu item
Options|Manage general station description files (GSD)
.
- Enter the source path where the GSDML files are stored, select the appropriate file and click on the Install button.
Note
Both files can be installed simultaneously.
- In the Project tree on left top, double click on the Add new device item.
- Select the PLC controller used in the hardware project. For this tutorial, the PLC S7-1200 is used.
Warning
Be careful to choose the right firmware version (V4.1 here).
- The Devices & networks window should open in the TIA portal. If not, use the tree view item Devices & networks in the Project view and open the window by double click.
- Now it is time to add TGZ drives to the project.
In the Catalog pane, open the Other field devices item, and navigate to
PROFINET IO|Drives|TGDrives|tgz-d|tgz-d
. Add the device to the project by double click.
- Do it two times to add two TGZ servo drives.
Use
tgz-s
item to work with single axis TGZ variant. The Devices & network window should look like:
- Rename the drives in the Network overview pane according to the hardware project. The names must be the same as used during preparing the devices.
- Connect the drives with PLC. Click on the blue text Not assigned and select the PLC PROFINET interface_1.
- Do the same for the second TGZ.
- Optionally use the Topology view and connect the PLC and TGZ devices by mouse in the same manner as in reality. This step is not necessary.
- Assign the right IP addresses to all devices in the project. The IP addresses and PROFINET device names must correspond to the values entered in the Name and IP address of the device. Activate the connection in the PLC box (green rectangle) and in the Properties pane below use the Ethernet addresses item. Enter the right IP address in the text box, together with the Subnet mask (usually 255.255.255.0).
- In a similar way assign the IP addresses to other devices.
- Switch to Device view (on the top right) and select the first TGZ device (
tgz_1
) by the combo box. In the hardware catalog on the right, double click on Siemens telegram 111. Do it twice for both axes (slot 1 and slot 2).
-
Rename the axes (slots 1 and 2) according to the real hardware project.
- Do the same for the second TGZ drive and get something like:
- Download the project to the PLC by using the icon Download to device or by using menu command
Online|Download to device
.
- It is necessary to find the PLC. Click on the Start search button in the following dialog.
- After a while the PLC should appear in the list Select target device. Select it and click on the Load button.
- The dialog box Load preview summarizes the load status.
- Click on Load and then on the Finish button.
- Check the hardware configuration. Click on the icon Go online in the command bar.
- Wait for the green mark status in the project view.
- Switch back to offline mode by the Go offline command.
- Expand the item Project view to Program blocks|Main [OB1] and open it by double click.
- A new window with PLC blocks will open.
- Find the function block SinaPos (FB) in the Instructions pane on the right. The search edit box can be used for that.
- Drag and drop the SinaPos block to the line Network 1 and assign the Data block name. Preferably use the same name as for axes (slots) assigned in the previous steps.
- Connect the telegram with the HWIDSTW and HWIDZSW inputs of the function block.
- The result should be something like:
- Repeat the SinaPos FB drag and drop and axis assignment for Network 2 together with Axis_2.
- The same process is for drive tgz_2 and Axis_3 and Axis_4.
- Compile and download the modified project to the PLC by the command
Online|Download to device
and switch the TIA Portal back to online mode. - The function block can be controlled by a watch table.
Create a new table by
Project view item PLC_1|Watch and force tables|Add new watch table
and rename it to Axis_1_Control.
- Add the following SinaPos function block inputs and outputs:
- When the values are correctly set (ModePos, Position, Velocity, EnableAxis), by switching ExecuteMode from FALSE to TRUE the desired movement should start.
The Status must be
16#7002
for the correct behavior of the function block. See the online documentation for the SinaPos for additional information how to operate this FB. - Optionally create additional watch tables for working with other axes.
Supported Control Bits in ConfigEPos¶
Additional bits can be used in ConfigEPos value to fine control the TGZ behavior.
When setting to 16#0000_0103
(bit 8 is also set), the constant setpoint transfer is activated.
When the traversing task is active, it is possible to change the target position or velocity, and the drive responds immediately without the need of toggling the ExecuteMode bit.
When the task finishes, the drive goes back to state S41
(see PROFIdrive documentation) and waits for the rising edge of ExecuteMode bit.
It is also possible to set the ConfigEPos to 16#0010_0103
(set bits 8 and 20).
Then the drive keeps the state S451
even if the task is finished, and a new task is immediately started when a new position arrives.
To exit from state S451
, the ConfigEPos value must be changed to 16#0000_0103
.
Note
Note that the value 16#0000_0103
or 16#0010_0103
can be used only for absolute positioning, i.e., when ModePos = 2.
As the minimal cycle time is 1 ms, it is possible to achieve constant positioning by PLC.
It is necessary to correctly set acceleration and speed values.
Also, the trapezoidal speed profile is recommended (Profile generator type 3).
Bit 8 of the ConfigEPos is internally mapped to bit 12 of the POS_STW1 control word in the telegram (MdiTrTyp). Bit 20 is mapped to bit 11 of the POS_STW1.
Additional data mapping in telegram 111¶
Telegram 111 allows to use additional data in its structure:
Each PZD box represents 16 bits of data. The PZD12 can be used for additional user data. The setting is done by using TGZ GUI service program by the PD-Tele111_UserOut and PD-Tele111_UserIn registers from the PROFIdrive group.
Digital outputs mapping¶
Low 8 bits of the telegram user value (PZD12) go directly to K-DigitalOutputForce_Set register of the corresponding axis. High 8 bits of the user value go directly to K-DigitalOutputForce_Clr register of the axis.
Digital inputs mapping¶
Low 4 bits of the MON-Digital_Inputs (of the telegram’s axis) are copied to the PZD12 value. Higher 12 bits are set to zero.
Actual current calculation¶
The M-In
(nominal current of the motor) must be set to nonzero value, otherwise zero is always returned. The resulting PZD12 value (actual current) is then normalized to percent value, where 16384 is 100 % of nominal current. There is no overflow checking, i.e. if the MON-I_rms
overflows 200 % of M-In
, the resulting value will be wrong (negative value).
Actual torque calculation¶
The M-Mn
(nominal motor torque) must be set to nonzero value, otherwise zero is always returned. Actual current MON-aIq
is multiplied by torque constant M-kT
and normalized to nominal torque. Because the MON-aIq
is measured in mA, the normalization constant is 16.384 (not 16384). The resulting PZD12 value (actual torque) is normalized to percent value, where 16384 is 100 % of nominal torque. There is no overflow checking of the value.
Extracting the PZD value from telegram¶
The SinaPos functional block does not offer direct access to the telegram 111 user values, so they must be extracted directly from the telegram data. Just add 22 to address (input and/or output) of the telegram. Each PZD is 2 bytes long and the PZD12 is on the eleventh position, therefore the address offset is 22.
Immediate error values¶
Telegram 111 contains space for the last active error code, where the WARN
code field (PZD11) contains the low 16 bits and the FAULT
code field (PZD10) contains the high 16 bits of the TGZ error code. Similarly, the telegram 352 has fields for WARN
(PZD5) and FAULT
(PZD6), they are coded in the same manner. See chapters Fault buffer and Error codes.
Using S7-300 or S7-400 PLC with Telegram 111¶
To use the older PLCs, download a DriveLib library from the internet.
At the time of writing this manual, the filename was Drive_Lib_V62_S7_300_400.zip
.
Extract it and install it to TIA portal.
After that, the steps to create a project will be the same as above, only use the Libraries tab and there find the SINA_POS function to add it to the Main’s Network line.
The TGZ servo drive now supports startup modes Advanced and Legacy. The Legacy mode is used for S7-300 or S7-400. The modified GSDML files (PNIO version 2.4) are available at the TGDrives website. There are also GSDML files of version V2.2 for use in older software packages.
Speed Mode Using Standard Telegram 3¶
- Create a new project and name it TGZ-S-Tele3.
- Open the project view.
- Double click on Add new device.
- Select the right PLC controller and its version.
- Select Network view and expand the tree in
Hardware catalog to item Other field devices|PROFINET IO|Drives|TGDrives|tgz-s|tgz-s
.
- Double click on tgz-s, the device will be added to the project in Network view.
- Rename the TGZ device and give it a name of the device – the same which was set during commissioning as described in Name and IP address of the device.
- For this example, we use the name tgz_2.
- Connect the TGZ drive to PLC by clicking on the Not assigned blue text and selecting
PLC_1 PROFINET interface_1
.
- The result should look like this:
- Assign the IP address to the PLC. Use the address described in the section Name and IP address of the device.
- Assign the IP address to the TGZ servo drive. Again, use the address already stored in the TGZ device.
- Select telegram 3 for slot 1 of the TGZ.
- Double click on the Standard telegram 3 item to set the telegram automatically.
- Download the hardware configuration to PLC:
- Click on the Start search button.
- The PLC should appear in the list box.
- Click on the Load button, wait for compilation to finish, and in the following dialog box select Stop all modules and click on the Load button again.
- Finish the loading by clicking on the Finish button.
- If not yet selected, choose telegram number 3 in the TGZ GUI service program.
- Save parameters and restart the TGZ drive.
- Switch TIA portal to Online mode, there should be green check marks in the project view.
- If there are any errors, stop and start the PLC.
Also, check that the
PD_SetDataCounter
parameter is increasing in the TGZ GUI service program.
- Expand the
PLC_1|Technology object|Add new object
item and double-click on it.
- Select Motion control and TO_PositioningAxis. Optionally, give a suitable name for the object.
- In the
Axis_1
window underBasic parameters|General
, select the PROFIdrive radio button.
- Switch to
Basic parameters|Drive
and select the right drive.
- Update the Reference speed and Maximum speed if necessary, according to the machinery.
- Select
Basic parameters|Encoder
and switch to Encoder on drive.
- Optionally, set up other parameters in the Extended parameters items according to the hardware project.
- When finished, switch to offline mode and download the modified project to the PLC using the menu command
Online|Download to device
. The process is the same as described above. - Switch back to online mode and double-click on the Commissioning item in the project view.
- Click on the Activate button at the top of the window.
- Enable the axis using the Enable button.
- Now you can Jog the axis, perform Homing, and/or Positioning depending on the selected command.
For a detailed description of the technology object, refer to the online documentation.