B&R Automation Studio Programming Example - Driving Motion Axes
Explore the design of a servo pick and place sample case using B&R Automation Studio, from the project creation to the configuration of the controller, drives, and motion axes.
See our previous articles on B&R Automation Studio:
Figure 1. B&R's Automation Studio. Image used courtesy of B&R
Servo-Driven Pick and Place Station
With any new programming interface, it is helpful to have an example scenario to work with. Over the following two articles, I will walk through configuring, programming, and simulating a pick-and-place station using B&R servos and digital inputs and outputs within Automation Studio.
Pick-and-place (PnP) stations are quite common with industrial automation equipment. Typically we use a PnP station to move parts from a conveyor or storage location to a fixture where the part can be worked on. A PnP station is more cost-effective than a robot but is more rigid with the motions it can perform.
Figure 2. Using a servo in a pick-and-place station. Image used courtesy of Steven Douglas Corp
Creating a New Automation Studio Project
When creating a new Automation Studio (AS) project, AS will require the controller you would like to use within your project. Once the controller is selected, the project will be created and you can start adding other components to your project from the toolbox. Be careful with the length of your project file name, if the name is too long, AS will have errors and not be able to compile.
After adding components, make sure to save and compile your project often. AS projects are not like typical PLC projects that have auto save and won’t let you make syntax errors. The file structure of an AS project is wide open and able to be manipulated with simple text editors. This can have negative effects if somebody were to corrupt the files within the project. The positive effect is you can write software to auto-generate your projects or you can use find and replace with a text editor to speed up similar configurations.
Choosing The Controller
Selecting the automation controller depends on many factors—how many inputs and outputs are required, what kind of industrial network (if any) is required, how many retentive variables are required, and how many stations the controller will be responsible for. Having the answers to these questions when talking to your sales representative will make the selection process much easier.
The size of our project is quite small with only a few retentive variables, so I’m going to use the Compact-S model. The X20CP0484 operates on a Cortex A9 processor with 2 GB of onboard flash memory. If more computing power is required, you can also move up to a panel PC or the box PC which will run the Automation Studio Runtime. When creating a new project in Automation Studio, you will be prompted to select your controller and backplane.
Figure 3. Choosing your automation controller.
Choosing Servo Components
For this project, I’m going to use B&R servos. While virtually any servo is compatible with a B&R controller, if we stay within the B&R catalog, we will have access to more features than choosing a servo outside of the B&R product family. Selecting the correct size of servo motor and drive can be quite complicated and is outside the scope of this article.
A typical PnP station will have two servos, one for the Y-axis and one for the Z-axis—the X-axis will be the conveyor. In the toolbox, select the motion icon and then select the servo drive you would like to add to your project.
Drag that item into the hardware designer window. You can now connect your controller to your drive by simply clicking and dragging a line from the controller port to the drive port. Once this connection is made, AS will prompt you to add your selected servo motor. A second prompt will appear if the selected drive is capable of supporting two motors.
Lastly, you will need to select which motion system will be used to control your servo motors—in our case we will use mapp Motion.
Figure 4. Adding motion controller in toolbox.
Figure 5. Adding a new drive.
Figure 6. Connecting controller, drive, and motors.
Choosing Digital Inputs and Outputs
Our gripper will consist of a pneumatic gripper, requiring one output for opening and one for close. We will use reed switches on the gripper to detect the individual states; the switches will be connected to remote input modules. The outputs will be pneumatic valves which will drive from a remote output module.
The X67 remote input and output module will be used as our field-ready module that has configurable input and output ports. The X67 uses the PowerLink industrial Ethernet protocol and can be selected from the toolbox by searching x67 and then selecting the X67BC8331. Drag the IO module into the project area and connect the PowerLink port to the drive. Right-click on the module to configure the output channels—we are going to set four channels to outputs. Right-click on the module again and choose the IO mapping option. Variables can now be mapped to physical inputs and outputs.
Figure 7. All components added.
Figure 8. IO mapping.
Configuration and More Configurations
The Automation Studio environment is designed to configure features instead of programming them. For example, some PLC projects require multiple rungs of mapping logic variables with physical output. In AS there is a mapping configuration file that does this process for you.
We will use the IOMapping configuration to set up our inputs and outputs. Each servo will also have configuration files which are stored in the mapp Motion folder. Project configurations can also be added allowing the programmer to create multiple versions of the same project but with different hardware versions. Machine features can be added to the configurations such as HMI bindings, recipe management, and alarm configurations. These configurations are added by highlighting the respective folder and then dragging the configuration from the toolbox into the folder.
Once the configuration file is added to the project, it can be opened and configured.
Similar to many other PLC servo drive systems, there are many parameters that can be set for the servo motors. Highlighting the mapp Motion folder and clicking on the mapp axis icon in the mapp Motion heading will reveal the configuration files that can be added to your system.
We are going to add the axis file by double-clicking on the single-axis component configuration file. Repeat this process for the second axis. When you open up the configuration file you will see parameters that can be set.
Now that we have our axis configuration files added, we need to tell the drive which configuration files to use with each axis. In the physical view, right click on the servo drive and select configure. Each channel is an axis with a configuration file pointing to the axis reference parameter. There are additional parameters that can be set here as well.
Figure 9. Clicking on the mapp axis icon in the mapp Motion heading will reveal the configuration files that can be added to your system.
Figure 10. Axis configuration.
Figure 11 Servo drive configuration.
Hardware and Configurations
By using the physical view tab and configuration tab we can build our physical system and we can build variations of the system. For example, say we have a PnP station, but we also have an advanced PnP station with a rotate servo on the end of the gripper. We would need to create another configuration that would have the necessary hardware and configuration files. By keeping both configurations in the same project, we reduce complex file structures and the overall number of projects we need to keep track of.
Now that we have our configuration files complete and our hardware is all connected and represented, the next step will be to begin building the code structure we will use to control our system—this will be covered in our next article.