Breadcrumbs

B&R Automation Studio

Library Download
Library Setup

Creating a new project

Step 1: Open Automation Studio, click File->New Project

BR_New_Project.png

Step 2: Choose a name and location for the new project, then click "Next"

BR_New_Project_2.png

Step 3: On the next screen pick "Define a new hardware configuration manually" and click "Next"

BR_Define_New_Hardware.png

Step 4: Then choose the CPU/system unit you will be using. This example using the 5APC2100.BY44-000. Then click "Finish"

BR_Pick_CPU.png

Setup Fieldbus

Step 1: Click Tools->Manage 3rd-Party Devices

BR_Manage_3rd_Party_Devices.png

Step 2: In the 3rd-Party Device Manager window click "Import Fieldbus Device(s)"

BR_Import_Fieldbus_Device.png

Step 3: In the Select fieldbus file(s) for import window browse to the included .xdd file and click "Open"

BR_Fieldbus_3.png

Step 4: In the Physical View select one of the empty module slots and then in the Toolbox – Hardware Catalog click the Powerlink module you are using. This example uses the "5ACCIF01-FPLK-000"

BR_Fieldbus_4.png

Step 5: Expand the new Powerlink module and select PLK. Then in the Toolbox search for and click the Planar Motor Incorporated Powerlink Module

BR_Fieldbus_5.png

Step 6: Right click the Planar Motor Incorporated Powerlink Module and click Node Number->Change Node Number

BR_Fieldbus_6.png

Step 7: The node number for the Planar Motor Incorporated Powerlink Module in B&R Automation Studio needs to match the Node ID in the Planar Motor Tool. You can find the Node ID in the PMT at Configuration->Open Configurator in the System Tab

BR_Fieldbus_7.png

Step 8: The node number is displayed here in Automation Studio

BR_Fieldbus_8.png

Step 9: Right click the Planar Motor Incorporated Powerlink Module and click "Configuration"

BR_Fieldbus_9.png

Step 10: In the Configuration window change Module supervised to off

BR_Fieldbus_10.png

Step 11: Next select the project in the Logical View and click ST Program All In One. This adds a structured text program to the project. The library works with ladder logic too, but this example sticks to structured text.

BR_Fieldbus_11.png

Import and use library

Step 1: Select Libraries in the Logical View and then click Existing Library in the Toolbox – Object Catalog

BR_Library_1.png

Step 2: In the Add Object window browse to the location of the PMCPwrLink library and click Finish

BR_Library_2.png

Step 3: Next, select the project in the Logical View and click ST Program All In One. This adds a structured text program to the project.

as_setup12.png

Step 4: Go into Variables.var for the new Program and declare a PMControllerType variable and a PMC_AutoRefresh function block

as_setup20.png

Step 5: Go to the Physical View and right click on the Planar Motor Incorporated Powerlink Module and click I/O Mapping

BR_Fieldbus_13.png

Step 6: Here you need to map each of the FB_IN elements to the corresponding element in the fieldbus in array. For the first element click the .. In the Process Variable column

BR_Fieldbus_14.png

Step 7: Expand the Program then select the first element of the DataFromPMC member of the PMControllerType and click "OK“.

as_setup21.png

Step 8: For the next 199 FB_IN elements you can copy and paste the first one and just increment the index number for each one

as_setup3.png

Step 8A: Alternatively, you can edit the IoMap.iom file directly. This file will be in the project directory under Physical->Config1->”Controller Name”->IoMap.iom.

as_setup9.png

Step 8B: Opening the IoMap.iom file shows that it is a simple plaintext file. The mappings are stored as lines of text with a simple pattern. The three underlined numbers increment for each line and the rest stays the same.  A spreadsheet program (Excel, Google Sheets, LibreOffice Calc, etc.) can be used to auto generate these lines of text and copy and paste them into the IoMap.iom file.

as_setup10.png


as_setup11.png

Step 9: Then you need to do the same for the FB_OUT elements. These elements will be mapped to the corresponding elements in the fieldbus out array. For the first element click the .. In the Process Variable column

as_setup5.png

Step 10: Expand the Program then select the first element in the fieldbus out array and click "OK"

as_setup6.png

Step 11: For the next 199 DataToPMC elements you can copy and paste the first one and just increment the index number for each one

as_setup7.png

Step 12: In Main.st make sure the following is done;

  • For user code, all PMC function blocks have a PM_Controller in/out variable. Use the one declared earlier as a global variable (in step 4)

  • Make sure that one and only one instance of the PMC_AutoRefresh function block is declared and that the PMC_AutoRefresh function block is called once and only once per PLC cycle

as_setup14.png

Upgrade Library

Step 1: First go into the Logical View and right click the old library and click "Delete"

BR_Upgrade_Lib_1.png

Step 2: Click "Yes" on the confirmation window

BR_Upgrade_Lib_2.png

Step 3: Then select Libraries in the Logical View and click Existing Library in the Toolbox

BR_Upgrade_Lib_3.png

Step 4: In the Add Object window browse to the location of the new library and click "Finish"

BR_Upgrade_Lib_4.png

Setup Streaming (Optional) - only for synchronization with external axis

Step 1: In the Physical View expand the Powerlink module that the PMC is connected to and right click "PLK". Then click "Configuration".

BR_Setup_Stream_1.png

Step 2: In the Configuration window for the module PLK go to Operating mode->POWERLINK parameters and make sure that the Cycle time is the same as the cycle time of the task that communicates with the PMC.

BR_Setup_Stream_2.png

Step 3: In the Physical View right click the CPU and select "Configuration".

BR_Setup_Stream_3.png

Step 4: In the Configuration window for the CPU go to Automation Runtime type->Timing->System timer and change the System timer to EPL/X2X Interface.

BR_Setup_Stream_4.png

Step 5: Then make sure that the Interface is the same one that is connected to the PMC and that Multiply cycle time by is set to 1.

BR_Setup_Stream_5.png

Step 6: In the Planar Motor Tool, open the Configurator, then select “External PLC Synchronized” for the Sync Mode.

bnr_Powerlink_pmt_1.png

Step 7: Click "Write To PMC" to save the configuration to the PMC.

File I/O on the PLC (Optional)

The following are one possible way to read and write files to the PLC storage. It could be helpful for commands such as Set PMC Configuration.

Step 1: We can access files on the B&R PLC using the FTP server. In the Physical View right click the PLC and select Configuration

fileio8.png

Step 2: In the Configuration window go to PLC->Automation Runtime type->File devices. Create a File device by specifying a name and drive number.

fileio9.png

Step 3: Next go to PLC->Automation Runtime type->FTP Server. Switch Activate FTP Server to “on” and select FTP for the Protocol. Then setup a user with read/write Access rights and All Devices for the Shared Device.

fileio10.png

Step 4: Note that B&R Automation Studio will encrypt the typed Password for the User. For example, “password” is used here for the Password. 

fileio20.png

Step 5: And as soon as enter is pressed, it turns into random characters. The Password is still “password”, but it is hidden in Automation Studio.

fileio21.png

Step 6: Once the File device and FTP server is configured, build the project, and Transfer it to the PLC.

fileio22.png

Step 7: Once the PLC reboots, you will need to open a program that can access FTP servers. This example will use WinSCP.

fileio23.png

Step 8: In WinSCP click Session->New Session…

fileio24.png

Step 9: In the Login window choose New Site. Choose FTP for the File protocol. The Host name is the IP address of the PLC. Use the Username and Password configured earlier. Then click Login.

fileio25.png

Step 10: You can now access the files on the PLC.