How to automate the Twincat 3 project configuration

How to automate the Twincat 3 project configuration

The #Beckhoff Twincat Automation Interface is a technology that allows the creation and configuration of #TwinCAT XAE’s projects automatically relaying on COM-capable programming languages (e.g. C#, .NET). Through Automation Interface the final user has the chance to create and configure a full TwinCAT Solution.

In #Reinova we employ Beckhoff PLC developed with TwinCAT to automatize the procedures by which we carry out daily test activities for our customers

Configuring a #PLC requires time, resources and expertise and in most cases involves a long sequence of manual, repetitive operations.

Automation Interfaces’ task is to break down these obstacles as well as streamline the process of creating the #automated solution.

The final application of Automation Interface is addressed to those who aren’t highly proficient programmers and still want to be able to create a TwinCAT solution independently.

Non è stato fornito nessun testo alternativo per questa immagine
image 1

Pros:

1.????Reduced times of setting up PLC’s projects and relative costs

2.????Automation of repetitive and easy to fail operations

3.????Automatic generation of PLC’s solution usable by figures without #software skills, too.?

So, how does it work then?

Since Automation Interface is able to automate almost everything, it is good practice to keep in mind why use it.

TwinCAT allows a variety of action that can be executed manually and they might take a lot of times, effort and might also mislead the final user. Those operation has to be executed whenever a new project is needed or an existing project has to be adapted to a new enviroinment.

In order to fully take advantage of Automation Interface features, an exhaustive knowledge of TwinCAT main operations to be done is required to the user to correctly configure Automation Interface to make it automate the desired operations and generate the corresponding code. From now on Automation Interface is in charge of those operations.

Behind the scenes, Automation Interface performs those actions using API Visual Studio methods (Visual Studio DTE) referencing to TwinCAT XAE Shell and its solution tree explorer without any further effort from the user.

Now that we know the purpose of the automation interface, the requirements for its implementation and its macro-functions, let's take a look at what happens 'behind the scenes' when the #Reinova-developed #AutomationInterface script runs:

1.????SHELL ENVIRONMENT OPENING

The application starts a #TwinCAT Shell instance using Visual Studio DTE and sets up the folders environment at the desired path


2.????SOLUTION AND PROJECT CREATION (OPENING)

?Within this environment, Automation Interface looks for the TwinCAT solution and TwinCAT project having names specified by the user via configuration, and if either the solution or the project does not exist already, new ones are generated.


3.????ROUTING

Automation Interface cannot function properly unless a route to the desired target PLC is first created, if one has not already been set up manually by the user.

4.????TARGET SELECTION

By means of the AMS NetID provided as input by the user, Automation Interface selects and connects to the desired target PLC


5.????PLC PROJECT CREATION (OPENING)

The application creates an instance of the TwinCAT shell (or #VisualStudio) via the visual studio DTE and sets up the folder environment at the path specified by the user


6.????AUTOMATIC DEVICES I/O SCAN WITH DYNAMIC VARIABLE LINKING

Automation Interface's strength lies in the possibility of calling up routines capable of autonomously scanning the hardware devices connected to the PLC, creating the GVL list for the I/O signals of the devices (R&W Routine) and linking the variables with the corresponding signals (RW&L Routine)

7.????SOLUTION ACTIVATION

Lastly, the configuration of the project is downloaded into the PLC and the RUN command is sent.

Non è stato fornito nessun testo alternativo per questa immagine
Flowchart

But, let’s focus for a moment on the two routines considered: Reinova Automation Interface is particularly advantageous due to its two R&W and RW&L routines, as they are responsible for the complex task of searching for, determining and 'linking' variables in the respective signals.

Such operations of a repetitive nature can be time-consuming (for particularly complex automation layouts) and must in any case be carried out very carefully to prevent the mapping of variables in the I/O channels from causing damage to the DUT.

R&W (Read and Write routine):

1.????????Scan device

Via the #SysManager of TwinCAT, Automation Interface enters the TIID, the portion of the solution tree that contains information about I/O devices connected to the #EtherCAT network. A scan is then performed to detect the hardware devices connected to the network.

2.????????Storage of I/O signals

For each of the devices Automation Interface stores the relevant physical signals, discriminating them by class (Input or Output) and by type of related data

3.????????Box generation

The data collected in the previous step are stored within specific 'BOXes', which are themselves included in the TC solution tree.


(RW&L) Read, Write and Link routine.

This routine integrates, to the 3 steps of the previous one, the subsequent operations to automatically link I/O signals, to appropriate variables created, based on the information obtained from the scanned devices:

4.????????GVL creation

A number of GVLs is created corresponding to the number of devices detected on the EtherCAT network by the scan function. Each GVL will inherit the name of the device associated with it, and host as many variables as there are signals associated with the device, preserving its type and name.

5.????????Linking GVLs vars with boxes signals

Once the AI variable environment has been set up, AI proceeds with a complete mapping of the variables into their respective I/O channels, saving the user a not inconsiderable amount of work.

Follow for more and #LiveTech #TechDivision

#CSharp #BeSharp #Twincat #Automation #Contols #Software #PLC #C#


Credits:

Development Team & Authors: Andrea Adduci and Lorenzo Musco

Graphics: Federica Cesaroni

Supervisor: Marco Rotella


要查看或添加评论,请登录

社区洞察

其他会员也浏览了